added list of accepted and ignored file types

This commit is contained in:
aardschok 2017-07-20 11:40:11 +02:00
parent 9dfc7f97e8
commit b4b9960d01
6 changed files with 75 additions and 8 deletions

2
colorbleed/filetypes.py Normal file
View file

@ -0,0 +1,2 @@
accepted_images_types = [".png", ".jpg", ".tga", ".tiff"]
ignored_images_types = [".pds"]

View file

@ -13,7 +13,3 @@ class DebugPlugin(pyblish.api.InstancePlugin):
self.log("\n\n----------------------") self.log("\n\n----------------------")
self.log("Instance") self.log("Instance")
pprint.pprint(instance) pprint.pprint(instance)
self.log("\n\n----------------------")
self.log("Instance.data")
pprint.pprint(instance.data)

View file

@ -2,7 +2,7 @@ from maya import cmds
import pyblish.api import pyblish.api
import cb.utils.maya.shaders as shader import cb.utils.maya.shaders as shaders
TAGS = ["maya", "attribute", "look"] TAGS = ["maya", "attribute", "look"]
TAGS_LOOKUP = set(TAGS) TAGS_LOOKUP = set(TAGS)
@ -74,7 +74,7 @@ class CollectLookTextures(pyblish.api.InstancePlugin):
order = pyblish.api.CollectorOrder + 0.498 order = pyblish.api.CollectorOrder + 0.498
label = 'Textures' label = 'Textures'
families = ["colorbleed.look"] families = ["colorbleed.texture"]
actions = [SelectTextureNodesAction] actions = [SelectTextureNodesAction]
def process(self, instance): def process(self, instance):
@ -134,19 +134,20 @@ class CollectLookTextures(pyblish.api.InstancePlugin):
# paths as the computed patterns # paths as the computed patterns
source = computed_source.replace("\\", "/") source = computed_source.replace("\\", "/")
files = shader.get_file_node_files(node) files = shaders.get_file_node_files(node)
if not files: if not files:
self.log.error("File node does not have a texture set: " self.log.error("File node does not have a texture set: "
"{0}".format(node)) "{0}".format(node))
return return
# Define the resource # Define the resource
# todo: find a way to generate the destination for the publisher
resource = {"tags": TAGS[:], resource = {"tags": TAGS[:],
"node": node, "node": node,
"attribute": attribute, "attribute": attribute,
"source": source, # required for resources "source": source, # required for resources
"files": files, # required for resources "files": files, # required for resources
"subfolder": "textures" # optional for resources "subfolder": "textures", # optional for resources
} }
return resource return resource

View file

@ -0,0 +1,68 @@
import os
import logging
import shutil
import maya.cmds as cmds
import pyblish.api
log = logging.getLogger(__name__)
class PostIntegrateAsset(pyblish.api.InstancePlugin):
"""Resolve any dependency issies
This plug-in resolves any paths which, if not updated might break
the published file.
The order of families is important, when working with lookdev you want to
first publish the texture, update the texture paths in the nodes and then
publish the shading network. Same goes for file dependent assets.
"""
label = "Post Intergrate Asset"
order = pyblish.api.IntegratorOrder + 0.1
families = ["colorbleed.lookdev", "colorbleed.texture"]
def process(self, instance):
# get needed variables
version_folder = instance.data["versionFolder"]
family = instance.data["family"]
resources = instance.data("resources", [])
self.log.info("Running post process for {}".format(instance.name))
if family == "colorbleed.texture":
texture_folder = os.path.join(version_folder, "textures")
self.remap_resource_nodes(resources, folder=texture_folder)
elif family == "colorbleed.lookdev":
self.remap_resource_nodes(resources)
# self.log.info("Removing temporary files and folders ...")
# if passed:
# stagingdir = instance.data["stagingDir"]
# shutil.rmtree(stagingdir)
def remap_resource_nodes(self, resources, folder=None):
self.log.info("Updating resource nodes ...")
for resource in resources:
source = resource["source"]
if folder:
fname = os.path.basename(source)
fpath = os.path.join(folder, fname)
else:
fpath = source
node_attr = resource["attribute"]
print("UPDATING {} -> {}".format(node_attr, fpath))
cmds.setAttr(node_attr, fpath, type="string")
self.log.info("Saving file ...")
cmds.file(save=True, type="mayaAscii")
def remap_yeti_resource_nodes(self, node,):
pass