UNSOLVED Visibility Red Button

Hello, I can control the visibility of the objects I know, but how can I activate and deactivate the red button traffic light?
Is there a python script for it?

  1. Would like to adjust the visibility in the editor and activate the red traffic light.
  2. Would like to adjust the visibility during rendering and activate the red traffic light.
    The objects should be able to be switched invisible for a stage rendering with this script to activate visible and deactivate.

Thanks very much!

Hello @WDP,

thank you for reaching out to us. The visibility flags of objects can be accessed with the BaseObject methods .GetEditorMode(), .SetEditorMode(), .GetRenderMode() and .SetRenderMode().See end of posting for an example and BaseObject for the technical documentation.

Cheers,
Ferdinand

import c4d

def main():
    """ Toggles both the render and editor visbilty of the active object.
    """
    if op is None:
        return 
    
    if op.GetEditorMode() == c4d.MODE_ON:
        op.SetEditorMode(c4d.MODE_OFF)
        op.SetRenderMode(c4d.MODE_OFF)
    else:
        op.SetEditorMode(c4d.MODE_ON)
        op.SetRenderMode(c4d.MODE_ON)
    
    c4d.EventAdd()


if __name__=='__main__':
    main()

Thank you!

Hello I think youRote Ampel.png have misunderstood I need a command that sets a key frame as shown in the photo, that would be great if you could send me such a Python example file.

Thank you!

Hello @wdp,

thank you for reaching out to us. Again, this is technically a new question, since this is about keyframing, while this topic was about object visibility. Please follow the rule of new topics for new questions.

The dropdown boxes shown in your screenshot are just another way to set the visibility of an object. As the visibility states of an object are just two of its parameters (which can be accessed with the bracket syntax you did already encounter). To keyframe a parameter, and subsequently get "the red dot", you must create a track for that parameter you want to animate and then a keyframe inside the curve of that track. We have a basic CTrack, CCurve and CKey example script for Python on GitHub. You should also look at the Animation examples section in general. Finally, there is the technical documentation for the mentioned types in our Python SDK documentation and the manual for CTrack in our C++ Docummentation which can be useful even when one does not want to use the C++ SDK.

Cheers,
Ferdinand

Hello @WDP,

when there are no further questions, we will consider this topic as solved by Wednesday, December the 1st.

Thank you for your understanding,
Cheers Ferdinand