import c4d from c4d import gui # Main function def main(): # Get V-Ray preferences vrayPreferences=c4d.plugins.GetWorldPluginData(1053273) if (vrayPreferences): currentPreviewLog = vrayPreferences.GetBool(1004) # Toggle the preview newPreviewLog = not currentPreviewLog # Set the value in preferences vrayPreferences.SetBool(1004, newPreviewLog) print("Material preview log set to {}".format(newPreviewLog)) # Execute main() if __name__=='__main__': main()