Revision: 24685
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24685
Author:   campbellbarton
Date:     2009-11-19 18:12:08 +0100 (Thu, 19 Nov 2009)

Log Message:
-----------
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

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

Modified: trunk/blender/release/scripts/io/export_3ds.py
===================================================================
--- trunk/blender/release/scripts/io/export_3ds.py      2009-11-19 17:04:28 UTC 
(rev 24684)
+++ trunk/blender/release/scripts/io/export_3ds.py      2009-11-19 17:12:08 UTC 
(rev 24685)
@@ -1123,7 +1123,7 @@
 
        
        def execute(self, context):
-               save_3ds(self.path, context)
+               save_3ds(self.properties.path, context)
                return ('FINISHED',)
        
        def invoke(self, context, event):

Modified: trunk/blender/release/scripts/io/export_fbx.py
===================================================================
--- trunk/blender/release/scripts/io/export_fbx.py      2009-11-19 17:04:28 UTC 
(rev 24684)
+++ trunk/blender/release/scripts/io/export_fbx.py      2009-11-19 17:12:08 UTC 
(rev 24685)
@@ -3393,36 +3393,36 @@
                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',)
        

Modified: trunk/blender/release/scripts/io/export_mdd.py
===================================================================
--- trunk/blender/release/scripts/io/export_mdd.py      2009-11-19 17:04:28 UTC 
(rev 24684)
+++ trunk/blender/release/scripts/io/export_mdd.py      2009-11-19 17:12:08 UTC 
(rev 24685)
@@ -173,10 +173,10 @@
         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):

Modified: trunk/blender/release/scripts/io/export_obj.py
===================================================================
--- trunk/blender/release/scripts/io/export_obj.py      2009-11-19 17:04:28 UTC 
(rev 24684)
+++ trunk/blender/release/scripts/io/export_obj.py      2009-11-19 17:12:08 UTC 
(rev 24685)
@@ -972,24 +972,24 @@
        
        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',)
        

Modified: trunk/blender/release/scripts/io/export_ply.py
===================================================================
--- trunk/blender/release/scripts/io/export_ply.py      2009-11-19 17:04:28 UTC 
(rev 24684)
+++ trunk/blender/release/scripts/io/export_ply.py      2009-11-19 17:12:08 UTC 
(rev 24685)
@@ -274,14 +274,14 @@
        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',)

Modified: trunk/blender/release/scripts/io/export_x3d.py
===================================================================
--- trunk/blender/release/scripts/io/export_x3d.py      2009-11-19 17:04:28 UTC 
(rev 24684)
+++ trunk/blender/release/scripts/io/export_x3d.py      2009-11-19 17:12:08 UTC 
(rev 24685)
@@ -1230,7 +1230,7 @@
        
        
        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):

Modified: trunk/blender/release/scripts/io/import_anim_bvh.py
===================================================================
--- trunk/blender/release/scripts/io/import_anim_bvh.py 2009-11-19 17:04:28 UTC 
(rev 24684)
+++ trunk/blender/release/scripts/io/import_anim_bvh.py 2009-11-19 17:12:08 UTC 
(rev 24685)
@@ -863,7 +863,7 @@
        def execute(self, context):
                # print("Selected: " + context.active_object.name)
 
-               read_bvh(context, self.path)
+               read_bvh(context, self.properties.path)
 
                return ('FINISHED',)
        

Modified: trunk/blender/release/scripts/io/import_scene_3ds.py
===================================================================
--- trunk/blender/release/scripts/io/import_scene_3ds.py        2009-11-19 
17:04:28 UTC (rev 24684)
+++ trunk/blender/release/scripts/io/import_scene_3ds.py        2009-11-19 
17:12:08 UTC (rev 24685)
@@ -1156,7 +1156,7 @@
 #      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):

Modified: trunk/blender/release/scripts/io/import_scene_obj.py
===================================================================
--- trunk/blender/release/scripts/io/import_scene_obj.py        2009-11-19 
17:04:28 UTC (rev 24684)
+++ trunk/blender/release/scripts/io/import_scene_obj.py        2009-11-19 
17:12:08 UTC (rev 24685)
@@ -1601,18 +1601,18 @@
        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',)
        

Modified: trunk/blender/release/scripts/modules/rna_prop_ui.py
===================================================================
--- trunk/blender/release/scripts/modules/rna_prop_ui.py        2009-11-19 
17:04:28 UTC (rev 24684)
+++ trunk/blender/release/scripts/modules/rna_prop_ui.py        2009-11-19 
17:12:08 UTC (rev 24685)
@@ -26,6 +26,7 @@
 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,7 +36,43 @@
         Scene.StringProperty(attr=EVIL_PROP_PROP)

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to