[Bf-extensions-cvs] [9b25fc6b] master: Fix: obj should be visible when changing to EDIT mode
Clemens Barth
noreply at git.blender.org
Mon Mar 18 19:37:20 CET 2019
Commit: 9b25fc6bd6b69c4c331dfc701f47fa472053d44a
Author: Clemens Barth
Date: Mon Mar 18 19:35:24 2019 +0100
Branches: master
https://developer.blender.org/rBAC9b25fc6bd6b69c4c331dfc701f47fa472053d44a
Fix: obj should be visible when changing to EDIT mode
The size of the sticks could not be changed because the representative 2 objects
(cylinder and cup) were not visible => 'EDIT' view mode does not work in this case.
===================================================================
M io_atomblend_utilities/io_atomblend_utilities.py
===================================================================
diff --git a/io_atomblend_utilities/io_atomblend_utilities.py b/io_atomblend_utilities/io_atomblend_utilities.py
index 3558e936..f3939bbc 100644
--- a/io_atomblend_utilities/io_atomblend_utilities.py
+++ b/io_atomblend_utilities/io_atomblend_utilities.py
@@ -315,11 +315,14 @@ def modify_objects(action_type,
atom.scale = (element.radii[int(radius_type)],) * 3
# Modify atom sticks
- if (action_type == "STICKS_RADIUS_ALL" and
- ('STICKS_CUPS' in atom.name.upper() or
- 'STICKS_CYLINDER' in atom.name.upper() or
- 'STICK_CYLINDER' in atom.name.upper())):
-
+ if (action_type == "STICKS_RADIUS_ALL" and 'STICK' in atom.name.upper() and
+ ('CUP' in atom.name.upper() or
+ 'CYLINDER' in atom.name.upper())):
+
+ # Make the cylinder or cup visible first, otherwise one cannot
+ # go into EDIT mode. Note that 'atom' here is in fact a 'stick'
+ # (cylinder or cup).
+ atom.hide_set(False)
bpy.context.view_layer.objects.active = atom
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
bm = bmesh.from_edit_mesh(atom.data)
@@ -340,6 +343,8 @@ def modify_objects(action_type,
v.co[1] = ((v.co[1] - center[1]) / radius) * radius_new + center[1]
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
+ # Hide again the representative stick (cylinder or cup).
+ atom.hide_set(True)
bpy.context.view_layer.objects.active = None
# Replace atom objects
More information about the Bf-extensions-cvs
mailing list