mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
collector fixes
This commit is contained in:
parent
53e5e0c33c
commit
1b69c712f1
5 changed files with 42 additions and 15 deletions
28
pype/hosts/harmony/js/publish/CollectCurrentFile.js
Normal file
28
pype/hosts/harmony/js/publish/CollectCurrentFile.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/* global PypeHarmony:writable, include */
|
||||
// ***************************************************************************
|
||||
// * CollectCurrentFile *
|
||||
// ***************************************************************************
|
||||
|
||||
|
||||
// check if PypeHarmony is defined and if not, load it.
|
||||
if (typeof PypeHarmony !== 'undefined') {
|
||||
var PYPE_HARMONY_JS = System.getenv('PYPE_HARMONY_JS');
|
||||
include(PYPE_HARMONY_JS + '/pype_harmony.js');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @namespace
|
||||
* @classdesc Collect Current file
|
||||
*/
|
||||
var CollectCurrentFile = function() {};
|
||||
|
||||
CollectCurrentFile.prototype.collect = function() {
|
||||
return (
|
||||
scene.currentProjectPath() + '/' +
|
||||
scene.currentVersionName() + '.xstage'
|
||||
);
|
||||
};
|
||||
|
||||
// add self to Pype Loaders
|
||||
PypeHarmony.Publish.CollectCurrentFile = new CollectCurrentFile();
|
||||
|
|
@ -19,12 +19,16 @@ class CollectSceneVersion(pyblish.api.ContextPlugin):
|
|||
if "unreal" in pyblish.api.registered_hosts():
|
||||
return
|
||||
|
||||
assert context.data.get('currentFile'), "Cannot get curren file"
|
||||
filename = os.path.basename(context.data.get('currentFile'))
|
||||
|
||||
if '<shell>' in filename:
|
||||
return
|
||||
|
||||
rootVersion = int(pype.get_version_from_path(filename))
|
||||
version = pype.get_version_from_path(filename)
|
||||
assert version, "Cannot determine version"
|
||||
|
||||
rootVersion = int(version)
|
||||
context.data['version'] = rootVersion
|
||||
self.log.info("{}".format(type(rootVersion)))
|
||||
self.log.info('Scene Version: %s' % context.data.get('version'))
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""Collect information about current file."""
|
||||
import os
|
||||
|
||||
import pyblish.api
|
||||
|
|
@ -5,24 +7,16 @@ from avalon import harmony
|
|||
|
||||
|
||||
class CollectCurrentFile(pyblish.api.ContextPlugin):
|
||||
"""Inject the current working file into context"""
|
||||
"""Inject the current working file into context."""
|
||||
|
||||
order = pyblish.api.CollectorOrder - 0.5
|
||||
label = "Current File"
|
||||
hosts = ["harmony"]
|
||||
|
||||
def process(self, context):
|
||||
"""Inject the current working file"""
|
||||
sig = harmony.signature()
|
||||
func = """function %s()
|
||||
{
|
||||
return (
|
||||
scene.currentProjectPath() + "/" +
|
||||
scene.currentVersionName() + ".xstage"
|
||||
);
|
||||
}
|
||||
%s
|
||||
""" % (sig, sig)
|
||||
"""Inject the current working file."""
|
||||
self_name = self.__class__.__name__
|
||||
|
||||
current_file = harmony.send({"function": func})["result"]
|
||||
current_file = harmony.send(
|
||||
{"function": f"PypeHarmony.Publish.{self_name}.collect"})["result"]
|
||||
context.data["currentFile"] = os.path.normpath(current_file)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class CollectPalettes(pyblish.api.ContextPlugin):
|
|||
self_name = self.__class__.__name__
|
||||
palettes = harmony.send(
|
||||
{
|
||||
"function": f"PypeHarmony.Loaders.{self_name}.getPalettes",
|
||||
"function": f"PypeHarmony.Publish.{self_name}.getPalettes",
|
||||
})["result"]
|
||||
|
||||
for name, id in palettes.items():
|
||||
|
|
|
|||
1
pype/vendor/OpenHarmony
vendored
Submodule
1
pype/vendor/OpenHarmony
vendored
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 8d318c68182a29fa520653c4dc36b8737e0cb2aa
|
||||
Loading…
Add table
Add a link
Reference in a new issue