AnimAll: rename the "Animate" tab back to "Animation"
[blender-addons.git] / io_mesh_atomic / __init__.py
blobb4bd761b3cb12ab4d2cf4370c84b99ea2681fe7a
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 ... .
19 # Acknowledgements
20 # ================
22 # A big thank you to all those people who I met in particular in the IRC and
23 # who helped me a lot.
25 # Blender developers
26 # ------------------
27 # Campbell Barton (ideasman)
28 # Brendon Murphy (meta_androcto)
29 # Truman Melton (?) (truman)
30 # Kilon Alios (kilon)
31 # ?? (CoDEmanX)
32 # Dima Glib (dairin0d)
33 # Peter K.H. Gragert (PKHG)
34 # Valter Battioli (?) (valter)
35 # ? (atmind)
36 # Ray Molenkamp (bzztploink)
38 # Other
39 # -----
40 # Frank Palmino (Femto-St institute, Belfort-Montbéliard, France)
41 # ... for testing the addons and for feedback
43 bl_info = {
44 "name": "Atomic Blender PDB/XYZ",
45 "description": "Importing atoms listed in PDB or XYZ files as balls into Blender",
46 "author": "Clemens Barth",
47 "version": (1, 8, 1),
48 "blender": (2, 80, 0),
49 "location": "File -> Import -> PDB (.pdb) and File -> Import -> XYZ (.xyz)",
50 "warning": "",
51 "doc_url": "{BLENDER_MANUAL_URL}/addons/import_export/mesh_atomic.html",
52 "category": "Import-Export",
55 import bpy
56 from bpy.types import Operator, AddonPreferences
57 from bpy_extras.io_utils import ImportHelper, ExportHelper
58 from bpy.props import (
59 StringProperty,
60 BoolProperty,
61 EnumProperty,
62 IntProperty,
63 FloatProperty,
66 from . import (
67 pdb_gui,
68 xyz_gui,
69 utility_gui,
70 utility_panel
73 # -----------------------------------------------------------------------------
74 # Preferences
76 class AddonPreferences(AddonPreferences):
77 # This must match the addon name, use '__package__'
78 # when defining this in a submodule of a python package.
79 bl_idname = __name__
81 bool_pdb : BoolProperty(
82 name="PDB import/export",
83 default=True,
84 description="Import/export PDB",
86 bool_xyz : BoolProperty(
87 name="XYZ import/export",
88 default=True,
89 description="Import/export XYZ",
91 # This boolean is checked in the poll function in PANEL_PT_prepare
92 # (see utility.py).
93 bool_utility : BoolProperty(
94 name="Utility panel",
95 default=False,
96 description=("Panel with functionalities for modifying " \
97 "atomic structures"),
100 def draw(self, context):
101 layout = self.layout
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 # -----------------------------------------------------------------------------
109 # Menu
112 # The entry into the menu 'file -> import'
113 def menu_func_import_pdb(self, context):
114 lay = self.layout
115 lay.operator(pdb_gui.IMPORT_OT_pdb.bl_idname,text="Protein Data Bank (.pdb)")
117 def menu_func_import_xyz(self, context):
118 lay = self.layout
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):
123 lay = self.layout
124 lay.operator(pdb_gui.EXPORT_OT_pdb.bl_idname,text="Protein Data Bank (.pdb)")
126 def menu_func_export_xyz(self, context):
127 lay = self.layout
128 lay.operator(xyz_gui.EXPORT_OT_xyz.bl_idname,text="XYZ (.xyz)")
131 # -----------------------------------------------------------------------------
132 # Register
134 def register():
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()
162 for cls in classes:
163 register_class(cls)
165 scene = bpy.types.Scene
166 scene.atom_blend = bpy.props.PointerProperty(type=utility_gui.PanelProperties)
169 def unregister():
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)
195 for cls in classes:
196 unregister_class(cls)
199 # -----------------------------------------------------------------------------
200 # Main
202 if __name__ == "__main__":
204 register()