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 #####
19 # Copyright 2011, Ryan Inch
22 "name": "Collection Manager",
23 "description": "Manage collections and their objects",
24 "author": "Ryan Inch",
26 "blender": (2, 80, 0),
27 "location": "View3D - Object Mode (Shortcut - M)",
28 "warning": '', # used for warning icon and text in addons panel
37 importlib
.reload(internals
)
38 importlib
.reload(operators
)
42 from . import internals
43 from . import operators
47 from bpy
.props
import (
56 internals
.CMListCollection
,
57 operators
.ExpandAllOperator
,
58 operators
.ExpandSublevelOperator
,
59 operators
.CMExcludeOperator
,
60 operators
.CMUnExcludeAllOperator
,
61 operators
.CMRestrictSelectOperator
,
62 operators
.CMUnRestrictSelectAllOperator
,
63 operators
.CMHideOperator
,
64 operators
.CMUnHideAllOperator
,
65 operators
.CMDisableViewportOperator
,
66 operators
.CMUnDisableViewportAllOperator
,
67 operators
.CMDisableRenderOperator
,
68 operators
.CMUnDisableRenderAllOperator
,
69 operators
.CMNewCollectionOperator
,
70 operators
.CMRemoveCollectionOperator
,
71 operators
.CMSetCollectionOperator
,
72 operators
.CMPhantomModeOperator
,
75 ui
.CMRestrictionTogglesPanel
,
80 bpy
.utils
.register_class(cls
)
82 bpy
.types
.Scene
.CMListCollection
= CollectionProperty(type=internals
.CMListCollection
)
83 bpy
.types
.Scene
.CMListIndex
= IntProperty(update
=ui
.update_selection
)
85 bpy
.types
.Scene
.show_exclude
= BoolProperty(default
=True, name
="Exclude from View Layer")
86 bpy
.types
.Scene
.show_selectable
= BoolProperty(default
=True, name
="Selectable")
87 bpy
.types
.Scene
.show_hideviewport
= BoolProperty(default
=True, name
="Hide in Viewport")
88 bpy
.types
.Scene
.show_disableviewport
= BoolProperty(default
=False, name
="Disable in Viewports")
89 bpy
.types
.Scene
.show_render
= BoolProperty(default
=False, name
="Disable in Renders")
91 bpy
.types
.Scene
.CM_Phantom_Mode
= BoolProperty(default
=False)
94 # create the global menu hotkey
95 wm
= bpy
.context
.window_manager
96 km
= wm
.keyconfigs
.addon
.keymaps
.new(name
='Object Mode')
97 kmi
= km
.keymap_items
.new('view3d.collection_manager', 'M', 'PRESS')
98 addon_keymaps
.append((km
, kmi
))
102 bpy
.utils
.unregister_class(cls
)
104 del bpy
.types
.Scene
.CMListCollection
105 del bpy
.types
.Scene
.CMListIndex
107 del bpy
.types
.Scene
.show_exclude
108 del bpy
.types
.Scene
.show_selectable
109 del bpy
.types
.Scene
.show_hideviewport
110 del bpy
.types
.Scene
.show_disableviewport
111 del bpy
.types
.Scene
.show_render
113 del bpy
.types
.Scene
.CM_Phantom_Mode
115 # remove keymaps when add-on is deactivated
116 for km
, kmi
in addon_keymaps
:
117 km
.keymap_items
.remove(kmi
)
118 addon_keymaps
.clear()
120 if __name__
== "__main__":