operators were copying the properties from the rna operator into the class instance.
authorCampbell Barton <ideasman42@gmail.com>
Thu, 19 Nov 2009 17:12:08 +0000 (17:12 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 19 Nov 2009 17:12:08 +0000 (17:12 +0000)
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

19 files changed:
release/scripts/io/export_3ds.py
release/scripts/io/export_fbx.py
release/scripts/io/export_mdd.py
release/scripts/io/export_obj.py
release/scripts/io/export_ply.py
release/scripts/io/export_x3d.py
release/scripts/io/import_anim_bvh.py
release/scripts/io/import_scene_3ds.py
release/scripts/io/import_scene_obj.py
release/scripts/modules/rna_prop_ui.py
release/scripts/op/add_mesh_torus.py
release/scripts/op/uvcalc_smart_project.py
release/scripts/op/vertexpaint_dirt.py
release/scripts/op/wm.py
release/scripts/templates/operator.py
release/scripts/ui/space_console.py
release/scripts/ui/space_userpref.py
release/scripts/ui/space_view3d.py
source/blender/python/intern/bpy_operator_wrap.c

index a96abb502154e80afd0680d11d529450b9eaea90..0d5827f6f18e2130a9d7aeecfbe7142735e3d501 100644 (file)
@@ -1123,7 +1123,7 @@ class Export3DS(bpy.types.Operator):
 
        
        def execute(self, context):
-               save_3ds(self.path, context)
+               save_3ds(self.properties.path, context)
                return ('FINISHED',)
        
        def invoke(self, context, event):
index 8b7501bea4d01bb2d0c4ff88c9de0a8f44827d29..b266d74fb57d8f47b9abaffa2b509b8a7d70b880 100644 (file)
@@ -3393,36 +3393,36 @@ class ExportFBX(bpy.types.Operator):
                return context.active_object != None
        
        def execute(self, context):
-               if not self.path:
+               if not self.properties.path:
                        raise Exception("path not set")
 
                GLOBAL_MATRIX = mtx4_identity
-               GLOBAL_MATRIX[0][0] = GLOBAL_MATRIX[1][1] = GLOBAL_MATRIX[2][2] = self._SCALE
-               if self._XROT90: GLOBAL_MATRIX = GLOBAL_MATRIX * mtx4_x90n
-               if self._YROT90: GLOBAL_MATRIX = GLOBAL_MATRIX * mtx4_y90n
-               if self._ZROT90: GLOBAL_MATRIX = GLOBAL_MATRIX * mtx4_z90n
+               GLOBAL_MATRIX[0][0] = GLOBAL_MATRIX[1][1] = GLOBAL_MATRIX[2][2] = self.properties._SCALE
+               if self.properties._XROT90: GLOBAL_MATRIX = GLOBAL_MATRIX * mtx4_x90n
+               if self.properties._YROT90: GLOBAL_MATRIX = GLOBAL_MATRIX * mtx4_y90n
+               if self.properties._ZROT90: GLOBAL_MATRIX = GLOBAL_MATRIX * mtx4_z90n
                        
-               write(self.path,
+               write(self.properties.path,
                          None, # XXX
                          context,
-                         self.EXP_OBS_SELECTED,
-                         self.EXP_MESH,
-                         self.EXP_MESH_APPLY_MOD,
-#                        self.EXP_MESH_HQ_NORMALS,
-                         self.EXP_ARMATURE,
-                         self.EXP_LAMP,
-                         self.EXP_CAMERA,
-                         self.EXP_EMPTY,
-                         self.EXP_IMAGE_COPY,
+                         self.properties.EXP_OBS_SELECTED,
+                         self.properties.EXP_MESH,
+                         self.properties.EXP_MESH_APPLY_MOD,
+#                        self.properties.EXP_MESH_HQ_NORMALS,
+                         self.properties.EXP_ARMATURE,
+                         self.properties.EXP_LAMP,
+                         self.properties.EXP_CAMERA,
+                         self.properties.EXP_EMPTY,
+                         self.properties.EXP_IMAGE_COPY,
                          GLOBAL_MATRIX,
-                         self.ANIM_ENABLE,
-                         self.ANIM_OPTIMIZE,
-                         self.ANIM_OPTIMIZE_PRECISSION,
-                         self.ANIM_ACTION_ALL,
-                         self.BATCH_ENABLE,
-                         self.BATCH_GROUP,
-                         self.BATCH_FILE_PREFIX,
-                         self.BATCH_OWN_DIR)           
+                         self.properties.ANIM_ENABLE,
+                         self.properties.ANIM_OPTIMIZE,
+                         self.properties.ANIM_OPTIMIZE_PRECISSION,
+                         self.properties.ANIM_ACTION_ALL,
+                         self.properties.BATCH_ENABLE,
+                         self.properties.BATCH_GROUP,
+                         self.properties.BATCH_FILE_PREFIX,
+                         self.properties.BATCH_OWN_DIR)                
 
                return ('FINISHED',)
        
index 729b23e4202e708ad5282daf60b023571a3f9fd6..7d08b4f9d7a157ed14e9e1e70d608bfc2ae38d94 100644 (file)
@@ -173,10 +173,10 @@ class ExportMDD(bpy.types.Operator):
         return (ob and ob.type=='MESH')
 
     def execute(self, context):
-        if not self.path:
+        if not self.properties.path:
             raise Exception("filename not set")
-        write(self.path, context.scene, context.active_object,
-            self.start_frame, self.end_frame, self.fps )
+        write(self.properties.path, context.scene, context.active_object,
+            self.properties.start_frame, self.properties.end_frame, self.properties.fps )
         return ('FINISHED',)
     
     def invoke(self, context, event):
index 2c77cbd702afe17dad133b89a68ceb7a30b1198e..34e05c44846ae6b64374318e99bf47951142d336 100644 (file)
@@ -972,24 +972,24 @@ class ExportOBJ(bpy.types.Operator):
        
        def execute(self, context):
 
-               do_export(self.path, context,
-                                 EXPORT_TRI=self.use_triangles,
-                                 EXPORT_EDGES=self.use_edges,
-                                 EXPORT_NORMALS=self.use_normals,
-                                 EXPORT_NORMALS_HQ=self.use_hq_normals,
-                                 EXPORT_UV=self.use_uvs,
-                                 EXPORT_MTL=self.use_materials,
-                                 EXPORT_COPY_IMAGES=self.copy_images,
-                                 EXPORT_APPLY_MODIFIERS=self.use_modifiers,
-                                 EXPORT_ROTX90=self.use_rotate90,
-                                 EXPORT_BLEN_OBS=self.use_blen_objects,
-                                 EXPORT_GROUP_BY_OB=self.group_by_object,
-                                 EXPORT_GROUP_BY_MAT=self.group_by_material,
-                                 EXPORT_KEEP_VERT_ORDER=self.keep_vertex_order,
-                                 EXPORT_POLYGROUPS=self.use_vertex_groups,
-                                 EXPORT_CURVE_AS_NURBS=self.use_nurbs,
-                                 EXPORT_SEL_ONLY=self.use_selection,
-                                 EXPORT_ALL_SCENES=self.use_all_scenes)
+               do_export(self.properties.path, context,
+                                 EXPORT_TRI=self.properties.use_triangles,
+                                 EXPORT_EDGES=self.properties.use_edges,
+                                 EXPORT_NORMALS=self.properties.use_normals,
+                                 EXPORT_NORMALS_HQ=self.properties.use_hq_normals,
+                                 EXPORT_UV=self.properties.use_uvs,
+                                 EXPORT_MTL=self.properties.use_materials,
+                                 EXPORT_COPY_IMAGES=self.properties.copy_images,
+                                 EXPORT_APPLY_MODIFIERS=self.properties.use_modifiers,
+                                 EXPORT_ROTX90=self.properties.use_rotate90,
+                                 EXPORT_BLEN_OBS=self.properties.use_blen_objects,
+                                 EXPORT_GROUP_BY_OB=self.properties.group_by_object,
+                                 EXPORT_GROUP_BY_MAT=self.properties.group_by_material,
+                                 EXPORT_KEEP_VERT_ORDER=self.properties.keep_vertex_order,
+                                 EXPORT_POLYGROUPS=self.properties.use_vertex_groups,
+                                 EXPORT_CURVE_AS_NURBS=self.properties.use_nurbs,
+                                 EXPORT_SEL_ONLY=self.properties.use_selection,
+                                 EXPORT_ALL_SCENES=self.properties.use_all_scenes)
 
                return ('FINISHED',)
        
index 99fa3233278105c10e2cdf14b78f267b94bbbb94..e97ca2155f03a3f3264fd600d366211347a72ea8 100644 (file)
@@ -274,14 +274,14 @@ class ExportPLY(bpy.types.Operator):
        def execute(self, context):
                # print("Selected: " + context.active_object.name)
 
-               if not self.path:
+               if not self.properties.path:
                        raise Exception("filename not set")
                        
-               write(self.path, context.scene, context.active_object,\
-                       EXPORT_APPLY_MODIFIERS = self.use_modifiers,
-                       EXPORT_NORMALS = self.use_normals,
-                       EXPORT_UV = self.use_uvs,
-                       EXPORT_COLORS = self.use_colors,
+               write(self.properties.path, context.scene, context.active_object,\
+                       EXPORT_APPLY_MODIFIERS = self.properties.use_modifiers,
+                       EXPORT_NORMALS = self.properties.use_normals,
+                       EXPORT_UV = self.properties.use_uvs,
+                       EXPORT_COLORS = self.properties.use_colors,
                )
 
                return ('FINISHED',)
index c8c5f71f6fff3513de437a76cf3c5af061b510a5..1fb4393020869f1b0309e83fb10034ad74f6c6bd 100644 (file)
@@ -1230,7 +1230,7 @@ class ExportX3D(bpy.types.Operator):
        
        
        def execute(self, context):
-               x3d_export(self.path, context, self.apply_modifiers, self.triangulate, self.compress)
+               x3d_export(self.properties.path, context, self.properties.apply_modifiers, self.properties.triangulate, self.properties.compress)
                return ('FINISHED',)
        
        def invoke(self, context, event):
index 8185785d1b2f5fee7c56c55cc60db719cb1b6718..364a16b00ea7ddf5125bed7b699e7982153b1ed4 100644 (file)
@@ -863,7 +863,7 @@ class BvhImporter(bpy.types.Operator):
        def execute(self, context):
                # print("Selected: " + context.active_object.name)
 
-               read_bvh(context, self.path)
+               read_bvh(context, self.properties.path)
 
                return ('FINISHED',)
        
index cd351ccb99e20bf863e5e933a4fbd7965ddd3656..35cd4028a4bef41fc7318607d99472a93a73116a 100644 (file)
@@ -1156,7 +1156,7 @@ class IMPORT_OT_autodesk_3ds(bpy.types.Operator):
 #      apply_matrix = BoolProperty(name="Transform Fix", description="Workaround for object transformations importing incorrectly", default=False),
        
        def execute(self, context):
-               load_3ds(self.path, context, 0.0, False, False)
+               load_3ds(self.properties.path, context, 0.0, False, False)
                return ('FINISHED',)
        
        def invoke(self, context, event):
index d1b29a3024da96f7e61d48cfeae118f05f1e109f..6e67c14d37a560ec7fe9512e9b9c5bef530845f9 100644 (file)
@@ -1601,18 +1601,18 @@ class IMPORT_OT_obj(bpy.types.Operator):
        def execute(self, context):
                # print("Selected: " + context.active_object.name)
 
-               load_obj(self.path,
+               load_obj(self.properties.path,
                                 context,
-                                self.CLAMP_SIZE,
-                                self.CREATE_FGONS,
-                                self.CREATE_SMOOTH_GROUPS,
-                                self.CREATE_EDGES,
-                                self.SPLIT_OBJECTS,
-                                self.SPLIT_GROUPS,
-                                self.SPLIT_MATERIALS,
-                                self.ROTATE_X90,
-                                self.IMAGE_SEARCH,
-                                self.POLYGROUPS)
+                                self.properties.CLAMP_SIZE,
+                                self.properties.CREATE_FGONS,
+                                self.properties.CREATE_SMOOTH_GROUPS,
+                                self.properties.CREATE_EDGES,
+                                self.properties.SPLIT_OBJECTS,
+                                self.properties.SPLIT_GROUPS,
+                                self.properties.SPLIT_MATERIALS,
+                                self.properties.ROTATE_X90,
+                                self.properties.IMAGE_SEARCH,
+                                self.properties.POLYGROUPS)
 
                return ('FINISHED',)
        
index 7f741e46bd0bc3bbd639f25d9913b63d001960b4..e4d3de2cef0d714f2cd53f166be43e73457aabda 100644 (file)
@@ -26,6 +26,7 @@ EVIL_PROP_VALUE = EVIL_PROP + '_value'
 EVIL_PROP_PROP = EVIL_PROP + '_prop'
 EVIL_PROP_PROP_ORIG = EVIL_PROP + '_prop_orig'
 
+
 # nasty!, use a scene property to store the active edit item
 def evil_prop_init():
     Scene = bpy.types.Scene
@@ -35,6 +36,42 @@ def evil_prop_init():
         Scene.StringProperty(attr=EVIL_PROP_PROP)
         Scene.StringProperty(attr=EVIL_PROP_PROP_ORIG)
 
+def rna_idprop_ui_get(item, create=True):
+    try:
+        return item['_RNA_UI']
+    except:
+        if create:
+            item['_RNA_UI'] = {}
+            return item['_RNA_UI']
+        else:
+            return None
+
+
+def rna_idprop_ui_prop_get(item, prop, create=True):
+    
+    rna_ui = rna_idprop_ui_get(item, create)
+    
+    if rna_ui == None:
+        return None
+    
+    try:
+        return rna_ui[prop]
+    except:
+        rna_ui[prop] = {}
+        return rna_ui[prop]
+
+
+def rna_idprop_ui_prop_clear(item, prop):
+    rna_ui = rna_idprop_ui_get(item, False)
+    
+    if rna_ui == None:
+        return
+
+    try:
+        del rna_ui[prop]
+    except:
+        pass
+
 
 def draw(layout, context, context_member, use_edit = True):
     
@@ -70,7 +107,7 @@ def draw(layout, context, context_member, use_edit = True):
         del row
 
     for key, val in items:
-        
+        print("KEY - " + key)
         if key == '_RNA_UI':
             continue
         
@@ -86,6 +123,7 @@ def draw(layout, context, context_member, use_edit = True):
 
         box = row.box()
         
+        '''
         if use_edit and key == global_prop_orig and context_member == global_path:
             split = box.split(percentage=0.75)
             
@@ -94,10 +132,12 @@ def draw(layout, context, context_member, use_edit = True):
             row.itemR(scene, EVIL_PROP_VALUE)
             
             row = split.column()
-            prop = row.itemO("wm.properties_edit_end", properties=True, text="done")
+            prop = row.itemO("wm.properties_edit", properties=True, text="done")
             assign_props(prop, val_draw, key)
             
         else:
+        '''
+        if 1:
             if use_edit:
                 split = box.split(percentage=0.75)
                 row = split.row()
@@ -114,7 +154,7 @@ def draw(layout, context, context_member, use_edit = True):
                 
             if use_edit:
                 row = split.row(align=True)
-                prop = row.itemO("wm.properties_edit_begin", properties=True, text="edit")
+                prop = row.itemO("wm.properties_edit", properties=True, text="edit")
                 assign_props(prop, val_draw, key)
                 
                 prop = row.itemO("wm.properties_remove", properties=True, text="", icon='ICON_ZOOMOUT')
@@ -125,7 +165,7 @@ from bpy.props import *
 
 
 rna_path = StringProperty(name="Property Edit",
-    description="Property path edit", maxlen=1024, default="")
+    description="Property path edit", maxlen=1024, default="", hidden=True)
 
 rna_value = StringProperty(name="Property Value",
     description="Property value edit", maxlen=1024, default="")
@@ -133,69 +173,104 @@ rna_value = StringProperty(name="Property Value",
 rna_property = StringProperty(name="Property Name",
     description="Property name edit", maxlen=1024, default="")
 
-class WM_OT_properties_edit_begin(bpy.types.Operator):
-    '''Internal use (edit a property path)'''
-    bl_idname = "wm.properties_edit_begin"
-    bl_label = "Edit Property"
-
-    path = rna_path
-    value = rna_value
-    property = rna_property
-
-    def execute(self, context):
-        scene = context.scene
-        
-        setattr(scene, EVIL_PROP_PATH, self.path)
-        setattr(scene, EVIL_PROP_VALUE, self.value)
-        setattr(scene, EVIL_PROP_PROP, self.property)
-        setattr(scene, EVIL_PROP_PROP_ORIG, self.property)
-        
-        return ('FINISHED',)
-
+rna_min = FloatProperty(name="Min", default=0.0)
+rna_min = FloatProperty(name="Max", default=1.0)
 
-class WM_OT_properties_edit_end(bpy.types.Operator):
+class WM_OT_properties_edit(bpy.types.Operator):
     '''Internal use (edit a property path)'''
-    bl_idname = "wm.properties_edit_end"
-    bl_label = "Edit Property"
+    bl_idname = "wm.properties_edit"
+    bl_label = "Edit Property!"
 
     path = rna_path
     value = rna_value
     property = rna_property
+    
+    min = FloatProperty(name="Min", default=0.0)
+    max = FloatProperty(name="Max", default=1.0)
+    description = StringProperty(name="Tip", default="")
+    
+    # the class instance is not persistant, need to store in the class
+    # not ideal but changes as the op runs.
+    _last_prop = ['']
 
     def execute(self, context):
-        
-        scene = context.scene
-        global_path = getattr(scene, EVIL_PROP_PATH)
-        global_value = getattr(scene, EVIL_PROP_VALUE)
-        global_prop = getattr(scene, EVIL_PROP_PROP)
-        
-        setattr(scene, EVIL_PROP_PATH, "")
-        setattr(scene, EVIL_PROP_VALUE, "")
-        setattr(scene, EVIL_PROP_PROP, "")
-        setattr(scene, EVIL_PROP_PROP_ORIG, "")
-        
+        global_path = self.properties.path
+        global_value = self.properties.value
+        global_prop = self.properties.property
+        global_prop_old = self._last_prop[0]
+
         try:
             value = eval(global_value)
         except:
             value = global_value
         
         if type(value) == str:
-            value = '"' + value + '"'
-        
+            value = '"' + value + '"'        
         
         # First remove
-        exec_str = "del context.%s['%s']" % (global_path, self.property)
+        item = eval("context.%s" % global_path)
+        
+        rna_idprop_ui_prop_clear(item, global_prop_old)
+        exec_str = "del item['%s']" % global_prop_old
         # print(exec_str)
         exec(exec_str)
         
         
         # Reassign
-        exec_str = "context.%s['%s'] = %s" % (global_path, global_prop, value)
+        exec_str = "item['%s'] = %s" % (global_prop, value)
         # print(exec_str)
         exec(exec_str)
         
+        prop_type = type(item[global_prop])
+        
+        prop_ui = rna_idprop_ui_prop_get(item, global_prop)
+
+        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)
+            
         return ('FINISHED',)
 
+    def invoke(self, context, event):
+        
+        self._last_prop[:] = [self.properties.property]
+        
+        item = eval("context.%s" % self.properties.path)
+        
+        # setup defaults
+        prop_ui = rna_idprop_ui_prop_get(item, self.properties.property, False) # dont create
+        if prop_ui:
+            self.properties.min = prop_ui.get("min", -1000000000)
+            self.properties.min = prop_ui.get("max",  1000000000)
+            self.properties.description = prop_ui.get("description",  "")
+            
+        if 0:
+            _message= "PyConsole, press Ctrl+D to unlock the BGE" 
+            import sys 
+            
+            # evaluate commands in current namespace 
+            frame= sys._getframe() 
+            namespace = frame.f_globals.copy() 
+            namespace.update(frame.f_locals) 
+             
+            import code 
+
+            # Autocomp in python, not as comprehensive as IPython
+            import rlcompleter
+            
+            try: # ick, some pythons dont have this
+                import readline
+                readline.parse_and_bind("tab: complete")  
+            except:
+                pass
+
+            code.interact(banner=_message, local=namespace)
+        
+        wm = context.manager
+        wm.invoke_props_popup(self, event)
+        return ('RUNNING_MODAL',)
+
 
 class WM_OT_properties_add(bpy.types.Operator):
     '''Internal use (edit a property path)'''
@@ -231,6 +306,7 @@ class WM_OT_properties_remove(bpy.types.Operator):
     property = rna_property
 
     def execute(self, context):
-        item = eval("context.%s" % self.path)
-        del item[self.property]
+        item = eval("context.%s" % self.properties.path)
+        del item[self.properties.property]
         return ('FINISHED',)        
+
index ddc4f0b977002a2f33aa714a860f2a697a6cfa74..2321c0bbeaba2152daf5820d24d5b494f1b75287 100644 (file)
@@ -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")
 
index 11202329a3da367eb919b1a7af7afe371ac6b466..23357bd15728fe9fa9cf0c95d021144c494e250a 100644 (file)
@@ -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)
index 04398dfa8cec2a9bd45b310e366fb260b4c9e1cc..bd052e909b63114ca8d9c18c043a1ff9c26020f9 100644 (file)
@@ -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
index 5e0894d990711c6e66f5a1c6a94a329c620c420c..1f660dbeb359d54800edf0b6939da52e20781652 100644 (file)
@@ -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)
index 60d7eeeabf98f186a2e88668c5f0e6625fa83497..dc46b66c96fde3a00d113051f21c3c35fbb60b14 100644 (file)
@@ -28,7 +28,7 @@ class ExportSomeData(bpy.types.Operator):
         #if not self.is_property_set("path"):
         #    raise Exception("filename not set")
 
-        write_some_data(self.path, context, self.use_setting)
+        write_some_data(self.properties.path, context, self.properties.use_setting)
 
         return ('FINISHED',)
 
index 2404b3b71c0d728c78c2a088e300e5e9f78d1c4b..8aa4df7b16a2d21292f8d691e48445dc8279556f 100644 (file)
@@ -180,7 +180,7 @@ class ConsoleLanguage(bpy.types.Operator):
         sc = context.space_data
 
         # defailt to python
-        sc.language = self.language
+        sc.language = self.properties.language
 
         bpy.ops.console.banner()
 
index d6982db4fd0fe85dc52b843c4781c9cc2f32902f..28eb8dc06c09eaec370d0d6b3a6f44815e2b4c02 100644 (file)
@@ -1309,10 +1309,10 @@ class WM_OT_keyconfig_export(bpy.types.Operator):
         return result
 
     def execute(self, context):
-        if not self.path:
+        if not self.properties.path:
             raise Exception("File path not set.")
 
-        f = open(self.path, "w")
+        f = open(self.properties.path, "w")
         if not f:
             raise Exception("Could not open file.")
 
@@ -1392,7 +1392,7 @@ class WM_OT_keymap_restore(bpy.types.Operator):
     def execute(self, context):
         wm = context.manager
 
-        if self.all:
+        if self.properties.all:
             for km in wm.default_keyconfig.keymaps:
                 km.restore_to_default()
         else:
index 817bd5fa43f7dd5b6ed3d45b008df8477a31c4b2..15663b615a061658a032ab587fe174f37a4b3443 100644 (file)
@@ -1671,15 +1671,15 @@ class OBJECT_OT_select_pattern(bpy.types.Operator):
 
         import fnmatch
 
-        if self.case_sensitive:
+        if self.properties.case_sensitive:
             pattern_match = fnmatch.fnmatchcase
         else:
             pattern_match = lambda a, b: fnmatch.fnmatchcase(a.upper(), b.upper())
 
         for ob in context.visible_objects:
-            if pattern_match(ob.name, self.pattern):
+            if pattern_match(ob.name, self.properties.pattern):
                 ob.selected = True
-            elif not self.extend:
+            elif not self.properties.extend:
                 ob.selected = False
 
         return ('FINISHED',)
index 5f3ddf02d7b16e3fa2f0053940a9311082072621..1aa56befe0e787df82cf47e0f0322363aa6edff5 100644 (file)
@@ -106,24 +106,6 @@ static int PYTHON_OT_generic(int mode, bContext *C, wmOperatorType *ot, wmOperat
        Py_DECREF(args);
        
        if (py_class_instance) { /* Initializing the class worked, now run its invoke function */
-               PyObject *class_dict= PyObject_GetAttrString(py_class_instance, "__dict__");
-               
-               /* Assign instance attributes from operator properties */
-               if(op) {
-                       const char *arg_name;
-
-                       RNA_STRUCT_BEGIN(op->ptr, prop) {
-                               arg_name= RNA_property_identifier(prop);
-
-                               if (strcmp(arg_name, "rna_type")==0) continue;
-
-                               item = pyrna_prop_to_py(op->ptr, prop);
-                               PyDict_SetItemString(class_dict, arg_name, item);
-                               Py_DECREF(item);
-                       }
-                       RNA_STRUCT_END;
-               }
-
                RNA_pointer_create(NULL, &RNA_Context, C, &ptr_context);
 
                if (mode==PYOP_INVOKE) {
@@ -154,7 +136,6 @@ static int PYTHON_OT_generic(int mode, bContext *C, wmOperatorType *ot, wmOperat
 
                Py_DECREF(args);
                Py_DECREF(item);
-               Py_DECREF(class_dict);
        }
        else {
                PyErr_Print();