diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-09-09 22:03:57 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-09-09 22:03:57 +0400 |
commit | 111965478a9fe671a827ed2a495b83fa3a100aeb (patch) | |
tree | d225ba52910a1f4b8f7152aa5a716ffad372be55 /release/scripts | |
parent | 7bd1f9a234aa0adeecc3ec8e77eead598b5af232 (diff) |
replace self.properties.foo --> self.foo
Diffstat (limited to 'release/scripts')
-rw-r--r-- | release/scripts/modules/io_utils.py | 4 | ||||
-rw-r--r-- | release/scripts/op/add_mesh_torus.py | 17 | ||||
-rw-r--r-- | release/scripts/op/image.py | 4 | ||||
-rw-r--r-- | release/scripts/op/nla.py | 3 | ||||
-rw-r--r-- | release/scripts/op/object.py | 23 | ||||
-rw-r--r-- | release/scripts/op/object_align.py | 9 | ||||
-rw-r--r-- | release/scripts/op/object_randomize_transform.py | 12 | ||||
-rw-r--r-- | release/scripts/op/presets.py | 12 | ||||
-rw-r--r-- | release/scripts/op/sequencer.py | 2 | ||||
-rw-r--r-- | release/scripts/op/uv.py | 6 | ||||
-rw-r--r-- | release/scripts/op/uvcalc_smart_project.py | 2 | ||||
-rw-r--r-- | release/scripts/op/vertexpaint_dirt.py | 2 | ||||
-rw-r--r-- | release/scripts/op/wm.py | 116 | ||||
-rw-r--r-- | release/scripts/templates/operator.py | 2 | ||||
-rw-r--r-- | release/scripts/templates/operator_modal.py | 10 | ||||
-rw-r--r-- | release/scripts/templates/operator_modal_view3d.py | 4 | ||||
-rw-r--r-- | release/scripts/ui/properties_scene.py | 6 | ||||
-rw-r--r-- | release/scripts/ui/space_console.py | 2 | ||||
-rw-r--r-- | release/scripts/ui/space_userpref.py | 8 | ||||
-rw-r--r-- | release/scripts/ui/space_userpref_keymap.py | 26 |
20 files changed, 131 insertions, 139 deletions
diff --git a/release/scripts/modules/io_utils.py b/release/scripts/modules/io_utils.py index 64062ed697f..04c441100d7 100644 --- a/release/scripts/modules/io_utils.py +++ b/release/scripts/modules/io_utils.py @@ -28,8 +28,8 @@ class ExportHelper: def invoke(self, context, event): import os - if not self.properties.is_property_set("filepath"): - self.properties.filepath = os.path.splitext(context.blend_data.filepath)[0] + self.filename_ext + if not self.filepath: + self.filepath = os.path.splitext(context.blend_data.filepath)[0] + self.filename_ext context.window_manager.add_fileselect(self) return {'RUNNING_MODAL'} diff --git a/release/scripts/op/add_mesh_torus.py b/release/scripts/op/add_mesh_torus.py index 70e394671fe..36baca45719 100644 --- a/release/scripts/op/add_mesh_torus.py +++ b/release/scripts/op/add_mesh_torus.py @@ -107,17 +107,16 @@ class AddTorus(bpy.types.Operator): rotation = FloatVectorProperty(name="Rotation") def execute(self, context): - props = self.properties - if props.use_abso == True: - extra_helper = (props.abso_major_rad - props.abso_minor_rad) * 0.5 - props.major_radius = props.abso_minor_rad + extra_helper - props.minor_radius = extra_helper + if self.use_abso == True: + extra_helper = (self.abso_major_rad - self.abso_minor_rad) * 0.5 + self.major_radius = self.abso_minor_rad + extra_helper + self.minor_radius = extra_helper - verts_loc, faces = add_torus(props.major_radius, - props.minor_radius, - props.major_segments, - props.minor_segments) + verts_loc, faces = add_torus(self.major_radius, + self.minor_radius, + self.major_segments, + self.minor_segments) mesh = bpy.data.meshes.new("Torus") diff --git a/release/scripts/op/image.py b/release/scripts/op/image.py index eff379ee563..09c9f5e6881 100644 --- a/release/scripts/op/image.py +++ b/release/scripts/op/image.py @@ -58,7 +58,7 @@ class EditExternally(bpy.types.Operator): def execute(self, context): import os import subprocess - filepath = bpy.path.abspath(self.properties.filepath) + filepath = bpy.path.abspath(self.filepath) if not os.path.exists(filepath): self.report('ERROR', "Image path '%s' not found." % filepath) @@ -77,7 +77,7 @@ class EditExternally(bpy.types.Operator): self.report({'ERROR'}, "Image not found on disk") return {'CANCELLED'} - self.properties.filepath = filepath + self.filepath = filepath self.execute(context) return {'FINISHED'} diff --git a/release/scripts/op/nla.py b/release/scripts/op/nla.py index e8ee018e8c3..a91c84999fa 100644 --- a/release/scripts/op/nla.py +++ b/release/scripts/op/nla.py @@ -148,9 +148,8 @@ class BakeAction(bpy.types.Operator): default=True) def execute(self, context): - props = self.properties - action = bake(props.frame_start, props.frame_end, props.step, props.show_only_selected) + action = bake(self.frame_start, self.frame_end, self.step, self.show_only_selected) # basic cleanup, could move elsewhere for fcu in action.fcurves: diff --git a/release/scripts/op/object.py b/release/scripts/op/object.py index 8575f0f9243..fd6235ba783 100644 --- a/release/scripts/op/object.py +++ b/release/scripts/op/object.py @@ -36,7 +36,7 @@ class SelectPattern(bpy.types.Operator): import fnmatch - if self.properties.case_sensitive: + if self.case_sensitive: pattern_match = fnmatch.fnmatchcase else: pattern_match = lambda a, b: fnmatch.fnmatchcase(a.upper(), b.upper()) @@ -51,9 +51,9 @@ class SelectPattern(bpy.types.Operator): # Can be pose bones or objects for item in items: - if pattern_match(item.name, self.properties.pattern): + if pattern_match(item.name, self.pattern): item.select = True - elif not self.properties.extend: + elif not self.extend: item.select = False return {'FINISHED'} @@ -66,12 +66,11 @@ class SelectPattern(bpy.types.Operator): def draw(self, context): layout = self.layout - props = self.properties - layout.prop(props, "pattern") + layout.prop(self.properties, "pattern") row = layout.row() - row.prop(props, "case_sensitive") - row.prop(props, "extend") + row.prop(self.properties, "case_sensitive") + row.prop(self.properties, "extend") class SelectCamera(bpy.types.Operator): @@ -124,7 +123,7 @@ class SelectHierarchy(bpy.types.Operator): if context.object not in selected_objects: selected_objects.append(context.object) - if self.properties.direction == 'PARENT': + if self.direction == 'PARENT': for obj in selected_objects: parent = obj.parent @@ -144,7 +143,7 @@ class SelectHierarchy(bpy.types.Operator): # dont edit any object settings above this if select_new: - if not self.properties.extend: + if not self.extend: bpy.ops.object.select_all(action='DESELECT') for obj in select_new: @@ -174,8 +173,8 @@ class SubdivisionSet(bpy.types.Operator): return (obs is not None) def execute(self, context): - level = self.properties.level - relative = self.properties.relative + level = self.level + relative = self.relative if relative and level == 0: return {'CANCELLED'} # nothing to do @@ -403,7 +402,7 @@ class ShapeTransfer(bpy.types.Operator): if ob_act.active_shape_key is None: self.report({'ERROR'}, "Other object has no shape key") return {'CANCELLED'} - return self._main(ob_act, objects, self.properties.mode, self.properties.use_clamp) + return self._main(ob_act, objects, self.mode, self.use_clamp) class JoinUVs(bpy.types.Operator): diff --git a/release/scripts/op/object_align.py b/release/scripts/op/object_align.py index dc9b7c34523..359ffa9aabe 100644 --- a/release/scripts/op/object_align.py +++ b/release/scripts/op/object_align.py @@ -268,14 +268,7 @@ class AlignObjects(bpy.types.Operator): return context.mode == 'OBJECT' def execute(self, context): - - align_mode = self.properties.align_mode - relative_to = self.properties.relative_to - align_x = self.properties.align_x - align_y = self.properties.align_y - align_z = self.properties.align_z - - align_objects(align_x, align_y, align_z, align_mode, relative_to) + align_objects(self.align_x, self.align_y, self.align_z, self.align_mode, self.relative_to) return {'FINISHED'} diff --git a/release/scripts/op/object_randomize_transform.py b/release/scripts/op/object_randomize_transform.py index e3afb1261dd..8c606527a6d 100644 --- a/release/scripts/op/object_randomize_transform.py +++ b/release/scripts/op/object_randomize_transform.py @@ -119,14 +119,14 @@ class RandomizeLocRotSize(bpy.types.Operator): def execute(self, context): from math import radians - seed = self.properties.random_seed + seed = self.random_seed - loc = None if not self.properties.use_loc else self.properties.loc - rot = None if not self.properties.use_rot else self.properties.rot * radians(1.0) - scale = None if not self.properties.use_scale else self.properties.scale + loc = None if not self.use_loc else self.loc + rot = None if not self.use_rot else self.rot * radians(1.0) + scale = None if not self.use_scale else self.scale - scale_even = self.properties.scale_even - scale_min = self.properties.scale_min + scale_even = self.scale_even + scale_min = self.scale_min randomize_selected(seed, loc, rot, scale, scale_even, scale_min) diff --git a/release/scripts/op/presets.py b/release/scripts/op/presets.py index 132a947218a..fc2f41d2cf5 100644 --- a/release/scripts/op/presets.py +++ b/release/scripts/op/presets.py @@ -39,16 +39,16 @@ class AddPresetBase(): def execute(self, context): - if not self.properties.name: + if not self.name: return {'FINISHED'} - filename = self._as_filename(self.properties.name) + ".py" + filename = self._as_filename(self.name) + ".py" target_path = bpy.utils.preset_paths(self.preset_subdir)[0] # we need some way to tell the user and system preset path filepath = os.path.join(target_path, filename) if getattr(self, "save_keyconfig", False): - bpy.ops.wm.keyconfig_export(filepath=filepath, kc_name=self.properties.name) + bpy.ops.wm.keyconfig_export(filepath=filepath, kc_name=self.name) file_preset = open(filepath, 'a') file_preset.write("wm.keyconfigs.active = kc\n\n") else: @@ -83,11 +83,11 @@ class ExecutePreset(bpy.types.Operator): def execute(self, context): # change the menu title to the most recently chosen option - preset_class = getattr(bpy.types, self.properties.menu_idname) - preset_class.bl_label = self.properties.preset_name + preset_class = getattr(bpy.types, self.menu_idname) + preset_class.bl_label = self.preset_name # execute the preset using script.python_file_run - bpy.ops.script.python_file_run(filepath=self.properties.filepath) + bpy.ops.script.python_file_run(filepath=self.filepath) return {'FINISHED'} diff --git a/release/scripts/op/sequencer.py b/release/scripts/op/sequencer.py index feedb5cb4a8..7d453745276 100644 --- a/release/scripts/op/sequencer.py +++ b/release/scripts/op/sequencer.py @@ -92,7 +92,7 @@ class SequencerCutMulticam(bpy.types.Operator): return False def execute(self, context): - camera = self.properties.camera + camera = self.camera s = context.scene.sequence_editor.active_strip diff --git a/release/scripts/op/uv.py b/release/scripts/op/uv.py index c4024e8bc18..05c2f2522a8 100644 --- a/release/scripts/op/uv.py +++ b/release/scripts/op/uv.py @@ -72,7 +72,7 @@ class ExportUVLayout(bpy.types.Operator): uv_layer = mesh.uv_textures.active.data uv_layer_len = len(uv_layer) - if not self.properties.export_all: + if not self.export_all: local_image = Ellipsis @@ -112,9 +112,9 @@ class ExportUVLayout(bpy.types.Operator): mesh = obj.data faces = mesh.faces - mode = self.properties.mode + mode = self.mode - filepath = self.properties.filepath + filepath = self.filepath filepath = bpy.path.ensure_ext(filepath, "." + mode.lower()) file = open(filepath, "w") fw = file.write diff --git a/release/scripts/op/uvcalc_smart_project.py b/release/scripts/op/uvcalc_smart_project.py index c4e19afc810..83303f8f7f1 100644 --- a/release/scripts/op/uvcalc_smart_project.py +++ b/release/scripts/op/uvcalc_smart_project.py @@ -1129,7 +1129,7 @@ class SmartProject(bpy.types.Operator): return context.active_object != None def execute(self, context): - main(context, self.properties.island_margin, self.properties.angle_limit) + main(context, self.island_margin, self.angle_limit) return {'FINISHED'} diff --git a/release/scripts/op/vertexpaint_dirt.py b/release/scripts/op/vertexpaint_dirt.py index 72317cf8c11..c5bb4450497 100644 --- a/release/scripts/op/vertexpaint_dirt.py +++ b/release/scripts/op/vertexpaint_dirt.py @@ -172,7 +172,7 @@ class VertexPaintDirt(bpy.types.Operator): t = time.time() - applyVertexDirt(mesh, self.properties.blur_iterations, self.properties.blur_strength, math.radians(self.properties.dirt_angle), math.radians(self.properties.clean_angle), self.properties.dirt_only) + applyVertexDirt(mesh, self.blur_iterations, self.blur_strength, math.radians(self.dirt_angle), math.radians(self.clean_angle), self.dirt_only) print('Dirt calculated in %.6f' % (time.time() - t)) diff --git a/release/scripts/op/wm.py b/release/scripts/op/wm.py index d90d80ce61d..51304bdc3eb 100644 --- a/release/scripts/op/wm.py +++ b/release/scripts/op/wm.py @@ -63,13 +63,13 @@ def context_path_validate(context, data_path): def execute_context_assign(self, context): - if context_path_validate(context, self.properties.data_path) is Ellipsis: + if context_path_validate(context, self.data_path) is Ellipsis: return {'PASS_THROUGH'} - if getattr(self.properties, "relative", False): - exec("context.%s+=self.properties.value" % self.properties.data_path) + if getattr(self, "relative", False): + exec("context.%s+=self.value" % self.data_path) else: - exec("context.%s=self.properties.value" % self.properties.data_path) + exec("context.%s=self.value" % self.data_path) return {'FINISHED'} @@ -113,16 +113,16 @@ class WM_OT_context_scale_int(bpy.types.Operator): default=True) def execute(self, context): - if context_path_validate(context, self.properties.data_path) is Ellipsis: + if context_path_validate(context, self.data_path) is Ellipsis: return {'PASS_THROUGH'} - value = self.properties.value - data_path = self.properties.data_path + value = self.value + data_path = self.data_path if value == 1.0: # nothing to do return {'CANCELLED'} - if getattr(self.properties, "always_step", False): + if getattr(self, "always_step", False): if value > 1.0: add = "1" func = "max" @@ -131,7 +131,7 @@ class WM_OT_context_scale_int(bpy.types.Operator): func = "min" exec("context.%s = %s(round(context.%s * value), context.%s + %s)" % (data_path, func, data_path, data_path, add)) else: - exec("context.%s *= value" % self.properties.data_path) + exec("context.%s *= value" % self.data_path) return {'FINISHED'} @@ -189,9 +189,9 @@ class WM_OT_context_set_value(bpy.types.Operator): maxlen=1024, default="") def execute(self, context): - if context_path_validate(context, self.properties.data_path) is Ellipsis: + if context_path_validate(context, self.data_path) is Ellipsis: return {'PASS_THROUGH'} - exec("context.%s=%s" % (self.properties.data_path, self.properties.value)) + exec("context.%s=%s" % (self.data_path, self.value)) return {'FINISHED'} @@ -205,11 +205,11 @@ class WM_OT_context_toggle(bpy.types.Operator): def execute(self, context): - if context_path_validate(context, self.properties.data_path) is Ellipsis: + if context_path_validate(context, self.data_path) is Ellipsis: return {'PASS_THROUGH'} exec("context.%s=not (context.%s)" % - (self.properties.data_path, self.properties.data_path)) + (self.data_path, self.data_path)) return {'FINISHED'} @@ -229,13 +229,13 @@ class WM_OT_context_toggle_enum(bpy.types.Operator): def execute(self, context): - if context_path_validate(context, self.properties.data_path) is Ellipsis: + if context_path_validate(context, self.data_path) is Ellipsis: return {'PASS_THROUGH'} exec("context.%s = ['%s', '%s'][context.%s!='%s']" % \ - (self.properties.data_path, self.properties.value_1,\ - self.properties.value_2, self.properties.data_path, - self.properties.value_2)) + (self.data_path, self.value_1,\ + self.value_2, self.data_path, + self.value_2)) return {'FINISHED'} @@ -251,12 +251,12 @@ class WM_OT_context_cycle_int(bpy.types.Operator): reverse = rna_reverse_prop def execute(self, context): - data_path = self.properties.data_path + data_path = self.data_path value = context_path_validate(context, data_path) if value is Ellipsis: return {'PASS_THROUGH'} - if self.properties.reverse: + if self.reverse: value -= 1 else: value += 1 @@ -265,7 +265,7 @@ class WM_OT_context_cycle_int(bpy.types.Operator): if value != eval("context.%s" % data_path): # relies on rna clamping int's out of the range - if self.properties.reverse: + if self.reverse: value = (1 << 32) else: value = - (1 << 32) @@ -286,14 +286,14 @@ class WM_OT_context_cycle_enum(bpy.types.Operator): def execute(self, context): - value = context_path_validate(context, self.properties.data_path) + value = context_path_validate(context, self.data_path) if value is Ellipsis: return {'PASS_THROUGH'} orig_value = value # Have to get rna enum values - rna_struct_str, rna_prop_str = self.properties.data_path.rsplit('.', 1) + rna_struct_str, rna_prop_str = self.data_path.rsplit('.', 1) i = rna_prop_str.find('[') # just incse we get "context.foo.bar[0]" @@ -311,7 +311,7 @@ class WM_OT_context_cycle_enum(bpy.types.Operator): orig_index = enums.index(orig_value) # Have the info we need, advance to the next item - if self.properties.reverse: + if self.reverse: if orig_index == 0: advance_enum = enums[-1] else: @@ -323,7 +323,7 @@ class WM_OT_context_cycle_enum(bpy.types.Operator): advance_enum = enums[orig_index + 1] # set the new value - exec("context.%s=advance_enum" % self.properties.data_path) + exec("context.%s=advance_enum" % self.data_path) return {'FINISHED'} @@ -338,13 +338,13 @@ class WM_OT_context_cycle_array(bpy.types.Operator): reverse = rna_reverse_prop def execute(self, context): - data_path = self.properties.data_path + data_path = self.data_path value = context_path_validate(context, data_path) if value is Ellipsis: return {'PASS_THROUGH'} def cycle(array): - if self.properties.reverse: + if self.reverse: array.insert(0, array.pop()) else: array.append(array.pop(0)) @@ -366,8 +366,8 @@ class WM_OT_context_set_id(bpy.types.Operator): description="Assign value", maxlen=1024, default="") def execute(self, context): - value = self.properties.value - data_path = self.properties.data_path + value = self.value + data_path = self.data_path # match the pointer type from the target property to bpy.data.* # so we lookup the correct list. @@ -409,8 +409,8 @@ class WM_OT_context_modal_mouse(bpy.types.Operator): initial_x = IntProperty(options={'HIDDEN'}) def _values_store(self, context): - data_path_iter = self.properties.data_path_iter - data_path_item = self.properties.data_path_item + data_path_iter = self.data_path_iter + data_path_item = self.data_path_item self._values = values = {} @@ -429,11 +429,11 @@ class WM_OT_context_modal_mouse(bpy.types.Operator): values[item] = value_orig def _values_delta(self, delta): - delta *= self.properties.input_scale - if self.properties.invert: + delta *= self.input_scale + if self.invert: delta = - delta - data_path_item = self.properties.data_path_item + data_path_item = self.data_path_item for item, value_orig in self._values.items(): if type(value_orig) == int: exec("item.%s = int(%d)" % (data_path_item, round(value_orig + delta))) @@ -441,7 +441,7 @@ class WM_OT_context_modal_mouse(bpy.types.Operator): exec("item.%s = %f" % (data_path_item, value_orig + delta)) def _values_restore(self): - data_path_item = self.properties.data_path_item + data_path_item = self.data_path_item for item, value_orig in self._values.items(): exec("item.%s = %s" % (data_path_item, value_orig)) @@ -454,7 +454,7 @@ class WM_OT_context_modal_mouse(bpy.types.Operator): event_type = event.type if event_type == 'MOUSEMOVE': - delta = event.mouse_x - self.properties.initial_x + delta = event.mouse_x - self.initial_x self._values_delta(delta) elif 'LEFTMOUSE' == event_type: @@ -472,11 +472,11 @@ class WM_OT_context_modal_mouse(bpy.types.Operator): if not self._values: self.report({'WARNING'}, "Nothing to operate on: %s[ ].%s" % - (self.properties.data_path_iter, self.properties.data_path_item)) + (self.data_path_iter, self.data_path_item)) return {'CANCELLED'} else: - self.properties.initial_x = event.mouse_x + self.initial_x = event.mouse_x context.window_manager.add_modal_handler(self) return {'RUNNING_MODAL'} @@ -491,7 +491,7 @@ class WM_OT_url_open(bpy.types.Operator): def execute(self, context): import webbrowser - webbrowser.open(self.properties.url) + webbrowser.open(self.url) return {'FINISHED'} @@ -507,7 +507,7 @@ class WM_OT_path_open(bpy.types.Operator): import os import subprocess - filepath = bpy.path.abspath(self.properties.filepath) + filepath = bpy.path.abspath(self.filepath) filepath = os.path.normpath(filepath) if not os.path.exists(filepath): @@ -545,7 +545,7 @@ class WM_OT_doc_view(bpy.types.Operator): return '.'.join([class_obj.identifier for class_obj in ls]) def execute(self, context): - id_split = self.properties.doc_id.split('.') + id_split = self.doc_id.split('.') if len(id_split) == 1: # rna, class url = '%s/bpy.types.%s.html' % (self._prefix, id_split[0]) elif len(id_split) == 2: # rna, class.prop @@ -591,8 +591,8 @@ class WM_OT_doc_edit(bpy.types.Operator): def execute(self, context): - doc_id = self.properties.doc_id - doc_new = self.properties.doc_new + doc_id = self.doc_id + doc_new = self.doc_new class_name, class_prop = doc_id.split('.') @@ -632,7 +632,7 @@ class WM_OT_doc_edit(bpy.types.Operator): def draw(self, context): layout = self.layout - props = self.properties + props = self layout.label(text="Descriptor ID: '%s'" % props.doc_id) layout.prop(props, "doc_new", text="") @@ -670,9 +670,9 @@ class WM_OT_properties_edit(bpy.types.Operator): description = StringProperty(name="Tip", default="") def execute(self, context): - data_path = self.properties.data_path - value = self.properties.value - prop = self.properties.property + data_path = self.data_path + value = self.value + prop = self.property prop_old = self._last_prop[0] try: @@ -700,25 +700,25 @@ class WM_OT_properties_edit(bpy.types.Operator): if prop_type in (float, int): - prop_ui['soft_min'] = prop_ui['min'] = prop_type(self.properties.min) - prop_ui['soft_max'] = prop_ui['max'] = prop_type(self.properties.max) + prop_ui['soft_min'] = prop_ui['min'] = prop_type(self.min) + prop_ui['soft_max'] = prop_ui['max'] = prop_type(self.max) - prop_ui['description'] = self.properties.description + prop_ui['description'] = self.description return {'FINISHED'} def invoke(self, context, event): - self._last_prop = [self.properties.property] + self._last_prop = [self.property] - item = eval("context.%s" % self.properties.data_path) + item = eval("context.%s" % self.data_path) # setup defaults - prop_ui = rna_idprop_ui_prop_get(item, self.properties.property, False) # dont create + prop_ui = rna_idprop_ui_prop_get(item, self.property, False) # dont create if prop_ui: - self.properties.min = prop_ui.get("min", -1000000000) - self.properties.max = prop_ui.get("max", 1000000000) - self.properties.description = prop_ui.get("description", "") + self.min = prop_ui.get("min", -1000000000) + self.max = prop_ui.get("max", 1000000000) + self.description = prop_ui.get("description", "") wm = context.window_manager # This crashes, TODO - fix @@ -736,7 +736,7 @@ class WM_OT_properties_add(bpy.types.Operator): data_path = rna_path def execute(self, context): - item = eval("context.%s" % self.properties.data_path) + item = eval("context.%s" % self.data_path) def unique_name(names): prop = 'prop' @@ -763,8 +763,8 @@ class WM_OT_properties_remove(bpy.types.Operator): property = rna_property def execute(self, context): - item = eval("context.%s" % self.properties.data_path) - del item[self.properties.property] + item = eval("context.%s" % self.data_path) + del item[self.property] return {'FINISHED'} diff --git a/release/scripts/templates/operator.py b/release/scripts/templates/operator.py index 423b0b85402..822d888a96c 100644 --- a/release/scripts/templates/operator.py +++ b/release/scripts/templates/operator.py @@ -33,7 +33,7 @@ class ExportSomeData(bpy.types.Operator): #if not self.is_property_set("filepath"): # raise Exception("filename not set") - write_some_data(self.properties.filepath, context, self.properties.use_setting) + write_some_data(self.filepath, context, self.use_setting) return {'FINISHED'} diff --git a/release/scripts/templates/operator_modal.py b/release/scripts/templates/operator_modal.py index 1e88ef3a3f6..522f9fea050 100644 --- a/release/scripts/templates/operator_modal.py +++ b/release/scripts/templates/operator_modal.py @@ -11,14 +11,14 @@ class ModalOperator(bpy.types.Operator): def modal(self, context, event): if event.type == 'MOUSEMOVE': - delta = self.properties.first_mouse_x - event.mouse_x - context.object.location.x = self.properties.first_value + delta * 0.01 + delta = self.first_mouse_x - event.mouse_x + context.object.location.x = self.first_value + delta * 0.01 elif event.type == 'LEFTMOUSE': return {'FINISHED'} elif event.type in ('RIGHTMOUSE', 'ESC'): - context.object.location.x = self.properties.first_value + context.object.location.x = self.first_value return {'CANCELLED'} return {'RUNNING_MODAL'} @@ -26,8 +26,8 @@ class ModalOperator(bpy.types.Operator): def invoke(self, context, event): if context.object: context.window_manager.add_modal_handler(self) - self.properties.first_mouse_x = event.mouse_x - self.properties.first_value = context.object.location.x + self.first_mouse_x = event.mouse_x + self.first_value = context.object.location.x return {'RUNNING_MODAL'} else: self.report({'WARNING'}, "No active object, could not finish") diff --git a/release/scripts/templates/operator_modal_view3d.py b/release/scripts/templates/operator_modal_view3d.py index d7d691dacf2..c116dd28b9e 100644 --- a/release/scripts/templates/operator_modal_view3d.py +++ b/release/scripts/templates/operator_modal_view3d.py @@ -14,14 +14,14 @@ class ViewOperator(bpy.types.Operator): v3d = context.space_data rv3d = v3d.region_3d - rv3d.view_location = self._initial_location + Vector(self.properties.offset) + rv3d.view_location = self._initial_location + Vector(self.offset) def modal(self, context, event): v3d = context.space_data rv3d = v3d.region_3d if event.type == 'MOUSEMOVE': - self.properties.offset = (self._initial_mouse - Vector((event.mouse_x, event.mouse_y, 0.0))) * 0.02 + self.offset = (self._initial_mouse - Vector((event.mouse_x, event.mouse_y, 0.0))) * 0.02 self.execute(context) elif event.type == 'LEFTMOUSE': diff --git a/release/scripts/ui/properties_scene.py b/release/scripts/ui/properties_scene.py index bc4fceaeb99..bb89b52cce6 100644 --- a/release/scripts/ui/properties_scene.py +++ b/release/scripts/ui/properties_scene.py @@ -207,6 +207,8 @@ class SCENE_PT_custom_props(SceneButtonsPanel, PropertyPanel, bpy.types.Panel): from bpy.props import * +# XXX, move operator to op/ dir + class ANIM_OT_keying_set_export(bpy.types.Operator): "Export Keying Set to a python script." @@ -219,10 +221,10 @@ class ANIM_OT_keying_set_export(bpy.types.Operator): filter_python = bpy.props.BoolProperty(name="Filter python", description="", default=True, options={'HIDDEN'}) def execute(self, context): - if not self.properties.filepath: + if not self.filepath: raise Exception("Filepath not set.") - f = open(self.properties.filepath, "w") + f = open(self.filepath, "w") if not f: raise Exception("Could not open file.") diff --git a/release/scripts/ui/space_console.py b/release/scripts/ui/space_console.py index f2264a5c926..558bded5e7f 100644 --- a/release/scripts/ui/space_console.py +++ b/release/scripts/ui/space_console.py @@ -186,7 +186,7 @@ class ConsoleLanguage(bpy.types.Operator): sc = context.space_data # defailt to python - sc.language = self.properties.language + sc.language = self.language bpy.ops.console.banner() diff --git a/release/scripts/ui/space_userpref.py b/release/scripts/ui/space_userpref.py index 7753fe71c94..9675698e21e 100644 --- a/release/scripts/ui/space_userpref.py +++ b/release/scripts/ui/space_userpref.py @@ -1049,7 +1049,7 @@ class WM_OT_addon_enable(bpy.types.Operator): module = StringProperty(name="Module", description="Module name of the addon to enable") def execute(self, context): - module_name = self.properties.module + module_name = self.module # note, this still gets added to _bpy_types.TypeMap @@ -1133,7 +1133,7 @@ class WM_OT_addon_disable(bpy.types.Operator): def execute(self, context): import bpy_types as _bpy_types - module_name = self.properties.module + module_name = self.module try: mod = __import__(module_name) @@ -1168,7 +1168,7 @@ class WM_OT_addon_install(bpy.types.Operator): def execute(self, context): import traceback import zipfile - pyfile = self.properties.filepath + pyfile = self.filepath path_addons = bpy.utils.script_paths("addons")[-1] @@ -1222,7 +1222,7 @@ class WM_OT_addon_expand(bpy.types.Operator): module = StringProperty(name="Module", description="Module name of the addon to expand") def execute(self, context): - module_name = self.properties.module + module_name = self.module # unlikely to fail, module should have already been imported try: diff --git a/release/scripts/ui/space_userpref_keymap.py b/release/scripts/ui/space_userpref_keymap.py index fcfd0a4170b..e8ccc096935 100644 --- a/release/scripts/ui/space_userpref_keymap.py +++ b/release/scripts/ui/space_userpref_keymap.py @@ -522,10 +522,10 @@ class WM_OT_keyconfig_import(bpy.types.Operator): def execute(self, context): import shutil - if not self.properties.is_property_set("filepath"): + if not self.filepath: raise Exception("Filepath not set") - f = open(self.properties.filepath, "r") + f = open(self.filepath, "r") if not f: raise Exception("Could not open file") @@ -548,10 +548,10 @@ class WM_OT_keyconfig_import(bpy.types.Operator): path = os.path.join(path, config_name + ".py") - if self.properties.keep_original: - shutil.copy(self.properties.filepath, path) + if self.keep_original: + shutil.copy(self.filepath, path) else: - shutil.move(self.properties.filepath, path) + shutil.move(self.filepath, path) # sneaky way to check we're actually running the code. wm = context.window_manager @@ -589,20 +589,20 @@ class WM_OT_keyconfig_export(bpy.types.Operator): kc_name = StringProperty(name="KeyConfig Name", description="Name to save the key config as") def execute(self, context): - if not self.properties.is_property_set("filepath"): + if not self.filepath: raise Exception("Filepath not set") - f = open(self.properties.filepath, "w") + f = open(self.filepath, "w") if not f: raise Exception("Could not open file") wm = context.window_manager kc = wm.keyconfigs.active - if self.properties.kc_name != '': - name = self.properties.kc_name + if self.kc_name != '': + name = self.kc_name elif kc.name == 'Blender': - name = os.path.splitext(os.path.basename(self.properties.filepath))[0] + name = os.path.splitext(os.path.basename(self.filepath))[0] else: name = kc.name @@ -696,7 +696,7 @@ class WM_OT_keymap_restore(bpy.types.Operator): def execute(self, context): wm = context.window_manager - if self.properties.all: + if self.all: for km in wm.keyconfigs.default.keymaps: km.restore_to_default() else: @@ -716,7 +716,7 @@ class WM_OT_keyitem_restore(bpy.types.Operator): def execute(self, context): wm = context.window_manager km = context.keymap - kmi = km.items.from_id(self.properties.item_id) + kmi = km.items.from_id(self.item_id) km.restore_item_to_default(kmi) @@ -757,7 +757,7 @@ class WM_OT_keyitem_remove(bpy.types.Operator): def execute(self, context): wm = context.window_manager km = context.keymap - kmi = km.items.from_id(self.properties.item_id) + kmi = km.items.from_id(self.item_id) km.items.remove(kmi) return {'FINISHED'} |