1 # SPDX-License-Identifier: GPL-2.0-or-later
4 # Author : Clemens Barth (Blendphys@root-1.de)
5 # Homepage(Wiki) : http://development.root-1.de/Atomic_Blender.php
7 # Start of project : 2011-08-31 by CB
8 # First publication in Blender : 2011-11-11 by CB
9 # Fusion of the PDB, XYZ and Panel : 2019-03-22 by CB
10 # Last modified : 2019-05-17
12 # Contributing authors
13 # ====================
15 # So far ... none ... .
21 # A big thank you to all those people who I met in particular in the IRC and
22 # who helped me a lot.
26 # Campbell Barton (ideasman)
27 # Brendon Murphy (meta_androcto)
28 # Truman Melton (?) (truman)
31 # Dima Glib (dairin0d)
32 # Peter K.H. Gragert (PKHG)
33 # Valter Battioli (?) (valter)
35 # Ray Molenkamp (bzztploink)
39 # Frank Palmino (Femto-St institute, Belfort-Montbéliard, France)
40 # ... for testing the addons and for feedback
43 "name": "Atomic Blender PDB/XYZ",
44 "description": "Importing atoms listed in PDB or XYZ files as balls into Blender",
45 "author": "Clemens Barth",
47 "blender": (2, 80, 0),
48 "location": "File -> Import -> PDB (.pdb) and File -> Import -> XYZ (.xyz)",
50 "doc_url": "{BLENDER_MANUAL_URL}/addons/import_export/mesh_atomic.html",
51 "category": "Import-Export",
55 from bpy
.types
import Operator
, AddonPreferences
56 from bpy_extras
.io_utils
import ImportHelper
, ExportHelper
57 from bpy
.props
import (
72 # -----------------------------------------------------------------------------
75 class AddonPreferences(AddonPreferences
):
76 # This must match the addon name, use '__package__'
77 # when defining this in a submodule of a python package.
80 bool_pdb
: BoolProperty(
81 name
="PDB import/export",
83 description
="Import/export PDB",
85 bool_xyz
: BoolProperty(
86 name
="XYZ import/export",
88 description
="Import/export XYZ",
90 # This boolean is checked in the poll function in PANEL_PT_prepare
92 bool_utility
: BoolProperty(
95 description
=("Panel with functionalities for modifying " \
99 def draw(self
, context
):
101 layout
.label(text
="Choose the importer(s) and a 'utility' panel")
102 layout
.prop(self
, "bool_pdb")
103 layout
.prop(self
, "bool_xyz")
104 layout
.prop(self
, "bool_utility")
107 # -----------------------------------------------------------------------------
111 # The entry into the menu 'file -> import'
112 def menu_func_import_pdb(self
, context
):
114 lay
.operator(pdb_gui
.IMPORT_OT_pdb
.bl_idname
,text
="Protein Data Bank (.pdb)")
116 def menu_func_import_xyz(self
, context
):
118 lay
.operator(xyz_gui
.IMPORT_OT_xyz
.bl_idname
,text
="XYZ (.xyz)")
120 # The entry into the menu 'file -> export'
121 def menu_func_export_pdb(self
, context
):
123 lay
.operator(pdb_gui
.EXPORT_OT_pdb
.bl_idname
,text
="Protein Data Bank (.pdb)")
125 def menu_func_export_xyz(self
, context
):
127 lay
.operator(xyz_gui
.EXPORT_OT_xyz
.bl_idname
,text
="XYZ (.xyz)")
130 # -----------------------------------------------------------------------------
134 from bpy
.utils
import register_class
136 register_class(AddonPreferences
)
138 register_class(pdb_gui
.IMPORT_OT_pdb
)
139 register_class(pdb_gui
.EXPORT_OT_pdb
)
140 bpy
.types
.TOPBAR_MT_file_import
.append(menu_func_import_pdb
)
141 bpy
.types
.TOPBAR_MT_file_export
.append(menu_func_export_pdb
)
143 register_class(xyz_gui
.IMPORT_OT_xyz
)
144 register_class(xyz_gui
.EXPORT_OT_xyz
)
145 bpy
.types
.TOPBAR_MT_file_import
.append(menu_func_import_xyz
)
146 bpy
.types
.TOPBAR_MT_file_export
.append(menu_func_export_xyz
)
148 classes
= (utility_gui
.PANEL_PT_prepare
,
149 utility_gui
.PanelProperties
,
150 utility_gui
.DatafileApply
,
151 utility_gui
.DefaultAtom
,
152 utility_gui
.ReplaceAtom
,
153 utility_gui
.SeparateAtom
,
154 utility_gui
.DistanceButton
,
155 utility_gui
.RadiusAllBiggerButton
,
156 utility_gui
.RadiusAllSmallerButton
,
157 utility_gui
.SticksAllBiggerButton
,
158 utility_gui
.SticksAllSmallerButton
)
159 from bpy
.utils
import register_class
160 utility_panel
.read_elements()
164 scene
= bpy
.types
.Scene
165 scene
.atom_blend
= bpy
.props
.PointerProperty(type=utility_gui
.PanelProperties
)
169 from bpy
.utils
import unregister_class
171 unregister_class(AddonPreferences
)
173 unregister_class(pdb_gui
.IMPORT_OT_pdb
)
174 unregister_class(pdb_gui
.EXPORT_OT_pdb
)
175 bpy
.types
.TOPBAR_MT_file_import
.remove(menu_func_import_pdb
)
176 bpy
.types
.TOPBAR_MT_file_export
.remove(menu_func_export_pdb
)
178 unregister_class(xyz_gui
.IMPORT_OT_xyz
)
179 unregister_class(xyz_gui
.EXPORT_OT_xyz
)
180 bpy
.types
.TOPBAR_MT_file_import
.remove(menu_func_import_xyz
)
181 bpy
.types
.TOPBAR_MT_file_export
.remove(menu_func_export_xyz
)
183 classes
= (utility_gui
.PANEL_PT_prepare
,
184 utility_gui
.PanelProperties
,
185 utility_gui
.DatafileApply
,
186 utility_gui
.DefaultAtom
,
187 utility_gui
.ReplaceAtom
,
188 utility_gui
.SeparateAtom
,
189 utility_gui
.DistanceButton
,
190 utility_gui
.RadiusAllBiggerButton
,
191 utility_gui
.RadiusAllSmallerButton
,
192 utility_gui
.SticksAllBiggerButton
,
193 utility_gui
.SticksAllSmallerButton
)
195 unregister_class(cls
)
198 # -----------------------------------------------------------------------------
201 if __name__
== "__main__":