Navigation

    • Register
    • Login
    • Search
    1. Home
    2. BineeMan
    B

    BineeMan

    @BineeMan

    1
    Reputation
    1
    Posts
    1
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    • Profile
    • More
      • Following
      • Followers
      • Topics
      • Posts
      • Best
      • Groups
    BineeMan Follow

    Best posts made by BineeMan

    Running Automatic UV for all objects

    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:
    ads.png
    Thank you for your help.

    posted in Cinema 4D SDK •

    Latest posts made by BineeMan

    Running Automatic UV for all objects

    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:
    ads.png
    Thank you for your help.

    posted in Cinema 4D SDK •