On 13/03/2017 at 09:17, xxxxxxxx wrote:
ok Im back with a working solution, but I'm stumped with a specific List issue, which does seem to work but which I do not understand..
I'm posting the function here, in hope that its self explanatory in itself. The args like objName etc are defined earlier in the chain of callback functions
What I don't understand is why my list "checkTags = []" wich is currently placed inside the "while loop" only prints out one value even if an object contains several texture tags?
I am getting the correct result out of the full script and this function is the main engine, so all in all it does work, i just don't understand why.
I would have expected the checkTags list to print out all the texture tags on an object and then after that only pic to work with the ones where the objName matches in the follwoing for loop using the checkTags list.
Sorry this feels a bit like Im rambling but its hard to explain. Hopefully someone can see some clarity
any advice much appreciated!
Thanks David
def checkTags(obj, objName, matList, matNames) :
objTEX = obj.GetTag(c4d.Ttexture)
objUVW = obj.GetTag(c4d.Tuvw)
tag = obj.GetFirstTag()
tags = obj.GetTags()
proj = None
# check if there is a TEX tag on the object but no UVW tag
if objTEX and not objUVW in tags:
while tag:
checkTag = []
if tag == objTEX:
checkTag.append(tag)
if not tag.GetNext() :
break
tag = tag.GetNext()
print checkTag
# check the new temp list for name of tex tags
for tTag in checkTag:
if tTag.GetMaterial().GetName() == objName:
return False
else:
proj = 'cubic'
placeTag(obj, objName, matList, matNames, proj) # call tag placement funcitons with CUBIC
elif objTEX and objUVW in tags:
while tag:
checkTag = []
if tag == objTEX:
checkTag.append(tag)
if not tag.GetNext() :
break
tag = tag.GetNext()
# check the new temp list for name of tex tags
for tTag in checkTag:
if tTag.GetMaterial().GetName() == objName:
return False # do nothing
else:
proj = 'uvw'
placeTag(obj, objName, matList, matNames, proj) # call function to place tag - UVW