[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26398] trunk/blender/release/scripts/op/ add_mesh_torus.py: bugfix [#19681] adjusting the settings of the 'add torus ' tool in edit mode

Campbell Barton ideasman42 at gmail.com
Fri Jan 29 16:19:21 CET 2010


Revision: 26398
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26398
Author:   campbellbarton
Date:     2010-01-29 16:19:19 +0100 (Fri, 29 Jan 2010)

Log Message:
-----------
bugfix [#19681] adjusting the settings of the 'add torus' tool in edit mode

Modified Paths:
--------------
    trunk/blender/release/scripts/op/add_mesh_torus.py

Modified: trunk/blender/release/scripts/op/add_mesh_torus.py
===================================================================
--- trunk/blender/release/scripts/op/add_mesh_torus.py	2010-01-29 14:49:21 UTC (rev 26397)
+++ trunk/blender/release/scripts/op/add_mesh_torus.py	2010-01-29 15:19:19 UTC (rev 26398)
@@ -130,13 +130,30 @@
         ob_new = bpy.data.objects.new("Torus", 'MESH')
         ob_new.data = mesh
         scene.objects.link(ob_new)
-        scene.objects.active = ob_new
         ob_new.selected = True
 
-        ob_new.location = tuple(context.scene.cursor_location)
+        ob_new.location = scene.cursor_location
+        
+        obj_act = scene.objects.active
+        
+        if obj_act and obj_act.mode == 'EDIT':
+            bpy.ops.object.mode_set(mode='OBJECT')
+            
+            obj_act.selected = True
+            scene.update() # apply location
+            #scene.objects.active = ob_new
 
+            bpy.ops.object.join() # join into the active.
+
+            bpy.ops.object.mode_set(mode='EDIT')
+        else:
+            scene.objects.active = ob_new
+            if context.user_preferences.edit.enter_edit_mode:
+                bpy.ops.object.mode_set(mode='EDIT')
+
         return {'FINISHED'}
 
+
 # Register the operator
 bpy.types.register(AddTorus)
 





More information about the Bf-blender-cvs mailing list