-
Notifications
You must be signed in to change notification settings - Fork 3
/
__init__.py
250 lines (231 loc) · 9.78 KB
/
__init__.py
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
# Copyright (C) 2019 h0bB1T
#
# 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 3 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
import bpy, platform, os, stat
from . preferences import PreferencesPanel, T3DN_OT_bip_showcase_install_pillow
from . properties import TexturesToExport, UI_UL_TexturePackList, Properties
from . preview_parsers import CollectionImageParser, NodesParser
from . preview_helper import PreviewHelper
from . panels import ImportPanel, ExportPanel, NodeWizardPanel, NodeWizardMapPanel, NodeWizardExportPanel
from . create_category_ops import CreateCategoryOperator
from . exporter_ops import UseObjectNameOperator, OverwriteObjectExporterOperator, TexturePackSelectionOperator,ObjectExporterOperator
from . importer_ops import (AppendObjectOperator, LinkObjectOperator,
SetMaterialOperator, AppendMaterialOperator, OpenObjectOperator, OpenMaterialOperator)
from . render_previews_ops import ModalTimerOperator, RenderPreviewsOperator, RenderAllPreviewsOperator
from . generate_ops import GeneratePBROperator, GenerateImageOperator, ExportPBROperator, ExportMaterialOperator
from . node_importer_ops import NodeImporter
from . ao_curv_calc_ops import BakeAoMapOperator, CurvatureMapOperator, AoNodeOperator, CurvatureNodeOperator, MapGenerateUV, UseObjectNameForMap
from . tools_ops import (DX2OGLConverterOperator, GenerateTwoLayerTextureBasedSetupOperator,
GenerateTwoLayerShaderBasedSetupOperator, ImportDistortionOperator,
ImportBlurOperator, ImportTextureBoxMapUVW, ImportExtNoise,
ImportExtMusgrave, ImportExtVoronoi, ImportMixNoise,
ImportScalarMix, ImportIntensityVisualizer, ImportScalarMapper,
ImportNormalDirection, ImportSlice)
from . support_ops import AutoNumberExportName, RefreshObjectPreviews, ReRenderObjectPreview, RefreshMaterialPreviews, ReRenderMaterialPreview, RemoveAsset
from . utils import (categories, categories_enum, ASSET_TYPE_OBJECT, ASSET_TYPE_MATERIAL,
ASSET_TYPE_NODES, ASSET_TYPE_NODES_MATERIALS)
from . icon_helper import IconHelper
# 0.3.0
# - New 'PLUS' button right off export file name to increase name for exported object asset
# - Visual separators between top level asset categories (optional/adjustable in preferences)
# 0.2.0
# - New version number scheme
# - Render ALL fixed
# - Remove Asset added to objects (material is more complex, so on the TODO list)
# 0.1.12
# - Blender 2.9 compatibility (texture path remap option in preferences)
# - Option to show .blend + .fbx added to preferences
# - Shorter category subfolders
# - Empty categories hidden
# - A subset of the used textures can now be packed to the exported .blend
# 0.1.11
# Fix when linking objects instead of appending. They are now automatically converted
# to local/proxy. After this change 'At Cursor' works for linked objects too.
# 0.1.10
# Fixing Blender API incompatibility in 2.80 final (curvature export failure).
# 0.1.9
# Curvature tool is now statically linked on Linux
# Packaging of 0.1.8 is wrong, this is fixed now.
# 0.1.8
# Export of Empty objects is working now
# 'Set'ting a material in Asset Wizard panel apply to the active material slot now.
# 0.1.7
# bl_idname added to panels
# 0.1.6
# Error fixes:
# - Create directory if not exists when creating curvature mask
# 0.1.5
# Error fixes:
# - Append at cursor (Blender API change)
# - Wrong library when creating root category
# - curvature executable flag on Linux
# 0.1.4
# Append/Add object at cursor position
# Lock appended object in XY plane (Move in Z and rotation in X/Y axis is locked for these objects)
# Both object and materials can now have subdirectories
# Categories are now cached an don't need to be rescanned on every panel redraw
# 0.1.3
# Curvature and AO map generator added to Node Wizard
# Preview size in panels can now be scaled from preferences
# Fix in preferences (use of __package__)
# Near and far clipping clipping plane of preview camera adjusted to allow smaller and larger objects
# 0.1.2
# Better view on objects in preview
# Support for multiple material in one .blend added
# Update Preview if selected only
# Open button for materials added
# 0.1.1
# Package Name Fix (assert -> asset)
# 0.1
# Initial Release
# +TODO: Automatic name suggestion on obj selection -> use name of active_object
# +TODO: Compact export panel -> compact adjustable in prefs
# +TODO: Integrate Node Wizard with export and generate
# +TODO: Render in background thread
# +TODO: Reload button for previews
# +TODO: Rerender selected assets
# +TODO: Check panel/op validity using poll()/enable
# +TODO: Unify preview object from Asset & Node-Wizard
# +TODO: No-Icon for Asset Wizard
# +TODO: Preview FBX render
# +TODO: NW: Fix utils import + nodes_materials
# +TODO: Finalize better handling of empty repositories
# +TODO: Reload previews automatically after preview-render
# +TODO: Auto render exported things
# +TODO: Better view on objects in preview
# +TODO: Support multiple materials in one .blend
# +TODO: Update Preview if selected only
# +TODO: Open button for materials added
# +TODO: --Release
# +TODO: Preview scale adjustable
# +TODO: Change near and far clipping setting in preview.blend
# +TODO: NW: Quick bake curvature and AO mask
# +TODO: Append object at cursor, optionally lock Move Z & Rotate XY
# +TODO: Sub-categories
# TODO: Fix linux curvature library dependency (GLIBC) bug
# TODO: ?Adjustable rows/columns for previews (possible?)
# TODO: Some default settings (e.g. for exporter) should be adjustable in prefs
# TODO: NW: One click create paint texture for mask
# TODO: NW: Better Masks
# TODO: NW: Finalize different texture unrepeater solutions
# TODO: NW: Finalize procedural wood shader
# TODO: NW?: Finalize moss generator (?metaball using object parser)
# TODO: STL (OpenSCAD), ?OBJ support
# TODO: DOC/VideoTutorial
# TODO: ?Integrate HDRI
# TODO: ?Integrate particles
# TODO: ?Move or delete assets
# TODO: ?Import 3DS/JSON
# TODO: ?Download new masks & materials from cloud/github
# TODO: ?Import GIMP gradients as ColorRamp
bl_info = {
"name" : "Asset Wizard (fast preview)",
"version": (0, 3, 1),
"author" : "h0bB1T, Atticus",
"description" : "Asset import and export utility.",
"blender" : (2, 80, 0),
"location" : "View3D",
"category" : "Import-Export"
}
ops = [
PreferencesPanel,T3DN_OT_bip_showcase_install_pillow,
TexturesToExport,
Properties,
ImportPanel,
UI_UL_TexturePackList,
ExportPanel,
NodeWizardPanel,
NodeWizardMapPanel,
NodeWizardExportPanel,
CreateCategoryOperator,
UseObjectNameOperator,
OverwriteObjectExporterOperator,
TexturePackSelectionOperator,
ObjectExporterOperator,
AppendObjectOperator,
LinkObjectOperator,
SetMaterialOperator,
AppendMaterialOperator,
OpenObjectOperator,
OpenMaterialOperator,
ModalTimerOperator,
RenderPreviewsOperator,
RenderAllPreviewsOperator,
GeneratePBROperator,
GenerateImageOperator,
ExportPBROperator,
ExportMaterialOperator,
NodeImporter,
BakeAoMapOperator,
CurvatureMapOperator,
AoNodeOperator,
CurvatureNodeOperator,
UseObjectNameForMap,
MapGenerateUV,
DX2OGLConverterOperator,
GenerateTwoLayerTextureBasedSetupOperator,
GenerateTwoLayerShaderBasedSetupOperator,
ImportDistortionOperator,
ImportBlurOperator,
ImportTextureBoxMapUVW,
ImportExtNoise,
ImportExtMusgrave,
ImportExtVoronoi,
ImportMixNoise,
ImportScalarMix,
ImportIntensityVisualizer,
ImportScalarMapper,
ImportNormalDirection,
ImportSlice,
RefreshObjectPreviews,
ReRenderObjectPreview,
RefreshMaterialPreviews,
ReRenderMaterialPreview,
RemoveAsset,
AutoNumberExportName,
]
def register():
for op in ops:
try:
bpy.utils.register_class(op)
except Exception as ex:
print(ex)
# Prepare previews for node wizard
for (asset_type, mod) in (
(ASSET_TYPE_NODES, "nodes"),
(ASSET_TYPE_NODES_MATERIALS, "materials")
):
PreviewHelper.addCollection(asset_type, NodesParser(), mod)
IconHelper.init()
Properties.initialize()
# On Linux, guarantee curvature has execute rights.
if platform.system() == "Linux":
os.chmod(
os.path.join(os.path.dirname(__file__), "data", "tools", "curvature"),
stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH |
stat.S_IWUSR | stat.S_IWGRP |
stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH
)
def unregister():
Properties.cleanup()
IconHelper.dispose()
PreviewHelper.removeAllCollections()
for op in ops:
try:
bpy.utils.unregister_class(op)
except Exception as ex:
print(ex)
if __name__ == "__main__":
register()