Skip to content

Commit

Permalink
Reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
n-jay committed Dec 23, 2023
1 parent e384e3b commit 5a7c837
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
13 changes: 8 additions & 5 deletions cuesubmit/plugins/blender/OpenCue/Setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand All @@ -94,25 +96,26 @@ 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"""
# remove installed opencue dependencies
shutil.rmtree(pyoutline_directory_path)
shutil.rmtree(opencue_directory_path)
shutil.rmtree(filesequence_directory_path)

6 changes: 5 additions & 1 deletion cuesubmit/plugins/blender/OpenCue/Submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import bpy


def buildBlenderCmd(layerData):
"""Builds the Blender command from layerdata
Expand Down Expand Up @@ -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.
Expand All @@ -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(
Expand All @@ -89,4 +93,4 @@ def submit(jobData):
ol.add_layer(layer)
lastLayer = layer

return outline.cuerun.launch(ol, use_pycuerun=False)
return outline.cuerun.launch(ol, use_pycuerun=False)
3 changes: 3 additions & 0 deletions cuesubmit/plugins/blender/OpenCue/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

from . import Setup


class SubmitJob(bpy.types.Operator):
"""Compiles and submits job on button press"""
bl_idname = "object.submit_job"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 5a7c837

Please sign in to comment.