diff options
-rw-r--r-- | blenderkit/__init__.py | 9 | ||||
-rw-r--r-- | blenderkit/asset_inspector.py | 32 | ||||
-rw-r--r-- | blenderkit/upload.py | 3 |
3 files changed, 33 insertions, 11 deletions
diff --git a/blenderkit/__init__.py b/blenderkit/__init__.py index 1eccfa4d..db8d1bf4 100644 --- a/blenderkit/__init__.py +++ b/blenderkit/__init__.py @@ -489,6 +489,14 @@ class BlenderKitCommonUploadProps(object): default="PUBLIC", ) + is_procedural: BoolProperty(name="Procedural", + description="Asset is procedural - has no texture.", + default=True + ) + node_count: IntProperty(name="Node count", description="Total nodes in the asset", default=0) + texture_count: IntProperty(name="Node count", description="Total nodes in the asset", default=0) + total_megapixels: IntProperty(name="Node count", description="Total nodes in the asset", default=0) + # is_private: BoolProperty(name="Asset is Private", # description="If not marked private, your asset will go into the validation process automatically\n" # "Private assets are limited by quota.", @@ -621,6 +629,7 @@ class BlenderKitMaterialUploadProps(PropertyGroup, BlenderKitCommonUploadProps): description="shaders used in asset, autofilled", default="", ) + is_free: BoolProperty(name="Free for Everyone", description="You consent you want to release this asset as free for everyone", default=True, update=update_free diff --git a/blenderkit/asset_inspector.py b/blenderkit/asset_inspector.py index 73e6c09a..e5d1d5cf 100644 --- a/blenderkit/asset_inspector.py +++ b/blenderkit/asset_inspector.py @@ -33,31 +33,41 @@ RENDER_OBTYPES = ['MESH', 'CURVE', 'SURFACE', 'METABALL', 'TEXT'] def check_material(props, mat): e = bpy.context.scene.render.engine shaders = [] + textures = [] + props.texture_count = 0 + props.node_count = 0 + props.total_megapixels = 0 + props.is_procedural = True + if e == 'CYCLES': if mat.node_tree is not None: checknodes = mat.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': if n.type not in shaders: shaders.append(n.type) if n.type == 'TEX_IMAGE': - mattype = 'image based' - if n.image is not None: - - maxres = max(n.image.size[0], n.image.size[1]) - - props.texture_resolution_max = max(props.texture_resolution_max, maxres) - minres = min(n.image.size[0], n.image.size[1]) + if n.image is not None: + mattype = 'image based' + props.is_procedural = False + if n.image not in textures: + textures.append(n.image) + props.texture_count += 1 + props.total_megapixels += (n.image.size[0] * n.image.size[1]) - if props.texture_resolution_min == 0: - props.texture_resolution_min = minres - else: - props.texture_resolution_min = min(props.texture_resolution_min, minres) + maxres = max(n.image.size[0], n.image.size[1]) + props.texture_resolution_max = max(props.texture_resolution_max, maxres) + minres = min(n.image.size[0], n.image.size[1]) + if props.texture_resolution_min == 0: + props.texture_resolution_min = minres + else: + props.texture_resolution_min = min(props.texture_resolution_min, minres) props.shaders = '' for s in shaders: diff --git a/blenderkit/upload.py b/blenderkit/upload.py index 001c6211..4b02d321 100644 --- a/blenderkit/upload.py +++ b/blenderkit/upload.py @@ -377,6 +377,9 @@ def get_upload_data(self, context, asset_type): "animated": props.animated, "purePbr": props.pbr, "textureSizeMeters": props.texture_size_meters, + "procedural": props.is_procedural, + "nodeCount": props.node_count, + "textureCount": props.texture_count, } |