diff options
author | Vilém Duha <vilda.novak@gmail.com> | 2020-11-24 14:11:48 +0300 |
---|---|---|
committer | Vilém Duha <vilda.novak@gmail.com> | 2020-11-24 14:11:48 +0300 |
commit | 3bbcfa7c2d5ca564804c30f0b19c219e00dc4892 (patch) | |
tree | c4e315629e8cf00db7fa893f12efc615081692ce | |
parent | 896ced2595dc8ee3e8db0c6c51f90598c21d9596 (diff) |
BlenderKit: fix a rare bug where mesh with no polygons would have material assigned with automap
-rw-r--r-- | blenderkit/utils.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/blenderkit/utils.py b/blenderkit/utils.py index d03140b7..35ae93e4 100644 --- a/blenderkit/utils.py +++ b/blenderkit/utils.py @@ -503,7 +503,8 @@ def automap(target_object=None, target_slot=None, tex_size=1, bg_exception=False if mat_props.automap: tob = bpy.data.objects[target_object] # only automap mesh models - if tob.type == 'MESH': + if tob.type == 'MESH' and len(tob.data.polygons)>0: + #check polycount for a rare case where no polys are in editmesh actob = bpy.context.active_object bpy.context.view_layer.objects.active = tob |