mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 05:42:15 +01:00
Merge pull request #196 from BigRoy/master
Cleanup Creators, fix Yeti Cache preroll instance key and cosmetics
This commit is contained in:
commit
07b2546b29
7 changed files with 32 additions and 100 deletions
|
|
@ -1,5 +1,3 @@
|
|||
from collections import OrderedDict
|
||||
|
||||
import avalon.maya
|
||||
from colorbleed.maya import lib
|
||||
|
||||
|
|
@ -16,21 +14,18 @@ class CreateAnimation(avalon.maya.Creator):
|
|||
super(CreateAnimation, self).__init__(*args, **kwargs)
|
||||
|
||||
# create an ordered dict with the existing data first
|
||||
data = OrderedDict(**self.data)
|
||||
|
||||
# get basic animation data : start / end / handles / steps
|
||||
for key, value in lib.collect_animation_data().items():
|
||||
data[key] = value
|
||||
self.data[key] = value
|
||||
|
||||
# Write vertex colors with the geometry.
|
||||
data["writeColorSets"] = False
|
||||
self.data["writeColorSets"] = False
|
||||
|
||||
# Include only renderable visible shapes.
|
||||
# Skips locators and empty transforms
|
||||
data["renderableOnly"] = False
|
||||
self.data["renderableOnly"] = False
|
||||
|
||||
# Include only nodes that are visible at least once during the
|
||||
# frame range.
|
||||
data["visibleOnly"] = False
|
||||
|
||||
self.data = data
|
||||
self.data["visibleOnly"] = False
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
from collections import OrderedDict
|
||||
import avalon.maya
|
||||
from colorbleed.maya import lib
|
||||
|
||||
|
|
@ -15,13 +14,11 @@ class CreateCamera(avalon.maya.Creator):
|
|||
super(CreateCamera, self).__init__(*args, **kwargs)
|
||||
|
||||
# get basic animation data : start / end / handles / steps
|
||||
data = OrderedDict(**self.data)
|
||||
animation_data = lib.collect_animation_data()
|
||||
for key, value in animation_data.items():
|
||||
data[key] = value
|
||||
self.data[key] = value
|
||||
|
||||
# Bake to world space by default, when this is False it will also
|
||||
# include the parent hierarchy in the baked results
|
||||
data['bakeToWorldSpace'] = True
|
||||
self.data['bakeToWorldSpace'] = True
|
||||
|
||||
self.data = data
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
from collections import OrderedDict
|
||||
import avalon.maya
|
||||
from colorbleed.maya import lib
|
||||
|
||||
|
|
@ -14,7 +13,4 @@ class CreateLook(avalon.maya.Creator):
|
|||
def __init__(self, *args, **kwargs):
|
||||
super(CreateLook, self).__init__(*args, **kwargs)
|
||||
|
||||
data = OrderedDict(**self.data)
|
||||
data["renderlayer"] = lib.get_current_renderlayer()
|
||||
|
||||
self.data = data
|
||||
self.data["renderlayer"] = lib.get_current_renderlayer()
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
from collections import OrderedDict
|
||||
|
||||
from maya import cmds
|
||||
|
||||
from avalon.vendor import requests
|
||||
|
|
@ -19,7 +17,7 @@ class CreateRenderGlobals(avalon.maya.Creator):
|
|||
# We won't be publishing this one
|
||||
self.data["id"] = "avalon.renderglobals"
|
||||
|
||||
# get pools
|
||||
# Get available Deadline pools
|
||||
AVALON_DEADLINE = api.Session["AVALON_DEADLINE"]
|
||||
argument = "{}/api/pools?NamesOnly=true".format(AVALON_DEADLINE)
|
||||
response = requests.get(argument)
|
||||
|
|
@ -34,29 +32,27 @@ class CreateRenderGlobals(avalon.maya.Creator):
|
|||
self.data.pop("asset", None)
|
||||
self.data.pop("active", None)
|
||||
|
||||
data = OrderedDict(**self.data)
|
||||
|
||||
data["suspendPublishJob"] = False
|
||||
data["extendFrames"] = False
|
||||
data["overrideExistingFrame"] = True
|
||||
data["useLegacyRenderLayers"] = True
|
||||
data["priority"] = 50
|
||||
data["framesPerTask"] = 1
|
||||
data["whitelist"] = False
|
||||
data["machineList"] = ""
|
||||
data["useMayaBatch"] = True
|
||||
data["primaryPool"] = pools
|
||||
self.data["suspendPublishJob"] = False
|
||||
self.data["extendFrames"] = False
|
||||
self.data["overrideExistingFrame"] = True
|
||||
self.data["useLegacyRenderLayers"] = True
|
||||
self.data["priority"] = 50
|
||||
self.data["framesPerTask"] = 1
|
||||
self.data["whitelist"] = False
|
||||
self.data["machineList"] = ""
|
||||
self.data["useMayaBatch"] = True
|
||||
self.data["primaryPool"] = pools
|
||||
# We add a string "-" to allow the user to not set any secondary pools
|
||||
data["secondaryPool"] = ["-"] + pools
|
||||
self.data["secondaryPool"] = ["-"] + pools
|
||||
|
||||
self.data = data
|
||||
self.options = {"useSelection": False} # Force no content
|
||||
|
||||
def process(self):
|
||||
|
||||
exists = cmds.ls(self.name)
|
||||
assert len(exists) <= 1, (
|
||||
"More than one renderglobal exists, this is a bug")
|
||||
"More than one renderglobal exists, this is a bug"
|
||||
)
|
||||
|
||||
if exists:
|
||||
return cmds.warning("%s already exists." % exists[0])
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
from collections import OrderedDict
|
||||
|
||||
import avalon.maya
|
||||
|
||||
|
||||
|
|
@ -14,13 +12,10 @@ class CreateVrayProxy(avalon.maya.Creator):
|
|||
def __init__(self, *args, **kwargs):
|
||||
super(CreateVrayProxy, self).__init__(*args, **kwargs)
|
||||
|
||||
data = OrderedDict(**self.data)
|
||||
|
||||
data["animation"] = False
|
||||
data["startFrame"] = 1
|
||||
data["endFrame"] = 1
|
||||
self.data["animation"] = False
|
||||
self.data["startFrame"] = 1
|
||||
self.data["endFrame"] = 1
|
||||
|
||||
# Write vertex colors
|
||||
data["vertexColors"] = False
|
||||
self.data["vertexColors"] = False
|
||||
|
||||
self.data.update(data)
|
||||
|
|
|
|||
|
|
@ -15,12 +15,13 @@ class CreateYetiCache(avalon.maya.Creator):
|
|||
def __init__(self, *args, **kwargs):
|
||||
super(CreateYetiCache, self).__init__(*args, **kwargs)
|
||||
|
||||
data = OrderedDict(**self.data)
|
||||
data["peroll"] = 0
|
||||
self.data["preroll"] = 0
|
||||
|
||||
# Add animation data without step and handles
|
||||
anim_data = lib.collect_animation_data()
|
||||
data.update({"startFrame": anim_data["startFrame"],
|
||||
"endFrame": anim_data["endFrame"],
|
||||
"samples": 3})
|
||||
anim_data.pop("step")
|
||||
anim_data.pop("handles")
|
||||
self.data.update(anim_data)
|
||||
|
||||
self.data = data
|
||||
# Add samples
|
||||
self.data["samples"] = 3
|
||||
|
|
|
|||
|
|
@ -1,48 +0,0 @@
|
|||
import colorbleed.maya.plugin
|
||||
|
||||
|
||||
class AbcLoader(colorbleed.maya.plugin.ReferenceLoader):
|
||||
"""Specific loader of Alembic for the avalon.animation family"""
|
||||
|
||||
families = ["colorbleed.animation",
|
||||
"colorbleed.camera",
|
||||
"colorbleed.pointcache"]
|
||||
representations = ["abc"]
|
||||
|
||||
label = "Reference animation"
|
||||
order = -10
|
||||
icon = "code-fork"
|
||||
color = "orange"
|
||||
|
||||
def process_reference(self, context, name, namespace, data):
|
||||
|
||||
import maya.cmds as cmds
|
||||
from avalon import maya
|
||||
|
||||
cmds.loadPlugin("AbcImport.mll", quiet=True)
|
||||
# Prevent identical alembic nodes from being shared
|
||||
# Create unique namespace for the cameras
|
||||
|
||||
# Get name from asset being loaded
|
||||
# Assuming name is subset name from the animation, we split the number
|
||||
# suffix from the name to ensure the namespace is unique
|
||||
name = name.split("_")[0]
|
||||
namespace = maya.unique_namespace("{}_".format(name),
|
||||
format="%03d",
|
||||
suffix="_abc")
|
||||
|
||||
# hero_001 (abc)
|
||||
# asset_counter{optional}
|
||||
|
||||
nodes = cmds.file(self.fname,
|
||||
namespace=namespace,
|
||||
sharedReferenceFile=False,
|
||||
groupReference=True,
|
||||
groupName="{}:{}".format(namespace, name),
|
||||
reference=True,
|
||||
returnNewNodes=True)
|
||||
|
||||
# load colorbleed ID attribute
|
||||
self[:] = nodes
|
||||
|
||||
return nodes
|
||||
Loading…
Add table
Add a link
Reference in a new issue