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

    Visibility Red Button

    Cinema 4D SDK
    python
    2
    6
    1.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W
      WDP
      last edited by WDP

      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!

      1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand
        last edited by

        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()
        

        MAXON SDK Specialist
        developers.maxon.net

        1 Reply Last reply Reply Quote 0
        • W
          WDP
          last edited by

          Thank you!

          1 Reply Last reply Reply Quote 0
          • W
            WDP
            last edited by WDP

            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!

            ferdinandF 1 Reply Last reply Reply Quote 0
            • ferdinandF
              ferdinand @WDP
              last edited by ferdinand

              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

              MAXON SDK Specialist
              developers.maxon.net

              1 Reply Last reply Reply Quote 0
              • ferdinandF
                ferdinand
                last edited by

                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

                MAXON SDK Specialist
                developers.maxon.net

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post