Skip to content
Snippets Groups Projects
Commit 5a24fe5c authored by Clemens Barth's avatar Clemens Barth
Browse files

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.
parent 4009ff18
No related branches found
No related tags found
No related merge requests found
...@@ -66,14 +66,6 @@ class PANEL_PT_prepare(Panel): ...@@ -66,14 +66,6 @@ class PANEL_PT_prepare(Panel):
col.operator("atom_blend.button_distance") col.operator("atom_blend.button_distance")
col.prop(scn, "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() box = layout.box()
col = box.column(align=True) col = box.column(align=True)
col.label(text="Change atom size") col.label(text="Change atom size")
...@@ -127,7 +119,6 @@ class PanelProperties(bpy.types.PropertyGroup): ...@@ -127,7 +119,6 @@ class PanelProperties(bpy.types.PropertyGroup):
def Callback_radius_type(self, context): def Callback_radius_type(self, context):
scn = bpy.context.scene.atom_blend scn = bpy.context.scene.atom_blend
choose_objects("ATOM_RADIUS_TYPE", choose_objects("ATOM_RADIUS_TYPE",
scn.action_type,
None, None,
None, None,
scn.radius_type, scn.radius_type,
...@@ -136,7 +127,6 @@ class PanelProperties(bpy.types.PropertyGroup): ...@@ -136,7 +127,6 @@ class PanelProperties(bpy.types.PropertyGroup):
def Callback_radius_pm(self, context): def Callback_radius_pm(self, context):
scn = bpy.context.scene.atom_blend scn = bpy.context.scene.atom_blend
choose_objects("ATOM_RADIUS_PM", choose_objects("ATOM_RADIUS_PM",
scn.action_type,
None, None,
[scn.radius_pm_name, [scn.radius_pm_name,
scn.radius_pm], scn.radius_pm],
...@@ -194,13 +184,6 @@ class PanelProperties(bpy.types.PropertyGroup): ...@@ -194,13 +184,6 @@ class PanelProperties(bpy.types.PropertyGroup):
('2',"F+ center", "Replace with a F+ center"), ('2',"F+ center", "Replace with a F+ center"),
('3',"F0 center", "Replace with a F0 center")), ('3',"F0 center", "Replace with a F0 center")),
default='0',) 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( radius_type: EnumProperty(
name="Type", name="Type",
description="Which type of atom radii?", description="Which type of atom radii?",
...@@ -275,7 +258,6 @@ class DefaultAtom(Operator): ...@@ -275,7 +258,6 @@ class DefaultAtom(Operator):
def execute(self, context): def execute(self, context):
scn = bpy.context.scene.atom_blend scn = bpy.context.scene.atom_blend
choose_objects("ATOM_DEFAULT_OBJ", choose_objects("ATOM_DEFAULT_OBJ",
scn.action_type,
None, None,
None, None,
None, None,
...@@ -301,7 +283,6 @@ class ReplaceAtom(Operator): ...@@ -301,7 +283,6 @@ class ReplaceAtom(Operator):
def execute(self, context): def execute(self, context):
scn = bpy.context.scene.atom_blend scn = bpy.context.scene.atom_blend
choose_objects("ATOM_REPLACE_OBJ", choose_objects("ATOM_REPLACE_OBJ",
scn.action_type,
None, None,
None, None,
None, None,
...@@ -357,7 +338,6 @@ class RadiusAllBiggerButton(Operator): ...@@ -357,7 +338,6 @@ class RadiusAllBiggerButton(Operator):
def execute(self, context): def execute(self, context):
scn = bpy.context.scene.atom_blend scn = bpy.context.scene.atom_blend
choose_objects("ATOM_RADIUS_ALL", choose_objects("ATOM_RADIUS_ALL",
scn.action_type,
scn.radius_all, scn.radius_all,
None, None,
None, None,
...@@ -375,7 +355,6 @@ class RadiusAllSmallerButton(Operator): ...@@ -375,7 +355,6 @@ class RadiusAllSmallerButton(Operator):
def execute(self, context): def execute(self, context):
scn = bpy.context.scene.atom_blend scn = bpy.context.scene.atom_blend
choose_objects("ATOM_RADIUS_ALL", choose_objects("ATOM_RADIUS_ALL",
scn.action_type,
1.0/scn.radius_all, 1.0/scn.radius_all,
None, None,
None, None,
...@@ -393,7 +372,6 @@ class SticksAllBiggerButton(Operator): ...@@ -393,7 +372,6 @@ class SticksAllBiggerButton(Operator):
def execute(self, context): def execute(self, context):
scn = bpy.context.scene.atom_blend scn = bpy.context.scene.atom_blend
choose_objects("STICKS_RADIUS_ALL", choose_objects("STICKS_RADIUS_ALL",
scn.action_type,
None, None,
None, None,
None, None,
...@@ -411,7 +389,6 @@ class SticksAllSmallerButton(Operator): ...@@ -411,7 +389,6 @@ class SticksAllSmallerButton(Operator):
def execute(self, context): def execute(self, context):
scn = bpy.context.scene.atom_blend scn = bpy.context.scene.atom_blend
choose_objects("STICKS_RADIUS_ALL", choose_objects("STICKS_RADIUS_ALL",
scn.action_type,
None, None,
None, None,
None, None,
......
...@@ -318,33 +318,16 @@ def distance(): ...@@ -318,33 +318,16 @@ def distance():
def choose_objects(action_type, def choose_objects(action_type,
who,
radius_all, radius_all,
radius_pm, radius_pm,
radius_type, radius_type,
radius_type_ionic, radius_type_ionic,
sticks_all): sticks_all):
# For selected objects of all selected layers # Note all selected objects first.
if who == "ALL_IN_LAYER": change_objects_all = []
# Determine all selected layers. for atom in bpy.context.selected_objects:
layers = [] change_objects_all.append(atom)
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)
# This is very important now: If there are dupliverts structures, note # This is very important now: If there are dupliverts structures, note
# only the parents and NOT the children! Otherwise the double work is # only the parents and NOT the children! Otherwise the double work is
...@@ -467,7 +450,7 @@ def modify_objects(action_type, ...@@ -467,7 +450,7 @@ def modify_objects(action_type,
bpy.context.view_layer.objects.active = None 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(): if action_type == "ATOM_REPLACE_OBJ" and "STICK" not in atom.name.upper():
scn = bpy.context.scene.atom_blend scn = bpy.context.scene.atom_blend
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment