feat(resolve): adding currentFile to collect project

This commit is contained in:
Jakub Jezek 2020-06-12 13:03:38 +03:00
parent ae7a655513
commit a4d3b40136
No known key found for this signature in database
GPG key ID: C4B96E101D2A47F3
2 changed files with 29 additions and 17 deletions

View file

@ -1,17 +0,0 @@
import pyblish.api
from pype.hosts.resolve.utils import get_resolve_module
class CollectProject(pyblish.api.ContextPlugin):
"""Collect Project object"""
order = pyblish.api.CollectorOrder - 0.1
label = "Collect Project"
hosts = ["resolve"]
def process(self, context):
resolve = get_resolve_module()
PM = resolve.GetProjectManager()
P = PM.GetCurrentProject()
self.log.info(P.GetName())

View file

@ -0,0 +1,29 @@
import os
import pyblish.api
from pype.hosts.resolve.utils import get_resolve_module
class CollectProject(pyblish.api.ContextPlugin):
"""Collect Project object"""
order = pyblish.api.CollectorOrder - 0.1
label = "Collect Project"
hosts = ["resolve"]
def process(self, context):
exported_projet_ext = ".drp"
current_dir = os.getenv("AVALON_WORKDIR")
resolve = get_resolve_module()
PM = resolve.GetProjectManager()
P = PM.GetCurrentProject()
name = P.GetName()
fname = name + exported_projet_ext
current_file = os.path.join(current_dir, fname)
normalised = os.path.normpath(current_file)
context.data["project"] = P
context.data["currentFile"] = normalised
self.log.info(name)
self.log.debug(normalised)