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 if not bpy
.app
.background
:
142 search
.load_previews()
143 ui_props
= bpy
.context
.scene
.blenderkitUI
144 ui_props
.assetbar_on
= False
145 ui_props
.turn_off
= False
146 preferences
= bpy
.context
.preferences
.addons
['blenderkit'].preferences
147 preferences
.login_attempt
= False
150 @bpy.app
.handlers
.persistent
151 def check_timers_timer():
152 ''' checks if all timers are registered regularly. Prevents possible bugs from stopping the addon.'''
153 if not bpy
.app
.timers
.is_registered(search
.timer_update
):
154 bpy
.app
.timers
.register(search
.timer_update
)
155 if not bpy
.app
.timers
.is_registered(download
.timer_update
):
156 bpy
.app
.timers
.register(download
.timer_update
)
157 if not (bpy
.app
.timers
.is_registered(tasks_queue
.queue_worker
)):
158 bpy
.app
.timers
.register(tasks_queue
.queue_worker
)
159 if not bpy
.app
.timers
.is_registered(bg_blender
.bg_update
):
160 bpy
.app
.timers
.register(bg_blender
.bg_update
)
166 ('UNSPECIFIED', 'Unspecified', "Don't use this in search"),
167 ('NEW', 'New', 'Shiny new item'),
168 ('USED', 'Used', 'Casually used item'),
169 ('OLD', 'Old', 'Old item'),
170 ('DESOLATE', 'Desolate', 'Desolate item - dusty & rusty'),
173 ('REALISTIC', 'Realistic', "photo realistic model"),
174 ('PAINTERLY', 'Painterly', 'hand painted with visible strokes, mostly for games'),
175 ('LOWPOLY', 'Lowpoly', "Lowpoly art -don't mix up with polycount!"),
176 ('ANIME', 'Anime', 'Anime style'),
177 ('2D_VECTOR', '2D Vector', '2D vector'),
178 ('3D_GRAPHICS', '3D Graphics', '3D graphics'),
179 ('OTHER', 'Other', 'Other style'),
181 search_model_styles
= (
182 ('REALISTIC', 'Realistic', "photo realistic model"),
183 ('PAINTERLY', 'Painterly', 'hand painted with visible strokes, mostly for games'),
184 ('LOWPOLY', 'Lowpoly', "Lowpoly art -don't mix up with polycount!"),
185 ('ANIME', 'Anime', 'Anime style'),
186 ('2D_VECTOR', '2D Vector', '2D vector'),
187 ('3D_GRAPHICS', '3D Graphics', '3D graphics'),
188 ('OTHER', 'Other', 'Other Style'),
189 ('ANY', 'Any', 'Any Style'),
192 ('REALISTIC', 'Realistic', "photo realistic model"),
193 ('NPR', 'Non photorealistic', 'hand painted with visible strokes, mostly for games'),
194 ('OTHER', 'Other', 'Other style'),
196 search_material_styles
= (
197 ('REALISTIC', 'Realistic', "photo realistic model"),
198 ('NPR', 'Non photorealistic', 'hand painted with visible strokes, mostly for games'),
199 ('ANY', 'Any', 'Any'),
202 ('CYCLES', 'Cycles', 'blender cycles pathtracer'),
203 ('EEVEE', 'Eevee', 'blender eevee renderer'),
204 ('OCTANE', 'Octane', 'octane render enginge'),
205 ('ARNOLD', 'Arnold', 'arnold render engine'),
206 ('V-RAY', 'V-Ray', 'V-Ray renderer'),
207 ('UNREAL', 'Unreal', 'Unreal engine'),
208 ('UNITY', 'Unity', 'Unity engine'),
209 ('GODOT', 'Godot', 'Godot engine'),
210 ('3D-PRINT', '3D printer', 'object can be 3D printed'),
211 ('OTHER', 'Other', 'any other engine'),
212 ('NONE', 'None', 'no more engine block'),
215 ('METALLIC', 'Metallic-Roughness', 'Metallic/Roughness PBR material type'),
216 ('SPECULAR', 'Specular Glossy', ''),
220 ('QUAD', 'quad', ''),
221 ('QUAD_DOMINANT', 'quad_dominant', ''),
222 ('TRI_DOMINANT', 'tri_dominant', ''),
224 ('NGON', 'ngon_dominant', ''),
225 ('OTHER', 'other', ''),
229 ('DEFAULT', 'default', ''),
230 ('FRONT', 'front', ''),
231 ('SIDE', 'side', ''),
236 ('GROUND', 'ground', ''),
237 ('WALL', 'wall', ''),
238 ('CEILING', 'ceiling', ''),
239 ('FLOAT', 'floating', ''),
242 thumbnail_resolutions
= (
244 ('512', '512 - minimum for public', ''),
245 ('1024', '1024', ''),
246 ('2048', '2048', ''),
249 def udate_down_up(self
, context
):
250 """Perform a search if results are empty."""
252 props
= s
.blenderkitUI
253 if s
['search results'] == None and props
.down_up
== 'SEARCH':
256 def switch_search_results(self
, context
):
257 s
= bpy
.context
.scene
258 props
= s
.blenderkitUI
259 if props
.asset_type
== 'MODEL':
260 s
['search results'] = s
.get('bkit model search')
261 s
['search results orig'] = s
.get('bkit model search orig')
262 elif props
.asset_type
== 'SCENE':
263 s
['search results'] = s
.get('bkit scene search')
264 s
['search results orig'] = s
.get('bkit scene search orig')
265 elif props
.asset_type
== 'HDR':
266 s
['search results'] = s
.get('bkit hdr search')
267 s
['search results orig'] = s
.get('bkit hdr search orig')
268 elif props
.asset_type
== 'MATERIAL':
269 s
['search results'] = s
.get('bkit material search')
270 s
['search results orig'] = s
.get('bkit material search orig')
271 elif props
.asset_type
== 'TEXTURE':
272 s
['search results'] = s
.get('bkit texture search')
273 s
['search results orig'] = s
.get('bkit texture search orig')
274 elif props
.asset_type
== 'BRUSH':
275 s
['search results'] = s
.get('bkit brush search')
276 s
['search results orig'] = s
.get('bkit brush search orig')
277 if not(context
.sculpt_object
or context
.image_paint_object
):
279 'Switch to paint or sculpt mode to search in BlenderKit brushes.')
281 search
.load_previews()
282 if s
['search results'] == None and props
.down_up
== 'SEARCH':
287 def asset_type_callback(self
, context
):
290 items for Enum property, depending on the down_up property - BlenderKit is either in search or in upload mode.
293 user_preferences
= bpy
.context
.preferences
.addons
['blenderkit'].preferences
295 if self
.down_up
== 'SEARCH':
297 ('MODEL', 'Models', 'Find models in the BlenderKit online database', 'OBJECT_DATAMODE', 0),
298 ('MATERIAL', 'Materials', 'Find materials in the BlenderKit online database', 'MATERIAL', 2),
299 # ('TEXTURE', 'Texture', 'Browse textures', 'TEXTURE', 3),
300 ('SCENE', 'Scenes', 'Browse scenes', 'SCENE_DATA', 3),
301 ('HDR', 'Hdrs', 'Browse hdrs', 'WORLD', 4),
302 ('BRUSH', 'Brushes', 'Find brushes in the BlenderKit online database', 'BRUSH_DATA', 5)
306 ('MODEL', 'Model', 'Upload a model to BlenderKit', 'OBJECT_DATAMODE', 0),
307 # ('SCENE', 'SCENE', 'Browse scenes', 'SCENE_DATA', 1),
308 ('MATERIAL', 'Material', 'Upload a material to BlenderKit', 'MATERIAL', 2),
309 # ('TEXTURE', 'Texture', 'Browse textures', 'TEXTURE', 3),
310 ('SCENE', 'Scenes', 'Browse scenes', 'SCENE_DATA', 3),
311 ('HDR', 'Hdrs', 'Browse hdrs', 'WORLD', 4),
312 ('BRUSH', 'Brush', 'Upload a brush to BlenderKit', 'BRUSH_DATA', 5)
318 class BlenderKitUIProps(PropertyGroup
):
319 down_up
: EnumProperty(
320 name
="Download vs Upload",
322 ('SEARCH', 'Search', 'Sctivate searching', 'VIEWZOOM', 0),
323 ('UPLOAD', 'Upload', 'Activate uploading', 'COPYDOWN', 1),
324 # ('RATING', 'Rating', 'Activate rating', 'SOLO_ON', 2)
326 description
="BLenderKit",
328 update
= udate_down_up
330 asset_type
: EnumProperty(
331 name
="BlenderKit Active Asset Type",
332 items
=asset_type_callback
,
333 description
="Activate asset in UI",
335 update
=switch_search_results
337 # these aren't actually used ( by now, seems to better use globals in UI module:
338 draw_tooltip
: BoolProperty(name
="Draw Tooltip", default
=False)
339 addon_update
: BoolProperty(name
="Should Update Addon", default
=False)
340 tooltip
: StringProperty(
342 description
="asset preview info",
350 thumb_size
: IntProperty(name
="Thumbnail Size", default
=thumb_size_def
, min=-1, max=256)
352 margin
: IntProperty(name
="Margin", default
=margin_def
, min=-1, max=256)
353 highlight_margin
: IntProperty(name
="Highlight Margin", default
=int(margin_def
/ 2), min=-10, max=256)
355 bar_height
: IntProperty(name
="Bar Height", default
=thumb_size_def
+ 2 * margin_def
, min=-1, max=2048)
356 bar_x_offset
: IntProperty(name
="Bar X Offset", default
=20, min=0, max=5000)
357 bar_y_offset
: IntProperty(name
="Bar Y Offset", default
=80, min=0, max=5000)
359 bar_x
: IntProperty(name
="Bar X", default
=100, min=0, max=5000)
360 bar_y
: IntProperty(name
="Bar Y", default
=100, min=50, max=5000)
361 bar_end
: IntProperty(name
="Bar End", default
=100, min=0, max=5000)
362 bar_width
: IntProperty(name
="Bar Width", default
=100, min=0, max=5000)
364 wcount
: IntProperty(name
="Width Count", default
=10, min=0, max=5000)
365 hcount
: IntProperty(name
="Rows", default
=5, min=0, max=5000)
367 reports_y
: IntProperty(name
="Reports Y", default
=5, min=0, max=5000)
368 reports_x
: IntProperty(name
="Reports X", default
=5, min=0, max=5000)
370 assetbar_on
: BoolProperty(name
="Assetbar On", default
=False)
371 turn_off
: BoolProperty(name
="Turn Off", default
=False)
373 mouse_x
: IntProperty(name
="Mouse X", default
=0)
374 mouse_y
: IntProperty(name
="Mouse Y", default
=0)
376 active_index
: IntProperty(name
="Active Index", default
=-3)
377 scrolloffset
: IntProperty(name
="Scroll Offset", default
=0)
378 drawoffset
: IntProperty(name
="Draw Offset", default
=0)
380 dragging
: BoolProperty(name
="Dragging", default
=False)
381 drag_init
: BoolProperty(name
="Drag Initialisation", default
=False)
382 drag_length
: IntProperty(name
="Drag length", default
=0)
383 draw_drag_image
: BoolProperty(name
="Draw Drag Image", default
=False)
384 draw_snapped_bounds
: BoolProperty(name
="Draw Snapped Bounds", default
=False)
386 snapped_location
: FloatVectorProperty(name
="Snapped Location", default
=(0, 0, 0))
387 snapped_bbox_min
: FloatVectorProperty(name
="Snapped Bbox Min", default
=(0, 0, 0))
388 snapped_bbox_max
: FloatVectorProperty(name
="Snapped Bbox Max", default
=(0, 0, 0))
389 snapped_normal
: FloatVectorProperty(name
="Snapped Normal", default
=(0, 0, 0))
391 snapped_rotation
: FloatVectorProperty(name
="Snapped Rotation", default
=(0, 0, 0), subtype
='QUATERNION')
393 has_hit
: BoolProperty(name
="has_hit", default
=False)
394 thumbnail_image
= StringProperty(
395 name
="Thumbnail Image",
397 default
=paths
.get_addon_thumbnail_path('thumbnail_notready.jpg'))
400 rating_ui_scale
= ui_scale
402 rating_button_on
: BoolProperty(name
="Rating Button On", default
=True)
403 rating_menu_on
: BoolProperty(name
="Rating Menu On", default
=False)
404 rating_on
: BoolProperty(name
="Rating on", default
=True)
406 rating_button_width
: IntProperty(name
="Rating Button Width", default
=50 * ui_scale
)
407 rating_button_height
: IntProperty(name
="Rating Button Height", default
=50 * ui_scale
)
409 rating_x
: IntProperty(name
="Rating UI X", default
=10)
410 rating_y
: IntProperty(name
="Rating UI Y", default
=10)
412 rating_ui_width
: IntProperty(name
="Rating UI Width", default
=rating_ui_scale
* 600)
413 rating_ui_height
: IntProperty(name
="Rating UI Heightt", default
=rating_ui_scale
* 256)
415 quality_stars_x
: IntProperty(name
="Rating UI Stars X", default
=rating_ui_scale
* 90)
416 quality_stars_y
: IntProperty(name
="Rating UI Stars Y", default
=rating_ui_scale
* 190)
418 star_size
: IntProperty(name
="Star Size", default
=rating_ui_scale
* 50)
420 workhours_bar_slider_size
: IntProperty(name
="Workhours Bar Slider Size", default
=rating_ui_scale
* 30)
422 workhours_bar_x
: IntProperty(name
="Workhours Bar X", default
=rating_ui_scale
* (100 - 15))
423 workhours_bar_y
: IntProperty(name
="Workhours Bar Y", default
=rating_ui_scale
* (45 - 15))
425 workhours_bar_x_max
: IntProperty(name
="Workhours Bar X Max", default
=rating_ui_scale
* (480 - 15))
427 dragging_rating
: BoolProperty(name
="Dragging Rating", default
=False)
428 dragging_rating_quality
: BoolProperty(name
="Dragging Rating Quality", default
=False)
429 dragging_rating_work_hours
: BoolProperty(name
="Dragging Rating Work Hours", default
=False)
430 last_rating_time
: FloatProperty(name
="Last Rating Time", default
=0.0)
432 hdr_upload_image
: PointerProperty(name
='Upload HDR',
433 type=bpy
.types
.Image
,
434 description
='Pick an image to upload')
438 # description="Active HDR image to upload",
442 def search_procedural_update(self
, context
):
443 if self
.search_procedural
in ('PROCEDURAL', 'BOTH'):
444 self
.search_texture_resolution
= False
445 search
.search_update(self
, context
)
448 class BlenderKitCommonSearchProps(object):
450 is_searching
: BoolProperty(name
="Searching", description
="search is currently running (internal)", default
=False)
451 is_downloading
: BoolProperty(name
="Downloading", description
="download is currently running (internal)",
453 search_done
: BoolProperty(name
="Search Completed", description
="at least one search did run (internal)",
455 own_only
: BoolProperty(name
="My Assets", description
="Search only for your assets",
456 default
=False, update
=search
.search_update
)
457 search_advanced
: BoolProperty(name
="Advanced Search Options", description
="use advanced search properties",
458 default
=False, update
=search
.search_update
)
460 search_error
: BoolProperty(name
="Search Error", description
="last search had an error", default
=False)
461 report
: StringProperty(
463 description
="errors and messages",
467 search_texture_resolution
: BoolProperty(name
="Texture Resolution",
468 description
="Span of the texture resolutions",
470 update
=search
.search_update
,
472 search_texture_resolution_min
: IntProperty(name
="Min Texture Resolution",
473 description
="Minimum texture resolution",
477 update
=search
.search_update
,
480 search_texture_resolution_max
: IntProperty(name
="Max Texture Resolution",
481 description
="Maximum texture resolution",
485 update
=search
.search_update
,
489 search_file_size
: BoolProperty(name
="File Size",
490 description
="Span of the file sizes",
492 update
=search
.search_update
,
494 search_file_size_min
: IntProperty(name
="Min File Size",
495 description
="Minimum file size",
499 update
=search
.search_update
,
502 search_file_size_max
: IntProperty(name
="Max File Size",
503 description
="Maximum file size",
507 update
=search
.search_update
,
510 search_procedural
: EnumProperty(
512 ('BOTH', 'Both', ''),
513 ('PROCEDURAL', 'Procedural', ''),
514 ('TEXTURE_BASED', 'Texture based', ''),
518 description
='Search only procedural/texture based assets',
519 update
=search_procedural_update
522 search_verification_status
: EnumProperty(
523 name
="Verification status",
524 description
="Search by verification status",
527 ('ALL', 'All', 'All'),
528 ('UPLOADING', 'Uploading', 'Uploading'),
529 ('UPLOADED', 'Uploaded', 'Uploaded'),
530 ('READY', 'Ready for V.', 'Ready for validation (deprecated since 2.8)'),
531 ('VALIDATED', 'Validated', 'Calidated'),
532 ('ON_HOLD', 'On Hold', 'On Hold'),
533 ('REJECTED', 'Rejected', 'Rejected'),
534 ('DELETED', 'Deleted', 'Deleted'),
537 update
=search
.search_update
,
540 # resolution download/import settings
541 resolution
: EnumProperty(
542 name
="Max resolution",
543 description
="Cap texture sizes in the file to this resolution",
546 # ('256', '256x256', ''),
547 ('512', '512x512', ''),
548 ('1024', '1024x1024', ''),
549 ('2048', '2048x2048', ''),
550 ('4096', '4096x4096', ''),
551 ('8192', '8192x8192', ''),
552 ('ORIGINAL', 'ORIGINAL FILE', ''),
557 free_only
: BoolProperty(name
="Free first", description
="Show free models first",
558 default
=False, update
=search
.search_update
)
560 unpack_files
: BoolProperty(name
="Unpack Files",
561 description
="Unpack files after download",
565 unrated_only
: BoolProperty(name
="Unrated only", description
="Show only unrated models",
566 default
=False, update
=search
.search_update
)
569 def name_update(self
, context
):
570 ''' checks for name change, because it decides if whole asset has to be re-uploaded. Name is stored in the blend file
571 and that's the reason.'''
577 def update_free(self
, context
):
578 if self
.is_free
== False:
580 title
= "All BlenderKit materials are free"
581 message
= "Any material uploaded to BlenderKit is free." \
582 " However, it can still earn money for the author," \
583 " based on our fair share system. " \
584 "Part of subscription is sent to artists based on usage by paying users."
586 def draw_message(self
, context
):
587 utils
.label_multiline(self
.layout
, text
=message
, icon
='NONE', width
=-1)
589 bpy
.context
.window_manager
.popup_menu(draw_message
, title
=title
, icon
='INFO')
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
="LINK_COLLECTION"
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
1503 def fix_subdir(self
, context
):
1504 '''Fixes project subdicrectory settings if people input invalid path.'''
1506 # pp = pathlib.PurePath(self.project_subdir)
1507 pp
= self
.project_subdir
[:]
1508 pp
= pp
.replace('\\', '')
1509 pp
= pp
.replace('/', '')
1510 pp
= pp
.replace(':', '')
1512 if self
.project_subdir
!= pp
:
1513 self
.project_subdir
= pp
1515 title
= "Fixed to relative path"
1516 message
= "This path should be always realative.\n" \
1517 " It's a directory BlenderKit creates where your .blend is \n " \
1518 "and uses it for storing assets."
1520 def draw_message(self
, context
):
1521 utils
.label_multiline(self
.layout
, text
=message
, icon
='NONE', width
=400)
1523 bpy
.context
.window_manager
.popup_menu(draw_message
, title
=title
, icon
='INFO')
1526 class BlenderKitAddonPreferences(AddonPreferences
):
1527 # this must match the addon name, use '__package__'
1528 # when defining this in a submodule of a python package.
1529 bl_idname
= __name__
1531 default_global_dict
= paths
.default_global_dict()
1535 api_key
: StringProperty(
1536 name
="BlenderKit API Key",
1537 description
="Your blenderkit API Key. Get it from your page on the website",
1540 update
=utils
.save_prefs
1543 api_key_refresh
: StringProperty(
1544 name
="BlenderKit refresh API Key",
1545 description
="API key used to refresh the token regularly.",
1550 api_key_timeout
: IntProperty(
1551 name
='api key timeout',
1552 description
='time where the api key will need to be refreshed',
1556 api_key_life
: IntProperty(
1557 name
='api key life time',
1558 description
='maximum lifetime of the api key, in seconds',
1562 refresh_in_progress
: BoolProperty(
1563 name
="Api key refresh in progress",
1564 description
="Api key is currently being refreshed. Don't refresh it again.",
1568 login_attempt
: BoolProperty(
1569 name
="Login/Signup attempt",
1570 description
="When this is on, BlenderKit is trying to connect and login",
1574 show_on_start
: BoolProperty(
1575 name
="Show assetbar when starting blender",
1576 description
="Show assetbar when starting blender",
1580 tips_on_start
: BoolProperty(
1581 name
="Show tips when starting blender",
1582 description
="Show tips when starting blender",
1586 search_in_header
: BoolProperty(
1587 name
="Show BlenderKit search in 3D view header",
1588 description
="Show BlenderKit search in 3D view header",
1592 global_dir
: StringProperty(
1593 name
="Global Files Directory",
1594 description
="Global storage for your assets, will use subdirectories for the contents",
1596 default
=default_global_dict
,
1597 update
=utils
.save_prefs
1600 project_subdir
: StringProperty(
1601 name
="Project Assets Subdirectory",
1602 description
="where data will be stored for individual projects",
1603 # subtype='DIR_PATH',
1608 directory_behaviour
: EnumProperty(
1609 name
="Use Directories",
1611 ('BOTH', 'Global and subdir',
1612 'store files both in global lib and subdirectory of current project. '
1613 'Warning - each file can be many times on your harddrive, but helps you keep your projects in one piece'),
1614 ('GLOBAL', 'Global',
1615 "store downloaded files only in global directory. \n "
1616 "This can bring problems when moving your projects, \n"
1617 "since assets won't be in subdirectory of current project"),
1619 'store downloaded files only in local directory.\n'
1620 ' This can use more bandwidth when you reuse assets in different projects. ')
1623 description
="Which directories will be used for storing downloaded data",
1626 thumbnail_use_gpu
: BoolProperty(
1627 name
="Use GPU for Thumbnails Rendering",
1628 description
="By default this is off so you can continue your work without any lag",
1632 panel_behaviour
: EnumProperty(
1633 name
="Panels Locations",
1635 ('BOTH', 'Both Types',
1637 ('UNIFIED', 'Unified 3D View Panel',
1639 ('LOCAL', 'Relative to Data',
1643 description
="Which directories will be used for storing downloaded data",
1647 max_assetbar_rows
: IntProperty(name
="Max Assetbar Rows",
1648 description
="max rows of assetbar in the 3D view",
1653 thumb_size
: IntProperty(name
="Assetbar thumbnail Size", default
=96, min=-1, max=256)
1655 asset_counter
: IntProperty(name
="Usage Counter",
1656 description
="Counts usages so it asks for registration only after reaching a limit",
1661 # this is now made obsolete by the new popup upon registration -ensures the user knows about the first search.
1662 # first_run: BoolProperty(
1664 # description="Detects if addon was already registered/run.",
1666 # update=utils.save_prefs
1669 use_timers
: BoolProperty(
1671 description
="Use timers for BlenderKit. Usefull for debugging since timers seem to be unstable.",
1673 update
=utils
.save_prefs
1676 experimental_features
: BoolProperty(
1677 name
="Enable experimental features",
1678 description
="Enable all experimental features of BlenderKit. Use at your own risk.",
1680 update
=utils
.save_prefs
1682 # allow_proximity : BoolProperty(
1683 # name="allow proximity data reports",
1684 # description="This sends anonymized proximity data \n \
1685 # and allows us to make relations between database objects \n \
1686 # without user interaction",
1690 def draw(self
, context
):
1691 layout
= self
.layout
1692 layout
.prop(self
, "show_on_start")
1694 if self
.api_key
.strip() == '':
1695 if self
.enable_oauth
:
1696 ui_panels
.draw_login_buttons(layout
)
1698 op
= layout
.operator("wm.url_open", text
="Register online and get your API Key",
1700 op
.url
= paths
.BLENDERKIT_SIGNUP_URL
1702 if self
.enable_oauth
:
1703 layout
.operator("wm.blenderkit_logout", text
="Logout",
1706 # if not self.enable_oauth:
1707 layout
.prop(self
, "api_key", text
='Your API Key')
1708 # layout.label(text='After you paste API Key, categories are downloaded, so blender will freeze for a few seconds.')
1709 layout
.prop(self
, "global_dir")
1710 layout
.prop(self
, "project_subdir")
1711 # layout.prop(self, "temp_dir")
1712 layout
.prop(self
, "directory_behaviour")
1713 layout
.prop(self
, "thumbnail_use_gpu")
1714 # layout.prop(self, "allow_proximity")
1715 # layout.prop(self, "panel_behaviour")
1716 layout
.prop(self
, "thumb_size")
1717 layout
.prop(self
, "max_assetbar_rows")
1718 layout
.prop(self
, "tips_on_start")
1719 layout
.prop(self
, "search_in_header")
1720 if bpy
.context
.preferences
.view
.show_developer_ui
:
1721 layout
.prop(self
, "use_timers")
1722 layout
.prop(self
, "experimental_features")
1728 BlenderKitAddonPreferences
,
1731 BlenderKitModelSearchProps
,
1732 BlenderKitModelUploadProps
,
1734 BlenderKitSceneSearchProps
,
1735 BlenderKitSceneUploadProps
,
1737 BlenderKitHDRSearchProps
,
1738 BlenderKitHDRUploadProps
,
1740 BlenderKitMaterialUploadProps
,
1741 BlenderKitMaterialSearchProps
,
1743 BlenderKitTextureUploadProps
,
1745 BlenderKitBrushSearchProps
,
1746 BlenderKitBrushUploadProps
,
1748 BlenderKitRatingProps
,
1754 bpy
.utils
.register_class(cls
)
1756 bpy
.types
.Scene
.blenderkitUI
= PointerProperty(
1757 type=BlenderKitUIProps
)
1760 bpy
.types
.Scene
.blenderkit_models
= PointerProperty(
1761 type=BlenderKitModelSearchProps
)
1762 bpy
.types
.Object
.blenderkit
= PointerProperty( # for uploads, not now...
1763 type=BlenderKitModelUploadProps
)
1764 bpy
.types
.Object
.bkit_ratings
= PointerProperty( # for uploads, not now...
1765 type=BlenderKitRatingProps
)
1768 bpy
.types
.Scene
.blenderkit_scene
= PointerProperty(
1769 type=BlenderKitSceneSearchProps
)
1770 bpy
.types
.Scene
.blenderkit
= PointerProperty( # for uploads, not now...
1771 type=BlenderKitSceneUploadProps
)
1772 bpy
.types
.Scene
.bkit_ratings
= PointerProperty( # for uploads, not now...
1773 type=BlenderKitRatingProps
)
1776 bpy
.types
.Scene
.blenderkit_HDR
= PointerProperty(
1777 type=BlenderKitHDRSearchProps
)
1778 bpy
.types
.Image
.blenderkit
= PointerProperty( # for uploads, not now...
1779 type=BlenderKitHDRUploadProps
)
1780 bpy
.types
.Image
.bkit_ratings
= PointerProperty( # for uploads, not now...
1781 type=BlenderKitRatingProps
)
1784 bpy
.types
.Scene
.blenderkit_mat
= PointerProperty(
1785 type=BlenderKitMaterialSearchProps
)
1786 bpy
.types
.Material
.blenderkit
= PointerProperty( # for uploads, not now...
1787 type=BlenderKitMaterialUploadProps
)
1788 bpy
.types
.Material
.bkit_ratings
= PointerProperty( # for uploads, not now...
1789 type=BlenderKitRatingProps
)
1792 bpy
.types
.Scene
.blenderkit_brush
= PointerProperty(
1793 type=BlenderKitBrushSearchProps
)
1794 bpy
.types
.Brush
.blenderkit
= PointerProperty( # for uploads, not now...
1795 type=BlenderKitBrushUploadProps
)
1796 bpy
.types
.Brush
.bkit_ratings
= PointerProperty( # for uploads, not now...
1797 type=BlenderKitRatingProps
)
1799 search
.register_search()
1800 asset_inspector
.register_asset_inspector()
1801 download
.register_download()
1802 upload
.register_upload()
1803 ratings
.register_ratings()
1804 autothumb
.register_thumbnailer()
1806 icons
.register_icons()
1807 ui_panels
.register_ui_panels()
1808 bg_blender
.register()
1810 overrides
.register_overrides()
1811 bkit_oauth
.register()
1812 tasks_queue
.register()
1813 asset_bar_op
.register()
1815 user_preferences
= bpy
.context
.preferences
.addons
['blenderkit'].preferences
1816 if user_preferences
.use_timers
:
1817 bpy
.app
.timers
.register(check_timers_timer
, persistent
=True)
1819 bpy
.app
.handlers
.load_post
.append(scene_load
)
1820 # detect if the user just enabled the addon in preferences, thus enable to run
1821 for w
in bpy
.context
.window_manager
.windows
:
1822 for a
in w
.screen
.areas
:
1823 if a
.type == 'PREFERENCES':
1824 tasks_queue
.add_task((bpy
.ops
.wm
.blenderkit_welcome
, ('INVOKE_DEFAULT',)), fake_context
=True,
1825 fake_context_area
='PREFERENCES')
1829 if bpy
.app
.timers
.is_registered(check_timers_timer
):
1830 bpy
.app
.timers
.unregister(check_timers_timer
)
1831 ui_panels
.unregister_ui_panels()
1834 icons
.unregister_icons()
1835 search
.unregister_search()
1836 asset_inspector
.unregister_asset_inspector()
1837 download
.unregister_download()
1838 upload
.unregister_upload()
1839 ratings
.unregister_ratings()
1840 autothumb
.unregister_thumbnailer()
1841 bg_blender
.unregister()
1842 overrides
.unregister_overrides()
1843 bkit_oauth
.unregister()
1844 tasks_queue
.unregister()
1845 asset_bar_op
.unregister()
1847 del bpy
.types
.Scene
.blenderkit_models
1848 del bpy
.types
.Scene
.blenderkit_scene
1849 del bpy
.types
.Scene
.blenderkit_HDR
1850 del bpy
.types
.Scene
.blenderkit_brush
1851 del bpy
.types
.Scene
.blenderkit_mat
1853 del bpy
.types
.Scene
.blenderkit
1854 del bpy
.types
.Object
.blenderkit
1855 del bpy
.types
.Image
.blenderkit
1856 del bpy
.types
.Material
.blenderkit
1857 del bpy
.types
.Brush
.blenderkit
1860 bpy
.utils
.unregister_class(cls
)
1862 bpy
.app
.handlers
.load_post
.remove(scene_load
)