mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
OP-4504 - added collector for originalDirname
This commit is contained in:
parent
8a267f6c34
commit
9bf00f9cfe
2 changed files with 43 additions and 16 deletions
|
|
@ -106,19 +106,3 @@ class CollectResourcesPath(pyblish.api.InstancePlugin):
|
|||
|
||||
self.log.debug("publishDir: \"{}\"".format(publish_folder))
|
||||
self.log.debug("resourcesDir: \"{}\"".format(resources_folder))
|
||||
|
||||
# parse folder name and file name for online and source templates
|
||||
# currentFile comes from hosts workfiles
|
||||
# source comes from Publisher
|
||||
current_file = instance.data.get("currentFile")
|
||||
source = instance.data.get("source")
|
||||
source_file = current_file or source
|
||||
if source_file and os.path.exists(source_file):
|
||||
self.log.debug("Parsing paths for {}".format(source_file))
|
||||
if not instance.data.get("originalBasename"):
|
||||
instance.data["originalBasename"] = \
|
||||
os.path.basename(source_file)
|
||||
|
||||
if not instance.data.get("originalDirname"):
|
||||
instance.data["originalDirname"] = \
|
||||
os.path.dirname(source_file)
|
||||
|
|
|
|||
43
openpype/plugins/publish/collect_source_for_source.py
Normal file
43
openpype/plugins/publish/collect_source_for_source.py
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
"""
|
||||
Requires:
|
||||
instance -> currentFile
|
||||
instance -> source
|
||||
|
||||
Provides:
|
||||
instance -> originalBasename
|
||||
instance -> originalDirname
|
||||
"""
|
||||
|
||||
import os
|
||||
import copy
|
||||
|
||||
import pyblish.api
|
||||
|
||||
|
||||
class CollectSourceForSource(pyblish.api.InstancePlugin):
|
||||
"""Collects source location of file for instance.
|
||||
|
||||
Used for 'source' template name which handles in place publishing.
|
||||
For this kind of publishing files are present with correct file name
|
||||
pattern and correct location.
|
||||
"""
|
||||
|
||||
label = "Collect Source"
|
||||
order = pyblish.api.CollectorOrder + 0.495
|
||||
|
||||
def process(self, instance):
|
||||
# parse folder name and file name for online and source templates
|
||||
# currentFile comes from hosts workfiles
|
||||
# source comes from Publisher
|
||||
current_file = instance.data.get("currentFile")
|
||||
source = instance.data.get("source")
|
||||
source_file = current_file or source
|
||||
if source_file and os.path.exists(source_file):
|
||||
self.log.debug("Parsing paths for {}".format(source_file))
|
||||
if not instance.data.get("originalBasename"):
|
||||
instance.data["originalBasename"] = \
|
||||
os.path.basename(source_file)
|
||||
|
||||
if not instance.data.get("originalDirname"):
|
||||
instance.data["originalDirname"] = \
|
||||
os.path.dirname(source_file)
|
||||
Loading…
Add table
Add a link
Reference in a new issue