From 86a611574b54dd6d53d937a3306fb2dcce6af134 Mon Sep 17 00:00:00 2001 From: Milan Kolar Date: Mon, 16 Mar 2020 19:02:45 +0100 Subject: [PATCH 1/6] Update README.md --- README.md | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index e254b0ad87..8110887cbd 100644 --- a/README.md +++ b/README.md @@ -1,31 +1,11 @@ Pype ==== -The base studio _config_ for [Avalon](https://getavalon.github.io/) +Welcome to PYPE _config_ for [Avalon](https://getavalon.github.io/) -Currently this config is dependent on our customised avalon instalation so it won't work with vanilla avalon core. We're working on open sourcing all of the necessary code though. You can still get inspiration or take our individual validators and scripts which should work just fine in other pipelines. +To get all the key information about the project, go to [PYPE.club](http://pype.club) + + +Currently this config is dependent on our customised avalon instalation so it won't work with vanilla avalon core. To install it you'll need to download [pype-setup](github.com/pypeclub/pype-setup), which is able to deploy everything for you if you follow the documentation. _This configuration acts as a starting point for all pype club clients wth avalon deployment._ - -Code convention ---------------- - -Below are some of the standard practices applied to this repositories. - -- **Etiquette: PEP8** - - All code is written in PEP8. It is recommended you use a linter as you work, flake8 and pylinter are both good options. -- **Etiquette: Napoleon docstrings** - - Any docstrings are made in Google Napoleon format. See [Napoleon](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html) for details. - -- **Etiquette: Semantic Versioning** - - This project follows [semantic versioning](http://semver.org). -- **Etiquette: Underscore means private** - - Anything prefixed with an underscore means that it is internal to wherever it is used. For example, a variable name is only ever used in the parent function or class. A module is not for use by the end-user. In contrast, anything without an underscore is public, but not necessarily part of the API. Members of the API resides in `api.py`. - -- **API: Idempotence** - - A public function must be able to be called twice and produce the exact same result. This means no changing of state without restoring previous state when finishing. For example, if a function requires changing the current selection in Autodesk Maya, it must restore the previous selection prior to completing. From 59f97ef904057093d5b74082aadf7e35501740f3 Mon Sep 17 00:00:00 2001 From: Milan Kolar Date: Tue, 17 Mar 2020 15:56:46 +0100 Subject: [PATCH 2/6] Update LICENSE --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index dfcd71eb3f..63249bb52b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2018 orbi tools s.r.o +Copyright (c) 2020 Orbi Tools s.r.o. Permission is hereby granted, free of charge, to any person obtaining a copy From a549634c0ad925a038574bc01610f8abf93089a5 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Tue, 17 Mar 2020 16:12:29 +0100 Subject: [PATCH 3/6] added options to maya reference loader --- pype/maya/plugin.py | 71 ++++++++++++++++++++++++++++++--------------- 1 file changed, 47 insertions(+), 24 deletions(-) diff --git a/pype/maya/plugin.py b/pype/maya/plugin.py index 327cf47cbd..85de5adec5 100644 --- a/pype/maya/plugin.py +++ b/pype/maya/plugin.py @@ -1,4 +1,5 @@ from avalon import api +from avalon.vendor import qargparse def get_reference_node_parents(ref): @@ -33,11 +34,25 @@ class ReferenceLoader(api.Loader): `update` logic. """ - def load(self, - context, - name=None, - namespace=None, - data=None): + + options = [ + qargparse.Integer( + "count", + label="Count", + default=1, + min=1, + help="How many times to load?" + ) + ] + + def load( + self, + context, + name=None, + namespace=None, + options=None, + data=None + ): import os from avalon.maya import lib @@ -46,29 +61,37 @@ class ReferenceLoader(api.Loader): assert os.path.exists(self.fname), "%s does not exist." % self.fname asset = context['asset'] + loaded_containers = [] - namespace = namespace or lib.unique_namespace( - asset["name"] + "_", - prefix="_" if asset["name"][0].isdigit() else "", - suffix="_", - ) + count = options.get("count") or 1 + while count > 0: + count -= 1 + namespace = namespace or lib.unique_namespace( + asset["name"] + "_", + prefix="_" if asset["name"][0].isdigit() else "", + suffix="_", + ) - self.process_reference(context=context, - name=name, - namespace=namespace, - data=data) + self.process_reference( + context=context, + name=name, + namespace=namespace, + data=data + ) - # Only containerize if any nodes were loaded by the Loader - nodes = self[:] - if not nodes: - return + # Only containerize if any nodes were loaded by the Loader + nodes = self[:] + if not nodes: + return - return containerise( - name=name, - namespace=namespace, - nodes=nodes, - context=context, - loader=self.__class__.__name__) + loaded_containers.append(containerise( + name=name, + namespace=namespace, + nodes=nodes, + context=context, + loader=self.__class__.__name__ + )) + return loaded_containers def process_reference(self, context, name, namespace, data): """To be implemented by subclass""" From e10343de2be9a795a42b98bee2d5bd8c55343a44 Mon Sep 17 00:00:00 2001 From: Milan Kolar Date: Wed, 18 Mar 2020 10:24:25 +0100 Subject: [PATCH 4/6] add offset when loading multiple subsets --- pype/maya/plugin.py | 23 ++++++++++++++++++----- pype/plugins/maya/load/load_reference.py | 12 ++++++++---- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/pype/maya/plugin.py b/pype/maya/plugin.py index 85de5adec5..ed244d56df 100644 --- a/pype/maya/plugin.py +++ b/pype/maya/plugin.py @@ -42,6 +42,11 @@ class ReferenceLoader(api.Loader): default=1, min=1, help="How many times to load?" + ), + qargparse.Double3( + "offset", + label="Position Offset", + help="Offset loaded models for easier selection." ) ] @@ -50,8 +55,7 @@ class ReferenceLoader(api.Loader): context, name=None, namespace=None, - options=None, - data=None + options=None ): import os @@ -64,19 +68,25 @@ class ReferenceLoader(api.Loader): loaded_containers = [] count = options.get("count") or 1 - while count > 0: - count -= 1 + for c in range(0, count): namespace = namespace or lib.unique_namespace( asset["name"] + "_", prefix="_" if asset["name"][0].isdigit() else "", suffix="_", ) + # Offset loaded subset + if "offset" in options: + offset = [i * c for i in options["offset"]] + options["translate"] = offset + + self.log.info(options) + self.process_reference( context=context, name=name, namespace=namespace, - data=data + options=options ) # Only containerize if any nodes were loaded by the Loader @@ -91,6 +101,9 @@ class ReferenceLoader(api.Loader): context=context, loader=self.__class__.__name__ )) + + c += 1 + namespace = None return loaded_containers def process_reference(self, context, name, namespace, data): diff --git a/pype/plugins/maya/load/load_reference.py b/pype/plugins/maya/load/load_reference.py index cbd1da7cbd..b1192d9c9e 100644 --- a/pype/plugins/maya/load/load_reference.py +++ b/pype/plugins/maya/load/load_reference.py @@ -1,4 +1,5 @@ import pype.maya.plugin +reload(pype.maya.plugin) from avalon import api, maya from maya import cmds import os @@ -24,7 +25,7 @@ class ReferenceLoader(pype.maya.plugin.ReferenceLoader): icon = "code-fork" color = "orange" - def process_reference(self, context, name, namespace, data): + def process_reference(self, context, name, namespace, options): import maya.cmds as cmds from avalon import maya import pymel.core as pm @@ -101,16 +102,19 @@ class ReferenceLoader(pype.maya.plugin.ReferenceLoader): cmds.setAttr(groupName + ".selectHandleY", cy) cmds.setAttr(groupName + ".selectHandleZ", cz) - if data.get("post_process", True): + if "translate" in options: + cmds.setAttr(groupName + ".t", *options["translate"]) + + if options.get("post_process", True): if family == "rig": - self._post_process_rig(name, namespace, context, data) + self._post_process_rig(name, namespace, context, options) return newNodes def switch(self, container, representation): self.update(container, representation) - def _post_process_rig(self, name, namespace, context, data): + def _post_process_rig(self, name, namespace, context, options): output = next((node for node in self if node.endswith("out_SET")), None) From 6c2b056dd479be7232e95ee7ac6adc7d09eeba24 Mon Sep 17 00:00:00 2001 From: Milan Kolar Date: Wed, 18 Mar 2020 10:51:31 +0100 Subject: [PATCH 5/6] make sure not to offset rigs --- pype/plugins/maya/load/load_reference.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/pype/plugins/maya/load/load_reference.py b/pype/plugins/maya/load/load_reference.py index b1192d9c9e..797933300c 100644 --- a/pype/plugins/maya/load/load_reference.py +++ b/pype/plugins/maya/load/load_reference.py @@ -1,5 +1,4 @@ import pype.maya.plugin -reload(pype.maya.plugin) from avalon import api, maya from maya import cmds import os @@ -102,12 +101,11 @@ class ReferenceLoader(pype.maya.plugin.ReferenceLoader): cmds.setAttr(groupName + ".selectHandleY", cy) cmds.setAttr(groupName + ".selectHandleZ", cz) - if "translate" in options: - cmds.setAttr(groupName + ".t", *options["translate"]) - - if options.get("post_process", True): - if family == "rig": - self._post_process_rig(name, namespace, context, options) + if family == "rig": + self._post_process_rig(name, namespace, context, options) + else: + if "translate" in options: + cmds.setAttr(groupName + ".t", *options["translate"]) return newNodes From 1f0383268722a5b85b40b740404c1c221b60dbe8 Mon Sep 17 00:00:00 2001 From: Milan Kolar Date: Wed, 18 Mar 2020 12:50:03 +0100 Subject: [PATCH 6/6] pool was being overwritten in submit publish job --- pype/plugins/global/publish/submit_publish_job.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pype/plugins/global/publish/submit_publish_job.py b/pype/plugins/global/publish/submit_publish_job.py index 47c0272254..dcf19ae32c 100644 --- a/pype/plugins/global/publish/submit_publish_job.py +++ b/pype/plugins/global/publish/submit_publish_job.py @@ -238,8 +238,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): ) i += 1 - # Avoid copied pools and remove secondary pool - payload["JobInfo"]["Pool"] = "none" + # remove secondary pool payload["JobInfo"].pop("SecondaryPool", None) self.log.info("Submitting Deadline job ...")