Disable SDS Globally!

Here’s a quick and handy little script which will enable / disable all the SDS objects in your scene. Super handy workflow helper!

Drop this script & icon in your ~/library/scripts/ directory which you can access very easily by opening the Cinema 4D preferences and clicking on the button bottom right of the prefs dialogue.

After you restart C4D, open Script/Script Manager find the disableSDS script and drag the icon into place. (ctrl-click to enable)

Written by Andy Runyon with icon from Can Erduman. Thank you guys for sharing this with us all!

Download here…

Here’s the code in all its beauty!

import c4d

# Turns off all Subdivision Surfaces. Turn them back on with CTRL modifier.#

# Written by Andrew Runyon #

def GetNextObject(op):

"""

This function loops through every object in the scene

"""

if op==None: return None

if op.GetDown(): return op.GetDown()

while not op.GetNext() and op.GetUp():

op = op.GetUp()

return op.GetNext()

def mod_key():

"""

This function outputs the user's modifier key (ALT or CTRL)

"""

bc = c4d.BaseContainer()

if c4d.gui.GetInputState(c4d.BFM_INPUT_KEYBOARD,c4d.BFM_INPUT_CHANNEL,bc):

if bc[c4d.BFM_INPUT_QUALIFIER] & c4d.QCTRL:

return "CTRL"

if c4d.gui.GetInputState(c4d.BFM_INPUT_KEYBOARD,c4d.BFM_INPUT_CHANNEL,bc):

if bc[c4d.BFM_INPUT_QUALIFIER] & c4d.QALT:

return "ALT"

return

def main():

#If shift is depressed turn on all Subdivision Surfaces

if mod_key() == "CTRL":

myobject = doc.GetFirstObject()

while myobject:

if myobject.GetTypeName() == "Subdivision Surface":

myobject[c4d.ID_BASEOBJECT_GENERATOR_FLAG] = 1

myobject = GetNextObject(myobject)

c4d.EventAdd()

return

#Else turn off all Subdivision Surfaces

if mod_key() != "CTRL":

myobject = doc.GetFirstObject()

while myobject:

if myobject.GetTypeName() == "Subdivision Surface":

myobject[c4d.ID_BASEOBJECT_GENERATOR_FLAG] = 0

myobject = GetNextObject(myobject)

c4d.EventAdd()

if __name__=='__main__':

main()