Cleanup: import operator class directly for Python operators

This commit is contained in:
2021-03-23 16:08:02 +11:00
parent 32301a0700
commit 3117de3a73
6 changed files with 25 additions and 16 deletions

View File

@@ -20,13 +20,14 @@
from __future__ import annotations from __future__ import annotations
import bpy import bpy
from bpy.types import Operator
from bpy_extras.asset_utils import ( from bpy_extras.asset_utils import (
SpaceAssetInfo, SpaceAssetInfo,
) )
class ASSET_OT_tag_add(bpy.types.Operator): class ASSET_OT_tag_add(Operator):
"""Add a new keyword tag to the active asset""" """Add a new keyword tag to the active asset"""
bl_idname = "asset.tag_add" bl_idname = "asset.tag_add"
@@ -44,7 +45,7 @@ class ASSET_OT_tag_add(bpy.types.Operator):
return {'FINISHED'} return {'FINISHED'}
class ASSET_OT_tag_remove(bpy.types.Operator): class ASSET_OT_tag_remove(Operator):
"""Remove an existing keyword tag from the active asset""" """Remove an existing keyword tag from the active asset"""
bl_idname = "asset.tag_remove" bl_idname = "asset.tag_remove"

View File

@@ -139,7 +139,7 @@ def CLIP_default_settings_from_track(clip, track, framenr):
settings.default_weight = track.weight settings.default_weight = track.weight
class CLIP_OT_filter_tracks(bpy.types.Operator): class CLIP_OT_filter_tracks(Operator):
"""Filter tracks which has weirdly looking spikes in motion curves""" """Filter tracks which has weirdly looking spikes in motion curves"""
bl_label = "Filter Tracks" bl_label = "Filter Tracks"
bl_idname = "clip.filter_tracks" bl_idname = "clip.filter_tracks"
@@ -216,7 +216,7 @@ class CLIP_OT_filter_tracks(bpy.types.Operator):
return {'FINISHED'} return {'FINISHED'}
class CLIP_OT_set_active_clip(bpy.types.Operator): class CLIP_OT_set_active_clip(Operator):
bl_label = "Set Active Clip" bl_label = "Set Active Clip"
bl_idname = "clip.set_active_clip" bl_idname = "clip.set_active_clip"
@@ -1037,7 +1037,7 @@ class CLIP_OT_track_settings_as_default(Operator):
return {'FINISHED'} return {'FINISHED'}
class CLIP_OT_track_settings_to_track(bpy.types.Operator): class CLIP_OT_track_settings_to_track(Operator):
"""Copy tracking settings from active track to selected tracks""" """Copy tracking settings from active track to selected tracks"""
bl_label = "Copy Track Settings" bl_label = "Copy Track Settings"

View File

@@ -19,7 +19,10 @@
# <pep8 compliant> # <pep8 compliant>
import bpy import bpy
from bpy.types import Operator from bpy.types import (
Operator,
OperatorFileListElement,
)
from bpy.props import ( from bpy.props import (
BoolProperty, BoolProperty,
CollectionProperty, CollectionProperty,
@@ -38,7 +41,7 @@ class WM_OT_previews_batch_generate(Operator):
# ----------- # -----------
# File props. # File props.
files: CollectionProperty( files: CollectionProperty(
type=bpy.types.OperatorFileListElement, type=OperatorFileListElement,
options={'HIDDEN', 'SKIP_SAVE'}, options={'HIDDEN', 'SKIP_SAVE'},
) )
@@ -148,7 +151,7 @@ class WM_OT_previews_batch_clear(Operator):
# ----------- # -----------
# File props. # File props.
files: CollectionProperty( files: CollectionProperty(
type=bpy.types.OperatorFileListElement, type=OperatorFileListElement,
options={'HIDDEN', 'SKIP_SAVE'}, options={'HIDDEN', 'SKIP_SAVE'},
) )

View File

@@ -20,6 +20,9 @@
import bpy import bpy
from bpy.types import (
Operator,
)
from bpy.props import ( from bpy.props import (
BoolProperty, BoolProperty,
EnumProperty, EnumProperty,
@@ -27,7 +30,7 @@ from bpy.props import (
) )
class SCENE_OT_freestyle_fill_range_by_selection(bpy.types.Operator): class SCENE_OT_freestyle_fill_range_by_selection(Operator):
"""Fill the Range Min/Max entries by the min/max distance between selected mesh objects and the source object """ """Fill the Range Min/Max entries by the min/max distance between selected mesh objects and the source object """
"""(either a user-specified object or the active camera)""" """(either a user-specified object or the active camera)"""
bl_idname = "scene.freestyle_fill_range_by_selection" bl_idname = "scene.freestyle_fill_range_by_selection"
@@ -132,7 +135,7 @@ class SCENE_OT_freestyle_fill_range_by_selection(bpy.types.Operator):
return {'FINISHED'} return {'FINISHED'}
class SCENE_OT_freestyle_add_edge_marks_to_keying_set(bpy.types.Operator): class SCENE_OT_freestyle_add_edge_marks_to_keying_set(Operator):
'''Add the data paths to the Freestyle Edge Mark property of selected edges to the active keying set''' '''Add the data paths to the Freestyle Edge Mark property of selected edges to the active keying set'''
bl_idname = "scene.freestyle_add_edge_marks_to_keying_set" bl_idname = "scene.freestyle_add_edge_marks_to_keying_set"
bl_label = "Add Edge Marks to Keying Set" bl_label = "Add Edge Marks to Keying Set"
@@ -163,7 +166,7 @@ class SCENE_OT_freestyle_add_edge_marks_to_keying_set(bpy.types.Operator):
return {'FINISHED'} return {'FINISHED'}
class SCENE_OT_freestyle_add_face_marks_to_keying_set(bpy.types.Operator): class SCENE_OT_freestyle_add_face_marks_to_keying_set(Operator):
'''Add the data paths to the Freestyle Face Mark property of selected polygons to the active keying set''' '''Add the data paths to the Freestyle Face Mark property of selected polygons to the active keying set'''
bl_idname = "scene.freestyle_add_face_marks_to_keying_set" bl_idname = "scene.freestyle_add_face_marks_to_keying_set"
bl_label = "Add Face Marks to Keying Set" bl_label = "Add Face Marks to Keying Set"
@@ -194,7 +197,7 @@ class SCENE_OT_freestyle_add_face_marks_to_keying_set(bpy.types.Operator):
return {'FINISHED'} return {'FINISHED'}
class SCENE_OT_freestyle_module_open(bpy.types.Operator): class SCENE_OT_freestyle_module_open(Operator):
"""Open a style module file""" """Open a style module file"""
bl_idname = "scene.freestyle_module_open" bl_idname = "scene.freestyle_module_open"
bl_label = "Open Style Module File" bl_label = "Open Style Module File"

View File

@@ -17,6 +17,7 @@
# ##### END GPL LICENSE BLOCK ##### # ##### END GPL LICENSE BLOCK #####
import bpy import bpy
from bpy.types import Operator
def geometry_node_group_empty_new(): def geometry_node_group_empty_new():
@@ -48,7 +49,7 @@ def geometry_modifier_poll(context):
return True return True
class NewGeometryNodesModifier(bpy.types.Operator): class NewGeometryNodesModifier(Operator):
"""Create a new modifier with a new geometry node group""" """Create a new modifier with a new geometry node group"""
bl_idname = "node.new_geometry_nodes_modifier" bl_idname = "node.new_geometry_nodes_modifier"
@@ -68,7 +69,7 @@ class NewGeometryNodesModifier(bpy.types.Operator):
return {'FINISHED'} return {'FINISHED'}
class NewGeometryNodeTreeAssign(bpy.types.Operator): class NewGeometryNodeTreeAssign(Operator):
"""Create a new geometry node group and assign it to the active modifier""" """Create a new geometry node group and assign it to the active modifier"""
bl_idname = "node.new_geometry_node_group_assign" bl_idname = "node.new_geometry_node_group_assign"
@@ -91,7 +92,7 @@ class NewGeometryNodeTreeAssign(bpy.types.Operator):
return {'FINISHED'} return {'FINISHED'}
class CopyGeometryNodeTreeAssign(bpy.types.Operator): class CopyGeometryNodeTreeAssign(Operator):
"""Copy the active geometry node group and assign it to the active modifier""" """Copy the active geometry node group and assign it to the active modifier"""
bl_idname = "node.copy_geometry_node_group_assign" bl_idname = "node.copy_geometry_node_group_assign"

View File

@@ -19,8 +19,9 @@
from __future__ import annotations from __future__ import annotations
import bpy import bpy
from bpy.types import Operator
class SPREADSHEET_OT_toggle_pin(bpy.types.Operator): class SPREADSHEET_OT_toggle_pin(Operator):
'''Turn on or off pinning''' '''Turn on or off pinning'''
bl_idname = "spreadsheet.toggle_pin" bl_idname = "spreadsheet.toggle_pin"
bl_label = "Toggle Pin" bl_label = "Toggle Pin"