Cinema 4D Tutorial – Traffic Lights

Here is a quick post to share a piece of python code that I use in nearly every C4D scene these days. It is really simple and all it does is take the current state of the objects “Visible in Editor” parameter and apply it to the same objects “Visible in Render” parameter.

I use this to hide objects that I don’t want to render. You can of course simply keyframe both parameters, but this means you only need to key the Visible in Editor parameter. Another option is to use a Display tag which will also allow you to keyframe the object visibility. So it is nothing revolutionary that I’m offering (sorry about that 😉

The reason I use this is simply because you have a visual indicator in the Object Manager of the current state of an objects visibility, you don’t get this with the Display Tag unfortunately. Would be kinda cool if the eyeball closed to indicate visibility, similar to PS layer switches.

Anyway here’s the code, simply copy and paste this into a Python Tag and then choose File > Save Tag Preset in the Object Manager. The tag will be there for you every time you need it.

Start copying here…

import c4d
#Welcome to the world of Python

def main():

# get object tag is attached to
obj = op.GetObject()

# get visibility from editor

# pass editor visibility to renderer visibility

…Stop copying here

Thanks to Patrick Goski who actually wrote this little snippet of code.

By the way if you get errors when you copy and paste this, it may be because of the formatting, so make sure you don’t use tabs and that it looks like this..

Cinema 4D Tutorial - Traffic Lights - Python Tag

Python Tag

Cinema 4D Tutorial – Traffic Lights

Author: Tim


  1. Andy
    Andy On January 27, 2012 at 9:46 PM

    Thanks for sharing this, Tim!

    Are you going to NAB this year?

    • Tim
      Tim On February 1, 2012 at 8:16 AM

      Not sure if I’ll be there or not right now..

  2. dahh
    dahh On February 9, 2012 at 2:19 AM

    Why not just alt + click (mac) on the stop watches?

    • Tim
      Tim On February 23, 2012 at 11:16 AM

      @dahh because this tag allows you to only keyframe one dot, alt click changes them both but you would still need to key both dots (if you wanted to see in the editor what was going to render).

  3. AJ
    AJ On February 23, 2012 at 10:19 AM

    Hey Tim, just saw this post and thought I would share a little Xpresso preset I made that Ive been using in almost all my projects. Its just a simple On/Off switch for objects, but best of all its keyframeless! You can get it here if your interested:

    • Tim
      Tim On February 23, 2012 at 11:16 AM

      @AJ Looks cool, thanks for sharing.

  4. rich nosworthy
    rich nosworthy On February 28, 2013 at 9:41 AM

    This is actually awesome! When you’ve gotta keyframe more than a couple of objects on and off, its so tedious without this.

    Thanks Tim

  5. rich nosworthy
    rich nosworthy On February 28, 2013 at 9:46 AM

    Actually tho, just trying this in R14 and getting an error

    SyntaxError: obj = op.GetObject()

    Line 7 Position 3

    Wonder if the python api’s changed slightly in R14

    • Tim
      Tim On February 28, 2013 at 9:54 AM

      @Rich I just tried it and it works ok for me in R14. Python is really fussy about line spaces, so perhaps you typed it incorrectly.

  6. rich nosworthy
    rich nosworthy On February 28, 2013 at 10:31 AM

    Damn sorry tim, your right, forgot python needs the correct indents (as I now see you pointed out above!). Thanks again

Leave a Reply