On 23/02/2015 at 00:18, xxxxxxxx wrote:
Hi Cracs :-)
I try to find and deleta double material-Tags.
So first I think it would be good to bild a list with all materials and then delete all double materials.
But I get get an error when using the set-instruction.
"TypeError: unhashable type: 'c4d.TextureTag'"
Can anybody be so kind and tell me why tis happens and what I can do to solve the Problem?
def delete_double_materials(doc) :
print 'delete_double_materials START'
o_list = get_all_objects_by_type(doc,c4d.Opolygon)
for obj in o_list:
taglist = obj.GetTags()
matlist = []
print 'Das Objekt hat ' + str(len(taglist)) + ' Tags'
for tag in taglist:
if tag.GetType() == c4d.Ttexture:
matlist.append(tag)
if len(matlist) > 1:
matlist_sauber = list(set(matlist))
#matlist_sauber = dict(map(lambda i: (i,1),matlist)).keys()
print matlist_sauber
Thanks a lot