Navigation

    • Register
    • Login
    • Search
    1. Home
    2. aug
    A

    aug

    @aug

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

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

    Best posts made by aug

    This user does not have any upvoted posts yet.

    Latest posts made by aug

    Keyframing the source file on an ImageTexture shader

    I have this Octane material with a ImageTexture shader.
    I can programmatically set the source file on the shader.
    I want to be able to Keyframe this source file.
    Here's what I got so far:

    def changeTexture(shader, item, chosen, curTime) :
    
        doc = shader.GetDocument()
        doc.AddUndo(c4d.UNDOTYPE_CHANGE, shader)
        filepath = f'{item}_{chosen}.png'
        # Assign the new value
        print(f'Applying texture: {filepath}')
        print (shader[c4d.IMAGETEXTURE_FILE])
        shader[c4d.IMAGETEXTURE_FILE] = filepath
        shader.Message(c4d.MSG_UPDATE)
        print(shader[c4d.IMAGETEXTURE_FILE])
    
        track = shader.FindCTrack(c4d.IMAGETEXTURE_FILE)
        if not track:
            track = c4d.CTrack(shader, c4d.IMAGETEXTURE_FILE)
            shader.InsertTrackSorted(track)
        print(track)
        curve = track.GetCurve()
        result = curve.FindKey(curTime)
        if result is None:
            result = curve.AddKey(curTime)
        print(result)
        track.FillKey(doc, shader, result['key'])
        c4d.EventAdd()
    

    This runs without bugs. The files do get changed but they're not keyframed. The first time I run this, the file keyframe indicator does show up orange. But not the subsequent times.

    posted in Cinema 4D SDK •