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
    • Register
    • Login
    1. Maxon Developers Forum
    2. cinamatic
    3. Posts
    C
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 2
    • Best 0
    • Controversial 0
    • Groups 0

    Posts made by cinamatic

    • Take Manager not recording Material Tag changes when running Python script

      Hi,

      The Python code below creates a new take, then finds the object of interest in order to add a new material tag for the newly created take (only). The code adds the material tag, however it does not record the changes within the Take Manager under take named "TEST". Any idea what the issue might be ?

      import c4d
      
      # Main function
      def main():
          doc.StartUndo()
          
          c4d.CallCommand(431000081) # Auto Take toggle on
      
          # Create needed take system variables
          take_data = doc.GetTakeData()
          main_take = take_data.GetMainTake()
          child_take = main_take.GetDown()
          if child_take is None:
              msg = "Create first child take to clone. Only one take should be present in the take manager at this time"
              raise RuntimeError(msg)
      
          # Create a new take & set it as active
          new_take = take_data.AddTake("", main_take, child_take)
          new_take.SetName("TEST")
          take_data.SetCurrentTake(new_take)
          c4d.EventAdd()
      
          # Find object of interest and create an empty material tag
          obj = doc.SearchObject('Body') # Find object
          tag = obj.MakeTag(c4d.Ttexture) # Create an empty Materials Tag within object
      
          # Find material and assign it to the tag
          mat = doc.SearchMaterial('Fine') # Find material within Material Manager
          tag.SetMaterial(mat) # Assign material to tag associated with object
          #tag[c4d.TEXTURETAG_MATERIAL]=mat #alternate code, not needed
      
          # Take Manager is not reflecting changes from above to the currently active take "TEST".
          #tag.AddTag(take_data,c4d.Ttexture,mat) # something I tried to solve this issue, however didn't work
      
          doc.AddUndo(c4d.UNDOTYPE_NEW,tag)
          doc.EndUndo()
      
          c4d.EventAdd()
      
      # Execute main()
      if __name__=='__main__':
          main()
      
      posted in Cinema 4D SDK python
      C
      cinamatic
    • RE: Beginner:How to assign A-material to B-cube by python?

      Hi,

      I was able to run this code, however the take system did not record changes to the "Tags" category when running the python script. What do I need to add to this code in order for it to record changes to the current take after cubeA.InsertTag(ttagA) & cubeB.InsertTag(ttagB) are executed.

      posted in Cinema 4D SDK
      C
      cinamatic