1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
# Copyright 2011, Ryan Inch
bl_info = {
"name": "Collection Manager",
"description": "Manage collections and their objects",
"author": "Ryan Inch",
"version": (1,9,2),
"blender": (2, 80, 0),
"location": "View3D - Object Mode (Shortcut - M)",
"warning": '', # used for warning icon and text in addons panel
"doc_url": "https://docs.blender.org/manual/en/dev/addons/"
"interface/collection_manager.html",
"category": "Interface",
}
if "bpy" in locals():
import importlib
importlib.reload(internals)
importlib.reload(operators)
importlib.reload(ui)
else:
from . import internals
from . import operators
from . import ui
import bpy
from bpy.props import (
CollectionProperty,
IntProperty,
BoolProperty,
)
addon_keymaps = []
classes = (
internals.CMListCollection,
internals.CMSendReport,
operators.ExpandAllOperator,
operators.ExpandSublevelOperator,
operators.CMExcludeOperator,
operators.CMUnExcludeAllOperator,
operators.CMRestrictSelectOperator,
operators.CMUnRestrictSelectAllOperator,
operators.CMHideOperator,
operators.CMUnHideAllOperator,
operators.CMDisableViewportOperator,
operators.CMUnDisableViewportAllOperator,
operators.CMDisableRenderOperator,
operators.CMUnDisableRenderAllOperator,
operators.CMNewCollectionOperator,
operators.CMRemoveCollectionOperator,
operators.CMSetCollectionOperator,
operators.CMPhantomModeOperator,
ui.CM_UL_items,
ui.CollectionManager,
ui.CMRestrictionTogglesPanel,
)
def register():
for cls in classes:
bpy.utils.register_class(cls)
bpy.types.Scene.CMListCollection = CollectionProperty(type=internals.CMListCollection)
bpy.types.Scene.CMListIndex = IntProperty(update=ui.update_selection)
bpy.types.Scene.show_exclude = BoolProperty(default=True, name="Exclude from View Layer")
bpy.types.Scene.show_selectable = BoolProperty(default=True, name="Selectable")
bpy.types.Scene.show_hideviewport = BoolProperty(default=True, name="Hide in Viewport")
bpy.types.Scene.show_disableviewport = BoolProperty(default=False, name="Disable in Viewports")
bpy.types.Scene.show_render = BoolProperty(default=False, name="Disable in Renders")
bpy.types.Scene.CM_Phantom_Mode = BoolProperty(default=False)
# create the global menu hotkey
wm = bpy.context.window_manager
km = wm.keyconfigs.addon.keymaps.new(name='Object Mode')
kmi = km.keymap_items.new('view3d.collection_manager', 'M', 'PRESS')
addon_keymaps.append((km, kmi))
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
del bpy.types.Scene.CMListCollection
del bpy.types.Scene.CMListIndex
del bpy.types.Scene.show_exclude
del bpy.types.Scene.show_selectable
del bpy.types.Scene.show_hideviewport
del bpy.types.Scene.show_disableviewport
del bpy.types.Scene.show_render
del bpy.types.Scene.CM_Phantom_Mode
# remove keymaps when add-on is deactivated
for km, kmi in addon_keymaps:
km.keymap_items.remove(kmi)
addon_keymaps.clear()
if __name__ == "__main__":
register()
|