From 5a24fe5c17c60e065acab25987730c9f2c737bdf Mon Sep 17 00:00:00 2001 From: Clemens Barth <barth@root-1.de> Date: Fri, 21 Jan 2022 21:44:14 +0100 Subject: [PATCH] io_mesh_atomic, utility panel: code cleaning Removal of code, which belongs to the good old times of Blender <=2.79 and which does not make sense anymore in higher Blender versions. --- io_mesh_atomic/utility_gui.py | 23 ----------------------- io_mesh_atomic/utility_panel.py | 27 +++++---------------------- 2 files changed, 5 insertions(+), 45 deletions(-) diff --git a/io_mesh_atomic/utility_gui.py b/io_mesh_atomic/utility_gui.py index 0c319c638..ac84d4c7f 100644 --- a/io_mesh_atomic/utility_gui.py +++ b/io_mesh_atomic/utility_gui.py @@ -66,14 +66,6 @@ class PANEL_PT_prepare(Panel): col.operator("atom_blend.button_distance") col.prop(scn, "distance") - # This is from Blender 2.79 and does not work in 2.80. However, it - # might be useful later on if changed. - # - #box = layout.box() - #col = box.column(align=True) - #col.label(text="All changes concern:") - #col.prop(scn, "action_type") - box = layout.box() col = box.column(align=True) col.label(text="Change atom size") @@ -127,7 +119,6 @@ class PanelProperties(bpy.types.PropertyGroup): def Callback_radius_type(self, context): scn = bpy.context.scene.atom_blend choose_objects("ATOM_RADIUS_TYPE", - scn.action_type, None, None, scn.radius_type, @@ -136,7 +127,6 @@ class PanelProperties(bpy.types.PropertyGroup): def Callback_radius_pm(self, context): scn = bpy.context.scene.atom_blend choose_objects("ATOM_RADIUS_PM", - scn.action_type, None, [scn.radius_pm_name, scn.radius_pm], @@ -194,13 +184,6 @@ class PanelProperties(bpy.types.PropertyGroup): ('2',"F+ center", "Replace with a F+ center"), ('3',"F0 center", "Replace with a F0 center")), default='0',) - action_type: EnumProperty( - name="", - description="Which objects shall be modified?", - items=(('ALL_ACTIVE',"all active objects", "in the current layer"), - ('ALL_IN_LAYER',"all in all selected layers", - "in selected layer(s)")), - default='ALL_ACTIVE',) radius_type: EnumProperty( name="Type", description="Which type of atom radii?", @@ -275,7 +258,6 @@ class DefaultAtom(Operator): def execute(self, context): scn = bpy.context.scene.atom_blend choose_objects("ATOM_DEFAULT_OBJ", - scn.action_type, None, None, None, @@ -301,7 +283,6 @@ class ReplaceAtom(Operator): def execute(self, context): scn = bpy.context.scene.atom_blend choose_objects("ATOM_REPLACE_OBJ", - scn.action_type, None, None, None, @@ -357,7 +338,6 @@ class RadiusAllBiggerButton(Operator): def execute(self, context): scn = bpy.context.scene.atom_blend choose_objects("ATOM_RADIUS_ALL", - scn.action_type, scn.radius_all, None, None, @@ -375,7 +355,6 @@ class RadiusAllSmallerButton(Operator): def execute(self, context): scn = bpy.context.scene.atom_blend choose_objects("ATOM_RADIUS_ALL", - scn.action_type, 1.0/scn.radius_all, None, None, @@ -393,7 +372,6 @@ class SticksAllBiggerButton(Operator): def execute(self, context): scn = bpy.context.scene.atom_blend choose_objects("STICKS_RADIUS_ALL", - scn.action_type, None, None, None, @@ -411,7 +389,6 @@ class SticksAllSmallerButton(Operator): def execute(self, context): scn = bpy.context.scene.atom_blend choose_objects("STICKS_RADIUS_ALL", - scn.action_type, None, None, None, diff --git a/io_mesh_atomic/utility_panel.py b/io_mesh_atomic/utility_panel.py index 079747770..5dc23d625 100644 --- a/io_mesh_atomic/utility_panel.py +++ b/io_mesh_atomic/utility_panel.py @@ -318,33 +318,16 @@ def distance(): def choose_objects(action_type, - who, radius_all, radius_pm, radius_type, radius_type_ionic, sticks_all): - # For selected objects of all selected layers - if who == "ALL_IN_LAYER": - # Determine all selected layers. - layers = [] - for i, layer in enumerate(bpy.context.scene.layers): - if layer == True: - layers.append(i) - - # Put all objects, which are in the layers, into a list. - change_objects_all = [] - for atom in bpy.context.scene.objects: - for layer in layers: - if atom.layers[layer] == True: - change_objects_all.append(atom) - # For selected objects of the visible layer - elif who == "ALL_ACTIVE": - change_objects_all = [] - # Note all selected objects first. - for atom in bpy.context.selected_objects: - change_objects_all.append(atom) + # Note all selected objects first. + change_objects_all = [] + for atom in bpy.context.selected_objects: + change_objects_all.append(atom) # This is very important now: If there are dupliverts structures, note # only the parents and NOT the children! Otherwise the double work is @@ -467,7 +450,7 @@ def modify_objects(action_type, bpy.context.view_layer.objects.active = None - # Change the atom objects + # Change the atom objects if action_type == "ATOM_REPLACE_OBJ" and "STICK" not in atom.name.upper(): scn = bpy.context.scene.atom_blend -- GitLab