From 10326c63216523ac86b7f8c96859f260bf8516f5 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 1 May 2020 18:56:18 +0900 Subject: [PATCH] Update texture slot check for blender 2.80+ This fixes the exception when using pixel density functions on an object that has been used with texture painting. --- utilities_texel.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utilities_texel.py b/utilities_texel.py index c6f68d1..a26f64a 100644 --- a/utilities_texel.py +++ b/utilities_texel.py @@ -54,9 +54,10 @@ def get_object_texture_image(obj): if slot_mat.material: # Check for traditional texture slots in material - for slot_tex in slot_mat.material.texture_paint_slots: - if slot_tex and slot_tex.texture and hasattr(slot_tex.texture , 'image'): - return slot_tex.texture.image + if slot_mat.material.texture_paint_images: + active_slot = slot_mat.material.paint_active_slot + if slot_mat.material.texture_paint_images[active_slot]: + return slot_mat.material.texture_paint_images[active_slot] # Check if material uses Nodes if hasattr(slot_mat.material , 'node_tree'):