[Durian-svn] [1199] fix for adding random block in editmode
soenke
durian-svn at blender.org
Wed Mar 3 00:35:29 CET 2010
Revision: 1199
https://blenderinstitute.dyndns.org/durian-svn/?do=log&project=durian&path=/&rev=1199
Author: soenke
Date: 2010-03-03 00:35:29 +0100 (Wed, 03 Mar 2010)
Log Message:
-----------
fix for adding random block in editmode
Modified Paths:
--------------
pro/scripts/ui/add_mesh_random_block.py
Modified: pro/scripts/ui/add_mesh_random_block.py
===================================================================
--- pro/scripts/ui/add_mesh_random_block.py 2010-03-02 21:33:18 UTC (rev 1198)
+++ pro/scripts/ui/add_mesh_random_block.py 2010-03-02 23:35:29 UTC (rev 1199)
@@ -213,10 +213,24 @@
ob_new = bpy.data.objects.new("epic.mesh", 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
+
+ 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')
@@ -232,4 +246,5 @@
bpy.types.unregister(AddRandomBlock)
bpy.types.INFO_MT_mesh_add.remove(menu_func)
-
+if __name__ == "__main__":
+ register()
\ No newline at end of file
More information about the Durian-svn
mailing list