mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
convert presets to pype2.0 way
This commit is contained in:
parent
7fe8d02abf
commit
698c59c8ea
14 changed files with 55 additions and 128 deletions
|
|
@ -6,7 +6,7 @@ import arrow
|
|||
import logging
|
||||
from pype.vendor import ftrack_api
|
||||
from pype.ftrack import BaseAction, get_ca_mongoid
|
||||
from pypeapp.config import get_presets
|
||||
from pypeapp import config
|
||||
|
||||
"""
|
||||
This action creates/updates custom attributes.
|
||||
|
|
@ -226,7 +226,7 @@ class CustomAttributes(BaseAction):
|
|||
self.process_attribute(data)
|
||||
|
||||
def custom_attributes_from_file(self, session, event):
|
||||
presets = get_presets()['ftrack']['ftrack_custom_attributes']
|
||||
presets = config.get_presets()['ftrack']['ftrack_custom_attributes']
|
||||
|
||||
for cust_attr_name in presets:
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -201,6 +201,8 @@ class AppAction(BaseHandler):
|
|||
if parents:
|
||||
hierarchy = os.path.join(*parents)
|
||||
|
||||
application = avalonlib.get_application(os.environ["AVALON_APP_NAME"])
|
||||
|
||||
data = {
|
||||
"root": os.environ.get("PYPE_STUDIO_PROJECTS_PATH"),
|
||||
"project": {"name": entity['project']['full_name'],
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import pype.maya.plugin
|
||||
import os
|
||||
import json
|
||||
from pypeapp import config
|
||||
|
||||
|
||||
class AbcLoader(pype.maya.plugin.ReferenceLoader):
|
||||
|
|
@ -36,14 +36,8 @@ class AbcLoader(pype.maya.plugin.ReferenceLoader):
|
|||
cmds.makeIdentity(groupName, apply=False, rotate=True,
|
||||
translate=True, scale=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)
|
||||
|
||||
presets = config.get_presets(project=os.environ['AVALON_PROJECT'])
|
||||
colors = presets['plugins']['maya']['load']['colors']
|
||||
c = colors.get(family)
|
||||
if c is not None:
|
||||
cmds.setAttr(groupName + ".useOutlinerColor", 1)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ from avalon import api
|
|||
import pype.maya.plugin
|
||||
import os
|
||||
import pymel.core as pm
|
||||
import json
|
||||
from pypeapp import config
|
||||
|
||||
|
||||
class AssProxyLoader(pype.maya.plugin.ReferenceLoader):
|
||||
|
|
@ -50,13 +50,8 @@ 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)
|
||||
presets = config.get_presets(project=os.environ['AVALON_PROJECT'])
|
||||
colors = presets['plugins']['maya']['load']['colors']
|
||||
|
||||
c = colors.get(family)
|
||||
if c is not None:
|
||||
|
|
@ -165,13 +160,8 @@ 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)
|
||||
presets = config.get_presets(project=os.environ['AVALON_PROJECT'])
|
||||
colors = presets['plugins']['maya']['load']['colors']
|
||||
|
||||
c = colors.get('ass')
|
||||
if c is not None:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import pype.maya.plugin
|
||||
import os
|
||||
import json
|
||||
from pypeapp import config
|
||||
|
||||
|
||||
class CameraLoader(pype.maya.plugin.ReferenceLoader):
|
||||
|
|
@ -35,13 +35,8 @@ class CameraLoader(pype.maya.plugin.ReferenceLoader):
|
|||
|
||||
cameras = cmds.ls(nodes, type="camera")
|
||||
|
||||
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)
|
||||
presets = config.get_presets(project=os.environ['AVALON_PROJECT'])
|
||||
colors = presets['plugins']['maya']['load']['colors']
|
||||
|
||||
c = colors.get(family)
|
||||
if c is not None:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import pype.maya.plugin
|
||||
import os
|
||||
import json
|
||||
from pypeapp import config
|
||||
|
||||
|
||||
class FBXLoader(pype.maya.plugin.ReferenceLoader):
|
||||
|
|
@ -36,13 +36,9 @@ class FBXLoader(pype.maya.plugin.ReferenceLoader):
|
|||
groupName="{}:{}".format(namespace, name))
|
||||
|
||||
groupName = "{}:{}".format(namespace, name)
|
||||
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)
|
||||
|
||||
presets = config.get_presets(project=os.environ['AVALON_PROJECT'])
|
||||
colors = presets['plugins']['maya']['load']['colors']
|
||||
|
||||
c = colors.get(family)
|
||||
if c is not None:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import pype.maya.plugin
|
||||
import json
|
||||
from pypeapp import config
|
||||
import os
|
||||
|
||||
|
||||
|
|
@ -36,13 +36,9 @@ class MayaAsciiLoader(pype.maya.plugin.ReferenceLoader):
|
|||
|
||||
self[:] = nodes
|
||||
groupName = "{}:{}".format(namespace, name)
|
||||
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)
|
||||
|
||||
presets = config.get_presets(project=os.environ['AVALON_PROJECT'])
|
||||
colors = presets['plugins']['maya']['load']['colors']
|
||||
|
||||
c = colors.get(family)
|
||||
if c is not None:
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
from avalon import api
|
||||
import pype.maya.plugin
|
||||
import json
|
||||
import os
|
||||
from pypeapp import config
|
||||
reload(config)
|
||||
|
||||
|
||||
class ModelLoader(pype.maya.plugin.ReferenceLoader):
|
||||
|
|
@ -21,18 +22,6 @@ class ModelLoader(pype.maya.plugin.ReferenceLoader):
|
|||
import maya.cmds as cmds
|
||||
from avalon import maya
|
||||
|
||||
try:
|
||||
family = context["representation"]["context"]["family"]
|
||||
except ValueError:
|
||||
family = "model"
|
||||
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)
|
||||
|
||||
with maya.maintained_selection():
|
||||
|
||||
groupName = "{}:{}".format(namespace, name)
|
||||
|
|
@ -46,7 +35,9 @@ class ModelLoader(pype.maya.plugin.ReferenceLoader):
|
|||
cmds.makeIdentity(groupName, apply=False, rotate=True,
|
||||
translate=True, scale=True)
|
||||
|
||||
c = colors.get(family)
|
||||
presets = config.get_presets(project=os.environ['AVALON_PROJECT'])
|
||||
colors = presets['plugins']['maya']['load']['colors']
|
||||
c = colors.get('model')
|
||||
if c is not None:
|
||||
cmds.setAttr(groupName + ".useOutlinerColor", 1)
|
||||
cmds.setAttr(groupName + ".outlinerColor",
|
||||
|
|
@ -89,14 +80,9 @@ class GpuCacheLoader(api.Loader):
|
|||
# Root group
|
||||
label = "{}:{}".format(namespace, name)
|
||||
root = cmds.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)
|
||||
|
||||
presets = config.get_presets(project=os.environ['AVALON_PROJECT'])
|
||||
colors = presets['plugins']['maya']['load']['colors']
|
||||
c = colors.get('model')
|
||||
if c is not None:
|
||||
cmds.setAttr(root + ".useOutlinerColor", 1)
|
||||
|
|
@ -196,14 +182,8 @@ class AbcModelLoader(pype.maya.plugin.ReferenceLoader):
|
|||
cmds.makeIdentity(groupName, apply=False, rotate=True,
|
||||
translate=True, scale=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)
|
||||
|
||||
presets = config.get_presets(project=os.environ['AVALON_PROJECT'])
|
||||
colors = presets['plugins']['maya']['load']['colors']
|
||||
c = colors.get('model')
|
||||
if c is not None:
|
||||
cmds.setAttr(groupName + ".useOutlinerColor", 1)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ from maya import cmds
|
|||
import pype.maya.plugin
|
||||
from avalon import api, maya
|
||||
import os
|
||||
import json
|
||||
from pypeapp import config
|
||||
|
||||
|
||||
class RigLoader(pype.maya.plugin.ReferenceLoader):
|
||||
|
|
@ -39,13 +39,8 @@ class RigLoader(pype.maya.plugin.ReferenceLoader):
|
|||
cmds.makeIdentity(groupName, apply=False, rotate=True,
|
||||
translate=True, scale=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)
|
||||
presets = config.get_presets(project=os.environ['AVALON_PROJECT'])
|
||||
colors = presets['plugins']['maya']['load']['colors']
|
||||
|
||||
c = colors.get(family)
|
||||
if c is not None:
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
from avalon import api
|
||||
import os
|
||||
import json
|
||||
|
||||
from pypeapp import config
|
||||
|
||||
class LoadVDBtoRedShift(api.Loader):
|
||||
"""Load OpenVDB in a Redshift Volume Shape"""
|
||||
|
|
@ -55,13 +54,9 @@ class LoadVDBtoRedShift(api.Loader):
|
|||
# Root group
|
||||
label = "{}:{}".format(namespace, name)
|
||||
root = cmds.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)
|
||||
|
||||
presets = config.get_presets(project=os.environ['AVALON_PROJECT'])
|
||||
colors = presets['plugins']['maya']['load']['colors']
|
||||
|
||||
c = colors.get(family)
|
||||
if c is not None:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from avalon import api
|
||||
import json
|
||||
from pypeapp import config
|
||||
import os
|
||||
|
||||
|
||||
|
|
@ -47,13 +47,9 @@ class LoadVDBtoVRay(api.Loader):
|
|||
# Root group
|
||||
label = "{}:{}".format(namespace, name)
|
||||
root = cmds.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)
|
||||
|
||||
presets = config.get_presets(project=os.environ['AVALON_PROJECT'])
|
||||
colors = presets['plugins']['maya']['load']['colors']
|
||||
|
||||
c = colors.get(family)
|
||||
if c is not None:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
from avalon.maya import lib
|
||||
from avalon import api
|
||||
import json
|
||||
from pypeapp import config
|
||||
import os
|
||||
import maya.cmds as cmds
|
||||
|
||||
|
|
@ -26,14 +26,6 @@ class VRayProxyLoader(api.Loader):
|
|||
except ValueError:
|
||||
family = "vrayproxy"
|
||||
|
||||
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)
|
||||
|
||||
asset_name = context['asset']["name"]
|
||||
namespace = namespace or lib.unique_namespace(
|
||||
asset_name + "_",
|
||||
|
|
@ -54,6 +46,9 @@ class VRayProxyLoader(api.Loader):
|
|||
if not nodes:
|
||||
return
|
||||
|
||||
presets = config.get_presets(project=os.environ['AVALON_PROJECT'])
|
||||
colors = presets['plugins']['maya']['load']['colors']
|
||||
|
||||
c = colors.get(family)
|
||||
if c is not None:
|
||||
cmds.setAttr("{0}_{1}.useOutlinerColor".format(name, "GRP"), 1)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ from maya import cmds
|
|||
from avalon import api
|
||||
from avalon.maya import lib as avalon_lib, pipeline
|
||||
from pype.maya import lib
|
||||
from pypeapp import config
|
||||
|
||||
|
||||
class YetiCacheLoader(api.Loader):
|
||||
|
|
@ -54,13 +55,9 @@ class YetiCacheLoader(api.Loader):
|
|||
|
||||
group_name = "{}:{}".format(namespace, name)
|
||||
group_node = cmds.group(nodes, name=group_name)
|
||||
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)
|
||||
|
||||
presets = config.get_presets(project=os.environ['AVALON_PROJECT'])
|
||||
colors = presets['plugins']['maya']['load']['colors']
|
||||
|
||||
c = colors.get(family)
|
||||
if c is not None:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import pype.maya.plugin
|
||||
import os
|
||||
import json
|
||||
from pypeapp import config
|
||||
|
||||
|
||||
class YetiRigLoader(pype.maya.plugin.ReferenceLoader):
|
||||
|
|
@ -27,13 +27,9 @@ class YetiRigLoader(pype.maya.plugin.ReferenceLoader):
|
|||
groupName="{}:{}".format(namespace, name))
|
||||
|
||||
groupName = "{}:{}".format(namespace, name)
|
||||
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)
|
||||
|
||||
presets = config.get_presets(project=os.environ['AVALON_PROJECT'])
|
||||
colors = presets['plugins']['maya']['load']['colors']
|
||||
|
||||
c = colors.get('yetiRig')
|
||||
if c is not None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue