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>2011-02-22 05:47:59 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-02-22 05:47:59 +0300
commit4b859e91cb83be43a92cf4df8ac7690778853142 (patch)
tree60a511d84a66a8953d74034dde881752f83096df /release
parent36618a099673a4d6b8552a67d469a223153f55a1 (diff)
bugfix/workaround [#25629] Add torus with autmatic edit mode duplicates mesh after >Aling to View.
adding meshes in C does: Add Empty Mesh -> Enter Editmode -> Create Mesh while python does: Add Generated Mesh -> Enter Editmode problem with this is there is no empty undo state for undo-redo to use so it always gave a duplicate mesh on redo-ing. workaround by adding an empty mesh, do an undo push, and join the generated mesh into the empty one. this would be fixed if undo stack spanned modes.
Diffstat (limited to 'release')
-rw-r--r--release/scripts/modules/add_object_utils.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/release/scripts/modules/add_object_utils.py b/release/scripts/modules/add_object_utils.py
index 10707734bc4..128b98b9aea 100644
--- a/release/scripts/modules/add_object_utils.py
+++ b/release/scripts/modules/add_object_utils.py
@@ -82,6 +82,19 @@ def object_data_add(context, obdata, operator=None):
obj_new.matrix_world = add_object_align_init(context, operator)
obj_act = scene.objects.active
+
+ # XXX
+ # caused because entering editmodedoes not add a empty undo slot!
+ if context.user_preferences.edit.use_enter_edit_mode:
+ if not (obj_act and obj_act.mode == 'EDIT' and obj_act.type == obj_new.type):
+ _obdata = bpy.data.meshes.new(obdata.name)
+ obj_act = bpy.data.objects.new(_obdata.name, _obdata)
+ obj_act.matrix_world = obj_new.matrix_world
+ scene.objects.link(obj_act)
+ scene.objects.active = obj_act
+ bpy.ops.object.mode_set(mode='EDIT')
+ bpy.ops.ed.undo_push(message="Enter Editmode") # need empty undo step
+ # XXX
if obj_act and obj_act.mode == 'EDIT' and obj_act.type == obj_new.type:
bpy.ops.mesh.select_all(action='DESELECT')
@@ -92,6 +105,7 @@ def object_data_add(context, obdata, operator=None):
#scene.objects.active = obj_new
bpy.ops.object.join() # join into the active.
+ bpy.data.meshes.remove(obdata)
bpy.ops.object.mode_set(mode='EDIT')
else: