mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
added post-integrate plugin - temp
This commit is contained in:
parent
73d93b1bd1
commit
5eaf66c55c
2 changed files with 42 additions and 22 deletions
|
|
@ -47,35 +47,15 @@ class IntegrateAsset(pyblish.api.InstancePlugin):
|
|||
# get needed data
|
||||
traffic = instance.data["traffic"]
|
||||
representations = instance.data["representations"]
|
||||
version_folder = instance.data["versionFolder"]
|
||||
family = instance.data["family"]
|
||||
resources = instance.data("resources", [])
|
||||
|
||||
self.log.info("Registering {} items".format(len(representations)))
|
||||
io.insert_many(representations)
|
||||
|
||||
# moving files
|
||||
for src_dest in traffic:
|
||||
src, dest = src_dest
|
||||
for src, dest in traffic:
|
||||
self.log.info("Copying file .. {} -> {}".format(src, dest))
|
||||
self.copy_file(src, dest)
|
||||
|
||||
if family == "colorbleed.texture":
|
||||
try:
|
||||
lib.remap_resource_nodes(resources, folder=version_folder)
|
||||
except Exception as e:
|
||||
self.log.error(e)
|
||||
|
||||
if family == "colorbleed.lookdev":
|
||||
try:
|
||||
tmp_dir = lib.maya_temp_folder()
|
||||
resource_file = os.path.join(tmp_dir, "resources.json")
|
||||
with open(resource_file, "r") as f:
|
||||
resources = json.load(f)
|
||||
lib.remap_resource_nodes(resources)
|
||||
except Exception as e:
|
||||
self.log.error(e)
|
||||
|
||||
self.log.info("Removing temporary files and folders ...")
|
||||
stagingdir = instance.data["stagingDir"]
|
||||
shutil.rmtree(stagingdir)
|
||||
|
|
@ -100,4 +80,4 @@ class IntegrateAsset(pyblish.api.InstancePlugin):
|
|||
self.log.critical("An unexpected error occurred.")
|
||||
raise
|
||||
|
||||
shutil.copy(src, dst)
|
||||
shutil.copy(src, dst)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
import json
|
||||
import os
|
||||
|
||||
|
||||
import colorbleed.maya.lib as lib
|
||||
|
||||
import pyblish.api
|
||||
|
||||
|
||||
class IntegrateAsset(pyblish.api.InstancePlugin):
|
||||
"""Remap source paths for lookdev and textures
|
||||
|
||||
"""
|
||||
|
||||
label = "Remap source paths"
|
||||
order = pyblish.api.IntegratorOrder + 0.15
|
||||
families = ["colorbleed.lookdev",
|
||||
"colorbleed.texture"]
|
||||
|
||||
def process(self, instance):
|
||||
|
||||
family = instance.data['family']
|
||||
resources = instance.data['resources']
|
||||
version_folder = instance.data['versionFolder']
|
||||
|
||||
if family == "colorbleed.texture":
|
||||
try:
|
||||
lib.remap_resource_nodes(resources, folder=version_folder)
|
||||
except Exception as e:
|
||||
self.log.error(e)
|
||||
|
||||
if family == "colorbleed.lookdev":
|
||||
try:
|
||||
tmp_dir = lib.maya_temp_folder()
|
||||
resource_file = os.path.join(tmp_dir, "resources.json")
|
||||
with open(resource_file, "r") as f:
|
||||
resources = json.load(f)
|
||||
lib.remap_resource_nodes(resources)
|
||||
except Exception as e:
|
||||
self.log.error(e)
|
||||
Loading…
Add table
Add a link
Reference in a new issue