[Bf-extensions-cvs] [3b018882] master: Fix of an unreported bug: when changing the radius of sticks that are in the form of cylinders, they were marked as invisible after the change. This should only be done for the representative cylinder and cup object of those sticks, which are in a dupliverts structure.

Clemens Barth noreply at git.blender.org
Sat Dec 28 11:29:55 CET 2019


Commit: 3b01888260e138caa613398403fa72b04bb3dcf0
Author: Clemens Barth
Date:   Sat Dec 28 11:26:35 2019 +0100
Branches: master
https://developer.blender.org/rBA3b01888260e138caa613398403fa72b04bb3dcf0

Fix of an unreported bug: when changing the radius of sticks that are in the form of cylinders, they were marked as
invisible after the change. This should only be done for the representative cylinder and cup object of those sticks,
which are in a dupliverts structure.

===================================================================

M	io_mesh_atomic/utility_panel.py

===================================================================

diff --git a/io_mesh_atomic/utility_panel.py b/io_mesh_atomic/utility_panel.py
index a5cdac3c..f41b8408 100644
--- a/io_mesh_atomic/utility_panel.py
+++ b/io_mesh_atomic/utility_panel.py
@@ -319,10 +319,15 @@ def modify_objects(action_type,
                                     ('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)
+        # For dupliverts structures only: 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).
+        # First, identify if it is a normal cylinder object or a dupliverts
+        # structure. The identifier for a dupliverts structure is the parent's
+        # name, which includes "_sticks_mesh"
+        if "_sticks_mesh" in atom.parent.name:
+            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)
@@ -343,8 +348,11 @@ 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)
+        # Hide again the representative stick (cylinder or cup) if it is a
+        # dupliverts structure.
+        if "_sticks_mesh" in atom.parent.name:
+            atom.hide_set(True)
+
         bpy.context.view_layer.objects.active = None
 
     # Replace atom objects



More information about the Bf-extensions-cvs mailing list