Skip to content

Commit

Permalink
Update shotgrid publish plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
jlorrain authored and ClementHector committed Feb 7, 2022
1 parent 7ab8c50 commit d11b089
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
"celaction": [r".*"]}

enviro_filter = [
"OPENPYPE_SG_USER",
"FTRACK_API_USER",
"FTRACK_API_KEY",
"FTRACK_SERVER",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def process(self, instance):

version_id = context.data.get("versionEntity", {}).get("_id")

shotgrid_version = context.data.get("shotgridVersion")
shotgrid_version = instance.data.get("shotgridVersion")

for representation in instance.data.get("representations", []):

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,30 @@
import pyblish.api


class IntegrateShotgridVersion(pyblish.api.ContextPlugin):
class IntegrateShotgridVersion(pyblish.api.InstancePlugin):
""" Integrate Shotgrid Version """

order = pyblish.api.IntegratorOrder+0.497
label = "Shotgrid Version"

sg = None

def process(self, context):
def process(self, instance):

context = instance.context
self.sg = context.data.get("shotgridSession")

code = os.path.splitext(os.path.basename(context.data.get("currentFile")))[0]
# TODO: Use path template solver to build version code from settings
anatomy = instance.data.get("anatomyData", {})
code = "_".join(
[
anatomy['project']['code'],
anatomy['parent'],
anatomy['asset'],
anatomy['task']['name'],
"v{:03}".format(int(anatomy['version']))
]
)

version = self._find_existing_version(code, context)

Expand All @@ -23,8 +34,9 @@ def process(self, context):
self.log.info("Create Shotgrid version: {}".format(version))
else:
self.log.info("Use existing Shotgrid version: {}".format(version))
self.sg.update("Version", version['id'], _additional_version_data(context))

context.data["shotgridVersion"] = version
instance.data["shotgridVersion"] = version

def _find_existing_version(self, code, context):

Expand Down

0 comments on commit d11b089

Please sign in to comment.