1 # SPDX-FileCopyrightText: 2019-2023 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
5 # Author : Clemens Barth (Blendphys@root-1.de)
6 # Homepage(Wiki) : https://docs.blender.org/manual/en/dev/addons/import_export/mesh_atomic.html
8 # Start of project : 2011-08-31 by CB
9 # First publication in Blender : 2011-11-11 by CB
10 # Fusion of the PDB, XYZ and Panel : 2019-03-22 by CB
11 # Last modified : 2023-05-19
13 # Contributing authors
14 # ====================
16 # So far ... none ... .
22 # A big thank you to all those people who I met in particular in the IRC and
23 # who helped me a lot.
27 # Campbell Barton (ideasman)
28 # Brendon Murphy (meta_androcto)
29 # Truman Melton (?) (truman)
32 # Dima Glib (dairin0d)
33 # Peter K.H. Gragert (PKHG)
34 # Valter Battioli (?) (valter)
36 # Ray Molenkamp (bzztploink)
40 # Frank Palmino (Femto-St institute, Belfort-Montbéliard, France)
41 # ... for testing the addons and for feedback
44 "name": "Atomic Blender PDB/XYZ",
45 "description": "Importing atoms listed in PDB or XYZ files as balls into Blender",
46 "author": "Clemens Barth",
48 "blender": (2, 80, 0),
49 "location": "File -> Import -> PDB (.pdb) and File -> Import -> XYZ (.xyz)",
51 "doc_url": "{BLENDER_MANUAL_URL}/addons/import_export/mesh_atomic.html",
52 "category": "Import-Export",
56 from bpy
.types
import Operator
, AddonPreferences
57 from bpy_extras
.io_utils
import ImportHelper
, ExportHelper
58 from bpy
.props
import (
73 # -----------------------------------------------------------------------------
76 class AddonPreferences(AddonPreferences
):
77 # This must match the addon name, use '__package__'
78 # when defining this in a submodule of a python package.
81 bool_pdb
: BoolProperty(
82 name
="PDB import/export",
84 description
="Import/export PDB",
86 bool_xyz
: BoolProperty(
87 name
="XYZ import/export",
89 description
="Import/export XYZ",
91 # This boolean is checked in the poll function in PANEL_PT_prepare
93 bool_utility
: BoolProperty(
96 description
=("Panel with functionalities for modifying " \
100 def draw(self
, context
):
102 layout
.label(text
="Choose the importer(s) and a 'utility' panel")
103 layout
.prop(self
, "bool_pdb")
104 layout
.prop(self
, "bool_xyz")
105 layout
.prop(self
, "bool_utility")
108 # -----------------------------------------------------------------------------
112 # The entry into the menu 'file -> import'
113 def menu_func_import_pdb(self
, context
):
115 lay
.operator(pdb_gui
.IMPORT_OT_pdb
.bl_idname
,text
="Protein Data Bank (.pdb)")
117 def menu_func_import_xyz(self
, context
):
119 lay
.operator(xyz_gui
.IMPORT_OT_xyz
.bl_idname
,text
="XYZ (.xyz)")
121 # The entry into the menu 'file -> export'
122 def menu_func_export_pdb(self
, context
):
124 lay
.operator(pdb_gui
.EXPORT_OT_pdb
.bl_idname
,text
="Protein Data Bank (.pdb)")
126 def menu_func_export_xyz(self
, context
):
128 lay
.operator(xyz_gui
.EXPORT_OT_xyz
.bl_idname
,text
="XYZ (.xyz)")
131 # -----------------------------------------------------------------------------
135 from bpy
.utils
import register_class
137 register_class(AddonPreferences
)
139 register_class(pdb_gui
.IMPORT_OT_pdb
)
140 register_class(pdb_gui
.EXPORT_OT_pdb
)
141 bpy
.types
.TOPBAR_MT_file_import
.append(menu_func_import_pdb
)
142 bpy
.types
.TOPBAR_MT_file_export
.append(menu_func_export_pdb
)
144 register_class(xyz_gui
.IMPORT_OT_xyz
)
145 register_class(xyz_gui
.EXPORT_OT_xyz
)
146 bpy
.types
.TOPBAR_MT_file_import
.append(menu_func_import_xyz
)
147 bpy
.types
.TOPBAR_MT_file_export
.append(menu_func_export_xyz
)
149 classes
= (utility_gui
.PANEL_PT_prepare
,
150 utility_gui
.PanelProperties
,
151 utility_gui
.DatafileApply
,
152 utility_gui
.DefaultAtom
,
153 utility_gui
.ReplaceAtom
,
154 utility_gui
.SeparateAtom
,
155 utility_gui
.DistanceButton
,
156 utility_gui
.RadiusAllBiggerButton
,
157 utility_gui
.RadiusAllSmallerButton
,
158 utility_gui
.SticksAllBiggerButton
,
159 utility_gui
.SticksAllSmallerButton
)
160 from bpy
.utils
import register_class
161 utility_panel
.read_elements()
165 scene
= bpy
.types
.Scene
166 scene
.atom_blend
= bpy
.props
.PointerProperty(type=utility_gui
.PanelProperties
)
170 from bpy
.utils
import unregister_class
172 unregister_class(AddonPreferences
)
174 unregister_class(pdb_gui
.IMPORT_OT_pdb
)
175 unregister_class(pdb_gui
.EXPORT_OT_pdb
)
176 bpy
.types
.TOPBAR_MT_file_import
.remove(menu_func_import_pdb
)
177 bpy
.types
.TOPBAR_MT_file_export
.remove(menu_func_export_pdb
)
179 unregister_class(xyz_gui
.IMPORT_OT_xyz
)
180 unregister_class(xyz_gui
.EXPORT_OT_xyz
)
181 bpy
.types
.TOPBAR_MT_file_import
.remove(menu_func_import_xyz
)
182 bpy
.types
.TOPBAR_MT_file_export
.remove(menu_func_export_xyz
)
184 classes
= (utility_gui
.PANEL_PT_prepare
,
185 utility_gui
.PanelProperties
,
186 utility_gui
.DatafileApply
,
187 utility_gui
.DefaultAtom
,
188 utility_gui
.ReplaceAtom
,
189 utility_gui
.SeparateAtom
,
190 utility_gui
.DistanceButton
,
191 utility_gui
.RadiusAllBiggerButton
,
192 utility_gui
.RadiusAllSmallerButton
,
193 utility_gui
.SticksAllBiggerButton
,
194 utility_gui
.SticksAllSmallerButton
)
196 unregister_class(cls
)
199 # -----------------------------------------------------------------------------
202 if __name__
== "__main__":