Solved How to get the status of video post in python

hello there!

I want to get the status of video post, open or close, but I don't know the way, can you help me? Thank you!
5a79b340-725a-4231-a2de-f3c4c582aa1c-image.png

Hello @render_exe,

Thank you for reaching out to us. The user you have been replying to was a spam-bot. I have removed the posting of the bot as well as your answer to it.

About your Question

The activation state of a video post node is expressed by the bit c4d.BIT_VPDISABLED. Find below an example for reading and writing the state of all video post nodes in the active render data.

Cheers,
Ferdinand

Result for running the script three times in a row on render settings which contain the 'Magic Bullet Looks' and 'Denoiser' video post effects.

----------------------------------------------------------------------------------------------------
New state for video post 'Magic Bullet Looks' = False
New state for video post 'Denoiser' = False
----------------------------------------------------------------------------------------------------
New state for video post 'Magic Bullet Looks' = True
New state for video post 'Denoiser' = True
----------------------------------------------------------------------------------------------------
New state for video post 'Magic Bullet Looks' = False
New state for video post 'Denoiser' = False

Code:

"""Demonstrates how to toggle the activation state of a video post node in a render data instance.

Must be run as a Script Manger script.
"""

import c4d

doc: c4d.documents.BaseDocument  # The active document

def main() -> None:
    """Toggles the activation state of all video post nodes in the active render data.
    """
    print ("-"*100)
    # Get the active render data and iterate over its video post nodes.
    renderData: c4d.documents.RenderData = doc.GetActiveRenderData()
    videoPost: c4d.documents.BaseVideoPost = renderData.GetFirstVideoPost()
    while videoPost:
        # If a video post is enabled or not is expressed as the bit #BIT_VPDISABLED. Remove the bit
        # when it is set, add it when it is not.
        state: bool = videoPost.GetBit(c4d.BIT_VPDISABLED)
        videoPost.DelBit(c4d.BIT_VPDISABLED) if state else videoPost.SetBit(c4d.BIT_VPDISABLED)
        print (f"New state for video post '{videoPost.GetName()}' = {not state}")
        videoPost = videoPost.GetNext()

if __name__ == '__main__':
    main()

MAXON SDK Specialist
developers.maxon.net

Hello @render_exe,

Thank you for reaching out to us. The user you have been replying to was a spam-bot. I have removed the posting of the bot as well as your answer to it.

About your Question

The activation state of a video post node is expressed by the bit c4d.BIT_VPDISABLED. Find below an example for reading and writing the state of all video post nodes in the active render data.

Cheers,
Ferdinand

Result for running the script three times in a row on render settings which contain the 'Magic Bullet Looks' and 'Denoiser' video post effects.

----------------------------------------------------------------------------------------------------
New state for video post 'Magic Bullet Looks' = False
New state for video post 'Denoiser' = False
----------------------------------------------------------------------------------------------------
New state for video post 'Magic Bullet Looks' = True
New state for video post 'Denoiser' = True
----------------------------------------------------------------------------------------------------
New state for video post 'Magic Bullet Looks' = False
New state for video post 'Denoiser' = False

Code:

"""Demonstrates how to toggle the activation state of a video post node in a render data instance.

Must be run as a Script Manger script.
"""

import c4d

doc: c4d.documents.BaseDocument  # The active document

def main() -> None:
    """Toggles the activation state of all video post nodes in the active render data.
    """
    print ("-"*100)
    # Get the active render data and iterate over its video post nodes.
    renderData: c4d.documents.RenderData = doc.GetActiveRenderData()
    videoPost: c4d.documents.BaseVideoPost = renderData.GetFirstVideoPost()
    while videoPost:
        # If a video post is enabled or not is expressed as the bit #BIT_VPDISABLED. Remove the bit
        # when it is set, add it when it is not.
        state: bool = videoPost.GetBit(c4d.BIT_VPDISABLED)
        videoPost.DelBit(c4d.BIT_VPDISABLED) if state else videoPost.SetBit(c4d.BIT_VPDISABLED)
        print (f"New state for video post '{videoPost.GetName()}' = {not state}")
        videoPost = videoPost.GetNext()

if __name__ == '__main__':
    main()

MAXON SDK Specialist
developers.maxon.net

This post is deleted!

@ferdinand Thank you, the code runs well. └(^o^)┘