Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Register
    • Login
    1. Home
    2. BineeMan
    B
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 1
    • Best 1
    • Controversial 0
    • Groups 0

    BineeMan

    @BineeMan

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

    BineeMan Unfollow 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 python windows
      B
      BineeMan

    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 python windows
      B
      BineeMan