[Bf-extensions-cvs] [50ea2790] master: BlenderKit initial commit. BlenderKit add-on is the official addon of the BlenderKit service for Blender 3d. (www.blenderkit.com) It enables users to upload, search, download, and rate different assets for blender. It works together with BlenderKit server.

Vilem Duha noreply at git.blender.org
Fri Mar 29 17:53:19 CET 2019


Commit: 50ea2790f91788f247225be88b8e7a97c7bfb937
Author: Vilem Duha
Date:   Fri Mar 29 17:52:47 2019 +0100
Branches: master
https://developer.blender.org/rBA50ea2790f91788f247225be88b8e7a97c7bfb937

BlenderKit initial commit.
BlenderKit add-on is the official addon of the BlenderKit service for Blender 3d. (www.blenderkit.com)
It enables users to upload, search, download, and rate different assets for blender.
It works together with BlenderKit server.

===================================================================

A	blenderkit/README.md
A	blenderkit/__init__.py
A	blenderkit/append_link.py
A	blenderkit/asset_inspector.py
A	blenderkit/autothumb.py
A	blenderkit/autothumb_material_bg.py
A	blenderkit/autothumb_model_bg.py
A	blenderkit/bg_blender.py
A	blenderkit/blendfiles/cleaned.blend
A	blenderkit/blendfiles/material_thumbnailer_cycles.blend
A	blenderkit/blendfiles/thumbnailer.blend
A	blenderkit/categories.py
A	blenderkit/data/categories.json
A	blenderkit/download.py
A	blenderkit/overrides.py
A	blenderkit/paths.py
A	blenderkit/ratings.py
A	blenderkit/registration.py
A	blenderkit/search.py
A	blenderkit/thumbnails/arrow_left.png
A	blenderkit/thumbnails/arrow_right.png
A	blenderkit/thumbnails/bar_slider.png
A	blenderkit/thumbnails/locked.png
A	blenderkit/thumbnails/locked_large.png
A	blenderkit/thumbnails/rating_ui.png
A	blenderkit/thumbnails/star_white.png
A	blenderkit/thumbnails/thumbnail_notready.jpg
A	blenderkit/thumbnails/vs_deleted.png
A	blenderkit/thumbnails/vs_on_hold.png
A	blenderkit/thumbnails/vs_ready.png
A	blenderkit/thumbnails/vs_uploaded.png
A	blenderkit/ui.py
A	blenderkit/ui_bgl.py
A	blenderkit/ui_panels.py
A	blenderkit/upload.py
A	blenderkit/upload_bg.py
A	blenderkit/utils.py
A	blenderkit/version_checker.py

===================================================================

diff --git a/blenderkit/README.md b/blenderkit/README.md
new file mode 100644
index 00000000..e2e77067
--- /dev/null
+++ b/blenderkit/README.md
@@ -0,0 +1,3 @@
+BlenderKit add-on is the official addon of the BlenderKit service for Blender 3d.
+It enables users to upload, search, download, and rate different assets for blender.
+It works together with BlenderKit server.
\ No newline at end of file
diff --git a/blenderkit/__init__.py b/blenderkit/__init__.py
new file mode 100644
index 00000000..017da14d
--- /dev/null
+++ b/blenderkit/__init__.py
@@ -0,0 +1,1410 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+bl_info = {
+    "name": "Blender Kit",
+    "author": "Vilem Duha",
+    "version": (1, 0, 22),
+    "blender": (2, 80, 0),
+    "location": "View3D > Properties > BlenderKit",
+    "description": "Online BlenderKit library (materials, models, brushes and more)",
+    "warning": "",
+    "wiki_url": "https://youtu.be/1hVgcQhIAo8"
+                "Scripts/Add_Mesh/BlenderKit",
+    "category": "Add Mesh",
+}
+
+if "bpy" in locals():
+    import importlib
+
+    importlib.reload(asset_inspector)
+    importlib.reload(search)
+    importlib.reload(download)
+    importlib.reload(ratings)
+    importlib.reload(autothumb)
+    importlib.reload(ui)
+    importlib.reload(bg_blender)
+    importlib.reload(paths)
+    importlib.reload(utils)
+else:
+    from blenderkit import asset_inspector, search, download, upload, ratings, autothumb, ui, bg_blender, paths, utils, \
+        overrides, ui_panels, categories
+
+import os
+import math
+import time
+# import logging
+import bpy
+
+from bpy.app.handlers import persistent
+import bpy.utils.previews
+import mathutils
+from mathutils import Vector
+from bpy.props import (
+    IntProperty,
+    FloatProperty,
+    FloatVectorProperty,
+    StringProperty,
+    EnumProperty,
+    BoolProperty,
+    PointerProperty,
+)
+from bpy.types import (
+    Operator,
+    Panel,
+    AddonPreferences,
+    PropertyGroup,
+)
+
+
+# logging.basicConfig(filename = 'blenderkit.log', level = logging.INFO,
+#                     format = '	%(asctime)s:%(filename)s:%(funcName)s:%(lineno)d:%(message)s')
+
+
+ at persistent
+def scene_load(context):
+    search.load_previews()
+    ui_props = bpy.context.scene.blenderkitUI
+    ui_props.assetbar_on = False
+    ui_props.turn_off = False
+
+
+licenses = (
+    ('royalty_free', 'Royalty Free', 'royalty free commercial license'),
+    ('cc_zero', 'Creative Commons Zero', 'Creative Commons Zero'),
+)
+conditions = (
+    ('UNSPECIFIED', 'Unspecified', "Don't use this in search"),
+    ('NEW', 'New', 'Shiny new item'),
+    ('USED', 'Used', 'Casually used item'),
+    ('OLD', 'Old', 'Old item'),
+    ('DESOLATE', 'Desolate', 'Desolate item - dusty & rusty'),
+)
+model_styles = (
+    ('REALISTIC', 'Realistic', "photo realistic model"),
+    ('PAINTERLY', 'Painterly', 'hand painted with visible strokes, mostly for games'),
+    ('LOWPOLY', 'Lowpoly', "Lowpoly art -don't mix up with polycount!"),
+    ('ANIME', 'Anime', 'Anime style'),
+    ('2D VECTOR', '2d Vector', '2d vector'),
+    ('3D GRAPHICS', '3d Graphics', '3d graphics'),
+    ('OTHER', 'Other', 'Other style'),
+)
+search_model_styles = (
+    ('REALISTIC', 'Realistic', "photo realistic model"),
+    ('PAINTERLY', 'Painterly', 'hand painted with visible strokes, mostly for games'),
+    ('LOWPOLY', 'Lowpoly', "Lowpoly art -don't mix up with polycount!"),
+    ('ANIME', 'Anime', 'Anime style'),
+    ('2D VECTOR', '2d Vector', '2d vector'),
+    ('3D GRAPHICS', '3d Graphics', '3d graphics'),
+    ('OTHER', 'Other', 'Other Style'),
+    ('ANY', 'Any', 'Any Style'),
+)
+material_styles = (
+    ('REALISTIC', 'Realistic', "photo realistic model"),
+    ('NPR', 'Non photorealistic', 'hand painted with visible strokes, mostly for games'),
+    ('OTHER', 'Other', 'Other style'),
+)
+search_material_styles = (
+    ('REALISTIC', 'Realistic', "photo realistic model"),
+    ('NPR', 'Non photorealistic', 'hand painted with visible strokes, mostly for games'),
+    ('ANY', 'Any', 'Any'),
+)
+engines = (
+    ('CYCLES', 'Cycles', 'blender cycles pathtracer'),
+    ('EEVEE', 'Eevee', 'blender eevee renderer'),
+    ('OCTANE', 'Octane', 'octane render enginge'),
+    ('ARNOLD', 'Arnold', 'arnold render engine'),
+    ('V-RAY', 'V-Ray', 'V-Ray renderer'),
+    ('UNREAL', 'Unreal', 'Unreal engine'),
+    ('UNITY', 'Unity', 'Unity engine'),
+    ('GODOT', 'Godot', 'Godot engine'),
+    ('3D-PRINT', '3d printer', 'object can be 3d printed'),
+    ('OTHER', 'Other', 'any other engine'),
+    ('NONE', 'None', 'no more engine block.'),
+)
+pbr_types = (
+    ('METALLIC', 'Metallic-Roughness', 'Metallic/Roughness PBR material type'),
+    ('SPECULAR', 'Specular  Glossy', ''),
+)
+
+mesh_poly_types = (
+    ('QUAD', 'quad', ''),
+    ('QUAD_DOMINANT', 'quad_dominant', ''),
+    ('TRI_DOMINANT', 'tri_dominant', ''),
+    ('TRI', 'tri', ''),
+    ('NGON', 'ngon_dominant', ''),
+    ('OTHER', 'other', ''),
+)
+
+thumbnail_angles = (
+    ('DEFAULT', 'default', ''),
+    ('FRONT', 'front', ''),
+    ('SIDE', 'side', ''),
+    ('TOP', 'top', ''),
+)
+
+thumbnail_snap = (
+    ('GROUND', 'ground', ''),
+    ('WALL', 'wall', ''),
+    ('CEILING', 'ceiling', ''),
+    ('FLOAT', 'floating', ''),
+)
+
+
+def get_upload_asset_type(self):
+    typemapper = {
+        BlenderKitModelUploadProps: 'model',
+        BlenderKitSceneUploadProps: 'scene',
+        BlenderKitMaterialUploadProps: 'material',
+        BlenderKitBrushUploadProps: 'brush'
+    }
+    asset_type = typemapper[type(self)]
+    return asset_type
+
+
+def get_subcategory_enums(self, context):
+    wm = bpy.context.window_manager
+    asset_type = get_upload_asset_type(self)
+    items = []
+    if self.category != '':
+        asset_categories = categories.get_category(wm['bkit_categories'], cat_path=(asset_type, self.category,))
+        for c in asset_categories['children']:
+            items.append((c['slug'], c['name'], c['description']))
+
+    return items
+
+
+def get_category_enums(self, context):
+    wm = bpy.context.window_manager
+    asset_type = get_upload_asset_type(self)
+    asset_categories = categories.get_category(wm['bkit_categories'], cat_path=(asset_type,))
+    items = []
+    for c in asset_categories['children']:
+        items.append((c['slug'], c['name'], c['description']))
+    return items
+
+
+def switch_search_results(self, context):
+    s = bpy.context.scene
+    props = s.blenderkitUI
+    if props.asset_type == 'MODEL':
+        s['search results'] = s.get('bkit model search')
+    elif props.asset_type == 'SCENE':
+        s['search results'] = s.get('bkit scene search')
+    elif props.asset_type == 'MATERIAL':
+        s['search results'] = s.get('bkit material search')
+    elif props.asset_type == 'TEXTURE':
+        s['search results'] = s.get('bkit texture search')
+    elif props.asset_type == 'BRUSH':
+        s['search results'] = s.get('bkit brush search')
+    search.load_previews()
+
+
+class BlenderKitUIProps(PropertyGroup):
+    down_up: EnumProperty(
+        name="Download vs Upload",
+        items=(
+            ('SEARCH', 'Search', 'Searching is active', 'VIEWZOOM', 0),
+            ('UPLOAD', 'Upload', 'Uploads are active', 'COPYDOWN', 1),
+            # ('RATING', 'Rating', 'Rating is active', 'SOLO_ON', 2)
+        ),
+        description="BLenderKit",
+        default="SEARCH",
+    )
+    asset_type: EnumProperty(
+        name="Active Asset Type",
+        items=(
+            ('MODEL', 'Model', 'Browse models', 'OBJECT_DATAMODE', 0),
+            ('SCENE', 'SCENE', 'Browse scenes', 'SCENE_DATA', 1),
+            ('MATERIAL', 'Material', 'Browse models', 'MATERIAL', 2),
+            # ('TEXTURE', 'Texture', 'Browse textures', 'TEXTURE', 3),
+            ('BRUSH', 'Brush', 'Browse brushes', 'BRUSH_DATA', 3)
+        ),
+        description="Activate asset in UI",
+        default="MATERIAL",
+        update=switch_search_results
+    )
+    # these aren't actually used ( by now, seems to better use globals in UI module:
+    draw_tooltip: BoolProperty(name="Draw Tooltip", default=False)
+    addon_update: BoolProperty(name="Should Update Addon", default=False)
+    tooltip: StringProperty(
+        name="Tooltip",
+        description="asset preview info",
+        default="")
+
+    ui_scale = 1
+
+    thumb_size_def = 96
+    margin_def = 0
+
+    thumb_size: IntProperty(name="Thumbnail Size", default=thumb_size_def, min=-1, max=256)
+
+    margin: IntProperty(name="Margin", default=margin_def, min=-1, max=256)
+    highlight_margin: IntProperty(name="Higlight Margin", default=int(margin_def / 2), min=-10, max=256)
+
+    bar_height: IntProperty(name="Bar Height", default=thumb_size_def + 2 * margin_def, min=-1, max=2048)
+    bar_x_offset: IntProperty(name="Bar X Offset", default=20, min=0, max=5000)
+    bar_y_offset: IntProperty(name="Bar Y Offset", default=80, min=0, max=5000)
+
+    bar_x: IntProperty(name="Bar X", default=100, min=0, max=5000)
+    bar_y: IntProperty(name="Bar Y", default=100, min=50, max=5000)
+    bar_end: IntProperty(name="Bar End", default=100, min=0, max=5000)
+    bar_width: IntProperty(name="Bar Width", default=100, min=0, max=5000)
+
+    wcount: IntProperty(name="Width Count", default=10, min=0, max=5000)
+    hcount: IntProperty(name="Rows", default=5, min=0, max=5000)
+
+    reports_y: IntProperty(name="Reports Y", default=5, min=0, max=5000)

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list