Navigation

    • Register
    • Login
    • Search
    1. Home
    2. cinamatic
    C

    cinamatic

    @cinamatic

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

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

    Best posts made by cinamatic

    This user does not have any upvoted posts yet.

    Latest 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 •
    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 •