change edit context appropriately
This commit is contained in:
parent
f3036dcc29
commit
54e1965998
12
__init__.py
12
__init__.py
@ -214,6 +214,18 @@ class ARMATURE_OT_build_envelope_mesh(bpy.types.Operator):
|
|||||||
result_obj = bpy.data.objects.new(arm_obj.name + "_envelope", mesh)
|
result_obj = bpy.data.objects.new(arm_obj.name + "_envelope", mesh)
|
||||||
context.collection.objects.link(result_obj)
|
context.collection.objects.link(result_obj)
|
||||||
|
|
||||||
|
# Make the new mesh active/selected while we are in OBJECT mode.
|
||||||
|
bpy.ops.object.select_all(action='DESELECT')
|
||||||
|
result_obj.select_set(True)
|
||||||
|
context.view_layer.objects.active = result_obj
|
||||||
|
|
||||||
|
# If we started in EDIT mode, restore it on the armature now.
|
||||||
|
if original_mode == 'EDIT':
|
||||||
|
result_obj.select_set(False)
|
||||||
|
arm_obj.select_set(True)
|
||||||
|
context.view_layer.objects.active = arm_obj
|
||||||
|
bpy.ops.object.mode_set(mode='EDIT')
|
||||||
|
|
||||||
source_label = {
|
source_label = {
|
||||||
'OBJECT': "rest pose",
|
'OBJECT': "rest pose",
|
||||||
'POSE': "current pose",
|
'POSE': "current pose",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user