mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-27 06:12:19 +01:00
replaced os.environ lookups with session
This commit is contained in:
parent
a294b6ca62
commit
a21ee37975
5 changed files with 17 additions and 21 deletions
|
|
@ -12,14 +12,14 @@ from collections import OrderedDict, defaultdict
|
|||
|
||||
from maya import cmds, mel
|
||||
|
||||
from avalon import maya, io
|
||||
from avalon import Session, maya, io
|
||||
from cb.utils.maya import core
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
project = io.find_one({"type": "project",
|
||||
"name": os.environ["AVALON_PROJECT"]},
|
||||
"name": Session["AVALON_PROJECT"]},
|
||||
projection={"config.template.publish": True,
|
||||
"_id": False})
|
||||
TEMPLATE = project["config"]["template"]["publish"]
|
||||
|
|
@ -656,8 +656,7 @@ def generate_ids(nodes):
|
|||
"""Assign a new id of the current active context to the nodes"""
|
||||
|
||||
# Get the asset ID from the database for the asset of current context
|
||||
asset = os.environ["AVALON_ASSET"]
|
||||
asset_id = io.find_one({"type": "asset", "name": asset},
|
||||
asset_id = io.find_one({"type": "asset", "name": Session["AVALON_ASSET"]},
|
||||
projection={"_id": True})
|
||||
|
||||
for node in nodes:
|
||||
|
|
@ -700,7 +699,7 @@ def get_representation_file(representation, template=TEMPLATE):
|
|||
|
||||
"""
|
||||
context = representation["context"].copy()
|
||||
context["root"] = os.environ["AVALON_ROOT"]
|
||||
context["root"] = Session["AVALON_ROOT"]
|
||||
return template.format(**context)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
import os
|
||||
|
||||
from maya import cmds
|
||||
|
||||
from avalon import api, maya
|
||||
from avalon import api, Session, maya
|
||||
|
||||
|
||||
class RigLoader(api.Loader):
|
||||
|
|
@ -56,7 +54,7 @@ class RigLoader(api.Loader):
|
|||
roots = cmds.ls(self[:], assemblies=True, long=True)
|
||||
assert roots, "No root nodes in rig, this is a bug."
|
||||
|
||||
asset = os.environ["AVALON_ASSET"]
|
||||
asset = Session["AVALON_ASSET"]
|
||||
dependency = str(context["representation"]["_id"])
|
||||
|
||||
# Create the animation instance
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
import os
|
||||
from maya import cmds
|
||||
|
||||
import pyblish.api
|
||||
|
||||
from avalon import maya, api
|
||||
from avalon import Session, maya, api
|
||||
import colorbleed.maya.lib as lib
|
||||
|
||||
|
||||
|
|
@ -18,7 +17,7 @@ class CollectMindbenderMayaRenderlayers(pyblish.api.ContextPlugin):
|
|||
def process(self, context):
|
||||
|
||||
registered_root = api.registered_root()
|
||||
asset_name = os.environ["AVALON_ASSET"]
|
||||
asset_name = Session["AVALON_ASSET"]
|
||||
|
||||
current_file = context.data["currentFile"]
|
||||
relative_file = current_file.replace(registered_root, "{root}")
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import pyblish.api
|
||||
import os
|
||||
|
||||
import avalon.io as io
|
||||
from avalon import Session, io
|
||||
|
||||
|
||||
class CollectAssumedDestination(pyblish.api.InstancePlugin):
|
||||
|
|
@ -64,7 +64,7 @@ class CollectAssumedDestination(pyblish.api.InstancePlugin):
|
|||
# get all the stuff from the database
|
||||
subset_name = instance.data["subset"]
|
||||
asset_name = instance.data["asset"]
|
||||
project_name = os.environ["AVALON_PROJECT"]
|
||||
project_name = Session["AVALON_PROJECT"]
|
||||
|
||||
project = io.find_one({"type": "project",
|
||||
"name": project_name},
|
||||
|
|
@ -95,9 +95,9 @@ class CollectAssumedDestination(pyblish.api.InstancePlugin):
|
|||
if version is not None:
|
||||
version_number += version["name"]
|
||||
|
||||
template_data = {"root": os.environ["AVALON_PROJECTS"],
|
||||
template_data = {"root": Session["AVALON_PROJECTS"],
|
||||
"project": project_name,
|
||||
"silo": os.environ["AVALON_SILO"],
|
||||
"silo": Session["AVALON_SILO"],
|
||||
"asset": asset_name,
|
||||
"subset": subset_name,
|
||||
"version": version_number,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import shutil
|
|||
|
||||
import errno
|
||||
import pyblish.api
|
||||
from avalon import api, io
|
||||
from avalon import Session, api, io
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
|
@ -47,10 +47,10 @@ class IntegrateAsset(pyblish.api.InstancePlugin):
|
|||
def register(self, instance):
|
||||
|
||||
# Required environment variables
|
||||
PROJECT = os.environ["AVALON_PROJECT"]
|
||||
ASSET = instance.data.get("asset") or os.environ["AVALON_ASSET"]
|
||||
SILO = os.environ["AVALON_SILO"]
|
||||
LOCATION = os.getenv("AVALON_LOCATION")
|
||||
PROJECT = Session["AVALON_PROJECT"]
|
||||
ASSET = instance.data.get("asset") or Session["AVALON_ASSET"]
|
||||
SILO = Session["AVALON_SILO"]
|
||||
LOCATION = Session("AVALON_LOCATION")
|
||||
|
||||
context = instance.context
|
||||
# Atomicity
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue