[Bf-extensions-cvs] [7c3d8127] blender-v2.82-release: BlenderKit: add several autotags

Vilém Duha noreply at git.blender.org
Tue Jan 28 13:49:36 CET 2020


Commit: 7c3d8127daf1f32858076484d07fd8a6e96a3fb0
Author: Vilém Duha
Date:   Tue Jan 21 16:57:54 2020 +0100
Branches: blender-v2.82-release
https://developer.blender.org/rBA7c3d8127daf1f32858076484d07fd8a6e96a3fb0

BlenderKit: add several autotags

megapixels checks number of total pixels in textures.
procedural, node count and texture count will help in heuristics and advanced searches.

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

M	blenderkit/asset_inspector.py
M	blenderkit/upload.py

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

diff --git a/blenderkit/asset_inspector.py b/blenderkit/asset_inspector.py
index 14224b21..e6fdc659 100644
--- a/blenderkit/asset_inspector.py
+++ b/blenderkit/asset_inspector.py
@@ -87,7 +87,9 @@ def check_render_engine(props, obs):
     shaders = []
     textures = []
     props.uv = False
-
+    props.texture_count = 0
+    props.total_megapixels = 0
+    props.node_count = 0
     for ob in obs:  # TODO , this is duplicated here for other engines, otherwise this should be more clever.
         for ms in ob.material_slots:
             if ms.material is not None:
@@ -109,6 +111,7 @@ def check_render_engine(props, obs):
                 checknodes = m.node_tree.nodes[:]
                 while len(checknodes) > 0:
                     n = checknodes.pop()
+                    props.node_count +=1
                     if n.type == 'GROUP':  # dive deeper here.
                         checknodes.extend(n.node_tree.nodes)
                     if len(n.outputs) == 1 and n.outputs[0].type == 'SHADER' and n.type != 'GROUP':
diff --git a/blenderkit/upload.py b/blenderkit/upload.py
index eaa0e6d3..f2f295e5 100644
--- a/blenderkit/upload.py
+++ b/blenderkit/upload.py
@@ -232,6 +232,10 @@ def get_upload_data(self, context, asset_type):
             "manifold": props.manifold,
             "objectCount": props.object_count,
 
+            "procedural": props.is_procedural,
+            "nodeCount": props.node_count,
+            "textureCount": props.texture_count,
+            "megapixels": round(props.total_megapixels/ 1000000),
             # "scene": props.is_scene,
         }
         if props.use_design_year:
@@ -359,6 +363,7 @@ def get_upload_data(self, context, asset_type):
             "procedural": props.is_procedural,
             "nodeCount": props.node_count,
             "textureCount": props.texture_count,
+            "megapixels": round(props.total_megapixels/ 1000000),
 
         }



More information about the Bf-extensions-cvs mailing list