diff --git a/cuesubmit/plugins/blender/OpenCue/Setup.py b/cuesubmit/plugins/blender/OpenCue/Setup.py index 49d498ff1..e66d54600 100644 --- a/cuesubmit/plugins/blender/OpenCue/Setup.py +++ b/cuesubmit/plugins/blender/OpenCue/Setup.py @@ -38,6 +38,7 @@ opencue_directory_path = os.path.join(sys.prefix, blender_dependencies_directory, opencue_imported_directory) filesequence_directory_path = os.path.join(sys.prefix, blender_dependencies_directory, filesequence_imported_directory) + def isWindows(): """Checks if host OS is Windows""" return os.name == 'nt' @@ -82,6 +83,7 @@ def installModule(): print("\n----- OpenCue-Blender Installed Successfully -----") + def installExternalModules(): """Installs externals dependencies onto Blender python environment with pip""" # Get path of requirements file @@ -94,20 +96,22 @@ def installExternalModules(): python_exe = python_exec() # upgrade pip - print ("\n----- Installing External Dependencies -----") + print("\n----- Installing External Dependencies -----") subprocess.call([python_exe, "-m", "ensurepip"]) subprocess.call([python_exe, "-m", "pip", "install", "--upgrade", "pip"]) # install required external packages subprocess.call([python_exe, "-m", "pip", "install", "-r", requirements, "-t", blender_dependencies_path]) - print ("\n----- External Dependencies Installed Successfully -----") + print("\n----- External Dependencies Installed Successfully -----") + def installOpencueModules(): """Installs OpenCue dependencies onto Blender python environment""" - print ("----- Installing OpenCue Dependencies -----") + print("----- Installing OpenCue Dependencies -----") shutil.copytree(pyoutline_path, pyoutline_directory_path) shutil.copytree(opencue_path, opencue_directory_path) shutil.copytree(filesequence_path, filesequence_directory_path) - print ("\n----- OpenCue Dependencies Installed Successfully -----") + print("\n----- OpenCue Dependencies Installed Successfully -----") + def removeOpencueModules(): """Removes OpenCue dependencies from Blender python environment""" @@ -115,4 +119,3 @@ def removeOpencueModules(): shutil.rmtree(pyoutline_directory_path) shutil.rmtree(opencue_directory_path) shutil.rmtree(filesequence_directory_path) - diff --git a/cuesubmit/plugins/blender/OpenCue/Submission.py b/cuesubmit/plugins/blender/OpenCue/Submission.py index 45be9e206..f0afc3ccb 100644 --- a/cuesubmit/plugins/blender/OpenCue/Submission.py +++ b/cuesubmit/plugins/blender/OpenCue/Submission.py @@ -18,6 +18,7 @@ import bpy + def buildBlenderCmd(layerData): """Builds the Blender command from layerdata @@ -49,6 +50,7 @@ def buildBlenderCmd(layerData): renderCommand += ' -f 1 -- --cycles-device {renderHW}'.format(renderHW=renderHW) return renderCommand + def buildLayer(layerData, command, lastLayer=None): """Creates a PyOutline Layer for the given layerData. @@ -74,11 +76,13 @@ def buildLayer(layerData, command, lastLayer=None): layer.depend_on(lastLayer) return layer + def buildBlenderLayer(layerData, lastLayer): """Builds a PyOutline layer running a Blender command.""" blenderCmd = buildBlenderCmd(layerData) return buildLayer(layerData, blenderCmd, lastLayer) + def submit(jobData): """Submits the job using the PyOutline API.""" ol = outline.Outline( @@ -89,4 +93,4 @@ def submit(jobData): ol.add_layer(layer) lastLayer = layer - return outline.cuerun.launch(ol, use_pycuerun=False) \ No newline at end of file + return outline.cuerun.launch(ol, use_pycuerun=False) diff --git a/cuesubmit/plugins/blender/OpenCue/__init__.py b/cuesubmit/plugins/blender/OpenCue/__init__.py index 7d3f58e62..27327df87 100644 --- a/cuesubmit/plugins/blender/OpenCue/__init__.py +++ b/cuesubmit/plugins/blender/OpenCue/__init__.py @@ -30,6 +30,7 @@ from . import Setup + class SubmitJob(bpy.types.Operator): """Compiles and submits job on button press""" bl_idname = "object.submit_job" @@ -114,11 +115,13 @@ class OpenCueAddonPreferences(bpy.types.AddonPreferences): name="OpenCue output path", default="", ) + def draw(self, context): layout = self.layout layout.prop(self, "use_gpu") layout.prop(self, "output_path") + def register(): """Registers addon to Blender""" bpy.utils.register_class(OpenCueAddonPreferences)