Hi !
The pipeline I am trying to replace with Shotgun at the moment is working like so:
- Exporting one alembic cache per asset from the animation scene
- In the lighting scene, one button gather the latest lookdev scene, and merge the alembic file onto it
I managed to keep those steps but I am not sure I did it the best way, and my implementation does not seem very flexible at the moment.
First when I publish the alembics from animation, to keep track of the upstreampublished file I have this:
def _maya_find_additional_session_dependencies(asset_name):
ref_paths = set()
ref_nodes = cmds.ls(references=True)
for ref_node in ref_nodes:
ref_path = cmds.referenceQuery(ref_node, filename=True)
ref_path = ref_path.replace("/", os.path.sep)
if ref_path:
if asset_name in ref_path
ref_paths.add(ref_path)
return list(ref_paths)
So this gives me a link between the published alembi file and the rigging file of the corresponding asset.
After that, in the Loader I added a _gather function on the Alembic Cache file type. This is to import the lookdev file and merge the alembic in one action, but it is mainly based on names:
def _gather(self, path, sg_publish_data):
if not cmds.pluginInfo("AbcExport", q = True, loaded = True):
cmds.loadPlugin("AbcExport")
if not os.path.exists(path):
raise Exception("File not found on disk - '%s'" % path)
namespace = "%s_ref" % sg_publish_data.get("code").split("_ref")[0]
publish_file = self.parent.shotgun.find_one("PublishedFile", [["code", "is", sg_publish_data.get("code")]], ["upstream_published_files"])
publish_path = self.parent.shotgun.find_one("PublishedFile", [["id", "is", publish_file["upstream_published_files"][0]["id"]]], ["path_cache"])
lookdev_path = publish_path["path_cache"].replace("/Rigging/", "/Lookdev/")
project_name = lookdev_path.split("/")[0]
project_path = path.split(project_name)[0].replace("\\", "/")
lookdev_path = project_path + lookdev_path
cmds.file(lookdev_path, i=True, ignoreVersion = True, mergeNamespacesOnClash=False, namespace=namespace, preserveReferences=True, options="v=0;")
cmds.AbcImport(path, connect = "/")
I just wanted to know if there was a cleaner way to do that ? I feel like it is not really reliable
Thanks !
Cheers