Hello everyone!
I'm making a Python script that applies Automatic UV algorithm for each object in the scene. This algorithm is used for making UVs for lightmaps for hundreds of objects for game engines. It means that I have two UVWs on each object: one for a texture and one for a lightmap.
The problem is that I don't know how to run "Automatic UV" algorithm with "Packed" mode for the object, I haven't found how to do this in the documentation.
import c4d
def main():
doc = c4d.documents.GetActiveDocument()
objects = doc.GetObjects() #getting all objects
for obj in objects:
tags = obj.GetTags() #getting all tags
lightmapTagIndex = 0
i = 0
for tag in tags: #finding tag with "Lightmap" name to avoid modifying UV tag for texture
if str(tag.GetName()) == "Lightmap":
lightmapTagIndex = i
break
i += 1
doc.SetActiveObject(obj, c4d.SELECTION_NEW) #selecting our object
doc.SetActiveTag(tags[lightmapTagIndex], c4d.SELECTION_NEW) #selecting Lightmap tag
#Pseudo Code: obj.RunAutimaticUV(mode.Packed)
c4d.EventAdd()
if __name__=='__main__':
main()
I'm referencing to this Cinema4D's function:
Thank you for your help.