replace operator options bl_undo and bl_register with bl_options
eg.
bl_options = {'REGISTER', 'UNDO', 'BLOCKING', 'GRAB_POINTER'}
This didnt exist when operators were originally wrapped.
This commit is contained in:
@@ -259,8 +259,7 @@ class AddGear(bpy.types.Operator):
|
||||
'''Add a gear mesh.'''
|
||||
bl_idname = "mesh.gear_add"
|
||||
bl_label = "Add Gear"
|
||||
bl_register = True
|
||||
bl_undo = True
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
number_of_teeth = IntProperty(name="Number of Teeth",
|
||||
description="Number of teeth on the gear",
|
||||
|
||||
@@ -586,8 +586,7 @@ class AddHuman(bpy.types.Operator):
|
||||
'''Add an advanced human metarig base'''
|
||||
bl_idname = "object.armature_human_advanced_add"
|
||||
bl_label = "Add Humanoid (advanced metarig)"
|
||||
bl_register = True
|
||||
bl_undo = True
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
def execute(self, context):
|
||||
bpy.ops.object.armature_add()
|
||||
|
||||
@@ -78,8 +78,7 @@ class AddTorus(bpy.types.Operator):
|
||||
'''Add a torus mesh'''
|
||||
bl_idname = "mesh.primitive_torus_add"
|
||||
bl_label = "Add Torus"
|
||||
bl_register = True
|
||||
bl_undo = True
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
major_radius = FloatProperty(name="Major Radius",
|
||||
description="Radius from the origin to the center of the cross sections",
|
||||
|
||||
@@ -24,8 +24,7 @@ class SaveDirty(bpy.types.Operator):
|
||||
'''Select object matching a naming pattern'''
|
||||
bl_idname = "image.save_dirty"
|
||||
bl_label = "Save Dirty"
|
||||
bl_register = True
|
||||
bl_undo = True
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
def execute(self, context):
|
||||
unique_paths = set()
|
||||
|
||||
@@ -26,8 +26,7 @@ class MeshSelectInteriorFaces(bpy.types.Operator):
|
||||
|
||||
bl_idname = "mesh.faces_select_interior"
|
||||
bl_label = "Select Interior Faces"
|
||||
bl_register = True
|
||||
bl_undo = True
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
def poll(self, context):
|
||||
ob = context.active_object
|
||||
@@ -68,8 +67,7 @@ class MeshMirrorUV(bpy.types.Operator):
|
||||
'''Copy mirror UV coordinates on the X axis based on a mirrored mesh'''
|
||||
bl_idname = "mesh.faces_miror_uv"
|
||||
bl_label = "Copy Mirrored UV coords"
|
||||
bl_register = True
|
||||
bl_undo = True
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
def poll(self, context):
|
||||
ob = context.active_object
|
||||
|
||||
@@ -26,8 +26,7 @@ class SelectPattern(bpy.types.Operator):
|
||||
'''Select object matching a naming pattern'''
|
||||
bl_idname = "object.select_pattern"
|
||||
bl_label = "Select Pattern"
|
||||
bl_register = True
|
||||
bl_undo = True
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
pattern = StringProperty(name="Pattern", description="Name filter using '*' and '?' wildcard chars", maxlen=32, default="*")
|
||||
case_sensitive = BoolProperty(name="Case Sensitive", description="Do a case sensitive compare", default=False)
|
||||
@@ -79,8 +78,7 @@ class SelectCamera(bpy.types.Operator):
|
||||
'''Select object matching a naming pattern'''
|
||||
bl_idname = "object.select_camera"
|
||||
bl_label = "Select Camera"
|
||||
bl_register = True
|
||||
bl_undo = True
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
def poll(self, context):
|
||||
return context.scene.camera is not None
|
||||
@@ -100,8 +98,7 @@ class SelectHierarchy(bpy.types.Operator):
|
||||
'''Select object relative to the active objects position in the hierarchy'''
|
||||
bl_idname = "object.select_hierarchy"
|
||||
bl_label = "Select Hierarchy"
|
||||
bl_register = True
|
||||
bl_undo = True
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
direction = EnumProperty(items=(
|
||||
('PARENT', "Parent", ""),
|
||||
@@ -143,8 +140,7 @@ class SubdivisionSet(bpy.types.Operator):
|
||||
|
||||
bl_idname = "object.subdivision_set"
|
||||
bl_label = "Subdivision Set"
|
||||
bl_register = True
|
||||
bl_undo = True
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
level = IntProperty(name="Level",
|
||||
default=1, min=-100, max=100, soft_min=-6, soft_max=6)
|
||||
@@ -207,8 +203,7 @@ class ShapeTransfer(bpy.types.Operator):
|
||||
|
||||
bl_idname = "object.shape_key_transfer"
|
||||
bl_label = "Transfer Shape Key"
|
||||
bl_register = True
|
||||
bl_undo = True
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
mode = EnumProperty(items=(
|
||||
('OFFSET', "Offset", "Apply the relative positional offset"),
|
||||
|
||||
@@ -235,8 +235,7 @@ class AlignObjects(bpy.types.Operator):
|
||||
'''Align Objects'''
|
||||
bl_idname = "object.align"
|
||||
bl_label = "Align Objects"
|
||||
bl_register = True
|
||||
bl_undo = True
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
align_mode = bpy.props.EnumProperty(items=(
|
||||
('OPT_1', "Negative Sides", ""),
|
||||
|
||||
@@ -83,8 +83,7 @@ class RandomizeLocRotSize(bpy.types.Operator):
|
||||
'''Randomize objects loc/rot/scale'''
|
||||
bl_idname = "object.randomize_transform"
|
||||
bl_label = "Randomize Transform"
|
||||
bl_register = True
|
||||
bl_undo = True
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
random_seed = IntProperty(name="Random Seed",
|
||||
description="Seed value for the random generator",
|
||||
|
||||
@@ -64,8 +64,7 @@ class PlayRenderedAnim(bpy.types.Operator):
|
||||
'''Plays back rendered frames/movies using an external player.'''
|
||||
bl_idname = "screen.play_rendered_anim"
|
||||
bl_label = "Play Rendered Animation"
|
||||
bl_register = True
|
||||
bl_undo = False
|
||||
bl_options = {'REGISTER'}
|
||||
|
||||
def execute(self, context):
|
||||
scene = context.scene
|
||||
|
||||
@@ -25,8 +25,7 @@ class SequencerCrossfadeSounds(bpy.types.Operator):
|
||||
|
||||
bl_idname = "sequencer.crossfade_sounds"
|
||||
bl_label = "Crossfade sounds"
|
||||
bl_register = True
|
||||
bl_undo = True
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
def poll(self, context):
|
||||
if context.scene and context.scene.sequence_editor and context.scene.sequence_editor.active_strip:
|
||||
|
||||
@@ -27,8 +27,7 @@ class ExportUVLayout(bpy.types.Operator):
|
||||
|
||||
bl_idname = "uv.export_layout"
|
||||
bl_label = "Export UV Layout"
|
||||
bl_register = True
|
||||
bl_undo = True
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
path = StringProperty(name="File Path", description="File path used for exporting the SVG file", maxlen=1024, default="")
|
||||
check_existing = BoolProperty(name="Check Existing", description="Check and warn on overwriting existing files", default=True, options={'HIDDEN'})
|
||||
|
||||
@@ -242,9 +242,7 @@ class FollowActiveQuads(bpy.types.Operator):
|
||||
'''Follow UVs from active quads along continuous face loops'''
|
||||
bl_idname = "uv.follow_active_quads"
|
||||
bl_label = "Follow Active Quads"
|
||||
|
||||
bl_register = True
|
||||
bl_undo = True
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
mode = bpy.props.EnumProperty(items=(("EVEN", "Even", "Space all UVs evently"), ("LENGTH", "Length", "Average space UVs edge length of each loop")),
|
||||
name="Edge Length Mode",
|
||||
|
||||
@@ -1115,9 +1115,7 @@ class SmartProject(bpy.types.Operator):
|
||||
'''This script projection unwraps the selected faces of a mesh. it operates on all selected mesh objects, and can be used unwrap selected faces, or all faces.'''
|
||||
bl_idname = "uv.smart_project"
|
||||
bl_label = "Smart UV Project"
|
||||
|
||||
bl_register = True
|
||||
bl_undo = True
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
angle_limit = FloatProperty(name="Angle Limit",
|
||||
description="lower for more projection groups, higher for less distortion.",
|
||||
|
||||
@@ -148,8 +148,7 @@ class VertexPaintDirt(bpy.types.Operator):
|
||||
|
||||
bl_idname = "mesh.vertex_paint_dirt"
|
||||
bl_label = "Dirty Vertex Colors"
|
||||
bl_register = True
|
||||
bl_undo = True
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
blur_strength = FloatProperty(name="Blur Strength", description="Blur strength per iteration", default=1.0, min=0.01, max=1.0)
|
||||
blur_iterations = IntProperty(name="Blur Iterations", description="Number times to blur the colors. (higher blurs more)", default=1, min=0, max=40)
|
||||
|
||||
@@ -78,7 +78,7 @@ class WM_OT_context_set_boolean(bpy.types.Operator):
|
||||
'''Set a context value.'''
|
||||
bl_idname = "wm.context_set_boolean"
|
||||
bl_label = "Context Set Boolean"
|
||||
bl_undo = True
|
||||
bl_options = {'UNDO'}
|
||||
|
||||
path = rna_path_prop
|
||||
value = BoolProperty(name="Value",
|
||||
@@ -91,7 +91,7 @@ class WM_OT_context_set_int(bpy.types.Operator): # same as enum
|
||||
'''Set a context value.'''
|
||||
bl_idname = "wm.context_set_int"
|
||||
bl_label = "Context Set"
|
||||
bl_undo = True
|
||||
bl_options = {'UNDO'}
|
||||
|
||||
path = rna_path_prop
|
||||
value = IntProperty(name="Value", description="Assign value", default=0)
|
||||
@@ -104,7 +104,7 @@ class WM_OT_context_set_float(bpy.types.Operator): # same as enum
|
||||
'''Set a context value.'''
|
||||
bl_idname = "wm.context_set_float"
|
||||
bl_label = "Context Set Float"
|
||||
bl_undo = True
|
||||
bl_options = {'UNDO'}
|
||||
|
||||
path = rna_path_prop
|
||||
value = FloatProperty(name="Value",
|
||||
@@ -118,7 +118,7 @@ class WM_OT_context_set_string(bpy.types.Operator): # same as enum
|
||||
'''Set a context value.'''
|
||||
bl_idname = "wm.context_set_string"
|
||||
bl_label = "Context Set String"
|
||||
bl_undo = True
|
||||
bl_options = {'UNDO'}
|
||||
|
||||
path = rna_path_prop
|
||||
value = StringProperty(name="Value",
|
||||
@@ -131,7 +131,7 @@ class WM_OT_context_set_enum(bpy.types.Operator):
|
||||
'''Set a context value.'''
|
||||
bl_idname = "wm.context_set_enum"
|
||||
bl_label = "Context Set Enum"
|
||||
bl_undo = True
|
||||
bl_options = {'UNDO'}
|
||||
|
||||
path = rna_path_prop
|
||||
value = StringProperty(name="Value",
|
||||
@@ -145,7 +145,7 @@ class WM_OT_context_set_value(bpy.types.Operator):
|
||||
'''Set a context value.'''
|
||||
bl_idname = "wm.context_set_value"
|
||||
bl_label = "Context Set Value"
|
||||
bl_undo = True
|
||||
bl_options = {'UNDO'}
|
||||
|
||||
path = rna_path_prop
|
||||
value = StringProperty(name="Value",
|
||||
@@ -163,7 +163,7 @@ class WM_OT_context_toggle(bpy.types.Operator):
|
||||
'''Toggle a context value.'''
|
||||
bl_idname = "wm.context_toggle"
|
||||
bl_label = "Context Toggle"
|
||||
bl_undo = True
|
||||
bl_options = {'UNDO'}
|
||||
|
||||
path = rna_path_prop
|
||||
|
||||
@@ -182,7 +182,7 @@ class WM_OT_context_toggle_enum(bpy.types.Operator):
|
||||
'''Toggle a context value.'''
|
||||
bl_idname = "wm.context_toggle_enum"
|
||||
bl_label = "Context Toggle Values"
|
||||
bl_undo = True
|
||||
bl_options = {'UNDO'}
|
||||
|
||||
path = rna_path_prop
|
||||
value_1 = StringProperty(name="Value", \
|
||||
@@ -209,7 +209,7 @@ class WM_OT_context_cycle_int(bpy.types.Operator):
|
||||
vertex keys, groups' etc.'''
|
||||
bl_idname = "wm.context_cycle_int"
|
||||
bl_label = "Context Int Cycle"
|
||||
bl_undo = True
|
||||
bl_options = {'UNDO'}
|
||||
|
||||
path = rna_path_prop
|
||||
reverse = rna_reverse_prop
|
||||
@@ -243,7 +243,7 @@ class WM_OT_context_cycle_enum(bpy.types.Operator):
|
||||
'''Toggle a context value.'''
|
||||
bl_idname = "wm.context_cycle_enum"
|
||||
bl_label = "Context Enum Cycle"
|
||||
bl_undo = True
|
||||
bl_options = {'UNDO'}
|
||||
|
||||
path = rna_path_prop
|
||||
reverse = rna_reverse_prop
|
||||
|
||||
@@ -252,8 +252,7 @@ class AsScript(bpy.types.Operator):
|
||||
|
||||
bl_idname = "pose.metarig_to_script"
|
||||
bl_label = "Write Metarig to Script"
|
||||
bl_register = True
|
||||
bl_undo = True
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
path = StringProperty(name="File Path", description="File path used for exporting the Armature file", maxlen=1024, default="")
|
||||
|
||||
|
||||
@@ -119,7 +119,6 @@ class ConsoleExec(bpy.types.Operator):
|
||||
'''Execute the current console line as a python expression'''
|
||||
bl_idname = "console.execute"
|
||||
bl_label = "Console Execute"
|
||||
bl_register = False
|
||||
|
||||
def execute(self, context):
|
||||
sc = context.space_data
|
||||
@@ -138,7 +137,6 @@ class ConsoleAutocomplete(bpy.types.Operator):
|
||||
'''Evaluate the namespace up until the cursor and give a list of options or complete the name if there is only one'''
|
||||
bl_idname = "console.autocomplete"
|
||||
bl_label = "Console Autocomplete"
|
||||
bl_register = False
|
||||
|
||||
def poll(self, context):
|
||||
return context.space_data.console_type != 'REPORT'
|
||||
|
||||
@@ -252,6 +252,14 @@ EnumPropertyItem keymap_modifiers_items[] = {
|
||||
{2, "SECOND", 0, "Second", ""},
|
||||
{0, NULL, 0, NULL, NULL}};
|
||||
|
||||
EnumPropertyItem operator_flag_items[] = {
|
||||
{OPTYPE_REGISTER, "REGISTER", 0, "Register", ""},
|
||||
{OPTYPE_UNDO, "UNDO", 0, "Undo", ""},
|
||||
{OPTYPE_BLOCKING, "BLOCKING", 0, "Finished", ""},
|
||||
{OPTYPE_MACRO, "MACRO", 0, "Macro", ""},
|
||||
{OPTYPE_GRAB_POINTER, "GRAB_POINTER", 0, "Grab Pointer", ""},
|
||||
{0, NULL, 0, NULL, NULL}};
|
||||
|
||||
EnumPropertyItem operator_return_items[] = {
|
||||
{OPERATOR_RUNNING_MODAL, "RUNNING_MODAL", 0, "Running Modal", ""},
|
||||
{OPERATOR_CANCELLED, "CANCELLED", 0, "Cancelled", ""},
|
||||
@@ -924,13 +932,11 @@ static void rna_def_operator(BlenderRNA *brna)
|
||||
RNA_def_property_string_maxlength(prop, 1024); /* else it uses the pointer size! */
|
||||
RNA_def_property_flag(prop, PROP_REGISTER);
|
||||
|
||||
prop= RNA_def_property(srna, "bl_register", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "type->flag", OPTYPE_REGISTER);
|
||||
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
|
||||
|
||||
prop= RNA_def_property(srna, "bl_undo", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "type->flag", OPTYPE_UNDO);
|
||||
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
|
||||
prop= RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "type->flag");
|
||||
RNA_def_property_enum_items(prop, operator_flag_items);
|
||||
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL|PROP_ENUM_FLAG);
|
||||
RNA_def_property_ui_text(prop, "Options", "Options for this operator type");
|
||||
|
||||
RNA_api_operator(srna);
|
||||
|
||||
@@ -981,13 +987,11 @@ static void rna_def_macro_operator(BlenderRNA *brna)
|
||||
RNA_def_property_string_maxlength(prop, 1024); /* else it uses the pointer size! */
|
||||
RNA_def_property_flag(prop, PROP_REGISTER);
|
||||
|
||||
prop= RNA_def_property(srna, "bl_register", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "type->flag", OPTYPE_REGISTER);
|
||||
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
|
||||
|
||||
prop= RNA_def_property(srna, "bl_undo", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "type->flag", OPTYPE_UNDO);
|
||||
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
|
||||
prop= RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "type->flag");
|
||||
RNA_def_property_enum_items(prop, operator_flag_items);
|
||||
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL|PROP_ENUM_FLAG);
|
||||
RNA_def_property_ui_text(prop, "Options", "Options for this operator type");
|
||||
|
||||
RNA_api_macro(srna);
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ PyObject *pyrna_callback_add(BPy_StructRNA *self, PyObject *args)
|
||||
|
||||
if(RNA_struct_is_a(self->ptr.type, &RNA_Region)) {
|
||||
|
||||
EnumPropertyItem region_draw_mode_items[] = {
|
||||
static EnumPropertyItem region_draw_mode_items[] = {
|
||||
{REGION_DRAW_POST_VIEW, "POST_VIEW", 0, "Pose View", ""},
|
||||
{REGION_DRAW_POST_PIXEL, "POST_PIXEL", 0, "Post Pixel", ""},
|
||||
{REGION_DRAW_PRE_VIEW, "PRE_VIEW", 0, "Pre View", ""},
|
||||
|
||||
Reference in New Issue
Block a user