# Create the temp-scene-file-path that we know where to copy it to temp_scene_file_path = os.path.join( temp_directory, scene_file) # Copy the scene-file to the temp-directory (copies only when newer then a maybe already existing one) cgruutils.copy_file(scene_file_path, temp_scene_file_path, debug=debug) # Copy now the scene-folders (copies only when newer then a maybe already existing one) folders_to_copy = ['tex'] for this_folder_name in folders_to_copy: source_folder = os.path.join(scene_folder, this_folder_name) temp_folder = os.path.join(temp_directory, this_folder_name) cgruutils.copy_directory(source_folder, temp_folder, debug=debug) # Now create the folder in which always the images get rendered to temp_output_folder = os.path.join(temp_directory, "Output") if not os.path.isdir(temp_output_folder): creation_status = cgruutils.createFolder( temp_output_folder, writeToAll = True) if not creation_status: error_exit( "The Temp-Output-Folder could not get created. So images can not get rendered and script stopped" ) # Create the parameteres to execute and set that it should start with the c4d command and should use the new scene-file parameteres = sys.argv parameteres[0] = "c4d" parameteres[parameteres.index("-render")+1] = temp_scene_file_path
# Create the temp-scene-file-path that we know where to copy it to temp_scene_file_path = os.path.join(temp_directory, scene_file) # Copy the scene-file to the temp-directory (copies only when newer then a # maybe already existing one) cgruutils.copy_file(scene_file_path, temp_scene_file_path, debug=debug) # Copy now the scene-folders (copies only when newer then a maybe already # existing one) folders_to_copy = ['tex'] for this_folder_name in folders_to_copy: source_folder = os.path.join(scene_folder, this_folder_name) temp_folder = os.path.join(temp_directory, this_folder_name) cgruutils.copy_directory(source_folder, temp_folder, debug=debug) # Now create the folder in which always the images get rendered to temp_output_folder = os.path.join(temp_directory, "Output") if not os.path.isdir(temp_output_folder): creation_status = cgruutils.createFolder(temp_output_folder, writeToAll=True) if not creation_status: error_exit("The Temp-Output-Folder could not get created. So images " "can not get rendered and script stopped") # Create the parameters to execute and set that it should start with the c4d # command and should use the new scene-file parameters = sys.argv
# Now combine all the Folders where the Plugins should get copied from all_c4d_plugin_folders = [] all_c4d_plugin_folders.append(cgru_c4d_plugin_folder) all_c4d_plugin_folders.append(afanasy_c4d_plugin_folder) try: # Look if additional plugin folders are set and add them if that is the case cgru_additional_plugin_folders = os.environ['C4D_ADDITIONAL_PLUGIN_FOLDERS'] print cgru_additional_plugin_folders all_c4d_plugin_folders.extend(cgru_additional_plugin_folders.split(";")) except: pass # Give the user a some informatins about what is happening print("\nSource Plugin-Folders:") for folder in all_c4d_plugin_folders: print(" -%s" % folder) # Check first of Plugin-Directory exists where the plugins should get copied to if os.path.isdir(c4d_plugin_folder): copied_plugins = cgruutils.copy_directory(all_c4d_plugin_folders, c4d_plugin_folder) if copied_plugins == 0: print("\nAll Plugins were already up to date!\n") else: print("\n%d Files got updated!\n" % copied_plugins) else: print ('\nERROR: The specified C4D-Plugin-Directory(%s) could not get found so the plugins did not get copied to it!\n' % c4d_plugin_folder)
# Now combine all the Folders where the Plugins should get copied from all_c4d_plugin_folders = [] all_c4d_plugin_folders.append(cgru_c4d_plugin_folder) try: # Look if additional plugin folders are set and add them if that is the case cgru_additional_plugin_folders = os.environ[ 'C4D_ADDITIONAL_PLUGIN_FOLDERS'] print cgru_additional_plugin_folders all_c4d_plugin_folders.extend(cgru_additional_plugin_folders.split(";")) except: pass # Give the user a some informatins about what is happening print("\nSource Plugin-Folders:") for folder in all_c4d_plugin_folders: print(" -%s" % folder) # Check first of Plugin-Directory exists where the plugins should get copied to if os.path.isdir(c4d_plugin_folder): copied_plugins = cgruutils.copy_directory(all_c4d_plugin_folders, c4d_plugin_folder) if copied_plugins == 0: print("\nAll Plugins were already up to date!\n") else: print("\n%d Files got updated!\n" % copied_plugins) else: print( '\nERROR: The specified C4D-Plugin-Directory(%s) could not get found so the plugins did not get copied to it!\n' % c4d_plugin_folder)