I encounter a problem when creating a Python script, and docking that script into the layout.
I have simplified the script as much as possible, by simple generating a new script from the Script Manager, and enabled the commented out "def state():" function as such
import c4d from c4d import gui # Welcome to the world of Python # Script state in the menu or the command palette # Return True or c4d.CMD_ENABLED to enable, False or 0 to disable # Alternatively return c4d.CMD_ENABLED|c4d.CMD_VALUE to enable and check/mark def state(): return True # Main function def main(): gui.MessageDialog('Hello World!') # Execute main() if __name__=='__main__': main()
When you save this script, and add the script icon into your layout, then rendering to viewport is broken.
Sometimes pressing the "render view" button simply does not react (same with shortcut Ctrl-R), sometimes the command reacts but generates a black render.
Open the script, put the "def state():" function in comment, save, and rendering is reacting as should be.
Haven't tried on other version of Cinema4D, but people have responded that this issue is present in R21 and up (at least on Windows, haven't tried on macOS)
I have tried returning True, False, CMD_ENABLED, CMD_ENABLED | CMD_VALUE ...
I even have tried without any return at all.
Same result: as soon as "def state():" is present in the script, and script's icon is added to a palette in the layout -> render view is broken