From c6d34a5c15f562407a054525e2a7f07b95ba4cd4 Mon Sep 17 00:00:00 2001 From: Milan Kolar Date: Mon, 12 Nov 2018 01:06:04 +0100 Subject: [PATCH] remove colorbleed traces --- pype/ftrack/actions/action_syncToAvalon.py | 15 ++-- pype/maya/__init__.py | 4 +- .../publish/collect_assumed_destination.py | 4 +- pype/plugins/global/publish/integrate.py | 12 +-- pype/plugins/maya/load/load_model.py | 31 ++++++++ .../plugins/maya/publish/collect_animation.py | 7 +- .../plugins/maya/publish/extract_animation.py | 25 ++++--- .../maya/publish/extract_pointcache.py | 2 +- pype/plugins/maya/publish/extract_rig.py | 2 +- pype/plugins/maya/publish/extract_setdress.py | 2 +- .../publish/validate_render_image_rule.py | 6 +- .../maya/publish/validate_single_assembly.py | 6 +- res/workspace.mel | 73 ++----------------- 13 files changed, 81 insertions(+), 108 deletions(-) diff --git a/pype/ftrack/actions/action_syncToAvalon.py b/pype/ftrack/actions/action_syncToAvalon.py index a2787e7a38..188e776063 100644 --- a/pype/ftrack/actions/action_syncToAvalon.py +++ b/pype/ftrack/actions/action_syncToAvalon.py @@ -82,7 +82,9 @@ class SyncToAvalon(BaseAction): 'tasks': [{'name': ''}], 'apps': apps, # TODO redo work!!! - 'template': {'work': '','publish':''} + 'template': { + 'work': '{root}/{project}/{hierarchy}/{asset}/work/{task}', + 'publish':'{root}/{project}/{hierarchy}/{asset}/publish/{family}/{subset}/v{version}/{projectcode}_{asset}_{subset}_v{version}.{representation}'} } # Set project template @@ -100,7 +102,7 @@ class SyncToAvalon(BaseAction): # Store info about project (FtrackId) io.update_many({'type': 'project','name': entityProj['full_name']}, - {'$set':{'data':{'ftrackId':entityProj['id'],'entityType':entityProj.entity_type}}}) + {'$set':{'data':{'code':entityProj['name'],'ftrackId':entityProj['id'],'entityType':entityProj.entity_type}}}) # Store project Id projectId = io.find_one({"type": "project", "name": entityProj["full_name"]})["_id"] @@ -121,7 +123,8 @@ class SyncToAvalon(BaseAction): folderStruct = [] parentId = None data = {'visualParent': parentId, 'parents': folderStruct, - 'tasks':None, 'ftrackId': None, 'entityType': None} + 'tasks':None, 'ftrackId': None, 'entityType': None, + 'hierarchy': ''} for asset in assets: os.environ['AVALON_ASSET'] = asset['name'] @@ -145,7 +148,9 @@ class SyncToAvalon(BaseAction): print("Asset "+asset["name"]+" - already exist") parentId = io.find_one({'type': 'asset', 'name': asset['name']})['_id'] - data.update({'visualParent': parentId, 'parents': folderStruct}) + hierarchy = os.path.sep.join(folderStruct) + data.update({'visualParent': parentId, 'parents': folderStruct, + 'hierarchy': hierarchy}) folderStruct.append(asset['name']) @@ -171,7 +176,7 @@ class SyncToAvalon(BaseAction): try: print("action <" + self.__class__.__name__ + "> is running") #TODO It's better to have these env set, are they used anywhere? - os.environ['AVALON_PROJECTS'] = "tmp" + # os.environ['AVALON_PROJECTS'] = "tmp" os.environ['AVALON_ASSET'] = "tmp" os.environ['AVALON_SILO'] = "tmp" importable = [] diff --git a/pype/maya/__init__.py b/pype/maya/__init__.py index 10c4b938c4..288cdc8150 100644 --- a/pype/maya/__init__.py +++ b/pype/maya/__init__.py @@ -120,8 +120,8 @@ def on_save(_): avalon.logger.info("Running callback on save..") - # Update current task for the current scene - update_task_from_path(cmds.file(query=True, sceneName=True)) + # # Update current task for the current scene + # update_task_from_path(cmds.file(query=True, sceneName=True)) # Generate ids of the current context on nodes in the scene nodes = lib.get_id_required_nodes(referenced_nodes=False) diff --git a/pype/plugins/global/publish/collect_assumed_destination.py b/pype/plugins/global/publish/collect_assumed_destination.py index 4b6aeb1a86..a2b6ab746b 100644 --- a/pype/plugins/global/publish/collect_assumed_destination.py +++ b/pype/plugins/global/publish/collect_assumed_destination.py @@ -74,7 +74,7 @@ class CollectAssumedDestination(pyblish.api.InstancePlugin): project = io.find_one({"type": "project", "name": project_name}, - projection={"config": True}) + projection={"config": True, "data": True}) template = project["config"]["template"]["publish"] @@ -109,7 +109,7 @@ class CollectAssumedDestination(pyblish.api.InstancePlugin): template_data = {"root": api.Session["AVALON_PROJECTS"], "project": project_name, - "projectcode": "prjX", + "projectcode": project['data']['code'], "silo": silo, "family": instance.data['family'], "asset": asset_name, diff --git a/pype/plugins/global/publish/integrate.py b/pype/plugins/global/publish/integrate.py index 15441406f4..87ffa2aaa3 100644 --- a/pype/plugins/global/publish/integrate.py +++ b/pype/plugins/global/publish/integrate.py @@ -159,7 +159,6 @@ class IntegrateAsset(pyblish.api.InstancePlugin): template_publish = project["config"]["template"]["publish"] anatomy = instance.context.data['anatomy'] - self.log.debug(anatomy) # Find the representations to transfer amongst the files # Each should be a single representation (as such, a single extension) @@ -192,9 +191,7 @@ class IntegrateAsset(pyblish.api.InstancePlugin): for fname in collection: src = os.path.join(stagingdir, fname) - self.log.debug("test: " + src) anatomy_filled = anatomy.format(template_data) - self.log.debug(anatomy_filled) dst = anatomy_filled.publish.path instance.data["transfers"].append([src, dst]) @@ -217,16 +214,13 @@ class IntegrateAsset(pyblish.api.InstancePlugin): template_data["representation"] = ext[1:] src = os.path.join(stagingdir, fname) - self.log.info("test: " + str(template_data)) anatomy_filled = anatomy.format(template_data) - self.log.info(anatomy_filled) dst = anatomy_filled.publish.path - self.log.info(dst) instance.data["transfers"].append([src, dst]) representation = { - "schema": "avalon-core:representation-2.0", + "schema": "pype:representation-2.0", "type": "representation", "parent": version_id, "name": ext[1:], @@ -302,7 +296,7 @@ class IntegrateAsset(pyblish.api.InstancePlugin): self.log.info("Subset '%s' not found, creating.." % subset_name) _id = io.insert_one({ - "schema": "avalon-core:subset-2.0", + "schema": "pype:subset-2.0", "type": "subset", "name": subset_name, "data": {}, @@ -328,7 +322,7 @@ class IntegrateAsset(pyblish.api.InstancePlugin): version_locations = [location for location in locations if location is not None] - return {"schema": "avalon-core:version-2.0", + return {"schema": "pype:version-2.0", "type": "version", "parent": subset["_id"], "name": version_number, diff --git a/pype/plugins/maya/load/load_model.py b/pype/plugins/maya/load/load_model.py index 145a1a3e00..82bc8c1ce9 100644 --- a/pype/plugins/maya/load/load_model.py +++ b/pype/plugins/maya/load/load_model.py @@ -123,3 +123,34 @@ class GpuCacheLoader(api.Loader): deleteNamespaceContent=True) except RuntimeError: pass + +class AbcModelLoader(pype.maya.plugin.ReferenceLoader): + """Specific loader of Alembic for the studio.animation family""" + + families = ["model"] + representations = ["abc"] + + label = "Reference Model" + order = -10 + icon = "code-fork" + color = "orange" + + def process_reference(self, context, name, namespace, data): + + import maya.cmds as cmds + + cmds.loadPlugin("AbcImport.mll", quiet=True) + nodes = cmds.file(self.fname, + namespace=namespace, + sharedReferenceFile=False, + groupReference=True, + groupName="{}:{}".format(namespace, name), + reference=True, + returnNewNodes=True) + + self[:] = nodes + + return nodes + + def switch(self, container, representation): + self.update(container, representation) diff --git a/pype/plugins/maya/publish/collect_animation.py b/pype/plugins/maya/publish/collect_animation.py index 349fa8e649..87eef7c387 100644 --- a/pype/plugins/maya/publish/collect_animation.py +++ b/pype/plugins/maya/publish/collect_animation.py @@ -43,7 +43,11 @@ class CollectAnimationOutputGeometry(pyblish.api.InstancePlugin): descendants = cmds.ls(descendants, noIntermediate=True, long=True) # Add members and descendants together for a complete overview - hierarchy = members + descendants + # hierarchy = members + descendants + hierarchy = members + + self.log.info(members) + self.log.info(hierarchy) # Ignore certain node types (e.g. constraints) ignore = cmds.ls(hierarchy, type=self.ignore_type, long=True) @@ -53,4 +57,3 @@ class CollectAnimationOutputGeometry(pyblish.api.InstancePlugin): # Store data in the instance for the validator instance.data["out_hierarchy"] = hierarchy - diff --git a/pype/plugins/maya/publish/extract_animation.py b/pype/plugins/maya/publish/extract_animation.py index 576991b0a9..9bee6d65c0 100644 --- a/pype/plugins/maya/publish/extract_animation.py +++ b/pype/plugins/maya/publish/extract_animation.py @@ -7,7 +7,7 @@ import pype.api from pype.maya.lib import extract_alembic -class ExtractColorbleedAnimation(pype.api.Extractor): +class ExtractAnimation(pype.api.Extractor): """Produce an alembic of just point positions and normals. Positions and normals, uvs, creases are preserved, but nothing more, @@ -29,10 +29,12 @@ class ExtractColorbleedAnimation(pype.api.Extractor): out_set = out_sets[0] nodes = cmds.sets(out_set, query=True) + self.log.info('nodes to export: {}'.format(str(nodes))) + # Include all descendants - nodes += cmds.listRelatives(nodes, - allDescendents=True, - fullPath=True) or [] + # nodes += cmds.listRelatives(nodes, + # allDescendents=True, + # fullPath=True) or [] # Collect the start and end including handles start = instance.data["startFrame"] @@ -55,7 +57,8 @@ class ExtractColorbleedAnimation(pype.api.Extractor): "writeVisibility": True, "writeCreases": True, "uvWrite": True, - "selection": True + "selection": False, + "root": nodes } if int(cmds.about(version=True)) >= 2017: @@ -63,12 +66,12 @@ class ExtractColorbleedAnimation(pype.api.Extractor): options["writeUVSets"] = True with avalon.maya.suspended_refresh(): - with avalon.maya.maintained_selection(): - cmds.select(nodes, noExpand=True) - extract_alembic(file=path, - startFrame=start, - endFrame=end, - **options) + # with avalon.maya.maintained_selection(): + cmds.select(nodes, noExpand=True) + extract_alembic(file=path, + startFrame=start, + endFrame=end, + **options) if "files" not in instance.data: instance.data["files"] = list() diff --git a/pype/plugins/maya/publish/extract_pointcache.py b/pype/plugins/maya/publish/extract_pointcache.py index ef4a064471..739ff62ec6 100644 --- a/pype/plugins/maya/publish/extract_pointcache.py +++ b/pype/plugins/maya/publish/extract_pointcache.py @@ -7,7 +7,7 @@ import pype.api from pype.maya.lib import extract_alembic -class ExtractColorbleedAlembic(pype.api.Extractor): +class ExtractAlembic(pype.api.Extractor): """Produce an alembic of just point positions and normals. Positions and normals, uvs, creases are preserved, but nothing more, diff --git a/pype/plugins/maya/publish/extract_rig.py b/pype/plugins/maya/publish/extract_rig.py index 6a92111bc7..bc355cc925 100644 --- a/pype/plugins/maya/publish/extract_rig.py +++ b/pype/plugins/maya/publish/extract_rig.py @@ -6,7 +6,7 @@ import avalon.maya import pype.api -class ExtractColorbleedRig(pype.api.Extractor): +class ExtractRig(pype.api.Extractor): """Extract rig as Maya Ascii""" label = "Extract Rig (Maya ASCII)" diff --git a/pype/plugins/maya/publish/extract_setdress.py b/pype/plugins/maya/publish/extract_setdress.py index c4d613dc61..7a9d643066 100644 --- a/pype/plugins/maya/publish/extract_setdress.py +++ b/pype/plugins/maya/publish/extract_setdress.py @@ -33,7 +33,7 @@ class ExtractSetDress(pype.api.Extractor): json.dump(instance.data["scenedata"], filepath, ensure_ascii=False) self.log.info("Extracting point cache ..") - cmds.select(instance.data["hierarchy"]) + cmds.select(instance.data["\"]) # Run basic alembic exporter extract_alembic(file=hierarchy_path, diff --git a/pype/plugins/maya/publish/validate_render_image_rule.py b/pype/plugins/maya/publish/validate_render_image_rule.py index 762cf963f1..377dbfeadc 100644 --- a/pype/plugins/maya/publish/validate_render_image_rule.py +++ b/pype/plugins/maya/publish/validate_render_image_rule.py @@ -9,9 +9,9 @@ def get_file_rule(rule): return mel.eval('workspace -query -fileRuleEntry "{}"'.format(rule)) -class ValidateRenderImageRule(pyblish.api.ContextPlugin): +class ValidateRenderImageRule(pyblish.api.InstancePlugin): """Validates "images" file rule is set to "renders/" - + """ order = pype.api.ValidateContentsOrder @@ -19,7 +19,7 @@ class ValidateRenderImageRule(pyblish.api.ContextPlugin): hosts = ["maya"] families = ["renderlayer"] - def process(self, context): + def process(self, instance): assert get_file_rule("images") == "renders", ( "Workspace's `images` file rule must be set to: renders" diff --git a/pype/plugins/maya/publish/validate_single_assembly.py b/pype/plugins/maya/publish/validate_single_assembly.py index 8a0e7b2cc4..12aa2848f2 100644 --- a/pype/plugins/maya/publish/validate_single_assembly.py +++ b/pype/plugins/maya/publish/validate_single_assembly.py @@ -5,9 +5,9 @@ import pype.api class ValidateSingleAssembly(pyblish.api.InstancePlugin): """Ensure the content of the instance is grouped in a single hierarchy - The instance must have a single root node containing all the content. + The instance must have a single root node containing all the content. This root node *must* be a top group in the outliner. - + Example outliner: root_GRP -- geometry_GRP @@ -19,7 +19,7 @@ class ValidateSingleAssembly(pyblish.api.InstancePlugin): order = pype.api.ValidateContentsOrder hosts = ['maya'] - families = ["rig', 'studio.animation'] + families = ['rig', 'studio.animation'] label = 'Single Assembly' def process(self, instance): diff --git a/res/workspace.mel b/res/workspace.mel index 60fda895d5..f7213fa4f6 100644 --- a/res/workspace.mel +++ b/res/workspace.mel @@ -1,74 +1,11 @@ //Maya 2018 Project Definition -workspace -fr "fluidCache" "cache/nCache/fluid"; -workspace -fr "JT_ATF" "data"; -workspace -fr "images" "renders"; -workspace -fr "offlineEdit" "scenes/edits"; -workspace -fr "STEP_ATF Export" "data"; -workspace -fr "furShadowMap" "renderData/fur/furShadowMap"; -workspace -fr "INVENTOR_ATF Export" "data"; -workspace -fr "SVG" "data"; -workspace -fr "scripts" "scripts"; -workspace -fr "STL_ATF" "data"; -workspace -fr "DAE_FBX" "data"; workspace -fr "shaders" "renderData/shaders"; -workspace -fr "NX_ATF" "data"; -workspace -fr "furFiles" "renderData/fur/furFiles"; -workspace -fr "CATIAV5_ATF Export" "data"; -workspace -fr "OBJ" "data"; -workspace -fr "PARASOLID_ATF Export" "data"; -workspace -fr "FBX export" "data"; -workspace -fr "furEqualMap" "renderData/fur/furEqualMap"; -workspace -fr "BIF" "data"; -workspace -fr "DAE_FBX export" "data"; -workspace -fr "CATIAV5_ATF" "data"; -workspace -fr "SAT_ATF Export" "data"; -workspace -fr "movie" "movies"; -workspace -fr "ASS Export" "data"; -workspace -fr "move" "data"; -workspace -fr "mayaAscii" "scenes"; -workspace -fr "autoSave" "autosave"; -workspace -fr "NX_ATF Export" "data"; -workspace -fr "sound" "sound"; -workspace -fr "mayaBinary" "scenes"; -workspace -fr "timeEditor" "Time Editor"; -workspace -fr "DWG_ATF" "data"; -workspace -fr "JT_ATF Export" "data"; -workspace -fr "iprImages" "renderData/iprImages"; -workspace -fr "FBX" "data"; +workspace -fr "alembicCache" "cache/alembic"; +workspace -fr "mayaAscii" ""; +workspace -fr "mayaBinary" ""; workspace -fr "renderData" "renderData"; -workspace -fr "CATIAV4_ATF" "data"; workspace -fr "fileCache" "cache/nCache"; -workspace -fr "eps" "data"; -workspace -fr "3dPaintTextures" "sourceimages/3dPaintTextures"; -workspace -fr "STL_ATF Export" "data"; -workspace -fr "mel" "scripts"; -workspace -fr "translatorData" "data"; -workspace -fr "particles" "cache/particles"; -workspace -fr "scene" "scenes"; -workspace -fr "SAT_ATF" "data"; -workspace -fr "PROE_ATF" "data"; -workspace -fr "WIRE_ATF Export" "data"; +workspace -fr "scene" ""; workspace -fr "sourceImages" "sourceimages"; -workspace -fr "clips" "clips"; -workspace -fr "furImages" "renderData/fur/furImages"; -workspace -fr "INVENTOR_ATF" "data"; -workspace -fr "STEP_ATF" "data"; -workspace -fr "DWG_ATF Export" "data"; -workspace -fr "depth" "renderData/depth"; -workspace -fr "sceneAssembly" "sceneAssembly"; -workspace -fr "IGES_ATF Export" "data"; -workspace -fr "PARASOLID_ATF" "data"; -workspace -fr "IGES_ATF" "data"; -workspace -fr "teClipExports" "Time Editor/Clip Exports"; -workspace -fr "ASS" "data"; -workspace -fr "audio" "sound"; -workspace -fr "bifrostCache" "cache/bifrost"; -workspace -fr "Alembic" "data"; -workspace -fr "illustrator" "data"; -workspace -fr "diskCache" "data"; -workspace -fr "WIRE_ATF" "data"; -workspace -fr "templates" "assets"; -workspace -fr "OBJexport" "data"; -workspace -fr "furAttrMap" "renderData/fur/furAttrMap"; -workspace -fr "alembicCache" "cache/alembic"; \ No newline at end of file +workspace -fr "images" "renders";