1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # ##### END GPL LICENSE BLOCK #####
21 # ----------------------------------------------------------
22 # Author: Antonio Vazquez (antonioya)
23 # ----------------------------------------------------------
25 # ----------------------------------------------
27 # ----------------------------------------------
30 "author": "Antonio Vazquez (antonioya)",
31 "location": "View3D > Add > Mesh > Archimesh",
34 "description": "Generate rooms, doors, windows, and other architecture objects",
35 "wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/Add_Mesh/Archimesh",
36 "category": "Add Mesh"
42 # ----------------------------------------------
44 # ----------------------------------------------
47 importlib
.reload(achm_room_maker
)
48 importlib
.reload(achm_door_maker
)
49 importlib
.reload(achm_window_maker
)
50 importlib
.reload(achm_roof_maker
)
51 importlib
.reload(achm_column_maker
)
52 importlib
.reload(achm_stairs_maker
)
53 importlib
.reload(achm_kitchen_maker
)
54 importlib
.reload(achm_shelves_maker
)
55 importlib
.reload(achm_books_maker
)
56 importlib
.reload(achm_lamp_maker
)
57 importlib
.reload(achm_curtain_maker
)
58 importlib
.reload(achm_venetian_maker
)
59 importlib
.reload(achm_main_panel
)
60 importlib
.reload(achm_window_panel
)
61 # print("archimesh: Reloaded multifiles")
63 from . import achm_books_maker
64 from . import achm_column_maker
65 from . import achm_curtain_maker
66 from . import achm_venetian_maker
67 from . import achm_door_maker
68 from . import achm_kitchen_maker
69 from . import achm_lamp_maker
70 from . import achm_main_panel
71 from . import achm_roof_maker
72 from . import achm_room_maker
73 from . import achm_shelves_maker
74 from . import achm_stairs_maker
75 from . import achm_window_maker
76 from . import achm_window_panel
78 # print("archimesh: Imported multifiles")
80 # noinspection PyUnresolvedReferences
82 # noinspection PyUnresolvedReferences
83 from bpy
.props
import (
90 # noinspection PyUnresolvedReferences
91 from bpy
.types
import (
99 # ----------------------------------------------------------
101 # ----------------------------------------------------------
104 class AchmInfoMtMeshDecorationAdd(Menu
):
105 bl_idname
= "INFO_MT_mesh_decoration_add"
106 bl_label
= "Decoration assets"
108 # noinspection PyUnusedLocal
109 def draw(self
, context
):
110 self
.layout
.operator("mesh.archimesh_books", text
="Add Books")
111 self
.layout
.operator("mesh.archimesh_lamp", text
="Add Lamp")
112 self
.layout
.operator("mesh.archimesh_roller", text
="Add Roller curtains")
113 self
.layout
.operator("mesh.archimesh_venetian", text
="Add Venetian blind")
114 self
.layout
.operator("mesh.archimesh_japan", text
="Add Japanese curtains")
116 # ----------------------------------------------------------
118 # ----------------------------------------------------------
121 class AchmInfoMtMeshCustomMenuAdd(Menu
):
122 bl_idname
= "INFO_MT_mesh_custom_menu_add"
123 bl_label
= "Archimesh"
125 # noinspection PyUnusedLocal
126 def draw(self
, context
):
127 self
.layout
.operator_context
= 'INVOKE_REGION_WIN'
128 self
.layout
.operator("mesh.archimesh_room", text
="Add Room")
129 self
.layout
.operator("mesh.archimesh_door", text
="Add Door")
130 self
.layout
.operator("mesh.archimesh_window", text
="Add Rail Window")
131 self
.layout
.operator("mesh.archimesh_winpanel", text
="Add Panel Window")
132 self
.layout
.operator("mesh.archimesh_kitchen", text
="Add Cabinet")
133 self
.layout
.operator("mesh.archimesh_shelves", text
="Add Shelves")
134 self
.layout
.operator("mesh.archimesh_column", text
="Add Column")
135 self
.layout
.operator("mesh.archimesh_stairs", text
="Add Stairs")
136 self
.layout
.operator("mesh.archimesh_roof", text
="Add Roof")
137 self
.layout
.menu("INFO_MT_mesh_decoration_add", text
="Decoration props", icon
="GROUP")
139 # --------------------------------------------------------------
140 # Register all operators and panels
141 # --------------------------------------------------------------
144 # Add-ons Preferences Update Panel
146 # Define Panel classes for updating
148 achm_main_panel
.ArchimeshMainPanel
,
152 def update_panel(self
, context
):
153 message
= "Archimesh: Updating Panel locations has failed"
156 if "bl_rna" in panel
.__dict
__:
157 bpy
.utils
.unregister_class(panel
)
160 panel
.bl_category
= context
.user_preferences
.addons
[__name__
].preferences
.category
161 bpy
.utils
.register_class(panel
)
163 except Exception as e
:
164 print("\n[{}]\n{}\n\nError:\n{}".format(__name__
, message
, e
))
168 class Archi_Pref(AddonPreferences
):
169 # this must match the addon name, use '__package__'
170 # when defining this in a submodule of a python package.
173 category
= StringProperty(
175 description
="Choose a name for the category of the panel",
180 def draw(self
, context
):
185 col
.label(text
="Tab Category:")
186 col
.prop(self
, "category", text
="")
190 # noinspection PyUnusedLocal
191 def AchmMenu_func(self
, context
):
192 self
.layout
.menu("INFO_MT_mesh_custom_menu_add", icon
="GROUP")
196 bpy
.utils
.register_class(AchmInfoMtMeshCustomMenuAdd
)
197 bpy
.utils
.register_class(AchmInfoMtMeshDecorationAdd
)
198 bpy
.utils
.register_class(achm_room_maker
.AchmRoom
)
199 bpy
.utils
.register_class(achm_room_maker
.AchmRoomGeneratorPanel
)
200 bpy
.utils
.register_class(achm_room_maker
.AchmExportRoom
)
201 bpy
.utils
.register_class(achm_room_maker
.AchmImportRoom
)
202 bpy
.utils
.register_class(achm_door_maker
.AchmDoor
)
203 bpy
.utils
.register_class(achm_door_maker
.AchmDoorObjectgeneratorpanel
)
204 bpy
.utils
.register_class(achm_window_maker
.AchmWindows
)
205 bpy
.utils
.register_class(achm_window_maker
.AchmWindowObjectgeneratorpanel
)
206 bpy
.utils
.register_class(achm_roof_maker
.AchmRoof
)
207 bpy
.utils
.register_class(achm_column_maker
.AchmColumn
)
208 bpy
.utils
.register_class(achm_stairs_maker
.AchmStairs
)
209 bpy
.utils
.register_class(achm_kitchen_maker
.AchmKitchen
)
210 bpy
.utils
.register_class(achm_kitchen_maker
.AchmExportInventory
)
211 bpy
.utils
.register_class(achm_shelves_maker
.AchmShelves
)
212 bpy
.utils
.register_class(achm_books_maker
.AchmBooks
)
213 bpy
.utils
.register_class(achm_lamp_maker
.AchmLamp
)
214 bpy
.utils
.register_class(achm_curtain_maker
.AchmRoller
)
215 bpy
.utils
.register_class(achm_curtain_maker
.AchmJapan
)
216 bpy
.utils
.register_class(achm_venetian_maker
.AchmVenetian
)
217 bpy
.utils
.register_class(achm_venetian_maker
.AchmVenetianObjectgeneratorpanel
)
218 bpy
.utils
.register_class(achm_main_panel
.ArchimeshMainPanel
)
219 bpy
.utils
.register_class(achm_main_panel
.AchmHoleAction
)
220 bpy
.utils
.register_class(achm_main_panel
.AchmPencilAction
)
221 bpy
.utils
.register_class(achm_main_panel
.AchmRunHintDisplayButton
)
222 bpy
.utils
.register_class(achm_window_panel
.AchmWinPanel
)
223 bpy
.utils
.register_class(achm_window_panel
.AchmWindowEditPanel
)
224 bpy
.utils
.register_class(Archi_Pref
)
225 INFO_MT_mesh_add
.append(AchmMenu_func
)
226 update_panel(None, bpy
.context
)
228 Scene
.archimesh_select_only
= BoolProperty(
229 name
="Only selected",
230 description
="Apply auto holes only to selected objects",
233 Scene
.archimesh_ceiling
= BoolProperty(
235 description
="Create a ceiling",
238 Scene
.archimesh_floor
= BoolProperty(
240 description
="Create a floor automatically",
244 Scene
.archimesh_merge
= BoolProperty(
246 description
="Close walls to create a full closed room",
250 Scene
.archimesh_text_color
= FloatVectorProperty(
252 description
="Color for the text and lines",
253 default
=(0.173, 0.545, 1.0, 1.0),
259 Scene
.archimesh_walltext_color
= FloatVectorProperty(
261 description
="Color for the wall label",
262 default
=(1, 0.8, 0.1, 1.0),
268 Scene
.archimesh_font_size
= IntProperty(
270 description
="Text size for hints",
271 default
=14, min=10, max=150,
273 Scene
.archimesh_wfont_size
= IntProperty(
275 description
="Text size for wall labels",
276 default
=16, min=10, max=150,
278 Scene
.archimesh_hint_space
= FloatProperty(
279 name
='Separation', min=0, max=5, default
=0.1,
281 description
='Distance from object to display hint',
283 Scene
.archimesh_gl_measure
= BoolProperty(
285 description
="Display measures",
288 Scene
.archimesh_gl_name
= BoolProperty(
290 description
="Display names",
293 Scene
.archimesh_gl_ghost
= BoolProperty(
295 description
="Display measures for all objects,"
296 " not only selected",
302 # register internal property
303 wm
.archimesh_run_opengl
= BoolProperty(default
=False)
307 bpy
.utils
.unregister_class(AchmInfoMtMeshCustomMenuAdd
)
308 bpy
.utils
.unregister_class(AchmInfoMtMeshDecorationAdd
)
309 bpy
.utils
.unregister_class(achm_room_maker
.AchmRoom
)
310 bpy
.utils
.unregister_class(achm_room_maker
.AchmRoomGeneratorPanel
)
311 bpy
.utils
.unregister_class(achm_room_maker
.AchmExportRoom
)
312 bpy
.utils
.unregister_class(achm_room_maker
.AchmImportRoom
)
313 bpy
.utils
.unregister_class(achm_door_maker
.AchmDoor
)
314 bpy
.utils
.unregister_class(achm_door_maker
.AchmDoorObjectgeneratorpanel
)
315 bpy
.utils
.unregister_class(achm_window_maker
.AchmWindows
)
316 bpy
.utils
.unregister_class(achm_window_maker
.AchmWindowObjectgeneratorpanel
)
317 bpy
.utils
.unregister_class(achm_roof_maker
.AchmRoof
)
318 bpy
.utils
.unregister_class(achm_column_maker
.AchmColumn
)
319 bpy
.utils
.unregister_class(achm_stairs_maker
.AchmStairs
)
320 bpy
.utils
.unregister_class(achm_kitchen_maker
.AchmKitchen
)
321 bpy
.utils
.unregister_class(achm_kitchen_maker
.AchmExportInventory
)
322 bpy
.utils
.unregister_class(achm_shelves_maker
.AchmShelves
)
323 bpy
.utils
.unregister_class(achm_books_maker
.AchmBooks
)
324 bpy
.utils
.unregister_class(achm_lamp_maker
.AchmLamp
)
325 bpy
.utils
.unregister_class(achm_curtain_maker
.AchmRoller
)
326 bpy
.utils
.unregister_class(achm_curtain_maker
.AchmJapan
)
327 bpy
.utils
.unregister_class(achm_venetian_maker
.AchmVenetian
)
328 bpy
.utils
.unregister_class(achm_venetian_maker
.AchmVenetianObjectgeneratorpanel
)
329 bpy
.utils
.unregister_class(achm_main_panel
.ArchimeshMainPanel
)
330 bpy
.utils
.unregister_class(achm_main_panel
.AchmHoleAction
)
331 bpy
.utils
.unregister_class(achm_main_panel
.AchmPencilAction
)
332 bpy
.utils
.unregister_class(achm_main_panel
.AchmRunHintDisplayButton
)
333 bpy
.utils
.unregister_class(achm_window_panel
.AchmWinPanel
)
334 bpy
.utils
.unregister_class(achm_window_panel
.AchmWindowEditPanel
)
335 bpy
.utils
.unregister_class(Archi_Pref
)
336 INFO_MT_mesh_add
.remove(AchmMenu_func
)
339 del Scene
.archimesh_select_only
340 del Scene
.archimesh_ceiling
341 del Scene
.archimesh_floor
342 del Scene
.archimesh_merge
343 del Scene
.archimesh_text_color
344 del Scene
.archimesh_walltext_color
345 del Scene
.archimesh_font_size
346 del Scene
.archimesh_wfont_size
347 del Scene
.archimesh_hint_space
348 del Scene
.archimesh_gl_measure
349 del Scene
.archimesh_gl_name
350 del Scene
.archimesh_gl_ghost
352 achm_main_panel
.AchmRunHintDisplayButton
.handle_remove(achm_main_panel
.AchmRunHintDisplayButton
, bpy
.context
)
353 wm
= bpy
.context
.window_manager
354 p
= 'archimesh_run_opengl'
359 if __name__
== '__main__':