mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-02 00:44:52 +01:00
feat(maya): colorize outliner based on families
This commit is contained in:
parent
4f45e9e2a7
commit
b6e22e7c47
11 changed files with 223 additions and 6 deletions
|
|
@ -2,6 +2,7 @@ from avalon import api
|
|||
import pype.maya.plugin
|
||||
import os
|
||||
import pymel.core as pm
|
||||
import json
|
||||
|
||||
|
||||
class AssProxyLoader(pype.maya.plugin.ReferenceLoader):
|
||||
|
|
@ -34,7 +35,8 @@ class AssProxyLoader(pype.maya.plugin.ReferenceLoader):
|
|||
groupReference=True,
|
||||
groupName=groupName)
|
||||
|
||||
cmds.makeIdentity(groupName, apply=False, rotate=True, translate=True, scale=True)
|
||||
cmds.makeIdentity(groupName, apply=False, rotate=True,
|
||||
translate=True, scale=True)
|
||||
|
||||
# Set attributes
|
||||
proxyShape = pm.ls(nodes, type="mesh")[0]
|
||||
|
|
@ -43,6 +45,19 @@ class AssProxyLoader(pype.maya.plugin.ReferenceLoader):
|
|||
proxyShape.dso.set(path)
|
||||
proxyShape.aiOverrideShaders.set(0)
|
||||
|
||||
preset_file = os.path.join(
|
||||
os.environ.get('PYPE_STUDIO_TEMPLATES'),
|
||||
'presets', 'tools',
|
||||
'family_colors.json'
|
||||
)
|
||||
with open(preset_file, 'r') as cfile:
|
||||
colors = json.load(cfile)
|
||||
|
||||
c = colors.get('ass')
|
||||
if c is not None:
|
||||
cmds.setAttr(groupName + ".useOutlinerColor", 1)
|
||||
cmds.setAttr(groupName + ".outlinerColor",
|
||||
c[0], c[1], c[2])
|
||||
|
||||
self[:] = nodes
|
||||
|
||||
|
|
@ -132,7 +147,6 @@ class AssStandinLoader(api.Loader):
|
|||
import mtoa.ui.arnoldmenu
|
||||
import pymel.core as pm
|
||||
|
||||
|
||||
asset = context['asset']['name']
|
||||
namespace = namespace or lib.unique_namespace(
|
||||
asset + "_",
|
||||
|
|
@ -146,6 +160,20 @@ class AssStandinLoader(api.Loader):
|
|||
label = "{}:{}".format(namespace, name)
|
||||
root = pm.group(name=label, empty=True)
|
||||
|
||||
preset_file = os.path.join(
|
||||
os.environ.get('PYPE_STUDIO_TEMPLATES'),
|
||||
'presets', 'tools',
|
||||
'family_colors.json'
|
||||
)
|
||||
with open(preset_file, 'r') as cfile:
|
||||
colors = json.load(cfile)
|
||||
|
||||
c = colors.get('ass')
|
||||
if c is not None:
|
||||
cmds.setAttr(root + ".useOutlinerColor", 1)
|
||||
cmds.setAttr(root + ".outlinerColor",
|
||||
c[0], c[1], c[2])
|
||||
|
||||
# Create transform with shape
|
||||
transform_name = label + "_ASS"
|
||||
# transform = pm.createNode("transform", name=transform_name,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue