Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-11-19 20:12:08 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-11-19 20:12:08 +0300
commite61c90e4162040f564e154da055995e2ed280fdf (patch)
tree70cfb3cde5608c03839acb460ddb6b53b57f39f9 /release/scripts/op
parentac8ff25b2d6465e3ad2b79c359d74b4bab4985e4 (diff)
operators were copying the properties from the rna operator into the class instance.
however this meant the invoke function could not modify properties for exec to use (unless it called exec directly after) since the popup for eg would re-instance the python class each time. now use the operator properties directly through rna without an automatic copy. now an operator attribute is accessed like this... self.path --> self.properties.path
Diffstat (limited to 'release/scripts/op')
-rw-r--r--release/scripts/op/add_mesh_torus.py8
-rw-r--r--release/scripts/op/uvcalc_smart_project.py2
-rw-r--r--release/scripts/op/vertexpaint_dirt.py4
-rw-r--r--release/scripts/op/wm.py63
4 files changed, 38 insertions, 39 deletions
diff --git a/release/scripts/op/add_mesh_torus.py b/release/scripts/op/add_mesh_torus.py
index ddc4f0b9770..2321c0bbeab 100644
--- a/release/scripts/op/add_mesh_torus.py
+++ b/release/scripts/op/add_mesh_torus.py
@@ -96,10 +96,10 @@ class AddTorus(bpy.types.Operator):
def execute(self, context):
- verts_loc, faces = add_torus(self.major_radius,
- self.minor_radius,
- self.major_segments,
- self.minor_segments)
+ verts_loc, faces = add_torus(self.properties.major_radius,
+ self.properties.minor_radius,
+ self.properties.major_segments,
+ self.properties.minor_segments)
mesh = bpy.data.add_mesh("Torus")
diff --git a/release/scripts/op/uvcalc_smart_project.py b/release/scripts/op/uvcalc_smart_project.py
index 11202329a3d..23357bd1572 100644
--- a/release/scripts/op/uvcalc_smart_project.py
+++ b/release/scripts/op/uvcalc_smart_project.py
@@ -1128,7 +1128,7 @@ class SmartProject(bpy.types.Operator):
return context.active_object != None
def execute(self, context):
- main(context, self.island_margin, self.angle_limit)
+ main(context, self.properties.island_margin, self.properties.angle_limit)
return ('FINISHED',)
bpy.ops.add(SmartProject)
diff --git a/release/scripts/op/vertexpaint_dirt.py b/release/scripts/op/vertexpaint_dirt.py
index 04398dfa8ce..bd052e909b6 100644
--- a/release/scripts/op/vertexpaint_dirt.py
+++ b/release/scripts/op/vertexpaint_dirt.py
@@ -166,7 +166,7 @@ class VertexPaintDirt(bpy.types.Operator):
t = time.time()
- applyVertexDirt(me, self.blur_iterations, self.blur_strength, math.radians(self.dirt_angle), math.radians(self.clean_angle), self.dirt_only)
+ applyVertexDirt(me, self.properties.blur_iterations, self.properties.blur_strength, math.radians(self.properties.dirt_angle), math.radians(self.properties.clean_angle), self.properties.dirt_only)
print('Dirt calculated in %.6f' % (time.time()-t))
@@ -175,4 +175,4 @@ class VertexPaintDirt(bpy.types.Operator):
bpy.ops.add(VertexPaintDirt)
if __name__ == "__main__":
- bpy.ops.mesh.vertex_paint_dirt()
+ bpy.ops.mesh.vertex_paint_dirt() \ No newline at end of file
diff --git a/release/scripts/op/wm.py b/release/scripts/op/wm.py
index 5e0894d9907..1f660dbeb35 100644
--- a/release/scripts/op/wm.py
+++ b/release/scripts/op/wm.py
@@ -60,9 +60,9 @@ def context_path_validate(context, path):
def execute_context_assign(self, context):
- if context_path_validate(context, self.path) == NullPathMember:
+ if context_path_validate(context, self.properties.path) == NullPathMember:
return ('PASS_THROUGH',)
- exec("context.%s=self.value" % self.path)
+ exec("context.%s=self.properties.value" % self.properties.path)
return ('FINISHED',)
@@ -134,10 +134,10 @@ class WM_OT_context_toggle(bpy.types.Operator):
def execute(self, context):
- if context_path_validate(context, self.path) == NullPathMember:
+ if context_path_validate(context, self.properties.path) == NullPathMember:
return ('PASS_THROUGH',)
- exec("context.%s=not (context.%s)" % (self.path, self.path))
+ exec("context.%s=not (context.%s)" % (self.properties.path, self.properties.path))
return ('FINISHED',)
@@ -155,11 +155,11 @@ class WM_OT_context_toggle_enum(bpy.types.Operator):
def execute(self, context):
- if context_path_validate(context, self.path) == NullPathMember:
+ if context_path_validate(context, self.properties.path) == NullPathMember:
return ('PASS_THROUGH',)
exec("context.%s = ['%s', '%s'][context.%s!='%s']" % \
- (self.path, self.value_1, self.value_2, self.path, self.value_2))
+ (self.properties.path, self.properties.value_1, self.properties.value_2, self.properties.path, self.properties.value_2))
return ('FINISHED',)
@@ -174,23 +174,23 @@ class WM_OT_context_cycle_int(bpy.types.Operator):
def execute(self, context):
- value = context_path_validate(context, self.path)
+ value = context_path_validate(context, self.properties.path)
if value == NullPathMember:
return ('PASS_THROUGH',)
- self.value = value
- if self.reverse:
- self.value -= 1
+ self.properties.value = value
+ if self.properties.reverse:
+ self.properties.value -= 1
else:
- self.value += 1
+ self.properties.value += 1
execute_context_assign(self, context)
- if self.value != eval("context.%s" % self.path):
+ if self.properties.value != eval("context.%s" % self.properties.path):
# relies on rna clamping int's out of the range
- if self.reverse:
- self.value = (1 << 32)
+ if self.properties.reverse:
+ self.properties.value = (1 << 32)
else:
- self.value = - (1 << 32)
+ self.properties.value = - (1 << 32)
execute_context_assign(self, context)
return ('FINISHED',)
@@ -206,14 +206,14 @@ class WM_OT_context_cycle_enum(bpy.types.Operator):
def execute(self, context):
- value = context_path_validate(context, self.path)
+ value = context_path_validate(context, self.properties.path)
if value == NullPathMember:
return ('PASS_THROUGH',)
orig_value = value
# Have to get rna enum values
- rna_struct_str, rna_prop_str = self.path.rsplit('.', 1)
+ rna_struct_str, rna_prop_str = self.properties.path.rsplit('.', 1)
i = rna_prop_str.find('[')
# just incse we get "context.foo.bar[0]"
@@ -231,7 +231,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.reverse:
+ if self.properties.reverse:
if orig_index == 0:
advance_enum = enums[-1]
else:
@@ -243,7 +243,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.path)
+ exec("context.%s=advance_enum" % self.properties.path)
return ('FINISHED',)
doc_id = StringProperty(name="Doc ID",
@@ -270,7 +270,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.doc_id.split('.')
+ id_split = self.properties.doc_id.split('.')
if len(id_split) == 1: # rna, class
url = '%s/bpy.types.%s-class.html' % (self._prefix, id_split[0])
elif len(id_split) == 2: # rna, class.prop
@@ -316,9 +316,9 @@ class WM_OT_doc_edit(bpy.types.Operator):
def execute(self, context):
- class_name, class_prop = self.doc_id.split('.')
+ class_name, class_prop = self.properties.doc_id.split('.')
- if not self.doc_new:
+ if not self.properties.doc_new:
return ('RUNNING_MODAL',)
# check if this is an operator
@@ -331,25 +331,25 @@ class WM_OT_doc_edit(bpy.types.Operator):
if op_class:
rna = op_class.bl_rna
doc_orig = rna.description
- if doc_orig == self.doc_new:
+ if doc_orig == self.properties.doc_new:
return ('RUNNING_MODAL',)
- print("op - old:'%s' -> new:'%s'" % (doc_orig, self.doc_new))
- upload["title"] = 'OPERATOR %s:%s' % (self.doc_id, doc_orig)
- upload["description"] = self.doc_new
+ print("op - old:'%s' -> new:'%s'" % (doc_orig, self.properties.doc_new))
+ upload["title"] = 'OPERATOR %s:%s' % (self.properties.doc_id, doc_orig)
+ upload["description"] = self.properties.doc_new
self._send_xmlrpc(upload)
else:
rna = getattr(bpy.types, class_name).bl_rna
doc_orig = rna.properties[class_prop].description
- if doc_orig == self.doc_new:
+ if doc_orig == self.properties.doc_new:
return ('RUNNING_MODAL',)
- print("rna - old:'%s' -> new:'%s'" % (doc_orig, self.doc_new))
- upload["title"] = 'RNA %s:%s' % (self.doc_id, doc_orig)
+ print("rna - old:'%s' -> new:'%s'" % (doc_orig, self.properties.doc_new))
+ upload["title"] = 'RNA %s:%s' % (self.properties.doc_id, doc_orig)
- upload["description"] = self.doc_new
+ upload["description"] = self.properties.doc_new
self._send_xmlrpc(upload)
@@ -410,7 +410,6 @@ bpy.ops.add(WM_OT_reload_scripts)
# experemental!
import rna_prop_ui
-bpy.ops.add(rna_prop_ui.WM_OT_properties_edit_begin)
-bpy.ops.add(rna_prop_ui.WM_OT_properties_edit_end)
+bpy.ops.add(rna_prop_ui.WM_OT_properties_edit)
bpy.ops.add(rna_prop_ui.WM_OT_properties_add)
bpy.ops.add(rna_prop_ui.WM_OT_properties_remove)