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.
This commit is contained in:
2018-07-11 22:18:09 +02:00
parent e3c85aaca7
commit 09aa799e53
39 changed files with 339 additions and 366 deletions

View File

@@ -17,12 +17,14 @@
# <pep8 compliant> # <pep8 compliant>
import bpy import bpy
from bpy.props import (BoolProperty, from bpy.props import (
EnumProperty, BoolProperty,
FloatProperty, EnumProperty,
IntProperty, FloatProperty,
PointerProperty, IntProperty,
StringProperty) PointerProperty,
StringProperty,
)
# enums # enums
@@ -1198,12 +1200,14 @@ class CyclesCurveRenderSettings(bpy.types.PropertyGroup):
def unregister(cls): def unregister(cls):
del bpy.types.Scene.cycles_curves del bpy.types.Scene.cycles_curves
def update_render_passes(self, context): def update_render_passes(self, context):
scene = context.scene scene = context.scene
rd = scene.render rd = scene.render
view_layer = context.view_layer view_layer = context.view_layer
view_layer.update_render_passes() view_layer.update_render_passes()
class CyclesRenderLayerSettings(bpy.types.PropertyGroup): class CyclesRenderLayerSettings(bpy.types.PropertyGroup):
@classmethod @classmethod
def register(cls): def register(cls):
@@ -1358,13 +1362,13 @@ class CyclesPreferences(bpy.types.AddonPreferences):
list.append(('OPENCL', "OpenCL", "Use OpenCL for GPU acceleration", 2)) list.append(('OPENCL', "OpenCL", "Use OpenCL for GPU acceleration", 2))
return list return list
compute_device_type = EnumProperty( compute_device_type: EnumProperty(
name="Compute Device Type", name="Compute Device Type",
description="Device to use for computation (rendering with Cycles)", description="Device to use for computation (rendering with Cycles)",
items=get_device_types, items=get_device_types,
) )
devices = bpy.props.CollectionProperty(type=CyclesDeviceSettings) devices: bpy.props.CollectionProperty(type=CyclesDeviceSettings)
def find_existing_device_entry(self, device): def find_existing_device_entry(self, device):
for device_entry in self.devices: for device_entry in self.devices:

View File

@@ -52,25 +52,19 @@ def _check_axis_conversion(op):
class ExportHelper: class ExportHelper:
filepath = StringProperty( filepath: StringProperty(
name="File Path", name="File Path",
description="Filepath used for exporting the file", description="Filepath used for exporting the file",
maxlen=1024, maxlen=1024,
subtype='FILE_PATH', subtype='FILE_PATH',
) )
check_existing = BoolProperty( check_existing: BoolProperty(
name="Check Existing", name="Check Existing",
description="Check and warn on overwriting existing files", description="Check and warn on overwriting existing files",
default=True, default=True,
options={'HIDDEN'}, options={'HIDDEN'},
) )
# needed for mix-ins
order = [
"filepath",
"check_existing",
]
# subclasses can override with decorator # subclasses can override with decorator
# True == use ext, False == no ext, None == do nothing. # True == use ext, False == no ext, None == do nothing.
check_extension = True check_extension = True
@@ -112,18 +106,13 @@ class ExportHelper:
class ImportHelper: class ImportHelper:
filepath = StringProperty( filepath: StringProperty(
name="File Path", name="File Path",
description="Filepath used for importing the file", description="Filepath used for importing the file",
maxlen=1024, maxlen=1024,
subtype='FILE_PATH', subtype='FILE_PATH',
) )
# needed for mix-ins
order = [
"filepath",
]
def invoke(self, context, event): def invoke(self, context, event):
context.window_manager.fileselect_add(self) context.window_manager.fileselect_add(self)
return {'RUNNING_MODAL'} return {'RUNNING_MODAL'}
@@ -173,11 +162,6 @@ def orientation_helper_factory(name, axis_forward='Y', axis_up='Z'):
update=_update_axis_up, update=_update_axis_up,
) )
members["order"] = [
"axis_forward",
"axis_up",
]
return type(name, (object,), members) return type(name, (object,), members)

View File

@@ -406,6 +406,7 @@ def keyconfig_test(kc):
result = True result = True
return result return result
# Note, we may eventually replace existing logic with this # Note, we may eventually replace existing logic with this
# so key configs are always data. # so key configs are always data.
from .keyconfig_utils_experimental import ( from .keyconfig_utils_experimental import (

View File

@@ -194,16 +194,16 @@ class AddObjectHelper:
if not self.view_align: if not self.view_align:
self.rotation.zero() self.rotation.zero()
view_align = BoolProperty( view_align: BoolProperty(
name="Align to View", name="Align to View",
default=False, default=False,
update=view_align_update_callback, update=view_align_update_callback,
) )
location = FloatVectorProperty( location: FloatVectorProperty(
name="Location", name="Location",
subtype='TRANSLATION', subtype='TRANSLATION',
) )
rotation = FloatVectorProperty( rotation: FloatVectorProperty(
name="Rotation", name="Rotation",
subtype='EULER', subtype='EULER',
) )

View File

@@ -568,39 +568,13 @@ class RNAMeta(type):
return "bl_rna" in cls.__dict__ 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): class RNAMetaPropGroup(StructMetaPropGroup, RNAMeta):
pass 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' # Same as 'Operator'
# only without 'as_keywords' # only without 'as_keywords'
class Manipulator(StructRNA, metaclass=OrderedMeta): class Manipulator(StructRNA):
__slots__ = () __slots__ = ()
def __getattribute__(self, attr): 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 # Only defined so operators members can be used by accessing self.order
# with doc generation 'self.properties.bl_rna.properties' can fail # with doc generation 'self.properties.bl_rna.properties' can fail
class Operator(StructRNA, metaclass=OrderedMeta): class Operator(StructRNA):
__slots__ = () __slots__ = ()
def __getattribute__(self, attr): def __getattribute__(self, attr):
@@ -732,7 +706,7 @@ class Operator(StructRNA, metaclass=OrderedMeta):
if attr not in ignore} if attr not in ignore}
class Macro(StructRNA, metaclass=OrderedMeta): class Macro(StructRNA):
# bpy_types is imported before ops is defined # bpy_types is imported before ops is defined
# so we have to do a local import on each run # so we have to do a local import on each run
__slots__ = () __slots__ = ()

View File

@@ -134,19 +134,19 @@ class AddTorus(Operator, object_utils.AddObjectHelper):
self.abso_major_rad = self.major_radius + self.minor_radius self.abso_major_rad = self.major_radius + self.minor_radius
self.abso_minor_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", name="Major Segments",
description="Number of segments for the main ring of the torus", description="Number of segments for the main ring of the torus",
min=3, max=256, min=3, max=256,
default=48, default=48,
) )
minor_segments = IntProperty( minor_segments: IntProperty(
name="Minor Segments", name="Minor Segments",
description="Number of segments for the minor ring of the torus", description="Number of segments for the minor ring of the torus",
min=3, max=256, min=3, max=256,
default=12, default=12,
) )
mode = bpy.props.EnumProperty( mode: bpy.props.EnumProperty(
name="Torus Dimensions", name="Torus Dimensions",
items=(("MAJOR_MINOR", "Major/Minor", items=(("MAJOR_MINOR", "Major/Minor",
"Use the major/minor radii for torus dimensions"), "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")), "Use the exterior/interior radii for torus dimensions")),
update=mode_update_callback, update=mode_update_callback,
) )
major_radius = FloatProperty( major_radius: FloatProperty(
name="Major Radius", name="Major Radius",
description=("Radius from the origin to the " description=("Radius from the origin to the "
"center of the cross sections"), "center of the cross sections"),
@@ -163,7 +163,7 @@ class AddTorus(Operator, object_utils.AddObjectHelper):
subtype='DISTANCE', subtype='DISTANCE',
unit='LENGTH', unit='LENGTH',
) )
minor_radius = FloatProperty( minor_radius: FloatProperty(
name="Minor Radius", name="Minor Radius",
description="Radius of the torus' cross section", description="Radius of the torus' cross section",
min=0.01, max=100.0, min=0.01, max=100.0,
@@ -171,7 +171,7 @@ class AddTorus(Operator, object_utils.AddObjectHelper):
subtype='DISTANCE', subtype='DISTANCE',
unit='LENGTH', unit='LENGTH',
) )
abso_major_rad = FloatProperty( abso_major_rad: FloatProperty(
name="Exterior Radius", name="Exterior Radius",
description="Total Exterior Radius of the torus", description="Total Exterior Radius of the torus",
min=0.01, max=100.0, min=0.01, max=100.0,
@@ -179,7 +179,7 @@ class AddTorus(Operator, object_utils.AddObjectHelper):
subtype='DISTANCE', subtype='DISTANCE',
unit='LENGTH', unit='LENGTH',
) )
abso_minor_rad = FloatProperty( abso_minor_rad: FloatProperty(
name="Interior Radius", name="Interior Radius",
description="Total Interior Radius of the torus", description="Total Interior Radius of the torus",
min=0.01, max=100.0, min=0.01, max=100.0,
@@ -187,7 +187,7 @@ class AddTorus(Operator, object_utils.AddObjectHelper):
subtype='DISTANCE', subtype='DISTANCE',
unit='LENGTH', unit='LENGTH',
) )
generate_uvs = BoolProperty( generate_uvs: BoolProperty(
name="Generate UVs", name="Generate UVs",
description="Generate a default UV map", description="Generate a default UV map",
default=False, default=False,

View File

@@ -40,20 +40,20 @@ class ANIM_OT_keying_set_export(Operator):
bl_idname = "anim.keying_set_export" bl_idname = "anim.keying_set_export"
bl_label = "Export Keying Set..." bl_label = "Export Keying Set..."
filepath = StringProperty( filepath: StringProperty(
subtype='FILE_PATH', subtype='FILE_PATH',
) )
filter_folder = BoolProperty( filter_folder: BoolProperty(
name="Filter folders", name="Filter folders",
default=True, default=True,
options={'HIDDEN'}, options={'HIDDEN'},
) )
filter_text = BoolProperty( filter_text: BoolProperty(
name="Filter text", name="Filter text",
default=True, default=True,
options={'HIDDEN'}, options={'HIDDEN'},
) )
filter_python = BoolProperty( filter_python: BoolProperty(
name="Filter python", name="Filter python",
default=True, default=True,
options={'HIDDEN'}, options={'HIDDEN'},
@@ -203,51 +203,51 @@ class BakeAction(Operator):
bl_label = "Bake Action" bl_label = "Bake Action"
bl_options = {'REGISTER', 'UNDO'} bl_options = {'REGISTER', 'UNDO'}
frame_start = IntProperty( frame_start: IntProperty(
name="Start Frame", name="Start Frame",
description="Start frame for baking", description="Start frame for baking",
min=0, max=300000, min=0, max=300000,
default=1, default=1,
) )
frame_end = IntProperty( frame_end: IntProperty(
name="End Frame", name="End Frame",
description="End frame for baking", description="End frame for baking",
min=1, max=300000, min=1, max=300000,
default=250, default=250,
) )
step = IntProperty( step: IntProperty(
name="Frame Step", name="Frame Step",
description="Frame Step", description="Frame Step",
min=1, max=120, min=1, max=120,
default=1, default=1,
) )
only_selected = BoolProperty( only_selected: BoolProperty(
name="Only Selected Bones", name="Only Selected Bones",
description="Only key selected bones (Pose baking only)", description="Only key selected bones (Pose baking only)",
default=True, default=True,
) )
visual_keying = BoolProperty( visual_keying: BoolProperty(
name="Visual Keying", name="Visual Keying",
description="Keyframe from the final transformations (with constraints applied)", description="Keyframe from the final transformations (with constraints applied)",
default=False, default=False,
) )
clear_constraints = BoolProperty( clear_constraints: BoolProperty(
name="Clear Constraints", name="Clear Constraints",
description="Remove all constraints from keyed object/bones, and do 'visual' keying", description="Remove all constraints from keyed object/bones, and do 'visual' keying",
default=False, default=False,
) )
clear_parents = BoolProperty( clear_parents: BoolProperty(
name="Clear Parents", name="Clear Parents",
description="Bake animation onto the object then clear parents (objects only)", description="Bake animation onto the object then clear parents (objects only)",
default=False, default=False,
) )
use_current_action = BoolProperty( use_current_action: BoolProperty(
name="Overwrite Current Action", name="Overwrite Current Action",
description="Bake animation into current action, instead of creating a new one " description="Bake animation into current action, instead of creating a new one "
"(useful for baking only part of bones in an armature)", "(useful for baking only part of bones in an armature)",
default=False, default=False,
) )
bake_types = EnumProperty( bake_types: EnumProperty(
name="Bake Data", name="Bake Data",
description="Which data's transformations to bake", description="Which data's transformations to bake",
options={'ENUM_FLAG'}, options={'ENUM_FLAG'},
@@ -302,7 +302,7 @@ class ClearUselessActions(Operator):
bl_label = "Clear Useless Actions" bl_label = "Clear Useless Actions"
bl_options = {'REGISTER', 'UNDO'} bl_options = {'REGISTER', 'UNDO'}
only_unused = BoolProperty( only_unused: BoolProperty(
name="Only Unused", name="Only Unused",
description="Only unused (Fake User only) actions get considered", description="Only unused (Fake User only) actions get considered",
default=True, default=True,
@@ -341,7 +341,7 @@ class UpdateAnimatedTransformConstraint(Operator):
bl_label = "Update Animated Transform Constraints" bl_label = "Update Animated Transform Constraints"
bl_options = {'REGISTER', 'UNDO'} bl_options = {'REGISTER', 'UNDO'}
use_convert_to_radians = BoolProperty( use_convert_to_radians: BoolProperty(
name="Convert To Radians", name="Convert To Radians",
description="Convert fcurves/drivers affecting rotations to radians (Warning: use this only once!)", description="Convert fcurves/drivers affecting rotations to radians (Warning: use this only once!)",
default=True, default=True,

View File

@@ -133,7 +133,7 @@ class CLIP_OT_filter_tracks(bpy.types.Operator):
bl_idname = "clip.filter_tracks" bl_idname = "clip.filter_tracks"
bl_options = {'UNDO', 'REGISTER'} bl_options = {'UNDO', 'REGISTER'}
track_threshold = FloatProperty( track_threshold: FloatProperty(
name="Track Threshold", name="Track Threshold",
description="Filter Threshold to select problematic tracks", description="Filter Threshold to select problematic tracks",
default=5.0, default=5.0,

View File

@@ -37,7 +37,7 @@ class ConsoleExec(Operator):
bl_idname = "console.execute" bl_idname = "console.execute"
bl_label = "Console Execute" bl_label = "Console Execute"
interactive = BoolProperty( interactive: BoolProperty(
options={'SKIP_SAVE'}, options={'SKIP_SAVE'},
) )
@@ -137,7 +137,7 @@ class ConsoleLanguage(Operator):
bl_idname = "console.language" bl_idname = "console.language"
bl_label = "Console Language" bl_label = "Console Language"
language = StringProperty( language: StringProperty(
name="Language", name="Language",
maxlen=32, maxlen=32,
) )

View File

@@ -37,56 +37,56 @@ class WM_OT_previews_batch_generate(Operator):
# ----------- # -----------
# File props. # File props.
files = CollectionProperty( files: CollectionProperty(
type=bpy.types.OperatorFileListElement, type=bpy.types.OperatorFileListElement,
options={'HIDDEN', 'SKIP_SAVE'}, options={'HIDDEN', 'SKIP_SAVE'},
) )
directory = StringProperty( directory: StringProperty(
maxlen=1024, maxlen=1024,
subtype='FILE_PATH', subtype='FILE_PATH',
options={'HIDDEN', 'SKIP_SAVE'}, options={'HIDDEN', 'SKIP_SAVE'},
) )
# Show only images/videos, and directories! # Show only images/videos, and directories!
filter_blender = BoolProperty( filter_blender: BoolProperty(
default=True, default=True,
options={'HIDDEN', 'SKIP_SAVE'}, options={'HIDDEN', 'SKIP_SAVE'},
) )
filter_folder = BoolProperty( filter_folder: BoolProperty(
default=True, default=True,
options={'HIDDEN', 'SKIP_SAVE'}, options={'HIDDEN', 'SKIP_SAVE'},
) )
# ----------- # -----------
# Own props. # Own props.
use_scenes = BoolProperty( use_scenes: BoolProperty(
default=True, default=True,
name="Scenes", name="Scenes",
description="Generate scenes' previews", description="Generate scenes' previews",
) )
use_collections = BoolProperty( use_collections: BoolProperty(
default=True, default=True,
name="Collections", name="Collections",
description="Generate collections' previews", description="Generate collections' previews",
) )
use_objects = BoolProperty( use_objects: BoolProperty(
default=True, default=True,
name="Objects", name="Objects",
description="Generate objects' previews", description="Generate objects' previews",
) )
use_intern_data = BoolProperty( use_intern_data: BoolProperty(
default=True, default=True,
name="Mat/Tex/...", name="Mat/Tex/...",
description="Generate 'internal' previews (materials, textures, images, etc.)", description="Generate 'internal' previews (materials, textures, images, etc.)",
) )
use_trusted = BoolProperty( use_trusted: BoolProperty(
default=False, default=False,
name="Trusted Blend Files", name="Trusted Blend Files",
description="Enable python evaluation for selected files", description="Enable python evaluation for selected files",
) )
use_backups = BoolProperty( use_backups: BoolProperty(
default=True, default=True,
name="Save Backups", name="Save Backups",
description="Keep a backup (.blend1) version of the files when saving with generated previews", 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. # File props.
files = CollectionProperty( files: CollectionProperty(
type=bpy.types.OperatorFileListElement, type=bpy.types.OperatorFileListElement,
options={'HIDDEN', 'SKIP_SAVE'}, options={'HIDDEN', 'SKIP_SAVE'},
) )
directory = StringProperty( directory: StringProperty(
maxlen=1024, maxlen=1024,
subtype='FILE_PATH', subtype='FILE_PATH',
options={'HIDDEN', 'SKIP_SAVE'}, options={'HIDDEN', 'SKIP_SAVE'},
) )
# Show only images/videos, and directories! # Show only images/videos, and directories!
filter_blender = BoolProperty( filter_blender: BoolProperty(
default=True, default=True,
options={'HIDDEN', 'SKIP_SAVE'}, options={'HIDDEN', 'SKIP_SAVE'},
) )
filter_folder = BoolProperty( filter_folder: BoolProperty(
default=True, default=True,
options={'HIDDEN', 'SKIP_SAVE'}, options={'HIDDEN', 'SKIP_SAVE'},
) )
# ----------- # -----------
# Own props. # Own props.
use_scenes = BoolProperty( use_scenes: BoolProperty(
default=True, default=True,
name="Scenes", name="Scenes",
description="Clear scenes' previews", description="Clear scenes' previews",
) )
use_collections = BoolProperty( use_collections: BoolProperty(
default=True, default=True,
name="Collections", name="Collections",
description="Clear collections' previews", description="Clear collections' previews",
) )
use_objects = BoolProperty( use_objects: BoolProperty(
default=True, default=True,
name="Objects", name="Objects",
description="Clear objects' previews", description="Clear objects' previews",
) )
use_intern_data = BoolProperty( use_intern_data: BoolProperty(
default=True, default=True,
name="Mat/Tex/...", name="Mat/Tex/...",
description="Clear 'internal' previews (materials, textures, images, etc.)", description="Clear 'internal' previews (materials, textures, images, etc.)",
) )
use_trusted = BoolProperty( use_trusted: BoolProperty(
default=False, default=False,
name="Trusted Blend Files", name="Trusted Blend Files",
description="Enable python evaluation for selected files", description="Enable python evaluation for selected files",
) )
use_backups = BoolProperty( use_backups: BoolProperty(
default=True, default=True,
name="Save Backups", name="Save Backups",
description="Keep a backup (.blend1) version of the files when saving with cleared previews", description="Keep a backup (.blend1) version of the files when saving with cleared previews",

View File

@@ -34,13 +34,13 @@ class SCENE_OT_freestyle_fill_range_by_selection(bpy.types.Operator):
bl_label = "Fill Range by Selection" bl_label = "Fill Range by Selection"
bl_options = {'INTERNAL'} bl_options = {'INTERNAL'}
type = EnumProperty( type: EnumProperty(
name="Type", description="Type of the modifier to work on", name="Type", description="Type of the modifier to work on",
items=(("COLOR", "Color", "Color modifier type"), items=(("COLOR", "Color", "Color modifier type"),
("ALPHA", "Alpha", "Alpha modifier type"), ("ALPHA", "Alpha", "Alpha modifier type"),
("THICKNESS", "Thickness", "Thickness modifier type")), ("THICKNESS", "Thickness", "Thickness modifier type")),
) )
name = StringProperty( name: StringProperty(
name="Name", name="Name",
description="Name of the modifier to work on", 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_label = "Open Style Module File"
bl_options = {'INTERNAL'} bl_options = {'INTERNAL'}
filepath = StringProperty(subtype='FILE_PATH') filepath: StringProperty(subtype='FILE_PATH')
make_internal = BoolProperty( make_internal: BoolProperty(
name="Make internal", name="Make internal",
description="Make module file internal after loading", description="Make module file internal after loading",
default=True) default=True)

View File

@@ -29,7 +29,7 @@ class EditExternally(Operator):
bl_label = "Image Edit Externally" bl_label = "Image Edit Externally"
bl_options = {'REGISTER'} bl_options = {'REGISTER'}
filepath = StringProperty( filepath: StringProperty(
subtype='FILE_PATH', subtype='FILE_PATH',
) )

View File

@@ -33,7 +33,7 @@ class MeshMirrorUV(Operator):
bl_label = "Copy Mirrored UV coords" bl_label = "Copy Mirrored UV coords"
bl_options = {'REGISTER', 'UNDO'} bl_options = {'REGISTER', 'UNDO'}
direction = EnumProperty( direction: EnumProperty(
name="Axis Direction", name="Axis Direction",
items=( items=(
('POSITIVE', "Positive", ""), ('POSITIVE', "Positive", ""),
@@ -41,7 +41,7 @@ class MeshMirrorUV(Operator):
), ),
) )
precision = IntProperty( precision: IntProperty(
name="Precision", name="Precision",
description=("Tolerance for finding vertex duplicates"), description=("Tolerance for finding vertex duplicates"),
min=1, max=16, min=1, max=16,

View File

@@ -34,7 +34,7 @@ from bpy.props import (
class NodeSetting(PropertyGroup): class NodeSetting(PropertyGroup):
value = StringProperty( value: StringProperty(
name="Value", name="Value",
description="Python expression to be evaluated " description="Python expression to be evaluated "
"as the initial node setting", "as the initial node setting",
@@ -45,16 +45,16 @@ class NodeSetting(PropertyGroup):
# Base class for node 'Add' operators # Base class for node 'Add' operators
class NodeAddOperator: class NodeAddOperator:
type = StringProperty( type: StringProperty(
name="Node Type", name="Node Type",
description="Node type", description="Node type",
) )
use_transform = BoolProperty( use_transform: BoolProperty(
name="Use Transform", name="Use Transform",
description="Start transform operator after inserting the node", description="Start transform operator after inserting the node",
default=False, default=False,
) )
settings = CollectionProperty( settings: CollectionProperty(
name="Settings", name="Settings",
description="Settings to be applied on the newly created node", description="Settings to be applied on the newly created node",
type=NodeSetting, type=NodeSetting,
@@ -152,7 +152,7 @@ class NODE_OT_add_and_link_node(NodeAddOperator, Operator):
bl_label = "Add and Link Node" bl_label = "Add and Link Node"
bl_options = {'REGISTER', 'UNDO'} bl_options = {'REGISTER', 'UNDO'}
link_socket_index = IntProperty( link_socket_index: IntProperty(
name="Link Socket Index", name="Link Socket Index",
description="Index of the socket to link", description="Index of the socket to link",
) )
@@ -210,7 +210,7 @@ class NODE_OT_add_search(NodeAddOperator, Operator):
return item return item
return None return None
node_item = EnumProperty( node_item: EnumProperty(
name="Node Type", name="Node Type",
description="Node type", description="Node type",
items=node_enum_items, items=node_enum_items,

View File

@@ -35,19 +35,19 @@ class SelectPattern(Operator):
bl_label = "Select Pattern" bl_label = "Select Pattern"
bl_options = {'REGISTER', 'UNDO'} bl_options = {'REGISTER', 'UNDO'}
pattern = StringProperty( pattern: StringProperty(
name="Pattern", name="Pattern",
description="Name filter using '*', '?' and " description="Name filter using '*', '?' and "
"'[abc]' unix style wildcards", "'[abc]' unix style wildcards",
maxlen=64, maxlen=64,
default="*", default="*",
) )
case_sensitive = BoolProperty( case_sensitive: BoolProperty(
name="Case Sensitive", name="Case Sensitive",
description="Do a case sensitive compare", description="Do a case sensitive compare",
default=False, default=False,
) )
extend = BoolProperty( extend: BoolProperty(
name="Extend", name="Extend",
description="Extend the existing selection", description="Extend the existing selection",
default=True, default=True,
@@ -115,7 +115,7 @@ class SelectCamera(Operator):
bl_label = "Select Camera" bl_label = "Select Camera"
bl_options = {'REGISTER', 'UNDO'} bl_options = {'REGISTER', 'UNDO'}
extend = BoolProperty( extend: BoolProperty(
name="Extend", name="Extend",
description="Extend the selection", description="Extend the selection",
default=False default=False
@@ -152,15 +152,15 @@ class SelectHierarchy(Operator):
bl_label = "Select Hierarchy" bl_label = "Select Hierarchy"
bl_options = {'REGISTER', 'UNDO'} bl_options = {'REGISTER', 'UNDO'}
direction = EnumProperty( direction: EnumProperty(
items=(('PARENT', "Parent", ""), items=(('PARENT', "Parent", ""),
('CHILD', "Child", ""), ('CHILD', "Child", ""),
), ),
name="Direction", name="Direction",
description="Direction to select in the hierarchy", description="Direction to select in the hierarchy",
default='PARENT') default='PARENT',
)
extend = BoolProperty( extend: BoolProperty(
name="Extend", name="Extend",
description="Extend the existing selection", description="Extend the existing selection",
default=False, default=False,
@@ -221,14 +221,13 @@ class SubdivisionSet(Operator):
bl_label = "Subdivision Set" bl_label = "Subdivision Set"
bl_options = {'REGISTER', 'UNDO'} bl_options = {'REGISTER', 'UNDO'}
level = IntProperty( level: IntProperty(
name="Level", name="Level",
min=-100, max=100, min=-100, max=100,
soft_min=-6, soft_max=6, soft_min=-6, soft_max=6,
default=1, default=1,
) )
relative: BoolProperty(
relative = BoolProperty(
name="Relative", name="Relative",
description=("Apply the subsurf level as an offset " description=("Apply the subsurf level as an offset "
"relative to the current level"), "relative to the current level"),
@@ -312,7 +311,7 @@ class ShapeTransfer(Operator):
bl_label = "Transfer Shape Key" bl_label = "Transfer Shape Key"
bl_options = {'REGISTER', 'UNDO'} bl_options = {'REGISTER', 'UNDO'}
mode = EnumProperty( mode: EnumProperty(
items=(('OFFSET', items=(('OFFSET',
"Offset", "Offset",
"Apply the relative positional offset", "Apply the relative positional offset",
@@ -330,7 +329,7 @@ class ShapeTransfer(Operator):
description="Relative shape positions to the new shape method", description="Relative shape positions to the new shape method",
default='OFFSET', default='OFFSET',
) )
use_clamp = BoolProperty( use_clamp: BoolProperty(
name="Clamp Offset", name="Clamp Offset",
description=("Clamp the transformation to the distance each " description=("Clamp the transformation to the distance each "
"vertex moves in the original shape"), "vertex moves in the original shape"),
@@ -696,7 +695,7 @@ class TransformsToDeltas(Operator):
bl_label = "Transforms to Deltas" bl_label = "Transforms to Deltas"
bl_options = {'REGISTER', 'UNDO'} bl_options = {'REGISTER', 'UNDO'}
mode = EnumProperty( mode: EnumProperty(
items=( items=(
('ALL', "All Transforms", "Transfer location, rotation, and scale transforms"), ('ALL', "All Transforms", "Transfer location, rotation, and scale transforms"),
('LOC', "Location", "Transfer location transforms only"), ('LOC', "Location", "Transfer location transforms only"),
@@ -707,7 +706,7 @@ class TransformsToDeltas(Operator):
description="Which transforms to transfer", description="Which transforms to transfer",
default='ALL', default='ALL',
) )
reset_values = BoolProperty( reset_values: BoolProperty(
name="Reset Values", name="Reset Values",
description=("Clear transform values after transferring to deltas"), description=("Clear transform values after transferring to deltas"),
default=True, default=True,

View File

@@ -363,7 +363,7 @@ class AlignObjects(Operator):
bl_label = "Align Objects" bl_label = "Align Objects"
bl_options = {'REGISTER', 'UNDO'} bl_options = {'REGISTER', 'UNDO'}
bb_quality = BoolProperty( bb_quality: BoolProperty(
name="High Quality", name="High Quality",
description=( description=(
"Enables high quality calculation of the " "Enables high quality calculation of the "
@@ -372,7 +372,7 @@ class AlignObjects(Operator):
), ),
default=True, default=True,
) )
align_mode = EnumProperty( align_mode: EnumProperty(
name="Align Mode:", name="Align Mode:",
description="Side of object to use for alignment", description="Side of object to use for alignment",
items=( items=(
@@ -382,7 +382,7 @@ class AlignObjects(Operator):
), ),
default='OPT_2', default='OPT_2',
) )
relative_to = EnumProperty( relative_to: EnumProperty(
name="Relative To:", name="Relative To:",
description="Reference location to align to", description="Reference location to align to",
items=( items=(
@@ -393,7 +393,7 @@ class AlignObjects(Operator):
), ),
default='OPT_4', default='OPT_4',
) )
align_axis = EnumProperty( align_axis: EnumProperty(
name="Align", name="Align",
description="Align to axis", description="Align to axis",
items=( items=(

View File

@@ -52,7 +52,7 @@ class QuickFur(Operator):
bl_label = "Quick Fur" bl_label = "Quick Fur"
bl_options = {'REGISTER', 'UNDO'} bl_options = {'REGISTER', 'UNDO'}
density = EnumProperty( density: EnumProperty(
name="Fur Density", name="Fur Density",
items=( items=(
('LIGHT', "Light", ""), ('LIGHT', "Light", ""),
@@ -61,13 +61,13 @@ class QuickFur(Operator):
), ),
default='MEDIUM', default='MEDIUM',
) )
view_percentage = IntProperty( view_percentage: IntProperty(
name="View %", name="View %",
min=1, max=100, min=1, max=100,
soft_min=1, soft_max=100, soft_min=1, soft_max=100,
default=10, default=10,
) )
length = FloatProperty( length: FloatProperty(
name="Length", name="Length",
min=0.001, max=100, min=0.001, max=100,
soft_min=0.01, soft_max=10, soft_min=0.01, soft_max=10,
@@ -118,7 +118,7 @@ class QuickExplode(Operator):
bl_label = "Quick Explode" bl_label = "Quick Explode"
bl_options = {'REGISTER', 'UNDO'} bl_options = {'REGISTER', 'UNDO'}
style = EnumProperty( style: EnumProperty(
name="Explode Style", name="Explode Style",
items=( items=(
('EXPLODE', "Explode", ""), ('EXPLODE', "Explode", ""),
@@ -126,40 +126,40 @@ class QuickExplode(Operator):
), ),
default='EXPLODE', default='EXPLODE',
) )
amount = IntProperty( amount: IntProperty(
name="Amount of pieces", name="Amount of pieces",
min=2, max=10000, min=2, max=10000,
soft_min=2, soft_max=10000, soft_min=2, soft_max=10000,
default=100, default=100,
) )
frame_duration = IntProperty( frame_duration: IntProperty(
name="Duration", name="Duration",
min=1, max=300000, min=1, max=300000,
soft_min=1, soft_max=10000, soft_min=1, soft_max=10000,
default=50, default=50,
) )
frame_start = IntProperty( frame_start: IntProperty(
name="Start Frame", name="Start Frame",
min=1, max=300000, min=1, max=300000,
soft_min=1, soft_max=10000, soft_min=1, soft_max=10000,
default=1, default=1,
) )
frame_end = IntProperty( frame_end: IntProperty(
name="End Frame", name="End Frame",
min=1, max=300000, min=1, max=300000,
soft_min=1, soft_max=10000, soft_min=1, soft_max=10000,
default=10, default=10,
) )
velocity = FloatProperty( velocity: FloatProperty(
name="Outwards Velocity", name="Outwards Velocity",
min=0, max=300000, min=0, max=300000,
soft_min=0, soft_max=10, soft_min=0, soft_max=10,
default=1, default=1,
) )
fade = BoolProperty( fade: BoolProperty(
name="Fade", name="Fade",
description="Fade the pieces over time", description="Fade the pieces over time",
default=True, default=True,
@@ -306,7 +306,7 @@ class QuickSmoke(Operator):
bl_label = "Quick Smoke" bl_label = "Quick Smoke"
bl_options = {'REGISTER', 'UNDO'} bl_options = {'REGISTER', 'UNDO'}
style = EnumProperty( style: EnumProperty(
name="Smoke Style", name="Smoke Style",
items=( items=(
('SMOKE', "Smoke", ""), ('SMOKE', "Smoke", ""),
@@ -316,7 +316,7 @@ class QuickSmoke(Operator):
default='SMOKE', default='SMOKE',
) )
show_flows = BoolProperty( show_flows: BoolProperty(
name="Render Smoke Objects", name="Render Smoke Objects",
description="Keep the smoke objects visible during rendering", description="Keep the smoke objects visible during rendering",
default=False, default=False,
@@ -410,7 +410,7 @@ class QuickFluid(Operator):
bl_label = "Quick Fluid" bl_label = "Quick Fluid"
bl_options = {'REGISTER', 'UNDO'} bl_options = {'REGISTER', 'UNDO'}
style = EnumProperty( style: EnumProperty(
name="Fluid Style", name="Fluid Style",
items=( items=(
('INFLOW', "Inflow", ""), ('INFLOW', "Inflow", ""),
@@ -418,19 +418,19 @@ class QuickFluid(Operator):
), ),
default='BASIC', default='BASIC',
) )
initial_velocity = FloatVectorProperty( initial_velocity: FloatVectorProperty(
name="Initial Velocity", name="Initial Velocity",
description="Initial velocity of the fluid", description="Initial velocity of the fluid",
min=-100.0, max=100.0, min=-100.0, max=100.0,
default=(0.0, 0.0, 0.0), default=(0.0, 0.0, 0.0),
subtype='VELOCITY', subtype='VELOCITY',
) )
show_flows = BoolProperty( show_flows: BoolProperty(
name="Render Fluid Objects", name="Render Fluid Objects",
description="Keep the fluid objects visible during rendering", description="Keep the fluid objects visible during rendering",
default=False, default=False,
) )
start_baking = BoolProperty( start_baking: BoolProperty(
name="Start Fluid Bake", name="Start Fluid Bake",
description=("Start baking the fluid immediately " description=("Start baking the fluid immediately "
"after creating the domain object"), "after creating the domain object"),

View File

@@ -103,25 +103,25 @@ class RandomizeLocRotSize(Operator):
bl_label = "Randomize Transform" bl_label = "Randomize Transform"
bl_options = {'REGISTER', 'UNDO'} bl_options = {'REGISTER', 'UNDO'}
random_seed = IntProperty( random_seed: IntProperty(
name="Random Seed", name="Random Seed",
description="Seed value for the random generator", description="Seed value for the random generator",
min=0, min=0,
max=10000, max=10000,
default=0, default=0,
) )
use_delta = BoolProperty( use_delta: BoolProperty(
name="Transform Delta", name="Transform Delta",
description=("Randomize delta transform values " description=("Randomize delta transform values "
"instead of regular transform"), "instead of regular transform"),
default=False, default=False,
) )
use_loc = BoolProperty( use_loc: BoolProperty(
name="Randomize Location", name="Randomize Location",
description="Randomize the location values", description="Randomize the location values",
default=True, default=True,
) )
loc = FloatVectorProperty( loc: FloatVectorProperty(
name="Location", name="Location",
description=("Maximum distance the objects " description=("Maximum distance the objects "
"can spread over each axis"), "can spread over each axis"),
@@ -130,12 +130,12 @@ class RandomizeLocRotSize(Operator):
default=(0.0, 0.0, 0.0), default=(0.0, 0.0, 0.0),
subtype='TRANSLATION', subtype='TRANSLATION',
) )
use_rot = BoolProperty( use_rot: BoolProperty(
name="Randomize Rotation", name="Randomize Rotation",
description="Randomize the rotation values", description="Randomize the rotation values",
default=True, default=True,
) )
rot = FloatVectorProperty( rot: FloatVectorProperty(
name="Rotation", name="Rotation",
description="Maximum rotation over each axis", description="Maximum rotation over each axis",
min=-3.141592, # math.pi min=-3.141592, # math.pi
@@ -143,25 +143,25 @@ class RandomizeLocRotSize(Operator):
default=(0.0, 0.0, 0.0), default=(0.0, 0.0, 0.0),
subtype='EULER', subtype='EULER',
) )
use_scale = BoolProperty( use_scale: BoolProperty(
name="Randomize Scale", name="Randomize Scale",
description="Randomize the scale values", description="Randomize the scale values",
default=True, default=True,
) )
scale_even = BoolProperty( scale_even: BoolProperty(
name="Scale Even", name="Scale Even",
description="Use the same scale value for all axis", description="Use the same scale value for all axis",
default=False, default=False,
) )
'''scale_min = FloatProperty( '''scale_min: FloatProperty(
name="Minimun Scale Factor", name="Minimun Scale Factor",
description="Lowest scale percentage possible", description="Lowest scale percentage possible",
min=-1.0, max=1.0, precision=3, min=-1.0, max=1.0, precision=3,
default=0.15, default=0.15,
)''' )'''
scale = FloatVectorProperty( scale: FloatVectorProperty(
name="Scale", name="Scale",
description="Maximum scale randomization over each axis", description="Maximum scale randomization over each axis",
min=-100.0, min=-100.0,

View File

@@ -41,28 +41,21 @@ class AddPresetBase:
# only because invoke_props_popup requires. Also do not add to search menu. # only because invoke_props_popup requires. Also do not add to search menu.
bl_options = {'REGISTER', 'INTERNAL'} bl_options = {'REGISTER', 'INTERNAL'}
name = StringProperty( name: StringProperty(
name="Name", name="Name",
description="Name of the preset, used to make the path name", description="Name of the preset, used to make the path name",
maxlen=64, maxlen=64,
options={'SKIP_SAVE'}, options={'SKIP_SAVE'},
) )
remove_name = BoolProperty( remove_name: BoolProperty(
default=False, default=False,
options={'HIDDEN', 'SKIP_SAVE'}, options={'HIDDEN', 'SKIP_SAVE'},
) )
remove_active = BoolProperty( remove_active: BoolProperty(
default=False, default=False,
options={'HIDDEN', 'SKIP_SAVE'}, options={'HIDDEN', 'SKIP_SAVE'},
) )
# needed for mix-ins
order = [
"name",
"remove_name",
"remove_active",
]
@staticmethod @staticmethod
def as_filename(name): # could reuse for other presets def as_filename(name): # could reuse for other presets
@@ -225,11 +218,11 @@ class ExecutePreset(Operator):
bl_idname = "script.execute_preset" bl_idname = "script.execute_preset"
bl_label = "Execute a Python Preset" bl_label = "Execute a Python Preset"
filepath = StringProperty( filepath: StringProperty(
subtype='FILE_PATH', subtype='FILE_PATH',
options={'SKIP_SAVE'}, options={'SKIP_SAVE'},
) )
menu_idname = StringProperty( menu_idname: StringProperty(
name="Menu ID Name", name="Menu ID Name",
description="ID name of the menu this was called from", description="ID name of the menu this was called from",
options={'SKIP_SAVE'}, options={'SKIP_SAVE'},
@@ -264,7 +257,7 @@ class PresetMenu(Panel):
bl_space_type = 'PROPERTIES' bl_space_type = 'PROPERTIES'
bl_region_type = 'HEADER' bl_region_type = 'HEADER'
bl_label = "Presets" bl_label = "Presets"
path_menu = Menu.path_menu path_menu: Menu.path_menu
@classmethod @classmethod
def draw_panel_header(cls, layout): def draw_panel_header(cls, layout):
@@ -333,7 +326,7 @@ class AddPresetCamera(AddPresetBase, Operator):
preset_subdir = "camera" preset_subdir = "camera"
use_focal_length = BoolProperty( use_focal_length: BoolProperty(
name="Include Focal Length", name="Include Focal Length",
description="Include focal length into the preset", description="Include focal length into the preset",
options={'SKIP_SAVE'}, options={'SKIP_SAVE'},
@@ -480,7 +473,7 @@ class AddPresetTrackingCamera(AddPresetBase, Operator):
preset_subdir = "tracking_camera" preset_subdir = "tracking_camera"
use_focal_length = BoolProperty( use_focal_length: BoolProperty(
name="Include Focal Length", name="Include Focal Length",
description="Include focal length into the preset", description="Include focal length into the preset",
options={'SKIP_SAVE'}, options={'SKIP_SAVE'},
@@ -605,7 +598,7 @@ class AddPresetOperator(AddPresetBase, Operator):
bl_label = "Operator Preset" bl_label = "Operator Preset"
preset_menu = "WM_MT_operator_presets" preset_menu = "WM_MT_operator_presets"
operator = StringProperty( operator: StringProperty(
name="Operator", name="Operator",
maxlen=64, maxlen=64,
options={'HIDDEN', 'SKIP_SAVE'}, options={'HIDDEN', 'SKIP_SAVE'},

View File

@@ -92,19 +92,19 @@ class BakeToKeyframes(Operator):
bl_label = "Bake To Keyframes" bl_label = "Bake To Keyframes"
bl_options = {'REGISTER', 'UNDO'} bl_options = {'REGISTER', 'UNDO'}
frame_start = IntProperty( frame_start: IntProperty(
name="Start Frame", name="Start Frame",
description="Start frame for baking", description="Start frame for baking",
min=0, max=300000, min=0, max=300000,
default=1, default=1,
) )
frame_end = IntProperty( frame_end: IntProperty(
name="End Frame", name="End Frame",
description="End frame for baking", description="End frame for baking",
min=1, max=300000, min=1, max=300000,
default=250, default=250,
) )
step = IntProperty( step: IntProperty(
name="Frame Step", name="Frame Step",
description="Frame Step", description="Frame Step",
min=1, max=120, min=1, max=120,
@@ -216,7 +216,7 @@ class ConnectRigidBodies(Operator):
bl_label = "Connect Rigid Bodies" bl_label = "Connect Rigid Bodies"
bl_options = {'REGISTER', 'UNDO'} bl_options = {'REGISTER', 'UNDO'}
con_type = EnumProperty( con_type: EnumProperty(
name="Type", name="Type",
description="Type of generated constraint", description="Type of generated constraint",
# XXX Would be nice to get icons too, but currently not possible ;) # XXX Would be nice to get icons too, but currently not possible ;)
@@ -226,7 +226,7 @@ class ConnectRigidBodies(Operator):
), ),
default='FIXED', default='FIXED',
) )
pivot_type = EnumProperty( pivot_type: EnumProperty(
name="Location", name="Location",
description="Constraint pivot location", description="Constraint pivot location",
items=( items=(
@@ -236,7 +236,7 @@ class ConnectRigidBodies(Operator):
), ),
default='CENTER', default='CENTER',
) )
connection_pattern = EnumProperty( connection_pattern: EnumProperty(
name="Connection Pattern", name="Connection Pattern",
description="Pattern used to connect objects", description="Pattern used to connect objects",
items=( items=(

View File

@@ -82,7 +82,7 @@ class SequencerCutMulticam(Operator):
bl_label = "Cut multicam" bl_label = "Cut multicam"
bl_options = {'REGISTER', 'UNDO'} bl_options = {'REGISTER', 'UNDO'}
camera = IntProperty( camera: IntProperty(
name="Camera", name="Camera",
min=1, max=32, min=1, max=32,
soft_min=1, soft_max=32, soft_min=1, soft_max=32,

View File

@@ -226,7 +226,7 @@ class FollowActiveQuads(Operator):
bl_label = "Follow Active Quads" bl_label = "Follow Active Quads"
bl_options = {'REGISTER', 'UNDO'} bl_options = {'REGISTER', 'UNDO'}
mode = bpy.props.EnumProperty( mode: bpy.props.EnumProperty(
name="Edge Length Mode", name="Edge Length Mode",
description="Method to space UV edge loops", description="Method to space UV edge loops",
items=(('EVEN', "Even", "Space all UVs evenly"), items=(('EVEN', "Even", "Space all UVs evenly"),

View File

@@ -616,7 +616,7 @@ class LightMapPack(Operator):
# This fixes infinite image creation reported there [#30968] (sergey) # This fixes infinite image creation reported there [#30968] (sergey)
bl_options = {'UNDO'} bl_options = {'UNDO'}
PREF_CONTEXT = bpy.props.EnumProperty( PREF_CONTEXT: bpy.props.EnumProperty(
name="Selection", name="Selection",
items=( items=(
('SEL_FACES', "Selected Faces", "Space all UVs evenly"), ('SEL_FACES', "Selected Faces", "Space all UVs evenly"),
@@ -626,7 +626,7 @@ class LightMapPack(Operator):
) )
# Image & UVs... # Image & UVs...
PREF_PACK_IN_ONE = BoolProperty( PREF_PACK_IN_ONE: BoolProperty(
name="Share Tex Space", name="Share Tex Space",
description=( description=(
"Objects Share texture space, map all objects " "Objects Share texture space, map all objects "
@@ -634,12 +634,12 @@ class LightMapPack(Operator):
), ),
default=True, default=True,
) )
PREF_NEW_UVLAYER = BoolProperty( PREF_NEW_UVLAYER: BoolProperty(
name="New UV Map", name="New UV Map",
description="Create a new UV map for every mesh packed", description="Create a new UV map for every mesh packed",
default=False, default=False,
) )
PREF_APPLY_IMAGE = BoolProperty( PREF_APPLY_IMAGE: BoolProperty(
name="New Image", name="New Image",
description=( description=(
"Assign new images for every mesh (only one if " "Assign new images for every mesh (only one if "
@@ -647,20 +647,20 @@ class LightMapPack(Operator):
), ),
default=False, default=False,
) )
PREF_IMG_PX_SIZE = IntProperty( PREF_IMG_PX_SIZE: IntProperty(
name="Image Size", name="Image Size",
description="Width and Height for the new image", description="Width and Height for the new image",
min=64, max=5000, min=64, max=5000,
default=512, default=512,
) )
# UV Packing... # UV Packing...
PREF_BOX_DIV = IntProperty( PREF_BOX_DIV: IntProperty(
name="Pack Quality", name="Pack Quality",
description="Pre Packing before the complex boxpack", description="Pre Packing before the complex boxpack",
min=1, max=48, min=1, max=48,
default=12, default=12,
) )
PREF_MARGIN_DIV = FloatProperty( PREF_MARGIN_DIV: FloatProperty(
name="Margin", name="Margin",
description="Size of the margin as a division of the UV", description="Size of the margin as a division of the UV",
min=0.001, max=1.0, min=0.001, max=1.0,

View File

@@ -1055,31 +1055,31 @@ class SmartProject(Operator):
bl_label = "Smart UV Project" bl_label = "Smart UV Project"
bl_options = {'REGISTER', 'UNDO'} bl_options = {'REGISTER', 'UNDO'}
angle_limit = FloatProperty( angle_limit: FloatProperty(
name="Angle Limit", name="Angle Limit",
description="Lower for more projection groups, higher for less distortion", description="Lower for more projection groups, higher for less distortion",
min=1.0, max=89.0, min=1.0, max=89.0,
default=66.0, default=66.0,
) )
island_margin = FloatProperty( island_margin: FloatProperty(
name="Island Margin", name="Island Margin",
description="Margin to reduce bleed from adjacent islands", description="Margin to reduce bleed from adjacent islands",
unit='LENGTH', subtype='DISTANCE', unit='LENGTH', subtype='DISTANCE',
min=0.0, max=1.0, min=0.0, max=1.0,
default=0.0, default=0.0,
) )
user_area_weight = FloatProperty( user_area_weight: FloatProperty(
name="Area Weight", name="Area Weight",
description="Weight projections vector by faces with larger areas", description="Weight projections vector by faces with larger areas",
min=0.0, max=1.0, min=0.0, max=1.0,
default=0.0, default=0.0,
) )
use_aspect = BoolProperty( use_aspect: BoolProperty(
name="Correct Aspect", name="Correct Aspect",
description="Map UVs taking image aspect ratio into account", description="Map UVs taking image aspect ratio into account",
default=True default=True
) )
stretch_to_bounds = BoolProperty( stretch_to_bounds: BoolProperty(
name="Stretch to UV Bounds", name="Stretch to UV Bounds",
description="Stretch the final output to texture bounds", description="Stretch the final output to texture bounds",
default=True, default=True,

View File

@@ -138,33 +138,33 @@ class VertexPaintDirt(Operator):
bl_label = "Dirty Vertex Colors" bl_label = "Dirty Vertex Colors"
bl_options = {'REGISTER', 'UNDO'} bl_options = {'REGISTER', 'UNDO'}
blur_strength = FloatProperty( blur_strength: FloatProperty(
name="Blur Strength", name="Blur Strength",
description="Blur strength per iteration", description="Blur strength per iteration",
min=0.01, max=1.0, min=0.01, max=1.0,
default=1.0, default=1.0,
) )
blur_iterations = IntProperty( blur_iterations: IntProperty(
name="Blur Iterations", name="Blur Iterations",
description="Number of times to blur the colors (higher blurs more)", description="Number of times to blur the colors (higher blurs more)",
min=0, max=40, min=0, max=40,
default=1, default=1,
) )
clean_angle = FloatProperty( clean_angle: FloatProperty(
name="Highlight Angle", name="Highlight Angle",
description="Less than 90 limits the angle used in the tonal range", description="Less than 90 limits the angle used in the tonal range",
min=0.0, max=pi, min=0.0, max=pi,
default=pi, default=pi,
unit="ROTATION", unit="ROTATION",
) )
dirt_angle = FloatProperty( dirt_angle: FloatProperty(
name="Dirt Angle", name="Dirt Angle",
description="Less than 90 limits the angle used in the tonal range", description="Less than 90 limits the angle used in the tonal range",
min=0.0, max=pi, min=0.0, max=pi,
default=0.0, default=0.0,
unit="ROTATION", unit="ROTATION",
) )
dirt_only = BoolProperty( dirt_only: BoolProperty(
name="Dirt Only", name="Dirt Only",
description="Don't calculate cleans for convex areas", description="Don't calculate cleans for convex areas",
default=False, default=False,

View File

@@ -143,37 +143,37 @@ class VIEW3D_OT_select_or_deselect_all(Operator):
bl_idname = "view3d.select_or_deselect_all" bl_idname = "view3d.select_or_deselect_all"
bl_options = {'UNDO'} bl_options = {'UNDO'}
extend = BoolProperty( extend: BoolProperty(
name="Extend", name="Extend",
description="Extend selection instead of deselecting everything first", description="Extend selection instead of deselecting everything first",
default=False, default=False,
) )
toggle = BoolProperty( toggle: BoolProperty(
name="Toggle", name="Toggle",
description="Toggle the selection", description="Toggle the selection",
default=False, default=False,
) )
deselect = BoolProperty( deselect: BoolProperty(
name="Deselect", name="Deselect",
description="Remove from selection", description="Remove from selection",
default=False, default=False,
) )
center = BoolProperty( center: BoolProperty(
name="Center", name="Center",
description="Use the object center when selecting, in editmode used to extend object selection", description="Use the object center when selecting, in editmode used to extend object selection",
default=False, default=False,
) )
enumerate = BoolProperty( enumerate: BoolProperty(
name="Enumerate", name="Enumerate",
description="List objects under the mouse (object mode only)", description="List objects under the mouse (object mode only)",
default=False, default=False,
) )
object = BoolProperty( object: BoolProperty(
name="Object", name="Object",
description="Use object selection (editmode only)", description="Use object selection (editmode only)",
default=False, default=False,

View File

@@ -162,12 +162,12 @@ class BRUSH_OT_active_index_set(Operator):
bl_idname = "brush.active_index_set" bl_idname = "brush.active_index_set"
bl_label = "Set Brush Number" bl_label = "Set Brush Number"
mode = StringProperty( mode: StringProperty(
name="Mode", name="Mode",
description="Paint mode to set brush for", description="Paint mode to set brush for",
maxlen=1024, maxlen=1024,
) )
index = IntProperty( index: IntProperty(
name="Number", name="Number",
description="Brush number", description="Brush number",
) )
@@ -199,8 +199,8 @@ class WM_OT_context_set_boolean(Operator):
bl_label = "Context Set Boolean" bl_label = "Context Set Boolean"
bl_options = {'UNDO', 'INTERNAL'} bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path_prop data_path: rna_path_prop
value = BoolProperty( value: BoolProperty(
name="Value", name="Value",
description="Assignment value", description="Assignment value",
default=True, default=True,
@@ -215,13 +215,13 @@ class WM_OT_context_set_int(Operator): # same as enum
bl_label = "Context Set" bl_label = "Context Set"
bl_options = {'UNDO', 'INTERNAL'} bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path_prop data_path: rna_path_prop
value = IntProperty( value: IntProperty(
name="Value", name="Value",
description="Assign value", description="Assign value",
default=0, default=0,
) )
relative = rna_relative_prop relative: rna_relative_prop
execute = execute_context_assign execute = execute_context_assign
@@ -232,8 +232,8 @@ class WM_OT_context_scale_float(Operator):
bl_label = "Context Scale Float" bl_label = "Context Scale Float"
bl_options = {'UNDO', 'INTERNAL'} bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path_prop data_path: rna_path_prop
value = FloatProperty( value: FloatProperty(
name="Value", name="Value",
description="Assign value", description="Assign value",
default=1.0, default=1.0,
@@ -260,13 +260,13 @@ class WM_OT_context_scale_int(Operator):
bl_label = "Context Scale Int" bl_label = "Context Scale Int"
bl_options = {'UNDO', 'INTERNAL'} bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path_prop data_path: rna_path_prop
value = FloatProperty( value: FloatProperty(
name="Value", name="Value",
description="Assign value", description="Assign value",
default=1.0, default=1.0,
) )
always_step = BoolProperty( always_step: BoolProperty(
name="Always Step", name="Always Step",
description="Always adjust the value by a minimum of 1 when 'value' is not 1.0", description="Always adjust the value by a minimum of 1 when 'value' is not 1.0",
default=True, default=True,
@@ -303,13 +303,13 @@ class WM_OT_context_set_float(Operator): # same as enum
bl_label = "Context Set Float" bl_label = "Context Set Float"
bl_options = {'UNDO', 'INTERNAL'} bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path_prop data_path: rna_path_prop
value = FloatProperty( value: FloatProperty(
name="Value", name="Value",
description="Assignment value", description="Assignment value",
default=0.0, default=0.0,
) )
relative = rna_relative_prop relative: rna_relative_prop
execute = execute_context_assign execute = execute_context_assign
@@ -320,8 +320,8 @@ class WM_OT_context_set_string(Operator): # same as enum
bl_label = "Context Set String" bl_label = "Context Set String"
bl_options = {'UNDO', 'INTERNAL'} bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path_prop data_path: rna_path_prop
value = StringProperty( value: StringProperty(
name="Value", name="Value",
description="Assign value", description="Assign value",
maxlen=1024, maxlen=1024,
@@ -336,8 +336,8 @@ class WM_OT_context_set_enum(Operator):
bl_label = "Context Set Enum" bl_label = "Context Set Enum"
bl_options = {'UNDO', 'INTERNAL'} bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path_prop data_path: rna_path_prop
value = StringProperty( value: StringProperty(
name="Value", name="Value",
description="Assignment value (as a string)", description="Assignment value (as a string)",
maxlen=1024, maxlen=1024,
@@ -352,8 +352,8 @@ class WM_OT_context_set_value(Operator):
bl_label = "Context Set Value" bl_label = "Context Set Value"
bl_options = {'UNDO', 'INTERNAL'} bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path_prop data_path: rna_path_prop
value = StringProperty( value: StringProperty(
name="Value", name="Value",
description="Assignment value (as a string)", description="Assignment value (as a string)",
maxlen=1024, maxlen=1024,
@@ -373,7 +373,7 @@ class WM_OT_context_toggle(Operator):
bl_label = "Context Toggle" bl_label = "Context Toggle"
bl_options = {'UNDO', 'INTERNAL'} bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path_prop data_path: rna_path_prop
def execute(self, context): def execute(self, context):
data_path = self.data_path data_path = self.data_path
@@ -392,13 +392,13 @@ class WM_OT_context_toggle_enum(Operator):
bl_label = "Context Toggle Values" bl_label = "Context Toggle Values"
bl_options = {'UNDO', 'INTERNAL'} bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path_prop data_path: rna_path_prop
value_1 = StringProperty( value_1: StringProperty(
name="Value", name="Value",
description="Toggle enum", description="Toggle enum",
maxlen=1024, maxlen=1024,
) )
value_2 = StringProperty( value_2: StringProperty(
name="Value", name="Value",
description="Toggle enum", description="Toggle enum",
maxlen=1024, maxlen=1024,
@@ -431,9 +431,9 @@ class WM_OT_context_cycle_int(Operator):
bl_label = "Context Int Cycle" bl_label = "Context Int Cycle"
bl_options = {'UNDO', 'INTERNAL'} bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path_prop data_path: rna_path_prop
reverse = rna_reverse_prop reverse: rna_reverse_prop
wrap = rna_wrap_prop wrap: rna_wrap_prop
def execute(self, context): def execute(self, context):
data_path = self.data_path data_path = self.data_path
@@ -467,9 +467,9 @@ class WM_OT_context_cycle_enum(Operator):
bl_label = "Context Enum Cycle" bl_label = "Context Enum Cycle"
bl_options = {'UNDO', 'INTERNAL'} bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path_prop data_path: rna_path_prop
reverse = rna_reverse_prop reverse: rna_reverse_prop
wrap = rna_wrap_prop wrap: rna_wrap_prop
def execute(self, context): def execute(self, context):
data_path = self.data_path data_path = self.data_path
@@ -524,8 +524,8 @@ class WM_OT_context_cycle_array(Operator):
bl_label = "Context Array Cycle" bl_label = "Context Array Cycle"
bl_options = {'UNDO', 'INTERNAL'} bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path_prop data_path: rna_path_prop
reverse = rna_reverse_prop reverse: rna_reverse_prop
def execute(self, context): def execute(self, context):
data_path = self.data_path data_path = self.data_path
@@ -549,7 +549,8 @@ class WM_OT_context_menu_enum(Operator):
bl_idname = "wm.context_menu_enum" bl_idname = "wm.context_menu_enum"
bl_label = "Context Enum Menu" bl_label = "Context Enum Menu"
bl_options = {'UNDO', 'INTERNAL'} bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path_prop
data_path: rna_path_prop
def execute(self, context): def execute(self, context):
data_path = self.data_path data_path = self.data_path
@@ -575,7 +576,8 @@ class WM_OT_context_pie_enum(Operator):
bl_idname = "wm.context_pie_enum" bl_idname = "wm.context_pie_enum"
bl_label = "Context Enum Pie" bl_label = "Context Enum Pie"
bl_options = {'UNDO', 'INTERNAL'} bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path_prop
data_path: rna_path_prop
def invoke(self, context, event): def invoke(self, context, event):
wm = context.window_manager wm = context.window_manager
@@ -602,12 +604,13 @@ class WM_OT_operator_pie_enum(Operator):
bl_idname = "wm.operator_pie_enum" bl_idname = "wm.operator_pie_enum"
bl_label = "Operator Enum Pie" bl_label = "Operator Enum Pie"
bl_options = {'UNDO', 'INTERNAL'} bl_options = {'UNDO', 'INTERNAL'}
data_path = StringProperty(
data_path: StringProperty(
name="Operator", name="Operator",
description="Operator name (in python as string)", description="Operator name (in python as string)",
maxlen=1024, maxlen=1024,
) )
prop_string = StringProperty( prop_string: StringProperty(
name="Property", name="Property",
description="Property name (as a string)", description="Property name (as a string)",
maxlen=1024, maxlen=1024,
@@ -646,8 +649,8 @@ class WM_OT_context_set_id(Operator):
bl_label = "Set Library ID" bl_label = "Set Library ID"
bl_options = {'UNDO', 'INTERNAL'} bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path_prop data_path: rna_path_prop
value = StringProperty( value: StringProperty(
name="Value", name="Value",
description="Assign value", description="Assign value",
maxlen=1024, maxlen=1024,
@@ -697,10 +700,10 @@ class WM_OT_context_collection_boolean_set(Operator):
bl_label = "Context Collection Boolean Set" bl_label = "Context Collection Boolean Set"
bl_options = {'UNDO', 'REGISTER', 'INTERNAL'} bl_options = {'UNDO', 'REGISTER', 'INTERNAL'}
data_path_iter = data_path_iter data_path_iter: data_path_iter
data_path_item = data_path_item data_path_item: data_path_item
type = EnumProperty( type: EnumProperty(
name="Type", name="Type",
items=(('TOGGLE', "Toggle", ""), items=(('TOGGLE', "Toggle", ""),
('ENABLE', "Enable", ""), ('ENABLE', "Enable", ""),
@@ -756,22 +759,22 @@ class WM_OT_context_modal_mouse(Operator):
bl_label = "Context Modal Mouse" bl_label = "Context Modal Mouse"
bl_options = {'GRAB_CURSOR', 'BLOCKING', 'UNDO', 'INTERNAL'} bl_options = {'GRAB_CURSOR', 'BLOCKING', 'UNDO', 'INTERNAL'}
data_path_iter = data_path_iter data_path_iter: data_path_iter
data_path_item = data_path_item data_path_item: data_path_item
header_text = StringProperty( header_text: StringProperty(
name="Header Text", name="Header Text",
description="Text to display in header during scale", 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", description="Scale the mouse movement by this value before applying the delta",
default=0.01, default=0.01,
) )
invert = BoolProperty( invert: BoolProperty(
description="Invert the mouse input", description="Invert the mouse input",
default=False, default=False,
) )
initial_x = IntProperty(options={'HIDDEN'}) initial_x: IntProperty(options={'HIDDEN'})
def _values_store(self, context): def _values_store(self, context):
data_path_iter = self.data_path_iter data_path_iter = self.data_path_iter
@@ -864,7 +867,7 @@ class WM_OT_url_open(Operator):
bl_label = "" bl_label = ""
bl_options = {'INTERNAL'} bl_options = {'INTERNAL'}
url = StringProperty( url: StringProperty(
name="URL", name="URL",
description="URL to open", description="URL to open",
) )
@@ -881,7 +884,7 @@ class WM_OT_path_open(Operator):
bl_label = "" bl_label = ""
bl_options = {'INTERNAL'} bl_options = {'INTERNAL'}
filepath = StringProperty( filepath: StringProperty(
subtype='FILE_PATH', subtype='FILE_PATH',
options={'SKIP_SAVE'}, options={'SKIP_SAVE'},
) )
@@ -996,7 +999,7 @@ class WM_OT_doc_view_manual(Operator):
bl_idname = "wm.doc_view_manual" bl_idname = "wm.doc_view_manual"
bl_label = "View Manual" bl_label = "View Manual"
doc_id = doc_id doc_id: doc_id
@staticmethod @staticmethod
def _find_reference(rna_id, url_mapping, verbose=True): 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_idname = "wm.doc_view"
bl_label = "View Documentation" bl_label = "View Documentation"
doc_id = doc_id doc_id: doc_id
if bpy.app.version_cycle == "release": if bpy.app.version_cycle == "release":
_prefix = ("https://docs.blender.org/api/blender_python_api_current") _prefix = ("https://docs.blender.org/api/blender_python_api_current")
else: else:
@@ -1114,16 +1117,16 @@ class WM_OT_properties_edit(Operator):
# register only because invoke_props_popup requires. # register only because invoke_props_popup requires.
bl_options = {'REGISTER', 'INTERNAL'} bl_options = {'REGISTER', 'INTERNAL'}
data_path = rna_path data_path: rna_path
property = rna_property property: rna_property
value = rna_value value: rna_value
min = rna_min min: rna_min
max = rna_max max: rna_max
use_soft_limits = rna_use_soft_limits use_soft_limits: rna_use_soft_limits
is_overridable_static = rna_is_overridable_static is_overridable_static: rna_is_overridable_static
soft_min = rna_min soft_min: rna_min
soft_max = rna_max soft_max: rna_max
description = StringProperty( description: StringProperty(
name="Tooltip", name="Tooltip",
) )
@@ -1319,7 +1322,7 @@ class WM_OT_properties_add(Operator):
bl_label = "Add Property" bl_label = "Add Property"
bl_options = {'UNDO', 'INTERNAL'} bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path data_path: rna_path
def execute(self, context): def execute(self, context):
from rna_prop_ui import ( from rna_prop_ui import (
@@ -1362,7 +1365,7 @@ class WM_OT_properties_context_change(Operator):
bl_label = "" bl_label = ""
bl_options = {'INTERNAL'} bl_options = {'INTERNAL'}
context = StringProperty( context: StringProperty(
name="Context", name="Context",
maxlen=64, maxlen=64,
) )
@@ -1378,8 +1381,8 @@ class WM_OT_properties_remove(Operator):
bl_label = "Remove Property" bl_label = "Remove Property"
bl_options = {'UNDO', 'INTERNAL'} bl_options = {'UNDO', 'INTERNAL'}
data_path = rna_path data_path: rna_path
property = rna_property property: rna_property
def execute(self, context): def execute(self, context):
from rna_prop_ui import ( from rna_prop_ui import (
@@ -1400,7 +1403,7 @@ class WM_OT_keyconfig_activate(Operator):
bl_idname = "wm.keyconfig_activate" bl_idname = "wm.keyconfig_activate"
bl_label = "Activate Keyconfig" bl_label = "Activate Keyconfig"
filepath = StringProperty( filepath: StringProperty(
subtype='FILE_PATH', subtype='FILE_PATH',
) )
@@ -1435,7 +1438,7 @@ class WM_OT_appconfig_activate(Operator):
bl_idname = "wm.appconfig_activate" bl_idname = "wm.appconfig_activate"
bl_label = "Activate Application Configuration" bl_label = "Activate Application Configuration"
filepath = StringProperty( filepath: StringProperty(
subtype='FILE_PATH', subtype='FILE_PATH',
) )
@@ -1460,7 +1463,7 @@ class WM_OT_sysinfo(Operator):
bl_idname = "wm.sysinfo" bl_idname = "wm.sysinfo"
bl_label = "Save System Info" bl_label = "Save System Info"
filepath = StringProperty( filepath: StringProperty(
subtype='FILE_PATH', subtype='FILE_PATH',
options={'SKIP_SAVE'}, options={'SKIP_SAVE'},
) )
@@ -1538,26 +1541,26 @@ class WM_OT_keyconfig_import(Operator):
bl_idname = "wm.keyconfig_import" bl_idname = "wm.keyconfig_import"
bl_label = "Import Key Configuration..." bl_label = "Import Key Configuration..."
filepath = StringProperty( filepath: StringProperty(
subtype='FILE_PATH', subtype='FILE_PATH',
default="keymap.py", default="keymap.py",
) )
filter_folder = BoolProperty( filter_folder: BoolProperty(
name="Filter folders", name="Filter folders",
default=True, default=True,
options={'HIDDEN'}, options={'HIDDEN'},
) )
filter_text = BoolProperty( filter_text: BoolProperty(
name="Filter text", name="Filter text",
default=True, default=True,
options={'HIDDEN'}, options={'HIDDEN'},
) )
filter_python = BoolProperty( filter_python: BoolProperty(
name="Filter python", name="Filter python",
default=True, default=True,
options={'HIDDEN'}, options={'HIDDEN'},
) )
keep_original = BoolProperty( keep_original: BoolProperty(
name="Keep original", name="Keep original",
description="Keep original file after copying to configuration folder", description="Keep original file after copying to configuration folder",
default=True, default=True,
@@ -1605,21 +1608,21 @@ class WM_OT_keyconfig_export(Operator):
bl_idname = "wm.keyconfig_export" bl_idname = "wm.keyconfig_export"
bl_label = "Export Key Configuration..." bl_label = "Export Key Configuration..."
filepath = StringProperty( filepath: StringProperty(
subtype='FILE_PATH', subtype='FILE_PATH',
default="keymap.py", default="keymap.py",
) )
filter_folder = BoolProperty( filter_folder: BoolProperty(
name="Filter folders", name="Filter folders",
default=True, default=True,
options={'HIDDEN'}, options={'HIDDEN'},
) )
filter_text = BoolProperty( filter_text: BoolProperty(
name="Filter text", name="Filter text",
default=True, default=True,
options={'HIDDEN'}, options={'HIDDEN'},
) )
filter_python = BoolProperty( filter_python: BoolProperty(
name="Filter python", name="Filter python",
default=True, default=True,
options={'HIDDEN'}, options={'HIDDEN'},
@@ -1655,7 +1658,7 @@ class WM_OT_keymap_restore(Operator):
bl_idname = "wm.keymap_restore" bl_idname = "wm.keymap_restore"
bl_label = "Restore Key Map(s)" bl_label = "Restore Key Map(s)"
all = BoolProperty( all: BoolProperty(
name="All Keymaps", name="All Keymaps",
description="Restore all keymaps to default", description="Restore all keymaps to default",
) )
@@ -1678,7 +1681,7 @@ class WM_OT_keyitem_restore(Operator):
bl_idname = "wm.keyitem_restore" bl_idname = "wm.keyitem_restore"
bl_label = "Restore Key Map Item" bl_label = "Restore Key Map Item"
item_id = IntProperty( item_id: IntProperty(
name="Item Identifier", name="Item Identifier",
description="Identifier of the item to remove", description="Identifier of the item to remove",
) )
@@ -1725,7 +1728,7 @@ class WM_OT_keyitem_remove(Operator):
bl_idname = "wm.keyitem_remove" bl_idname = "wm.keyitem_remove"
bl_label = "Remove Key Map Item" bl_label = "Remove Key Map Item"
item_id = IntProperty( item_id: IntProperty(
name="Item Identifier", name="Item Identifier",
description="Identifier of the item to remove", description="Identifier of the item to remove",
) )
@@ -1793,7 +1796,7 @@ class WM_OT_addon_enable(Operator):
bl_idname = "wm.addon_enable" bl_idname = "wm.addon_enable"
bl_label = "Enable Add-on" bl_label = "Enable Add-on"
module = StringProperty( module: StringProperty(
name="Module", name="Module",
description="Module name of the add-on to enable", 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_idname = "wm.addon_disable"
bl_label = "Disable Add-on" bl_label = "Disable Add-on"
module = StringProperty( module: StringProperty(
name="Module", name="Module",
description="Module name of the add-on to disable", 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_idname = "wm.owner_enable"
bl_label = "Enable Add-on" bl_label = "Enable Add-on"
owner_id = StringProperty( owner_id: StringProperty(
name="UI Tag", name="UI Tag",
) )
@@ -1883,7 +1886,7 @@ class WM_OT_owner_disable(Operator):
bl_idname = "wm.owner_disable" bl_idname = "wm.owner_disable"
bl_label = "Disable UI Tag" bl_label = "Disable UI Tag"
owner_id = StringProperty( owner_id: StringProperty(
name="UI Tag", name="UI Tag",
) )
@@ -1899,20 +1902,20 @@ class WM_OT_theme_install(Operator):
bl_idname = "wm.theme_install" bl_idname = "wm.theme_install"
bl_label = "Install Theme..." bl_label = "Install Theme..."
overwrite = BoolProperty( overwrite: BoolProperty(
name="Overwrite", name="Overwrite",
description="Remove existing theme file if exists", description="Remove existing theme file if exists",
default=True, default=True,
) )
filepath = StringProperty( filepath: StringProperty(
subtype='FILE_PATH', subtype='FILE_PATH',
) )
filter_folder = BoolProperty( filter_folder: BoolProperty(
name="Filter folders", name="Filter folders",
default=True, default=True,
options={'HIDDEN'}, options={'HIDDEN'},
) )
filter_glob = StringProperty( filter_glob: StringProperty(
default="*.xml", default="*.xml",
options={'HIDDEN'}, options={'HIDDEN'},
) )
@@ -1976,31 +1979,31 @@ class WM_OT_addon_install(Operator):
bl_idname = "wm.addon_install" bl_idname = "wm.addon_install"
bl_label = "Install Add-on from File..." bl_label = "Install Add-on from File..."
overwrite = BoolProperty( overwrite: BoolProperty(
name="Overwrite", name="Overwrite",
description="Remove existing add-ons with the same ID", description="Remove existing add-ons with the same ID",
default=True, default=True,
) )
target = EnumProperty( target: EnumProperty(
name="Target Path", name="Target Path",
items=(('DEFAULT', "Default", ""), items=(('DEFAULT', "Default", ""),
('PREFS', "User Prefs", "")), ('PREFS', "User Prefs", "")),
) )
filepath = StringProperty( filepath: StringProperty(
subtype='FILE_PATH', subtype='FILE_PATH',
) )
filter_folder = BoolProperty( filter_folder: BoolProperty(
name="Filter folders", name="Filter folders",
default=True, default=True,
options={'HIDDEN'}, options={'HIDDEN'},
) )
filter_python = BoolProperty( filter_python: BoolProperty(
name="Filter python", name="Filter python",
default=True, default=True,
options={'HIDDEN'}, options={'HIDDEN'},
) )
filter_glob = StringProperty( filter_glob: StringProperty(
default="*.py;*.zip", default="*.py;*.zip",
options={'HIDDEN'}, options={'HIDDEN'},
) )
@@ -2130,7 +2133,7 @@ class WM_OT_addon_remove(Operator):
bl_idname = "wm.addon_remove" bl_idname = "wm.addon_remove"
bl_label = "Remove Add-on" bl_label = "Remove Add-on"
module = StringProperty( module: StringProperty(
name="Module", name="Module",
description="Module name of the add-on to remove", description="Module name of the add-on to remove",
) )
@@ -2190,7 +2193,7 @@ class WM_OT_addon_expand(Operator):
bl_label = "" bl_label = ""
bl_options = {'INTERNAL'} bl_options = {'INTERNAL'}
module = StringProperty( module: StringProperty(
name="Module", name="Module",
description="Module name of the add-on to expand", description="Module name of the add-on to expand",
) )
@@ -2214,7 +2217,7 @@ class WM_OT_addon_userpref_show(Operator):
bl_label = "" bl_label = ""
bl_options = {'INTERNAL'} bl_options = {'INTERNAL'}
module = StringProperty( module: StringProperty(
name="Module", name="Module",
description="Module name of the add-on to expand", 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_idname = "wm.app_template_install"
bl_label = "Install Template from File..." bl_label = "Install Template from File..."
overwrite = BoolProperty( overwrite: BoolProperty(
name="Overwrite", name="Overwrite",
description="Remove existing template with the same ID", description="Remove existing template with the same ID",
default=True, default=True,
) )
filepath = StringProperty( filepath: StringProperty(
subtype='FILE_PATH', subtype='FILE_PATH',
) )
filter_folder = BoolProperty( filter_folder: BoolProperty(
name="Filter folders", name="Filter folders",
default=True, default=True,
options={'HIDDEN'}, options={'HIDDEN'},
) )
filter_glob = StringProperty( filter_glob: StringProperty(
default="*.zip", default="*.zip",
options={'HIDDEN'}, options={'HIDDEN'},
) )
@@ -2344,19 +2347,18 @@ class WM_OT_tool_set_by_name(Operator):
bl_idname = "wm.tool_set_by_name" bl_idname = "wm.tool_set_by_name"
bl_label = "Set Tool By Name" bl_label = "Set Tool By Name"
name = StringProperty( name: StringProperty(
name="Text", name="Text",
description="Display name of the tool", description="Display name of the tool",
) )
cycle: BoolProperty(
cycle = BoolProperty(
name="Cycle", name="Cycle",
description="Cycle through tools in this group", description="Cycle through tools in this group",
default=False, default=False,
options={'SKIP_SAVE'}, options={'SKIP_SAVE'},
) )
space_type = rna_space_type_prop space_type: rna_space_type_prop
def execute(self, context): def execute(self, context):
from bl_ui.space_toolsystem_common import ( from bl_ui.space_toolsystem_common import (
@@ -2414,23 +2416,23 @@ class WM_OT_studiolight_install(Operator):
bl_idname = "wm.studiolight_install" bl_idname = "wm.studiolight_install"
bl_label = "Install Custom Studio Light" bl_label = "Install Custom Studio Light"
files = CollectionProperty( files: CollectionProperty(
name="File Path", name="File Path",
type=OperatorFileListElement, type=OperatorFileListElement,
) )
directory = StringProperty( directory: StringProperty(
subtype='DIR_PATH', subtype='DIR_PATH',
) )
filter_folder = BoolProperty( filter_folder: BoolProperty(
name="Filter folders", name="Filter folders",
default=True, default=True,
options={'HIDDEN'}, options={'HIDDEN'},
) )
filter_glob = StringProperty( filter_glob: StringProperty(
default="*.png;*.jpg;*.hdr;*.exr", default="*.png;*.jpg;*.hdr;*.exr",
options={'HIDDEN'}, options={'HIDDEN'},
) )
orientation = EnumProperty( orientation: EnumProperty(
items=( items=(
("MATCAP", "MatCap", ""), ("MATCAP", "MatCap", ""),
("WORLD", "World", ""), ("WORLD", "World", ""),
@@ -2480,7 +2482,7 @@ class WM_OT_studiolight_install(Operator):
class WM_OT_studiolight_uninstall(Operator): class WM_OT_studiolight_uninstall(Operator):
bl_idname = 'wm.studiolight_uninstall' bl_idname = 'wm.studiolight_uninstall'
bl_label = "Uninstall Studio Light" bl_label = "Uninstall Studio Light"
index = bpy.props.IntProperty() index: bpy.props.IntProperty()
def _remove_path(self, path): def _remove_path(self, path):
if path.exists(): if path.exists():

View File

@@ -45,7 +45,7 @@ class OBJECT_OT_add_object(Operator, AddObjectHelper):
bl_label = "Add Mesh Object" bl_label = "Add Mesh Object"
bl_options = {'REGISTER', 'UNDO'} bl_options = {'REGISTER', 'UNDO'}
scale = FloatVectorProperty( scale: FloatVectorProperty(
name="scale", name="scale",
default=(1.0, 1.0, 1.0), default=(1.0, 1.0, 1.0),
subtype='TRANSLATION', subtype='TRANSLATION',

View File

@@ -30,10 +30,15 @@ class MyCustomSocket(NodeSocket):
('DOWN', "Down", "Where your feet are"), ('DOWN', "Down", "Where your feet are"),
('UP', "Up", "Where your head should be"), ('UP', "Up", "Where your head should be"),
('LEFT', "Left", "Not right"), ('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 # Optional function for drawing the socket input value
def draw(self, context, layout, node, text): 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 # These work just like custom properties in ID data blocks
# Extensive information can be found under # Extensive information can be found under
# http://wiki.blender.org/index.php/Doc:2.6/Manual/Extensions/Python/Properties # http://wiki.blender.org/index.php/Doc:2.6/Manual/Extensions/Python/Properties
my_string_prop = bpy.props.StringProperty() my_string_prop: bpy.props.StringProperty()
my_float_prop = bpy.props.FloatProperty(default=3.1415926) my_float_prop: bpy.props.FloatProperty(default=3.1415926)
# === Optional Functions === # === Optional Functions ===
# Initialization function, called when a new node is created. # Initialization function, called when a new node is created.

View File

@@ -39,11 +39,11 @@ class SelectSideOfPlane(Operator):
bl_label = "Select Side of Plane" bl_label = "Select Side of Plane"
bl_options = {'REGISTER', 'UNDO'} bl_options = {'REGISTER', 'UNDO'}
plane_co = FloatVectorProperty( plane_co: FloatVectorProperty(
size=3, size=3,
default=(0, 0, 0), default=(0, 0, 0),
) )
plane_no = FloatVectorProperty( plane_no: FloatVectorProperty(
size=3, size=3,
default=(0, 0, 1), default=(0, 0, 1),
) )

View File

@@ -25,7 +25,7 @@ class ExportSomeData(Operator, ExportHelper):
# ExportHelper mixin class uses this # ExportHelper mixin class uses this
filename_ext = ".txt" filename_ext = ".txt"
filter_glob = StringProperty( filter_glob: StringProperty(
default="*.txt", default="*.txt",
options={'HIDDEN'}, options={'HIDDEN'},
maxlen=255, # Max internal buffer length, longer would be clamped. 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 # List of operator properties, the attributes will be assigned
# to the class instance from the operator settings before calling. # to the class instance from the operator settings before calling.
use_setting = BoolProperty( use_setting: BoolProperty(
name="Example Boolean", name="Example Boolean",
description="Example Tooltip", description="Example Tooltip",
default=True, default=True,
) )
type = EnumProperty( type: EnumProperty(
name="Example Enum", name="Example Enum",
description="Choose between two items", description="Choose between two items",
items=( items=(

View File

@@ -28,7 +28,7 @@ class ImportSomeData(Operator, ImportHelper):
# ImportHelper mixin class uses this # ImportHelper mixin class uses this
filename_ext = ".txt" filename_ext = ".txt"
filter_glob = StringProperty( filter_glob: StringProperty(
default="*.txt", default="*.txt",
options={'HIDDEN'}, options={'HIDDEN'},
maxlen=255, # Max internal buffer length, longer would be clamped. 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 # List of operator properties, the attributes will be assigned
# to the class instance from the operator settings before calling. # to the class instance from the operator settings before calling.
use_setting = BoolProperty( use_setting: BoolProperty(
name="Example Boolean", name="Example Boolean",
description="Example Tooltip", description="Example Tooltip",
default=True, default=True,
) )
type = EnumProperty( type: EnumProperty(
name="Example Enum", name="Example Enum",
description="Choose between two items", description="Choose between two items",
items=( items=(

View File

@@ -49,25 +49,25 @@ class AddBox(bpy.types.Operator):
bl_label = "Add Box" bl_label = "Add Box"
bl_options = {'REGISTER', 'UNDO'} bl_options = {'REGISTER', 'UNDO'}
width = FloatProperty( width: FloatProperty(
name="Width", name="Width",
description="Box Width", description="Box Width",
min=0.01, max=100.0, min=0.01, max=100.0,
default=1.0, default=1.0,
) )
height = FloatProperty( height: FloatProperty(
name="Height", name="Height",
description="Box Height", description="Box Height",
min=0.01, max=100.0, min=0.01, max=100.0,
default=1.0, default=1.0,
) )
depth = FloatProperty( depth: FloatProperty(
name="Depth", name="Depth",
description="Box Depth", description="Box Depth",
min=0.01, max=100.0, min=0.01, max=100.0,
default=1.0, default=1.0,
) )
layers = BoolVectorProperty( layers: BoolVectorProperty(
name="Layers", name="Layers",
description="Object Layers", description="Object Layers",
size=20, size=20,
@@ -75,15 +75,15 @@ class AddBox(bpy.types.Operator):
) )
# generic transform props # generic transform props
view_align = BoolProperty( view_align: BoolProperty(
name="Align to View", name="Align to View",
default=False, default=False,
) )
location = FloatVectorProperty( location: FloatVectorProperty(
name="Location", name="Location",
subtype='TRANSLATION', subtype='TRANSLATION',
) )
rotation = FloatVectorProperty( rotation: FloatVectorProperty(
name="Rotation", name="Rotation",
subtype='EULER', subtype='EULER',
) )

View File

@@ -7,8 +7,8 @@ class ModalOperator(bpy.types.Operator):
bl_idname = "object.modal_operator" bl_idname = "object.modal_operator"
bl_label = "Simple Modal Operator" bl_label = "Simple Modal Operator"
first_mouse_x = IntProperty() first_mouse_x: IntProperty()
first_value = FloatProperty() first_value: FloatProperty()
def modal(self, context, event): def modal(self, context, event):
if event.type == 'MOUSEMOVE': if event.type == 'MOUSEMOVE':

View File

@@ -8,7 +8,7 @@ class ViewOperator(bpy.types.Operator):
bl_idname = "view3d.modal_operator" bl_idname = "view3d.modal_operator"
bl_label = "Simple View Operator" bl_label = "Simple View Operator"
offset = FloatVectorProperty( offset: FloatVectorProperty(
name="Offset", name="Offset",
size=3, size=3,
) )

View File

@@ -7,8 +7,10 @@ class MESH_UL_mylist(bpy.types.UIList):
# E.g. VGROUP_EMPTY = 1 << 0 # E.g. VGROUP_EMPTY = 1 << 0
# Custom properties, saved with .blend file. E.g. # Custom properties, saved with .blend file. E.g.
# use_filter_empty = bpy.props.BoolProperty(name="Filter Empty", default=False, options=set(), # use_filter_empty: bpy.props.BoolProperty(
# description="Whether to filter empty vertex groups") # name="Filter Empty", default=False, options=set(),
# description="Whether to filter empty vertex groups",
# )
# Called for each drawn item. # Called for each drawn item.
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index, flt_flag): def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index, flt_flag):

View File

@@ -36,6 +36,7 @@
static PyObject *bpy_intern_str_arr[16]; static PyObject *bpy_intern_str_arr[16];
PyObject *bpy_intern_str___annotations__;
PyObject *bpy_intern_str___doc__; PyObject *bpy_intern_str___doc__;
PyObject *bpy_intern_str___main__; PyObject *bpy_intern_str___main__;
PyObject *bpy_intern_str___module__; PyObject *bpy_intern_str___module__;
@@ -47,7 +48,6 @@ PyObject *bpy_intern_str_bl_rna;
PyObject *bpy_intern_str_bl_target_properties; PyObject *bpy_intern_str_bl_target_properties;
PyObject *bpy_intern_str_bpy_types; PyObject *bpy_intern_str_bpy_types;
PyObject *bpy_intern_str_frame; PyObject *bpy_intern_str_frame;
PyObject *bpy_intern_str_order;
PyObject *bpy_intern_str_properties; PyObject *bpy_intern_str_properties;
PyObject *bpy_intern_str_register; PyObject *bpy_intern_str_register;
PyObject *bpy_intern_str_self; PyObject *bpy_intern_str_self;
@@ -60,6 +60,7 @@ void bpy_intern_string_init(void)
#define BPY_INTERN_STR(var, str) \ #define BPY_INTERN_STR(var, str) \
{ var = bpy_intern_str_arr[i++] = PyUnicode_FromString(str); } (void)0 { var = bpy_intern_str_arr[i++] = PyUnicode_FromString(str); } (void)0
BPY_INTERN_STR(bpy_intern_str___annotations__, "__annotations__");
BPY_INTERN_STR(bpy_intern_str___doc__, "__doc__"); BPY_INTERN_STR(bpy_intern_str___doc__, "__doc__");
BPY_INTERN_STR(bpy_intern_str___main__, "__main__"); BPY_INTERN_STR(bpy_intern_str___main__, "__main__");
BPY_INTERN_STR(bpy_intern_str___module__, "__module__"); BPY_INTERN_STR(bpy_intern_str___module__, "__module__");
@@ -71,7 +72,6 @@ void bpy_intern_string_init(void)
BPY_INTERN_STR(bpy_intern_str_bl_target_properties, "bl_target_properties"); BPY_INTERN_STR(bpy_intern_str_bl_target_properties, "bl_target_properties");
BPY_INTERN_STR(bpy_intern_str_bpy_types, "bpy.types"); BPY_INTERN_STR(bpy_intern_str_bpy_types, "bpy.types");
BPY_INTERN_STR(bpy_intern_str_frame, "frame"); BPY_INTERN_STR(bpy_intern_str_frame, "frame");
BPY_INTERN_STR(bpy_intern_str_order, "order");
BPY_INTERN_STR(bpy_intern_str_properties, "properties"); BPY_INTERN_STR(bpy_intern_str_properties, "properties");
BPY_INTERN_STR(bpy_intern_str_register, "register"); BPY_INTERN_STR(bpy_intern_str_register, "register");
BPY_INTERN_STR(bpy_intern_str_self, "self"); BPY_INTERN_STR(bpy_intern_str_self, "self");

View File

@@ -30,6 +30,7 @@
void bpy_intern_string_init(void); void bpy_intern_string_init(void);
void bpy_intern_string_exit(void); void bpy_intern_string_exit(void);
extern PyObject *bpy_intern_str___annotations__;
extern PyObject *bpy_intern_str___doc__; extern PyObject *bpy_intern_str___doc__;
extern PyObject *bpy_intern_str___main__; extern PyObject *bpy_intern_str___main__;
extern PyObject *bpy_intern_str___module__; extern PyObject *bpy_intern_str___module__;
@@ -41,7 +42,6 @@ extern PyObject *bpy_intern_str_bl_rna;
extern PyObject *bpy_intern_str_bl_target_properties; extern PyObject *bpy_intern_str_bl_target_properties;
extern PyObject *bpy_intern_str_bpy_types; extern PyObject *bpy_intern_str_bpy_types;
extern PyObject *bpy_intern_str_frame; extern PyObject *bpy_intern_str_frame;
extern PyObject *bpy_intern_str_order;
extern PyObject *bpy_intern_str_properties; extern PyObject *bpy_intern_str_properties;
extern PyObject *bpy_intern_str_register; extern PyObject *bpy_intern_str_register;
extern PyObject *bpy_intern_str_self; extern PyObject *bpy_intern_str_self;

View File

@@ -7423,29 +7423,38 @@ static int deferred_register_prop(StructRNA *srna, PyObject *key, PyObject *item
static int pyrna_deferred_register_props(StructRNA *srna, PyObject *class_dict) static int pyrna_deferred_register_props(StructRNA *srna, PyObject *class_dict)
{ {
PyObject *fields_dict;
PyObject *item, *key; PyObject *item, *key;
PyObject *order;
Py_ssize_t pos = 0; Py_ssize_t pos = 0;
int ret = 0; int ret = 0;
/* in both cases PyDict_CheckExact(class_dict) will be true even /* in both cases PyDict_CheckExact(class_dict) will be true even
* though Operators have a metaclass dict namespace */ * though Operators have a metaclass dict namespace */
if ((fields_dict = PyDict_GetItem(class_dict, bpy_intern_str___annotations__)) && PyDict_CheckExact(fields_dict)) {
while (PyDict_Next(fields_dict, &pos, &key, &item)) {
ret = deferred_register_prop(srna, key, item);
if ((order = PyDict_GetItem(class_dict, bpy_intern_str_order)) && PyList_CheckExact(order)) { if (ret != 0) {
for (pos = 0; pos < PyList_GET_SIZE(order); pos++) { break;
key = PyList_GET_ITEM(order, pos);
/* however unlikely its possible
* fails in py 3.3 beta with __qualname__ */
if ((item = PyDict_GetItem(class_dict, key))) {
ret = deferred_register_prop(srna, key, item);
if (ret != 0) {
break;
}
} }
} }
} }
else {
{
/* This block can be removed once 2.8x is released and fields are in use. */
bool has_warning = false;
while (PyDict_Next(class_dict, &pos, &key, &item)) { while (PyDict_Next(class_dict, &pos, &key, &item)) {
if (pyrna_is_deferred_prop(item)) {
if (!has_warning) {
PyC_StackSpit();
printf("Warning: class %.200s "
"contains a properties which should be a field!\n",
RNA_struct_identifier(srna));
has_warning = true;
}
printf(" make field: %.200s.%.200s\n",
RNA_struct_identifier(srna), _PyUnicode_AsString(key));
}
ret = deferred_register_prop(srna, key, item); ret = deferred_register_prop(srna, key, item);
if (ret != 0) if (ret != 0)