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 #####
20 "name": "BlenderKit Online Asset Library",
21 "author": "Vilem Duha, Petr Dlouhy",
22 "version": (1, 0, 40),
23 "blender": (2, 92, 0),
24 "location": "View3D > Properties > BlenderKit",
25 "description": "Online BlenderKit library (materials, models, brushes and more). Connects to the internet.",
27 "doc_url": "{BLENDER_MANUAL_URL}/addons/add_mesh/blenderkit.html",
28 "category": "3D View",
32 from importlib
import reload
33 #alphabetically sorted all add-on modules since reload only happens from __init__.
34 # modules with _bg are used for background computations in separate blender instance and that's why they don't need reload.
36 append_link
= reload(append_link
)
37 asset_bar_op
= reload(asset_bar_op
)
38 asset_inspector
= reload(asset_inspector
)
39 autothumb
= reload(autothumb
)
40 bg_blender
= reload(bg_blender
)
41 bkit_oauth
= reload(bkit_oauth
)
42 categories
= reload(categories
)
43 colors
= reload(colors
)
44 download
= reload(download
)
46 image_utils
= reload(image_utils
)
48 overrides
= reload(overrides
)
50 ratings
= reload(ratings
)
51 resolutions
= reload(resolutions
)
52 search
= reload(search
)
53 tasks_queue
= reload(tasks_queue
)
55 ui_bgl
= reload(ui_bgl
)
56 ui_panels
= reload(ui_panels
)
57 upload
= reload(upload
)
60 bl_ui_label
= reload(bl_ui_label
)
61 bl_ui_button
= reload(bl_ui_button
)
62 # bl_ui_checkbox = reload(bl_ui_checkbox)
63 # bl_ui_slider = reload(bl_ui_slider)
64 # bl_ui_up_down = reload(bl_ui_up_down)
65 bl_ui_drag_panel
= reload(bl_ui_drag_panel
)
66 bl_ui_draw_op
= reload(bl_ui_draw_op
)
67 # bl_ui_textbox = reload(bl_ui_textbox)
70 from blenderkit
import append_link
71 from blenderkit
import asset_bar_op
72 from blenderkit
import asset_inspector
73 from blenderkit
import autothumb
74 from blenderkit
import bg_blender
75 from blenderkit
import bkit_oauth
76 from blenderkit
import categories
77 from blenderkit
import colors
78 from blenderkit
import download
79 from blenderkit
import icons
80 from blenderkit
import image_utils
81 from blenderkit
import oauth
82 from blenderkit
import overrides
83 from blenderkit
import paths
84 from blenderkit
import ratings
85 from blenderkit
import resolutions
86 from blenderkit
import search
87 from blenderkit
import tasks_queue
88 from blenderkit
import ui
89 from blenderkit
import ui_bgl
90 from blenderkit
import ui_panels
91 from blenderkit
import upload
92 from blenderkit
import utils
94 from blenderkit
.bl_ui_widgets
import bl_ui_label
95 from blenderkit
.bl_ui_widgets
import bl_ui_button
96 # from blenderkit.bl_ui_widgets import bl_ui_checkbox
97 # from blenderkit.bl_ui_widgets import bl_ui_slider
98 # from blenderkit.bl_ui_widgets import bl_ui_up_down
99 from blenderkit
.bl_ui_widgets
import bl_ui_drag_panel
100 from blenderkit
.bl_ui_widgets
import bl_ui_draw_op
101 # from blenderkit.bl_ui_widgets import bl_ui_textbox
111 log
= logging
.getLogger(__name__
)
114 from bpy
.app
.handlers
import persistent
115 import bpy
.utils
.previews
117 from mathutils
import Vector
118 from bpy
.props
import (
127 from bpy
.types
import (
135 # logging.basicConfig(filename = 'blenderkit.log', level = logging.INFO,
136 # format = ' %(asctime)s:%(filename)s:%(funcName)s:%(lineno)d:%(message)s')
140 def scene_load(context
):
141 print('loading in background')
142 print(bpy
.context
.window_manager
)
143 if not bpy
.app
.background
:
145 search
.load_previews()
146 ui_props
= bpy
.context
.scene
.blenderkitUI
147 ui_props
.assetbar_on
= False
148 ui_props
.turn_off
= False
149 preferences
= bpy
.context
.preferences
.addons
['blenderkit'].preferences
150 preferences
.login_attempt
= False
153 @bpy.app
.handlers
.persistent
154 def check_timers_timer():
155 ''' checks if all timers are registered regularly. Prevents possible bugs from stopping the addon.'''
156 if not bpy
.app
.timers
.is_registered(search
.timer_update
):
157 bpy
.app
.timers
.register(search
.timer_update
)
158 if not bpy
.app
.timers
.is_registered(download
.timer_update
):
159 bpy
.app
.timers
.register(download
.timer_update
)
160 if not (bpy
.app
.timers
.is_registered(tasks_queue
.queue_worker
)):
161 bpy
.app
.timers
.register(tasks_queue
.queue_worker
)
162 if not bpy
.app
.timers
.is_registered(bg_blender
.bg_update
):
163 bpy
.app
.timers
.register(bg_blender
.bg_update
)
169 ('UNSPECIFIED', 'Unspecified', "Don't use this in search"),
170 ('NEW', 'New', 'Shiny new item'),
171 ('USED', 'Used', 'Casually used item'),
172 ('OLD', 'Old', 'Old item'),
173 ('DESOLATE', 'Desolate', 'Desolate item - dusty & rusty'),
176 ('REALISTIC', 'Realistic', "photo realistic model"),
177 ('PAINTERLY', 'Painterly', 'hand painted with visible strokes, mostly for games'),
178 ('LOWPOLY', 'Lowpoly', "Lowpoly art -don't mix up with polycount!"),
179 ('ANIME', 'Anime', 'Anime style'),
180 ('2D_VECTOR', '2D Vector', '2D vector'),
181 ('3D_GRAPHICS', '3D Graphics', '3D graphics'),
182 ('OTHER', 'Other', 'Other style'),
184 search_model_styles
= (
185 ('REALISTIC', 'Realistic', "photo realistic model"),
186 ('PAINTERLY', 'Painterly', 'hand painted with visible strokes, mostly for games'),
187 ('LOWPOLY', 'Lowpoly', "Lowpoly art -don't mix up with polycount!"),
188 ('ANIME', 'Anime', 'Anime style'),
189 ('2D_VECTOR', '2D Vector', '2D vector'),
190 ('3D_GRAPHICS', '3D Graphics', '3D graphics'),
191 ('OTHER', 'Other', 'Other Style'),
192 ('ANY', 'Any', 'Any Style'),
195 ('REALISTIC', 'Realistic', "photo realistic model"),
196 ('NPR', 'Non photorealistic', 'hand painted with visible strokes, mostly for games'),
197 ('OTHER', 'Other', 'Other style'),
199 search_material_styles
= (
200 ('REALISTIC', 'Realistic', "photo realistic model"),
201 ('NPR', 'Non photorealistic', 'hand painted with visible strokes, mostly for games'),
202 ('ANY', 'Any', 'Any'),
205 ('CYCLES', 'Cycles', 'blender cycles pathtracer'),
206 ('EEVEE', 'Eevee', 'blender eevee renderer'),
207 ('OCTANE', 'Octane', 'octane render enginge'),
208 ('ARNOLD', 'Arnold', 'arnold render engine'),
209 ('V-RAY', 'V-Ray', 'V-Ray renderer'),
210 ('UNREAL', 'Unreal', 'Unreal engine'),
211 ('UNITY', 'Unity', 'Unity engine'),
212 ('GODOT', 'Godot', 'Godot engine'),
213 ('3D-PRINT', '3D printer', 'object can be 3D printed'),
214 ('OTHER', 'Other', 'any other engine'),
215 ('NONE', 'None', 'no more engine block'),
218 ('METALLIC', 'Metallic-Roughness', 'Metallic/Roughness PBR material type'),
219 ('SPECULAR', 'Specular Glossy', ''),
223 ('QUAD', 'quad', ''),
224 ('QUAD_DOMINANT', 'quad_dominant', ''),
225 ('TRI_DOMINANT', 'tri_dominant', ''),
227 ('NGON', 'ngon_dominant', ''),
228 ('OTHER', 'other', ''),
232 ('DEFAULT', 'default', ''),
233 ('FRONT', 'front', ''),
234 ('SIDE', 'side', ''),
239 ('GROUND', 'ground', ''),
240 ('WALL', 'wall', ''),
241 ('CEILING', 'ceiling', ''),
242 ('FLOAT', 'floating', ''),
245 thumbnail_resolutions
= (
247 ('512', '512 - minimum for public', ''),
248 ('1024', '1024', ''),
249 ('2048', '2048', ''),
252 def udate_down_up(self
, context
):
253 """Perform a search if results are empty."""
255 wm
= bpy
.context
.window_manager
256 props
= s
.blenderkitUI
257 if wm
['search results'] == None and props
.down_up
== 'SEARCH':
260 def switch_search_results(self
, context
):
261 s
= bpy
.context
.scene
262 wm
= bpy
.context
.window_manager
263 props
= s
.blenderkitUI
264 if props
.asset_type
== 'MODEL':
265 wm
['search results'] = wm
.get('bkit model search')
266 wm
['search results orig'] = wm
.get('bkit model search orig')
267 elif props
.asset_type
== 'SCENE':
268 wm
['search results'] = wm
.get('bkit scene search')
269 wm
['search results orig'] = wm
.get('bkit scene search orig')
270 elif props
.asset_type
== 'HDR':
271 wm
['search results'] = wm
.get('bkit hdr search')
272 wm
['search results orig'] = wm
.get('bkit hdr search orig')
273 elif props
.asset_type
== 'MATERIAL':
274 wm
['search results'] = wm
.get('bkit material search')
275 wm
['search results orig'] = wm
.get('bkit material search orig')
276 elif props
.asset_type
== 'TEXTURE':
277 wm
['search results'] = wm
.get('bkit texture search')
278 wm
['search results orig'] = wm
.get('bkit texture search orig')
279 elif props
.asset_type
== 'BRUSH':
280 wm
['search results'] = wm
.get('bkit brush search')
281 wm
['search results orig'] = wm
.get('bkit brush search orig')
282 if not(context
.sculpt_object
or context
.image_paint_object
):
284 'Switch to paint or sculpt mode to search in BlenderKit brushes.')
286 search
.load_previews()
287 if wm
['search results'] == None and props
.down_up
== 'SEARCH':
292 def asset_type_callback(self
, context
):
295 items for Enum property, depending on the down_up property - BlenderKit is either in search or in upload mode.
298 user_preferences
= bpy
.context
.preferences
.addons
['blenderkit'].preferences
300 if self
.down_up
== 'SEARCH':
302 ('MODEL', 'Models', 'Find models in the BlenderKit online database', 'OBJECT_DATAMODE', 0),
303 ('MATERIAL', 'Materials', 'Find materials in the BlenderKit online database', 'MATERIAL', 2),
304 # ('TEXTURE', 'Texture', 'Browse textures', 'TEXTURE', 3),
305 ('SCENE', 'Scenes', 'Browse scenes', 'SCENE_DATA', 3),
306 ('HDR', 'Hdrs', 'Browse hdrs', 'WORLD', 4),
307 ('BRUSH', 'Brushes', 'Find brushes in the BlenderKit online database', 'BRUSH_DATA', 5)
311 ('MODEL', 'Model', 'Upload a model to BlenderKit', 'OBJECT_DATAMODE', 0),
312 # ('SCENE', 'SCENE', 'Browse scenes', 'SCENE_DATA', 1),
313 ('MATERIAL', 'Material', 'Upload a material to BlenderKit', 'MATERIAL', 2),
314 # ('TEXTURE', 'Texture', 'Browse textures', 'TEXTURE', 3),
315 ('SCENE', 'Scenes', 'Browse scenes', 'SCENE_DATA', 3),
316 ('HDR', 'Hdrs', 'Browse hdrs', 'WORLD', 4),
317 ('BRUSH', 'Brush', 'Upload a brush to BlenderKit', 'BRUSH_DATA', 5)
323 class BlenderKitUIProps(PropertyGroup
):
324 down_up
: EnumProperty(
325 name
="Download vs Upload",
327 ('SEARCH', 'Search', 'Sctivate searching', 'VIEWZOOM', 0),
328 ('UPLOAD', 'Upload', 'Activate uploading', 'COPYDOWN', 1),
329 # ('RATING', 'Rating', 'Activate rating', 'SOLO_ON', 2)
331 description
="BLenderKit",
333 update
= udate_down_up
335 asset_type
: EnumProperty(
336 name
="BlenderKit Active Asset Type",
337 items
=asset_type_callback
,
338 description
="Activate asset in UI",
340 update
=switch_search_results
342 # these aren't actually used ( by now, seems to better use globals in UI module:
343 draw_tooltip
: BoolProperty(name
="Draw Tooltip", default
=False)
344 addon_update
: BoolProperty(name
="Should Update Addon", default
=False)
345 tooltip
: StringProperty(
347 description
="asset preview info",
355 thumb_size
: IntProperty(name
="Thumbnail Size", default
=thumb_size_def
, min=-1, max=256)
357 margin
: IntProperty(name
="Margin", default
=margin_def
, min=-1, max=256)
358 highlight_margin
: IntProperty(name
="Highlight Margin", default
=int(margin_def
/ 2), min=-10, max=256)
360 bar_height
: IntProperty(name
="Bar Height", default
=thumb_size_def
+ 2 * margin_def
, min=-1, max=2048)
361 bar_x_offset
: IntProperty(name
="Bar X Offset", default
=20, min=0, max=5000)
362 bar_y_offset
: IntProperty(name
="Bar Y Offset", default
=80, min=0, max=5000)
364 bar_x
: IntProperty(name
="Bar X", default
=100, min=0, max=5000)
365 bar_y
: IntProperty(name
="Bar Y", default
=100, min=50, max=5000)
366 bar_end
: IntProperty(name
="Bar End", default
=100, min=0, max=5000)
367 bar_width
: IntProperty(name
="Bar Width", default
=100, min=0, max=5000)
369 wcount
: IntProperty(name
="Width Count", default
=10, min=0, max=5000)
370 hcount
: IntProperty(name
="Rows", default
=5, min=0, max=5000)
372 reports_y
: IntProperty(name
="Reports Y", default
=5, min=0, max=5000)
373 reports_x
: IntProperty(name
="Reports X", default
=5, min=0, max=5000)
375 assetbar_on
: BoolProperty(name
="Assetbar On", default
=False)
376 turn_off
: BoolProperty(name
="Turn Off", default
=False)
378 mouse_x
: IntProperty(name
="Mouse X", default
=0)
379 mouse_y
: IntProperty(name
="Mouse Y", default
=0)
381 active_index
: IntProperty(name
="Active Index", default
=-3)
382 scrolloffset
: IntProperty(name
="Scroll Offset", default
=0)
383 drawoffset
: IntProperty(name
="Draw Offset", default
=0)
385 dragging
: BoolProperty(name
="Dragging", default
=False)
386 drag_init
: BoolProperty(name
="Drag Initialisation", default
=False)
387 drag_length
: IntProperty(name
="Drag length", default
=0)
388 draw_drag_image
: BoolProperty(name
="Draw Drag Image", default
=False)
389 draw_snapped_bounds
: BoolProperty(name
="Draw Snapped Bounds", default
=False)
391 snapped_location
: FloatVectorProperty(name
="Snapped Location", default
=(0, 0, 0))
392 snapped_bbox_min
: FloatVectorProperty(name
="Snapped Bbox Min", default
=(0, 0, 0))
393 snapped_bbox_max
: FloatVectorProperty(name
="Snapped Bbox Max", default
=(0, 0, 0))
394 snapped_normal
: FloatVectorProperty(name
="Snapped Normal", default
=(0, 0, 0))
396 snapped_rotation
: FloatVectorProperty(name
="Snapped Rotation", default
=(0, 0, 0), subtype
='QUATERNION')
398 has_hit
: BoolProperty(name
="has_hit", default
=False)
399 thumbnail_image
= StringProperty(
400 name
="Thumbnail Image",
402 default
=paths
.get_addon_thumbnail_path('thumbnail_notready.jpg'))
405 rating_ui_scale
= ui_scale
407 rating_button_on
: BoolProperty(name
="Rating Button On", default
=True)
408 rating_menu_on
: BoolProperty(name
="Rating Menu On", default
=False)
409 rating_on
: BoolProperty(name
="Rating on", default
=True)
411 rating_button_width
: IntProperty(name
="Rating Button Width", default
=50 * ui_scale
)
412 rating_button_height
: IntProperty(name
="Rating Button Height", default
=50 * ui_scale
)
414 rating_x
: IntProperty(name
="Rating UI X", default
=10)
415 rating_y
: IntProperty(name
="Rating UI Y", default
=10)
417 rating_ui_width
: IntProperty(name
="Rating UI Width", default
=rating_ui_scale
* 600)
418 rating_ui_height
: IntProperty(name
="Rating UI Heightt", default
=rating_ui_scale
* 256)
420 quality_stars_x
: IntProperty(name
="Rating UI Stars X", default
=rating_ui_scale
* 90)
421 quality_stars_y
: IntProperty(name
="Rating UI Stars Y", default
=rating_ui_scale
* 190)
423 star_size
: IntProperty(name
="Star Size", default
=rating_ui_scale
* 50)
425 workhours_bar_slider_size
: IntProperty(name
="Workhours Bar Slider Size", default
=rating_ui_scale
* 30)
427 workhours_bar_x
: IntProperty(name
="Workhours Bar X", default
=rating_ui_scale
* (100 - 15))
428 workhours_bar_y
: IntProperty(name
="Workhours Bar Y", default
=rating_ui_scale
* (45 - 15))
430 workhours_bar_x_max
: IntProperty(name
="Workhours Bar X Max", default
=rating_ui_scale
* (480 - 15))
432 dragging_rating
: BoolProperty(name
="Dragging Rating", default
=False)
433 dragging_rating_quality
: BoolProperty(name
="Dragging Rating Quality", default
=False)
434 dragging_rating_work_hours
: BoolProperty(name
="Dragging Rating Work Hours", default
=False)
435 last_rating_time
: FloatProperty(name
="Last Rating Time", default
=0.0)
437 hdr_upload_image
: PointerProperty(name
='Upload HDR',
438 type=bpy
.types
.Image
,
439 description
='Pick an image to upload')
443 # description="Active HDR image to upload",
447 def search_procedural_update(self
, context
):
448 if self
.search_procedural
in ('PROCEDURAL', 'BOTH'):
449 self
.search_texture_resolution
= False
450 search
.search_update(self
, context
)
453 class BlenderKitCommonSearchProps(object):
455 is_searching
: BoolProperty(name
="Searching", description
="search is currently running (internal)", default
=False)
456 is_downloading
: BoolProperty(name
="Downloading", description
="download is currently running (internal)",
458 search_done
: BoolProperty(name
="Search Completed", description
="at least one search did run (internal)",
460 own_only
: BoolProperty(name
="My Assets", description
="Search only for your assets",
461 default
=False, update
=search
.search_update
)
462 search_advanced
: BoolProperty(name
="Advanced Search Options", description
="use advanced search properties",
463 default
=False, update
=search
.search_update
)
465 search_error
: BoolProperty(name
="Search Error", description
="last search had an error", default
=False)
466 report
: StringProperty(
468 description
="errors and messages",
472 search_texture_resolution
: BoolProperty(name
="Texture Resolution",
473 description
="Span of the texture resolutions",
475 update
=search
.search_update
,
477 search_texture_resolution_min
: IntProperty(name
="Min Texture Resolution",
478 description
="Minimum texture resolution",
482 update
=search
.search_update
,
485 search_texture_resolution_max
: IntProperty(name
="Max Texture Resolution",
486 description
="Maximum texture resolution",
490 update
=search
.search_update
,
494 search_file_size
: BoolProperty(name
="File Size",
495 description
="Span of the file sizes",
497 update
=search
.search_update
,
499 search_file_size_min
: IntProperty(name
="Min File Size",
500 description
="Minimum file size",
504 update
=search
.search_update
,
507 search_file_size_max
: IntProperty(name
="Max File Size",
508 description
="Maximum file size",
512 update
=search
.search_update
,
515 search_procedural
: EnumProperty(
517 ('BOTH', 'Both', ''),
518 ('PROCEDURAL', 'Procedural', ''),
519 ('TEXTURE_BASED', 'Texture based', ''),
523 description
='Search only procedural/texture based assets',
524 update
=search_procedural_update
527 search_verification_status
: EnumProperty(
528 name
="Verification status",
529 description
="Search by verification status",
532 ('ALL', 'All', 'All'),
533 ('UPLOADING', 'Uploading', 'Uploading'),
534 ('UPLOADED', 'Uploaded', 'Uploaded'),
535 ('READY', 'Ready for V.', 'Ready for validation (deprecated since 2.8)'),
536 ('VALIDATED', 'Validated', 'Calidated'),
537 ('ON_HOLD', 'On Hold', 'On Hold'),
538 ('REJECTED', 'Rejected', 'Rejected'),
539 ('DELETED', 'Deleted', 'Deleted'),
542 update
=search
.search_update
,
545 # resolution download/import settings
546 resolution
: EnumProperty(
547 name
="Max resolution",
548 description
="Cap texture sizes in the file to this resolution",
551 # ('256', '256x256', ''),
552 ('512', '512x512', ''),
553 ('1024', '1024x1024', ''),
554 ('2048', '2048x2048', ''),
555 ('4096', '4096x4096', ''),
556 ('8192', '8192x8192', ''),
557 ('ORIGINAL', 'ORIGINAL FILE', ''),
562 free_only
: BoolProperty(name
="Free first", description
="Show free models first",
563 default
=False, update
=search
.search_update
)
565 unpack_files
: BoolProperty(name
="Unpack Files",
566 description
="Unpack files after download",
570 unrated_only
: BoolProperty(name
="Unrated only", description
="Show only unrated models",
571 default
=False, update
=search
.search_update
)
574 def name_update(self
, context
):
575 ''' checks for name change, because it decides if whole asset has to be re-uploaded. Name is stored in the blend file
576 and that's the reason.'''
582 def update_free(self
, context
):
583 if self
.is_free
== False:
585 ui_panels
.ui_message(title
= "All BlenderKit materials are free",
586 message
= "Any material uploaded to BlenderKit is free." \
587 " However, it can still earn money for the author," \
588 " based on our fair share system. " \
589 "Part of subscription is sent to artists based on usage by paying users.")
592 class BlenderKitCommonUploadProps(object):
594 name
="Asset Version Id",
595 description
="Unique name of the asset version(hidden)",
597 asset_base_id
: StringProperty(
598 name
="Asset Base Id",
599 description
="Unique name of the asset (hidden)",
601 name
: StringProperty(
603 description
="Main name of the asset",
607 # this is to store name for purpose of checking if name has changed.
608 name_old
: StringProperty(
610 description
="Old name of the asset",
614 description
: StringProperty(
616 description
="Description of the asset",
618 tags
: StringProperty(
620 description
="List of tags, separated by commas (optional)",
622 update
=utils
.update_tags
625 name_changed
: BoolProperty(name
="Name Changed",
626 description
="Name has changed, the asset has to be re-uploaded with all data",
629 pbr
: BoolProperty(name
="Pure PBR Compatible",
630 description
="Is compatible with PBR standard. This means only image textures are used with no"
631 " procedurals and no color correction, only pbr shader is used",
634 pbr_type
: EnumProperty(
637 description
="PBR type",
640 license
: EnumProperty(
641 items
=upload
.licenses
,
642 default
='royalty_free',
643 description
='License. Please read our help for choosing the right licenses',
646 is_private
: EnumProperty(
647 name
="Thumbnail Style",
649 ('PRIVATE', 'Private', "You asset will be hidden to public. The private assets are limited by a quota."),
650 ('PUBLIC', 'Public', '"Your asset will go into the validation process automatically')
652 description
="If not marked private, your asset will go into the validation process automatically\n"
653 "Private assets are limited by quota",
657 is_procedural
: BoolProperty(name
="Procedural",
658 description
="Asset is procedural - has no texture",
661 node_count
: IntProperty(name
="Node count", description
="Total nodes in the asset", default
=0)
662 texture_count
: IntProperty(name
="Texture count", description
="Total texture count in asset", default
=0)
663 total_megapixels
: IntProperty(name
="Megapixels", description
="Total megapixels of texture", default
=0)
665 # is_private: BoolProperty(name="Asset is Private",
666 # description="If not marked private, your asset will go into the validation process automatically\n"
667 # "Private assets are limited by quota",
670 is_free
: BoolProperty(name
="Free for Everyone",
671 description
="You consent you want to release this asset as free for everyone",
674 uploading
: BoolProperty(name
="Uploading",
675 description
="True when background process is running",
677 update
=autothumb
.update_upload_material_preview
)
678 upload_state
: StringProperty(
679 name
="State Of Upload",
680 description
="bg process reports for upload",
683 has_thumbnail
: BoolProperty(name
="Has Thumbnail", description
="True when thumbnail was checked and loaded",
686 thumbnail_generating_state
: StringProperty(
687 name
="Thumbnail Generating State",
688 description
="bg process reports for thumbnail generation",
689 default
='Please add thumbnail(jpg, at least 512x512)')
691 report
: StringProperty(
692 name
="Missing Upload Properties",
693 description
="used to write down what's missing",
696 category
: EnumProperty(
698 description
="main category to put into",
699 items
=categories
.get_category_enums
,
700 update
=categories
.update_category_enums
702 subcategory
: EnumProperty(
704 description
="Subcategory to put into",
705 items
=categories
.get_subcategory_enums
,
706 update
=categories
.update_subcategory_enums
708 subcategory1
: EnumProperty(
709 name
="Subcategory lvl2",
710 description
="Subcategory to put into",
711 items
=categories
.get_subcategory1_enums
715 class BlenderKitRatingProps(PropertyGroup
):
716 rating_quality
: IntProperty(name
="Quality",
717 description
="quality of the material",
720 update
=ratings
.update_ratings_quality
)
722 # the following enum is only to ease interaction - enums support 'drag over' and enable to draw the stars easily.
723 rating_quality_ui
: EnumProperty(name
='rating_quality_ui',
724 items
=ratings
.stars_enum_callback
,
725 description
='Rating stars 0 - 10',
727 update
=ratings
.update_quality_ui
,
730 rating_work_hours
: FloatProperty(name
="Work Hours",
731 description
="How many hours did this work take?",
733 min=0.0, max=150, update
=ratings
.update_ratings_work_hours
736 # rating_complexity: IntProperty(name="Complexity",
737 # description="Complexity is a number estimating how much work was spent on the asset.aaa",
738 # default=0, min=0, max=10)
739 # rating_virtual_price: FloatProperty(name="Virtual Price",
740 # description="How much would you pay for this object if buing it?",
741 # default=0, min=0, max=10000)
742 rating_problems
: StringProperty(
744 description
="Problems found/ why did you take points down - this will be available for the author"
745 " As short as possible",
748 rating_compliments
: StringProperty(
750 description
="Comliments - let the author know you like his work! "
751 " As short as possible",
756 class BlenderKitMaterialSearchProps(PropertyGroup
, BlenderKitCommonSearchProps
):
757 search_keywords
: StringProperty(
759 description
="Search for these keywords",
761 update
=search
.search_update
763 search_style
: EnumProperty(
765 items
=search_material_styles
,
766 description
="Style of material",
768 update
=search
.search_update
,
770 search_style_other
: StringProperty(
772 description
="Style not in the list",
774 update
=search
.search_update
,
776 search_engine
: EnumProperty(
780 description
='Output engine',
781 update
=search
.search_update
,
783 search_engine_other
: StringProperty(
785 description
="engine not specified by addon",
787 update
=search
.search_update
,
789 append_method
: EnumProperty(
790 name
="Import Method",
792 ('LINK', 'Link', "Link Material - will be in external file and can't be directly edited"),
793 ('APPEND', 'Append', 'Append if you need to edit the material'),
795 description
="Appended materials are editable in your scene. Linked assets are saved in original files, "
796 "aren't editable directly, but also don't increase your file size",
799 automap
: BoolProperty(name
="Auto-Map",
800 description
="reset object texture space and also add automatically a cube mapped UV "
801 "to the object. \n this allows most materials to apply instantly to any mesh",
805 class BlenderKitMaterialUploadProps(PropertyGroup
, BlenderKitCommonUploadProps
):
808 items
=material_styles
,
809 description
="Style of material",
812 style_other
: StringProperty(
814 description
="Style not in the list",
817 engine
: EnumProperty(
821 description
='Output engine',
823 engine_other
: StringProperty(
825 description
="engine not specified by addon",
829 shaders
: StringProperty(
831 description
="shaders used in asset, autofilled",
835 is_free
: BoolProperty(name
="Free for Everyone",
836 description
="You consent you want to release this asset as free for everyone",
837 default
=True, update
=update_free
840 uv
: BoolProperty(name
="Needs UV", description
="needs an UV set", default
=False)
841 # printable_3d : BoolProperty( name = "3d printable", description = "can be 3d printed", default = False)
842 animated
: BoolProperty(name
="Animated", description
="is animated", default
=False)
843 texture_resolution_min
: IntProperty(name
="Texture Resolution Min", description
="texture resolution minimum",
845 texture_resolution_max
: IntProperty(name
="Texture Resolution Max", description
="texture resolution maximum",
848 texture_size_meters
: FloatProperty(name
="Texture Size in Meters", description
="face count, autofilled",
851 thumbnail_scale
: FloatProperty(name
="Thumbnail Object Size",
852 description
="size of material preview object in meters "
853 "- change for materials that look better at sizes different than 1m",
854 default
=1, min=0.00001, max=10)
855 thumbnail_background
: BoolProperty(name
="Thumbnail Background (for Glass only)",
856 description
="For refractive materials, you might need a background. "
857 "Don't use if thumbnail looks good without it!",
859 thumbnail_background_lightness
: FloatProperty(name
="Thumbnail Background Lightness",
860 description
="set to make your material stand out", default
=.9,
862 thumbnail_samples
: IntProperty(name
="Cycles Samples",
863 description
="cycles samples setting", default
=150,
865 thumbnail_denoising
: BoolProperty(name
="Use Denoising",
866 description
="Use denoising", default
=True)
867 adaptive_subdivision
: BoolProperty(name
="Adaptive Subdivide",
868 description
="Use adaptive displacement subdivision", default
=False)
870 thumbnail_resolution
: EnumProperty(
872 items
=thumbnail_resolutions
,
873 description
="Thumbnail resolution",
877 thumbnail_generator_type
: EnumProperty(
878 name
="Thumbnail Style",
880 ('BALL', 'Ball', ""),
881 ('BALL_COMPLEX', 'Ball complex', 'Complex ball to highlight edgewear or material thickness'),
882 ('FLUID', 'Fluid', 'Fluid'),
883 ('CLOTH', 'Cloth', 'Cloth'),
884 ('HAIR', 'Hair', 'Hair ')
886 description
="Style of asset",
890 thumbnail
: StringProperty(
892 description
="Path to the thumbnail - 512x512 .jpg image",
895 update
=autothumb
.update_upload_material_preview
)
897 is_generating_thumbnail
: BoolProperty(name
="Generating Thumbnail",
898 description
="True when background process is running", default
=False,
899 update
=autothumb
.update_upload_material_preview
)
902 class BlenderKitTextureUploadProps(PropertyGroup
, BlenderKitCommonUploadProps
):
905 items
=material_styles
,
906 description
="Style of texture",
909 style_other
: StringProperty(
911 description
="Style not in the list",
915 pbr
: BoolProperty(name
="PBR Compatible", description
="Is compatible with PBR standard", default
=False)
917 # printable_3d : BoolProperty( name = "3d printable", description = "can be 3d printed", default = False)
918 animated
: BoolProperty(name
="Animated", description
="is animated", default
=False)
919 resolution
: IntProperty(name
="Texture Resolution", description
="texture resolution", default
=0)
922 class BlenderKitBrushSearchProps(PropertyGroup
, BlenderKitCommonSearchProps
):
923 search_keywords
: StringProperty(
925 description
="Search for these keywords",
927 update
=search
.search_update
931 class BlenderKitHDRUploadProps(PropertyGroup
, BlenderKitCommonUploadProps
):
932 texture_resolution_max
: IntProperty(name
="Texture Resolution Max", description
="texture resolution maximum",
935 class BlenderKitBrushUploadProps(PropertyGroup
, BlenderKitCommonUploadProps
):
939 ('IMAGE', 'Texture paint', "Texture brush"),
940 ('SCULPT', 'Sculpt', 'Sculpt brush'),
941 ('VERTEX', 'Vertex paint', 'Vertex paint brush'),
942 ('WEIGHT', 'Weight paint', 'Weight paint brush'),
944 description
="Mode where the brush works",
950 class BlenderKitModelUploadProps(PropertyGroup
, BlenderKitCommonUploadProps
):
954 description
="Style of asset",
957 style_other
: StringProperty(
959 description
="Style not in the list",
962 engine
: EnumProperty(
966 description
='Output engine',
969 production_level
: EnumProperty(
970 name
='Production Level',
972 ('FINISHED', 'Finished', 'Render or animation ready asset'),
973 ('TEMPLATE', 'Template', 'Asset intended to help in creation of something else'),
976 description
='Production state of the asset, \n also template should be actually finished, \n'
977 'just the nature of it can be a template, like a thumbnailer scene, \n '
978 'finished mesh topology as start for modelling or similar',
981 engine_other
: StringProperty(
983 description
="engine not specified by addon",
987 engine1
: EnumProperty(
991 description
='Output engine',
993 engine2
: EnumProperty(
997 description
='Output engine',
999 engine3
: EnumProperty(
1003 description
='Output engine',
1006 manufacturer
: StringProperty(
1007 name
="Manufacturer",
1008 description
="Manufacturer, company making a design peace or product. Not you",
1012 designer
: StringProperty(
1014 description
="Author of the original design piece depicted. Usually not you",
1018 design_collection
: StringProperty(
1019 name
="Design Collection",
1020 description
="Fill if this piece is part of a real world design collection",
1024 design_variant
: StringProperty(
1026 description
="Colour or material variant of the product",
1030 thumbnail
: StringProperty(
1032 description
="Path to the thumbnail - 512x512 .jpg image",
1033 subtype
='FILE_PATH',
1035 update
=autothumb
.update_upload_model_preview
)
1037 thumbnail_background_lightness
: FloatProperty(name
="Thumbnail Background Lightness",
1038 description
="set to make your material stand out", default
=1.0,
1041 thumbnail_angle
: EnumProperty(
1042 name
='Thumbnail Angle',
1043 items
=thumbnail_angles
,
1045 description
='thumbnailer angle',
1048 thumbnail_snap_to
: EnumProperty(
1049 name
='Model Snaps To:',
1050 items
=thumbnail_snap
,
1052 description
='typical placing of the interior. Leave on ground for most objects that respect gravity :)',
1055 thumbnail_resolution
: EnumProperty(
1057 items
=thumbnail_resolutions
,
1058 description
="Thumbnail resolution",
1062 thumbnail_samples
: IntProperty(name
="Cycles Samples",
1063 description
="cycles samples setting", default
=200,
1065 thumbnail_denoising
: BoolProperty(name
="Use Denoising",
1066 description
="Use denoising", default
=True)
1068 use_design_year
: BoolProperty(name
="Use Design Year",
1069 description
="When this thing came into world for the first time\n"
1070 " e.g. for dinosaur, you set -240 million years ;) ",
1072 design_year
: IntProperty(name
="Design Year", description
="when was this item designed", default
=1960)
1073 # use_age : BoolProperty( name = "use item age", description = "use item age", default = False)
1074 condition
: EnumProperty(
1076 default
='UNSPECIFIED',
1077 description
='age of the object',
1080 adult
: BoolProperty(name
="Adult Content", description
="adult content", default
=False)
1082 work_hours
: FloatProperty(name
="Work Hours", description
="How long did it take you to finish the asset?",
1083 default
=0.0, min=0.0, max=8760)
1085 modifiers
: StringProperty(
1086 name
="Modifiers Used",
1087 description
="if you need specific modifiers, autofilled",
1091 materials
: StringProperty(
1092 name
="Material Names",
1093 description
="names of materials in the file, autofilled",
1096 shaders
: StringProperty(
1097 name
="Shaders Used",
1098 description
="shaders used in asset, autofilled",
1102 dimensions
: FloatVectorProperty(
1104 description
="dimensions of the whole asset hierarchy",
1107 bbox_min
: FloatVectorProperty(
1109 description
="dimensions of the whole asset hierarchy",
1110 default
=(-.25, -.25, 0),
1112 bbox_max
: FloatVectorProperty(
1114 description
="dimensions of the whole asset hierarchy",
1115 default
=(.25, .25, .5),
1118 texture_resolution_min
: IntProperty(name
="Texture Resolution Min",
1119 description
="texture resolution min, autofilled", default
=0)
1120 texture_resolution_max
: IntProperty(name
="Texture Resolution Max",
1121 description
="texture resolution max, autofilled", default
=0)
1123 pbr
: BoolProperty(name
="PBR Compatible", description
="Is compatible with PBR standard", default
=False)
1125 uv
: BoolProperty(name
="Has UV", description
="has an UV set", default
=False)
1126 # printable_3d : BoolProperty( name = "3d printable", description = "can be 3d printed", default = False)
1127 animated
: BoolProperty(name
="Animated", description
="is animated", default
=False)
1128 face_count
: IntProperty(name
="Face count", description
="face count, autofilled", default
=0)
1129 face_count_render
: IntProperty(name
="Render Face Count", description
="render face count, autofilled", default
=0)
1131 object_count
: IntProperty(name
="Number of Objects", description
="how many objects are in the asset, autofilled",
1133 mesh_poly_type
: EnumProperty(
1134 name
='Dominant Poly Type',
1135 items
=mesh_poly_types
,
1140 manifold
: BoolProperty(name
="Manifold", description
="asset is manifold, autofilled", default
=False)
1142 rig
: BoolProperty(name
="Rig", description
="asset is rigged, autofilled", default
=False)
1143 simulation
: BoolProperty(name
="Simulation", description
="asset uses simulation, autofilled", default
=False)
1145 filepath : StringProperty(
1147 description="file path",
1153 is_generating_thumbnail
: BoolProperty(name
="Generating Thumbnail",
1154 description
="True when background process is running", default
=False,
1155 update
=autothumb
.update_upload_model_preview
)
1157 has_autotags
: BoolProperty(name
="Has Autotagging Done", description
="True when autotagging done", default
=False)
1160 class BlenderKitSceneUploadProps(PropertyGroup
, BlenderKitCommonUploadProps
):
1161 style
: EnumProperty(
1164 description
="Style of asset",
1165 default
="REALISTIC",
1167 style_other
: StringProperty(
1169 description
="Style not in the list",
1172 engine
: EnumProperty(
1176 description
='Output engine',
1179 production_level
: EnumProperty(
1180 name
='Production Level',
1182 ('FINISHED', 'Finished', 'Render or animation ready asset'),
1183 ('TEMPLATE', 'Template', 'Asset intended to help in creation of something else'),
1186 description
='Production state of the asset, \n also template should be actually finished, \n'
1187 'just the nature of it can be a template, like a thumbnailer scene, \n '
1188 'finished mesh topology as start for modelling or similar',
1191 engine_other
: StringProperty(
1193 description
="engine not specified by addon",
1197 engine1
: EnumProperty(
1201 description
='Output engine',
1203 engine2
: EnumProperty(
1207 description
='Output engine',
1209 engine3
: EnumProperty(
1213 description
='Output engine',
1216 thumbnail
: StringProperty(
1218 description
="Path to the thumbnail - 512x512 .jpg image",
1219 subtype
='FILE_PATH',
1221 update
=autothumb
.update_upload_scene_preview
)
1223 use_design_year
: BoolProperty(name
="Use Design Year",
1224 description
="When this thing came into world for the first time\n"
1225 " e.g. for dinosaur, you set -240 million years ;) ",
1227 design_year
: IntProperty(name
="Design Year", description
="when was this item designed", default
=1960)
1228 # use_age : BoolProperty( name = "use item age", description = "use item age", default = False)
1229 condition
: EnumProperty(
1231 default
='UNSPECIFIED',
1232 description
='age of the object',
1235 adult
: BoolProperty(name
="Adult Content", description
="adult content", default
=False)
1237 work_hours
: FloatProperty(name
="Work Hours", description
="How long did it take you to finish the asset?",
1238 default
=0.0, min=0.0, max=8760)
1240 modifiers
: StringProperty(
1241 name
="Modifiers Used",
1242 description
="if you need specific modifiers, autofilled",
1246 materials
: StringProperty(
1247 name
="Material Names",
1248 description
="names of materials in the file, autofilled",
1251 shaders
: StringProperty(
1252 name
="Shaders Used",
1253 description
="shaders used in asset, autofilled",
1257 dimensions
: FloatVectorProperty(
1259 description
="dimensions of the whole asset hierarchy",
1262 bbox_min
: FloatVectorProperty(
1264 description
="dimensions of the whole asset hierarchy",
1265 default
=(-.25, -.25, 0),
1267 bbox_max
: FloatVectorProperty(
1269 description
="dimensions of the whole asset hierarchy",
1270 default
=(.25, .25, .5),
1273 texture_resolution_min
: IntProperty(name
="Texture Resolution Min",
1274 description
="texture resolution min, autofilled", default
=0)
1275 texture_resolution_max
: IntProperty(name
="Texture Resolution Max",
1276 description
="texture resolution max, autofilled", default
=0)
1278 pbr
: BoolProperty(name
="PBR Compatible", description
="Is compatible with PBR standard", default
=False)
1280 uv
: BoolProperty(name
="Has UV", description
="has an UV set", default
=False)
1281 # printable_3d : BoolProperty( name = "3d printable", description = "can be 3d printed", default = False)
1282 animated
: BoolProperty(name
="Animated", description
="is animated", default
=False)
1283 face_count
: IntProperty(name
="Face Count", description
="face count, autofilled", default
=0)
1284 face_count_render
: IntProperty(name
="Render Face Count", description
="render face count, autofilled", default
=0)
1286 object_count
: IntProperty(name
="Number of Objects", description
="how many objects are in the asset, autofilled",
1288 mesh_poly_type
: EnumProperty(
1289 name
='Dominant Poly Type',
1290 items
=mesh_poly_types
,
1295 rig
: BoolProperty(name
="Rig", description
="asset is rigged, autofilled", default
=False)
1296 simulation
: BoolProperty(name
="Simulation", description
="asset uses simulation, autofilled", default
=False)
1299 is_generating_thumbnail
: BoolProperty(name
="Generating Thumbnail",
1300 description
="True when background process is running", default
=False,
1301 update
=autothumb
.update_upload_model_preview
)
1303 has_autotags
: BoolProperty(name
="Has Autotagging Done", description
="True when autotagging done", default
=False)
1306 class BlenderKitModelSearchProps(PropertyGroup
, BlenderKitCommonSearchProps
):
1307 search_keywords
: StringProperty(
1309 description
="Search for these keywords",
1311 update
=search
.search_update
1313 search_style
: EnumProperty(
1315 items
=search_model_styles
,
1316 description
="Keywords defining style (realistic, painted, polygonal, other)",
1318 update
=search
.search_update
1320 search_style_other
: StringProperty(
1322 description
="Search style - other",
1324 update
=search
.search_update
1326 search_engine
: EnumProperty(
1329 description
='Output engine',
1330 update
=search
.search_update
1332 search_engine_other
: StringProperty(
1334 description
="Engine not specified by addon",
1336 update
=search
.search_update
1341 search_condition
: EnumProperty(
1343 default
='UNSPECIFIED',
1344 description
='Condition of the object',
1345 update
=search
.search_update
1348 search_adult
: BoolProperty(
1349 name
="Adult Content",
1350 description
="You're adult and agree with searching adult content",
1352 update
=search
.search_update
1356 search_design_year
: BoolProperty(name
="Sesigned in Year",
1357 description
="When the object was approximately designed",
1359 update
=search
.search_update
,
1362 search_design_year_min
: IntProperty(name
="Minimum Design Year",
1363 description
="Minimum design year",
1364 default
=1950, min=-100000000, max=1000000000,
1365 update
=search
.search_update
,
1368 search_design_year_max
: IntProperty(name
="Maximum Design Year",
1369 description
="Maximum design year",
1373 update
=search
.search_update
,
1377 search_polycount
: BoolProperty(name
="Use Polycount",
1378 description
="Use polycount of object search tag",
1380 update
=search
.search_update
, )
1382 search_polycount_min
: IntProperty(name
="Min Polycount",
1383 description
="Minimum poly count of the asset",
1387 update
=search
.search_update
, )
1389 search_polycount_max
: IntProperty(name
="Max Polycount",
1390 description
="Maximum poly count of the asset",
1394 update
=search
.search_update
,
1397 append_method
: EnumProperty(
1398 name
="Import Method",
1400 ('LINK_COLLECTION', 'Link', 'Link Collection'),
1401 ('APPEND_OBJECTS', 'Append', 'Append as Objects'),
1403 description
="Appended objects are editable in your scene. Linked assets are saved in original files, "
1404 "aren't editable but also don't increase your file size",
1405 default
="APPEND_OBJECTS"
1407 append_link
: EnumProperty(
1408 name
="How to Attach",
1410 ('LINK', 'Link', ''),
1411 ('APPEND', 'Append', ''),
1413 description
="choose if the assets will be linked or appended",
1416 import_as
: EnumProperty(
1419 ('GROUP', 'group', ''),
1420 ('INDIVIDUAL', 'objects', ''),
1423 description
="choose if the assets will be linked or appended",
1426 randomize_rotation
: BoolProperty(name
='Randomize Rotation',
1427 description
="randomize rotation at placement",
1429 randomize_rotation_amount
: FloatProperty(name
="Randomization Max Angle",
1430 description
="maximum angle for random rotation",
1431 default
=math
.pi
/ 36,
1435 offset_rotation_amount
: FloatProperty(name
="Offset Rotation",
1436 description
="offset rotation, hidden prop",
1441 offset_rotation_step
: FloatProperty(name
="Offset Rotation Step",
1442 description
="offset rotation, hidden prop",
1443 default
=math
.pi
/ 2,
1448 perpendicular_snap
: BoolProperty(name
='Perpendicular snap',
1449 description
="Limit snapping that is close to perpendicular angles to be perpendicular",
1452 perpendicular_snap_threshold
: FloatProperty(name
="Threshold",
1453 description
="Limit perpendicular snap to be below these values",
1460 class BlenderKitHDRSearchProps(PropertyGroup
, BlenderKitCommonSearchProps
):
1461 search_keywords
: StringProperty(
1463 description
="Search for these keywords",
1465 update
=search
.search_update
1469 class BlenderKitSceneSearchProps(PropertyGroup
, BlenderKitCommonSearchProps
):
1470 search_keywords
: StringProperty(
1472 description
="Search for these keywords",
1474 update
=search
.search_update
1476 search_style
: EnumProperty(
1478 items
=search_model_styles
,
1479 description
="keywords defining style (realistic, painted, polygonal, other)",
1481 update
=search
.search_update
1483 search_style_other
: StringProperty(
1485 description
="Search style - other",
1487 update
=search
.search_update
1489 search_engine
: EnumProperty(
1492 description
='Output engine',
1493 update
=search
.search_update
1495 search_engine_other
: StringProperty(
1497 description
="engine not specified by addon",
1499 update
=search
.search_update
1501 append_link
: EnumProperty(
1502 name
="Append or link",
1504 ('LINK', 'Link', ''),
1505 ('APPEND', 'Append', ''),
1507 description
="choose if the scene will be linked or appended",
1510 switch_after_append
: BoolProperty(
1511 name
= 'Switch to scene after download',
1515 def fix_subdir(self
, context
):
1516 '''Fixes project subdicrectory settings if people input invalid path.'''
1518 # pp = pathlib.PurePath(self.project_subdir)
1519 pp
= self
.project_subdir
[:]
1520 pp
= pp
.replace('\\', '')
1521 pp
= pp
.replace('/', '')
1522 pp
= pp
.replace(':', '')
1524 if self
.project_subdir
!= pp
:
1525 self
.project_subdir
= pp
1527 ui_panels
.ui_message(title
= "Fixed to relative path",
1528 message
= "This path should be always realative.\n" \
1529 " It's a directory BlenderKit creates where your .blend is \n " \
1530 "and uses it for storing assets.")
1534 class BlenderKitAddonPreferences(AddonPreferences
):
1535 # this must match the addon name, use '__package__'
1536 # when defining this in a submodule of a python package.
1537 bl_idname
= __name__
1539 default_global_dict
= paths
.default_global_dict()
1543 api_key
: StringProperty(
1544 name
="BlenderKit API Key",
1545 description
="Your blenderkit API Key. Get it from your page on the website",
1548 update
=utils
.save_prefs
1551 api_key_refresh
: StringProperty(
1552 name
="BlenderKit refresh API Key",
1553 description
="API key used to refresh the token regularly",
1558 api_key_timeout
: IntProperty(
1559 name
='api key timeout',
1560 description
='time where the api key will need to be refreshed',
1564 api_key_life
: IntProperty(
1565 name
='api key life time',
1566 description
='maximum lifetime of the api key, in seconds',
1570 refresh_in_progress
: BoolProperty(
1571 name
="Api key refresh in progress",
1572 description
="Api key is currently being refreshed. Don't refresh it again",
1576 login_attempt
: BoolProperty(
1577 name
="Login/Signup attempt",
1578 description
="When this is on, BlenderKit is trying to connect and login",
1582 show_on_start
: BoolProperty(
1583 name
="Show assetbar when starting blender",
1584 description
="Show assetbar when starting blender",
1588 tips_on_start
: BoolProperty(
1589 name
="Show tips when starting blender",
1590 description
="Show tips when starting blender",
1594 search_in_header
: BoolProperty(
1595 name
="Show BlenderKit search in 3D view header",
1596 description
="Show BlenderKit search in 3D view header",
1600 global_dir
: StringProperty(
1601 name
="Global Files Directory",
1602 description
="Global storage for your assets, will use subdirectories for the contents",
1604 default
=default_global_dict
,
1605 update
=utils
.save_prefs
1608 project_subdir
: StringProperty(
1609 name
="Project Assets Subdirectory",
1610 description
="where data will be stored for individual projects",
1611 # subtype='DIR_PATH',
1616 directory_behaviour
: EnumProperty(
1617 name
="Use Directories",
1619 ('BOTH', 'Global and subdir',
1620 'store files both in global lib and subdirectory of current project. '
1621 'Warning - each file can be many times on your harddrive, but helps you keep your projects in one piece'),
1622 ('GLOBAL', 'Global',
1623 "store downloaded files only in global directory. \n "
1624 "This can bring problems when moving your projects, \n"
1625 "since assets won't be in subdirectory of current project"),
1627 'store downloaded files only in local directory.\n'
1628 ' This can use more bandwidth when you reuse assets in different projects. ')
1631 description
="Which directories will be used for storing downloaded data",
1634 thumbnail_use_gpu
: BoolProperty(
1635 name
="Use GPU for Thumbnails Rendering",
1636 description
="By default this is off so you can continue your work without any lag",
1640 panel_behaviour
: EnumProperty(
1641 name
="Panels Locations",
1643 ('BOTH', 'Both Types',
1645 ('UNIFIED', 'Unified 3D View Panel',
1647 ('LOCAL', 'Relative to Data',
1651 description
="Which directories will be used for storing downloaded data",
1655 max_assetbar_rows
: IntProperty(name
="Max Assetbar Rows",
1656 description
="max rows of assetbar in the 3D view",
1661 thumb_size
: IntProperty(name
="Assetbar thumbnail Size", default
=96, min=-1, max=256)
1663 asset_counter
: IntProperty(name
="Usage Counter",
1664 description
="Counts usages so it asks for registration only after reaching a limit",
1669 # this is now made obsolete by the new popup upon registration -ensures the user knows about the first search.
1670 # first_run: BoolProperty(
1672 # description="Detects if addon was already registered/run.",
1674 # update=utils.save_prefs
1677 use_timers
: BoolProperty(
1679 description
="Use timers for BlenderKit. Usefull for debugging since timers seem to be unstable",
1681 update
=utils
.save_prefs
1684 experimental_features
: BoolProperty(
1685 name
="Enable experimental features",
1686 description
="Enable all experimental features of BlenderKit. Use at your own risk.",
1688 update
=utils
.save_prefs
1690 # allow_proximity : BoolProperty(
1691 # name="allow proximity data reports",
1692 # description="This sends anonymized proximity data \n \
1693 # and allows us to make relations between database objects \n \
1694 # without user interaction",
1698 def draw(self
, context
):
1699 layout
= self
.layout
1700 layout
.prop(self
, "show_on_start")
1702 if self
.api_key
.strip() == '':
1703 if self
.enable_oauth
:
1704 ui_panels
.draw_login_buttons(layout
)
1706 op
= layout
.operator("wm.url_open", text
="Register online and get your API Key",
1708 op
.url
= paths
.BLENDERKIT_SIGNUP_URL
1710 if self
.enable_oauth
:
1711 layout
.operator("wm.blenderkit_logout", text
="Logout",
1714 # if not self.enable_oauth:
1715 layout
.prop(self
, "api_key", text
='Your API Key')
1716 # layout.label(text='After you paste API Key, categories are downloaded, so blender will freeze for a few seconds.')
1717 layout
.prop(self
, "global_dir")
1718 layout
.prop(self
, "project_subdir")
1719 # layout.prop(self, "temp_dir")
1720 layout
.prop(self
, "directory_behaviour")
1721 layout
.prop(self
, "thumbnail_use_gpu")
1722 # layout.prop(self, "allow_proximity")
1723 # layout.prop(self, "panel_behaviour")
1724 layout
.prop(self
, "thumb_size")
1725 layout
.prop(self
, "max_assetbar_rows")
1726 layout
.prop(self
, "tips_on_start")
1727 layout
.prop(self
, "search_in_header")
1728 if bpy
.context
.preferences
.view
.show_developer_ui
:
1729 layout
.prop(self
, "use_timers")
1730 layout
.prop(self
, "experimental_features")
1736 BlenderKitAddonPreferences
,
1739 BlenderKitModelSearchProps
,
1740 BlenderKitModelUploadProps
,
1742 BlenderKitSceneSearchProps
,
1743 BlenderKitSceneUploadProps
,
1745 BlenderKitHDRSearchProps
,
1746 BlenderKitHDRUploadProps
,
1748 BlenderKitMaterialUploadProps
,
1749 BlenderKitMaterialSearchProps
,
1751 BlenderKitTextureUploadProps
,
1753 BlenderKitBrushSearchProps
,
1754 BlenderKitBrushUploadProps
,
1756 BlenderKitRatingProps
,
1762 bpy
.utils
.register_class(cls
)
1764 bpy
.types
.Scene
.blenderkitUI
= PointerProperty(
1765 type=BlenderKitUIProps
)
1768 bpy
.types
.Scene
.blenderkit_models
= PointerProperty(
1769 type=BlenderKitModelSearchProps
)
1770 bpy
.types
.Object
.blenderkit
= PointerProperty( # for uploads, not now...
1771 type=BlenderKitModelUploadProps
)
1772 bpy
.types
.Object
.bkit_ratings
= PointerProperty( # for uploads, not now...
1773 type=BlenderKitRatingProps
)
1776 bpy
.types
.Scene
.blenderkit_scene
= PointerProperty(
1777 type=BlenderKitSceneSearchProps
)
1778 bpy
.types
.Scene
.blenderkit
= PointerProperty( # for uploads, not now...
1779 type=BlenderKitSceneUploadProps
)
1780 bpy
.types
.Scene
.bkit_ratings
= PointerProperty( # for uploads, not now...
1781 type=BlenderKitRatingProps
)
1784 bpy
.types
.Scene
.blenderkit_HDR
= PointerProperty(
1785 type=BlenderKitHDRSearchProps
)
1786 bpy
.types
.Image
.blenderkit
= PointerProperty( # for uploads, not now...
1787 type=BlenderKitHDRUploadProps
)
1788 bpy
.types
.Image
.bkit_ratings
= PointerProperty( # for uploads, not now...
1789 type=BlenderKitRatingProps
)
1792 bpy
.types
.Scene
.blenderkit_mat
= PointerProperty(
1793 type=BlenderKitMaterialSearchProps
)
1794 bpy
.types
.Material
.blenderkit
= PointerProperty( # for uploads, not now...
1795 type=BlenderKitMaterialUploadProps
)
1796 bpy
.types
.Material
.bkit_ratings
= PointerProperty( # for uploads, not now...
1797 type=BlenderKitRatingProps
)
1800 bpy
.types
.Scene
.blenderkit_brush
= PointerProperty(
1801 type=BlenderKitBrushSearchProps
)
1802 bpy
.types
.Brush
.blenderkit
= PointerProperty( # for uploads, not now...
1803 type=BlenderKitBrushUploadProps
)
1804 bpy
.types
.Brush
.bkit_ratings
= PointerProperty( # for uploads, not now...
1805 type=BlenderKitRatingProps
)
1807 search
.register_search()
1808 asset_inspector
.register_asset_inspector()
1809 download
.register_download()
1810 upload
.register_upload()
1811 ratings
.register_ratings()
1812 autothumb
.register_thumbnailer()
1814 icons
.register_icons()
1815 ui_panels
.register_ui_panels()
1816 bg_blender
.register()
1818 overrides
.register_overrides()
1819 bkit_oauth
.register()
1820 tasks_queue
.register()
1821 asset_bar_op
.register()
1823 user_preferences
= bpy
.context
.preferences
.addons
['blenderkit'].preferences
1824 if user_preferences
.use_timers
:
1825 bpy
.app
.timers
.register(check_timers_timer
, persistent
=True)
1827 bpy
.app
.handlers
.load_post
.append(scene_load
)
1828 # detect if the user just enabled the addon in preferences, thus enable to run
1829 for w
in bpy
.context
.window_manager
.windows
:
1830 for a
in w
.screen
.areas
:
1831 if a
.type == 'PREFERENCES':
1832 tasks_queue
.add_task((bpy
.ops
.wm
.blenderkit_welcome
, ('INVOKE_DEFAULT',)), fake_context
=True,
1833 fake_context_area
='PREFERENCES')
1837 if bpy
.app
.timers
.is_registered(check_timers_timer
):
1838 bpy
.app
.timers
.unregister(check_timers_timer
)
1839 ui_panels
.unregister_ui_panels()
1842 icons
.unregister_icons()
1843 search
.unregister_search()
1844 asset_inspector
.unregister_asset_inspector()
1845 download
.unregister_download()
1846 upload
.unregister_upload()
1847 ratings
.unregister_ratings()
1848 autothumb
.unregister_thumbnailer()
1849 bg_blender
.unregister()
1850 overrides
.unregister_overrides()
1851 bkit_oauth
.unregister()
1852 tasks_queue
.unregister()
1853 asset_bar_op
.unregister()
1855 del bpy
.types
.Scene
.blenderkit_models
1856 del bpy
.types
.Scene
.blenderkit_scene
1857 del bpy
.types
.Scene
.blenderkit_HDR
1858 del bpy
.types
.Scene
.blenderkit_brush
1859 del bpy
.types
.Scene
.blenderkit_mat
1861 del bpy
.types
.Scene
.blenderkit
1862 del bpy
.types
.Object
.blenderkit
1863 del bpy
.types
.Image
.blenderkit
1864 del bpy
.types
.Material
.blenderkit
1865 del bpy
.types
.Brush
.blenderkit
1868 bpy
.utils
.unregister_class(cls
)
1870 bpy
.app
.handlers
.load_post
.remove(scene_load
)