mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 21:32:15 +01:00
Merge pull request #82 from BigRoy/master
Enable clean up, allow nurbsSurface in model and minor changes
This commit is contained in:
commit
041f3ff7ad
6 changed files with 28 additions and 25 deletions
|
|
@ -28,7 +28,7 @@ class Extractor(pyblish.api.InstancePlugin):
|
|||
staging_dir = instance.data.get('stagingDir', None)
|
||||
|
||||
if not staging_dir:
|
||||
staging_dir = tempfile.mkdtemp()
|
||||
staging_dir = tempfile.mkdtemp(prefix="pyblish_tmp_")
|
||||
instance.data['stagingDir'] = staging_dir
|
||||
|
||||
return staging_dir
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class ValidateModelContent(pyblish.api.InstancePlugin):
|
|||
content_instance = list(set(content_instance + descendants))
|
||||
|
||||
# Ensure only valid node types
|
||||
allowed = ('mesh', 'transform', 'nurbsCurve')
|
||||
allowed = ('mesh', 'transform', 'nurbsCurve', 'nurbsSurface')
|
||||
nodes = cmds.ls(content_instance, long=True)
|
||||
valid = cmds.ls(content_instance, long=True, type=allowed)
|
||||
invalid = set(nodes) - set(valid)
|
||||
|
|
|
|||
|
|
@ -1,21 +1,32 @@
|
|||
import os
|
||||
|
||||
from pyblish import api
|
||||
import pyblish.api
|
||||
|
||||
|
||||
class CleanUp(api.InstancePlugin):
|
||||
"""Cleans up the staging directory after a successful publish
|
||||
class CleanUp(pyblish.api.InstancePlugin):
|
||||
"""Cleans up the staging directory after a successful publish.
|
||||
|
||||
The removal will only happen for staging directories which are inside the
|
||||
temporary folder, otherwise the folder is ignored.
|
||||
|
||||
"""
|
||||
|
||||
order = api.IntegratorOrder + 10
|
||||
order = pyblish.api.IntegratorOrder + 10
|
||||
label = "Clean Up"
|
||||
|
||||
def process(self, instance):
|
||||
return
|
||||
|
||||
def clean_up(self, instance):
|
||||
staging_dir = instance.get("stagingDir", None)
|
||||
if staging_dir and os.path.exists(staging_dir):
|
||||
self.log.info("Removing temporary folder ...")
|
||||
os.rmdir(staging_dir)
|
||||
import tempfile
|
||||
|
||||
staging_dir = instance.data.get("stagingDir", None)
|
||||
if not staging_dir or not os.path.exists(staging_dir):
|
||||
self.log.info("No staging directory found: %s" % staging_dir)
|
||||
return
|
||||
|
||||
temp_root = tempfile.gettempdir()
|
||||
if not os.path.normpath(staging_dir).startswith(temp_root):
|
||||
self.log.info("Skipping cleanup. Staging directory is not in the "
|
||||
"temp folder: %s" % staging_dir)
|
||||
return
|
||||
|
||||
self.log.info("Removing temporary folder ...")
|
||||
os.rmdir(staging_dir)
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ class CollectMindbenderImageSequences(pyblish.api.ContextPlugin):
|
|||
"""Gather image sequnences from working directory"""
|
||||
|
||||
order = pyblish.api.CollectorOrder
|
||||
targets = ["imagesequence"]
|
||||
hosts = ["shell"]
|
||||
label = "Image Sequences"
|
||||
|
||||
|
|
|
|||
|
|
@ -37,15 +37,10 @@ class IntegrateAsset(pyblish.api.InstancePlugin):
|
|||
|
||||
def process(self, instance):
|
||||
|
||||
self.log.info("Integrating Asset in to the database ...")
|
||||
|
||||
self.register(instance)
|
||||
self.integrate(instance)
|
||||
|
||||
# TODO: Decide how to clean up? And when?
|
||||
# self.log.info("Removing temporary files and folders ...")
|
||||
# stagingdir = instance.data["stagingDir"]
|
||||
# shutil.rmtree(stagingdir)
|
||||
self.log.info("Integrating Asset in to the database ...")
|
||||
self.integrate(instance)
|
||||
|
||||
def register(self, instance):
|
||||
|
||||
|
|
|
|||
|
|
@ -64,13 +64,9 @@ def publish_data(json_file):
|
|||
from avalon import api, shell
|
||||
api.install(shell)
|
||||
|
||||
# Add environment variable to force collector to use a single folder
|
||||
# based on the given JSON file
|
||||
os.environ['USE_JSON'] = str(json_file)
|
||||
|
||||
# Publish items, returns context instances
|
||||
import pyblish.util
|
||||
context = pyblish.util.publish()
|
||||
context = pyblish.util.publish(targets=["imagesequence"])
|
||||
|
||||
if not context:
|
||||
log.warning("Nothing published.")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue