mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
reduce usage of legay_io
This commit is contained in:
parent
4b1933b1b9
commit
02b371139a
25 changed files with 90 additions and 188 deletions
|
|
@ -49,7 +49,6 @@ class HostBase(object):
|
|||
Todo:
|
||||
- move content of 'install_host' as method of this class
|
||||
- register host object
|
||||
- install legacy_io
|
||||
- install global plugin paths
|
||||
- store registered plugin paths to this object
|
||||
- handle current context (project, asset, task)
|
||||
|
|
@ -133,8 +132,6 @@ class HostBase(object):
|
|||
can be opened multiple workfiles at one moment and change of context
|
||||
can't be caught properly.
|
||||
|
||||
Default implementation returns values from 'legacy_io.Session'.
|
||||
|
||||
Returns:
|
||||
Dict[str, Union[str, None]]: Context with 3 keys 'project_name',
|
||||
'asset_name' and 'task_name'. All of them can be 'None'.
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ from qtpy import QtCore
|
|||
|
||||
from ayon_core.lib import Logger
|
||||
from ayon_core.tests.lib import is_in_tests
|
||||
from ayon_core.pipeline import install_host, legacy_io
|
||||
from ayon_core.pipeline import install_host
|
||||
from ayon_core.addon import AddonsManager
|
||||
from ayon_core.tools.utils import host_tools, get_ayon_qt_app
|
||||
from ayon_core.tools.adobe_webserver.app import WebServerTool
|
||||
|
|
@ -298,13 +298,10 @@ class AfterEffectsRoute(WebSocketRoute):
|
|||
log.info("Setting context change")
|
||||
log.info("project {} asset {} ".format(project, asset))
|
||||
if project:
|
||||
legacy_io.Session["AVALON_PROJECT"] = project
|
||||
os.environ["AVALON_PROJECT"] = project
|
||||
if asset:
|
||||
legacy_io.Session["AVALON_ASSET"] = asset
|
||||
os.environ["AVALON_ASSET"] = asset
|
||||
if task:
|
||||
legacy_io.Session["AVALON_TASK"] = task
|
||||
os.environ["AVALON_TASK"] = task
|
||||
|
||||
async def read(self):
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ from ayon_core.host import (
|
|||
from ayon_core.client import get_asset_by_name
|
||||
from ayon_core.pipeline import (
|
||||
schema,
|
||||
legacy_io,
|
||||
get_current_project_name,
|
||||
get_current_asset_name,
|
||||
register_loader_plugin_path,
|
||||
|
|
@ -380,7 +379,7 @@ def _on_task_changed():
|
|||
# `directory` attribute, so it opens in that directory (does it?).
|
||||
# https://docs.blender.org/api/blender2.8/bpy.types.Operator.html#calling-a-file-selector
|
||||
# https://docs.blender.org/api/blender2.8/bpy.types.WindowManager.html#bpy.types.WindowManager.fileselect_add
|
||||
workdir = legacy_io.Session["AVALON_WORKDIR"]
|
||||
workdir = os.getenv("AVALON_WORKDIR")
|
||||
log.debug("New working directory: %s", workdir)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ from ayon_core.lib import (
|
|||
EnumDef,
|
||||
)
|
||||
from ayon_core.pipeline import (
|
||||
legacy_io,
|
||||
Creator,
|
||||
CreatedInstance
|
||||
)
|
||||
|
|
@ -136,7 +135,7 @@ class GenericCreateSaver(Creator):
|
|||
ext = data["creator_attributes"]["image_format"]
|
||||
|
||||
# Subset change detected
|
||||
workdir = os.path.normpath(legacy_io.Session["AVALON_WORKDIR"])
|
||||
workdir = os.path.normpath(os.getenv("AVALON_WORKDIR"))
|
||||
formatting_data.update({
|
||||
"workdir": workdir,
|
||||
"frame": "0" * frame_padding,
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ from ayon_core.lib import (
|
|||
emit_event
|
||||
)
|
||||
from ayon_core.pipeline import (
|
||||
legacy_io,
|
||||
get_current_project_name,
|
||||
register_loader_plugin_path,
|
||||
register_inventory_action_path,
|
||||
|
|
@ -247,7 +246,7 @@ def _set_project():
|
|||
None
|
||||
|
||||
"""
|
||||
workdir = legacy_io.Session["AVALON_WORKDIR"]
|
||||
workdir = os.getenv("AVALON_WORKDIR")
|
||||
|
||||
try:
|
||||
os.makedirs(workdir)
|
||||
|
|
@ -629,7 +628,7 @@ def on_task_changed():
|
|||
# Run
|
||||
menu.update_menu_task_label()
|
||||
|
||||
workdir = legacy_io.Session["AVALON_WORKDIR"]
|
||||
workdir = os.getenv("AVALON_WORKDIR")
|
||||
if os.path.exists(workdir):
|
||||
log.info("Updating Maya workspace for task change to %s", workdir)
|
||||
_set_project()
|
||||
|
|
@ -678,7 +677,7 @@ def workfile_save_before_xgen(event):
|
|||
|
||||
import xgenm
|
||||
|
||||
current_work_dir = legacy_io.Session["AVALON_WORKDIR"].replace("\\", "/")
|
||||
current_work_dir = os.getenv("AVALON_WORKDIR").replace("\\", "/")
|
||||
expected_work_dir = event.data["workdir_path"].replace("\\", "/")
|
||||
if current_work_dir == expected_work_dir:
|
||||
return
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import maya.cmds as cmds
|
|||
from ayon_core.settings import get_project_settings
|
||||
from ayon_core.pipeline import (
|
||||
load,
|
||||
legacy_io,
|
||||
get_representation_path
|
||||
)
|
||||
from ayon_core.hosts.maya.api.lib import (
|
||||
|
|
@ -26,11 +25,6 @@ def is_sequence(files):
|
|||
return sequence
|
||||
|
||||
|
||||
def get_current_session_fps():
|
||||
session_fps = float(legacy_io.Session.get('AVALON_FPS', 25))
|
||||
return convert_to_maya_fps(session_fps)
|
||||
|
||||
|
||||
class ArnoldStandinLoader(load.LoaderPlugin):
|
||||
"""Load as Arnold standin"""
|
||||
|
||||
|
|
@ -99,7 +93,7 @@ class ArnoldStandinLoader(load.LoaderPlugin):
|
|||
sequence = is_sequence(os.listdir(os.path.dirname(repre_path)))
|
||||
cmds.setAttr(standin_shape + ".useFrameExtension", sequence)
|
||||
|
||||
fps = float(version["data"].get("fps"))or get_current_session_fps()
|
||||
fps = float(version["data"].get("fps")) or 25
|
||||
cmds.setAttr(standin_shape + ".abcFPS", fps)
|
||||
|
||||
nodes = [root, standin, standin_shape]
|
||||
|
|
|
|||
|
|
@ -1,13 +1,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""Collect Vray Scene and prepare it for extraction and publishing."""
|
||||
import re
|
||||
|
||||
import maya.app.renderSetup.model.renderSetup as renderSetup
|
||||
from maya import cmds
|
||||
|
||||
import pyblish.api
|
||||
|
||||
from ayon_core.pipeline import legacy_io
|
||||
from ayon_core.lib import get_formatted_current_time
|
||||
from ayon_core.hosts.maya.api import lib
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import ayon_core.hosts.maya.api.action
|
|||
from ayon_core.client.mongo import OpenPypeMongoConnection
|
||||
from ayon_core.hosts.maya.api.shader_definition_editor import (
|
||||
DEFINITION_FILENAME)
|
||||
from ayon_core.pipeline import legacy_io
|
||||
from ayon_core.pipeline.publish import (
|
||||
OptionalPyblishPluginMixin, PublishValidationError, ValidateContentsOrder)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import pyblish.api
|
|||
import ayon_core.hosts.maya.api.action
|
||||
from ayon_core.client import get_assets
|
||||
from ayon_core.hosts.maya.api import lib
|
||||
from ayon_core.pipeline import legacy_io
|
||||
from ayon_core.pipeline.publish import (
|
||||
PublishValidationError, ValidatePipelineOrder)
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import pyblish.api
|
|||
|
||||
import ayon_core.hosts.maya.api.action
|
||||
from ayon_core.client import get_subset_by_name
|
||||
from ayon_core.pipeline import legacy_io
|
||||
from ayon_core.pipeline.publish import PublishValidationError
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@ import re
|
|||
import pyblish.api
|
||||
|
||||
import ayon_core.hosts.maya.api.action
|
||||
from ayon_core.pipeline import legacy_io
|
||||
from ayon_core.settings import get_project_settings
|
||||
from ayon_core.pipeline.publish import (
|
||||
ValidateContentsOrder,
|
||||
OptionalPyblishPluginMixin,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ import os
|
|||
|
||||
import pyblish.api
|
||||
|
||||
from ayon_core.pipeline import legacy_io
|
||||
from openpype_modules.webpublisher.lib import (
|
||||
get_batch_asset_task_info,
|
||||
parse_json
|
||||
|
|
@ -71,8 +70,6 @@ class CollectBatchData(pyblish.api.ContextPlugin):
|
|||
|
||||
os.environ["AVALON_ASSET"] = asset_name
|
||||
os.environ["AVALON_TASK"] = task_name
|
||||
legacy_io.Session["AVALON_ASSET"] = asset_name
|
||||
legacy_io.Session["AVALON_TASK"] = task_name
|
||||
|
||||
context.data["asset"] = asset_name
|
||||
context.data["task"] = task_name
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import pyblish.api
|
|||
|
||||
from ayon_core.pipeline import (
|
||||
register_creator_plugin_path,
|
||||
legacy_io,
|
||||
)
|
||||
from ayon_core.host import HostBase, IPublishHost
|
||||
|
||||
|
|
@ -24,7 +23,6 @@ class TrayPublisherHost(HostBase, IPublishHost):
|
|||
|
||||
def install(self):
|
||||
os.environ["AVALON_APP"] = self.name
|
||||
legacy_io.Session["AVALON_APP"] = self.name
|
||||
|
||||
pyblish.api.register_host("traypublisher")
|
||||
pyblish.api.register_plugin_path(PUBLISH_PATH)
|
||||
|
|
@ -43,8 +41,6 @@ class TrayPublisherHost(HostBase, IPublishHost):
|
|||
# TODO Deregister project specific plugins and register new project
|
||||
# plugins
|
||||
os.environ["AVALON_PROJECT"] = project_name
|
||||
legacy_io.Session["AVALON_PROJECT"] = project_name
|
||||
legacy_io.install()
|
||||
HostContext.set_project_name(project_name)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ from ayon_core.hosts.tvpaint import TVPAINT_ROOT_DIR
|
|||
from ayon_core.settings import get_current_project_settings
|
||||
from ayon_core.lib import register_event_callback
|
||||
from ayon_core.pipeline import (
|
||||
legacy_io,
|
||||
register_loader_plugin_path,
|
||||
register_creator_plugin_path,
|
||||
AVALON_CONTAINER_ID,
|
||||
|
|
@ -66,11 +65,10 @@ class TVPaintHost(HostBase, IWorkfileHost, ILoadHost, IPublishHost):
|
|||
def install(self):
|
||||
"""Install TVPaint-specific functionality."""
|
||||
|
||||
log.info("OpenPype - Installing TVPaint integration")
|
||||
legacy_io.install()
|
||||
log.info("AYON - Installing TVPaint integration")
|
||||
|
||||
# Create workdir folder if does not exist yet
|
||||
workdir = legacy_io.Session["AVALON_WORKDIR"]
|
||||
workdir = os.getenv("AVALON_WORKDIR")
|
||||
if not os.path.exists(workdir):
|
||||
os.makedirs(workdir)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import tempfile
|
|||
|
||||
import pyblish.api
|
||||
|
||||
from ayon_core.pipeline import legacy_io
|
||||
from ayon_core.hosts.tvpaint.api.lib import (
|
||||
execute_george,
|
||||
execute_george_through_file,
|
||||
|
|
@ -90,7 +89,6 @@ class CollectWorkfileData(pyblish.api.ContextPlugin):
|
|||
("AVALON_TASK", "task_name")
|
||||
)
|
||||
for env_key, key in key_map:
|
||||
legacy_io.Session[env_key] = workfile_context[key]
|
||||
os.environ[env_key] = workfile_context[key]
|
||||
self.log.info("Context changed to: {}".format(workfile_context))
|
||||
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@ from pprint import pformat
|
|||
|
||||
import pyblish.api
|
||||
|
||||
from ayon_core.pipeline import legacy_io
|
||||
|
||||
|
||||
def collect(root,
|
||||
regex=None,
|
||||
|
|
@ -132,7 +130,6 @@ class CollectSequencesFromJob(pyblish.api.ContextPlugin):
|
|||
session = metadata.get("session")
|
||||
if session:
|
||||
self.log.info("setting session using metadata")
|
||||
legacy_io.Session.update(session)
|
||||
os.environ.update(session)
|
||||
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -13,9 +13,6 @@ from ayon_core.modules.royalrender.rr_job import (
|
|||
get_rr_platform
|
||||
)
|
||||
from ayon_core.pipeline.publish import KnownPublishError
|
||||
from ayon_core.pipeline import (
|
||||
legacy_io,
|
||||
)
|
||||
from ayon_core.pipeline.farm.pyblish_functions import (
|
||||
create_skeleton_instance,
|
||||
create_instances_for_aov,
|
||||
|
|
@ -145,7 +142,6 @@ class CreatePublishRoyalRenderJob(pyblish.api.InstancePlugin,
|
|||
"intent": instance.context.data.get("intent"),
|
||||
"comment": instance.context.data.get("comment"),
|
||||
"job": attr.asdict(rr_job),
|
||||
"session": legacy_io.Session.copy(),
|
||||
"instances": instances
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,11 +29,11 @@ from .publish.lib import filter_pyblish_plugins
|
|||
from .anatomy import Anatomy
|
||||
from .template_data import get_template_data_with_names
|
||||
from .workfile import (
|
||||
get_workdir,
|
||||
get_workfile_template_key,
|
||||
get_custom_workfile_template_by_string_context,
|
||||
)
|
||||
from . import (
|
||||
legacy_io,
|
||||
register_loader_plugin_path,
|
||||
register_inventory_action_path,
|
||||
register_creator_plugin_path,
|
||||
|
|
@ -116,22 +116,15 @@ def install_host(host):
|
|||
# Make sure global AYON connection has set site id and version
|
||||
get_ayon_server_api_connection()
|
||||
|
||||
legacy_io.install()
|
||||
addons_manager = _get_addons_manager()
|
||||
|
||||
missing = list()
|
||||
for key in ("AVALON_PROJECT", "AVALON_ASSET"):
|
||||
if key not in legacy_io.Session:
|
||||
missing.append(key)
|
||||
project_name = os.getenv("AVALON_PROJECT")
|
||||
if not project_name:
|
||||
raise ValueError(
|
||||
"AVALON_PROJECT is missing in environment variables."
|
||||
)
|
||||
|
||||
assert not missing, (
|
||||
"%s missing from environment, %s" % (
|
||||
", ".join(missing),
|
||||
json.dumps(legacy_io.Session, indent=4, sort_keys=True)
|
||||
))
|
||||
|
||||
project_name = legacy_io.Session["AVALON_PROJECT"]
|
||||
log.info("Activating %s.." % project_name)
|
||||
log.info("Activating {}..".format(project_name))
|
||||
|
||||
# Optional host install function
|
||||
if hasattr(host, "install"):
|
||||
|
|
@ -158,7 +151,6 @@ def install_host(host):
|
|||
print("Registering pyblish target: automated")
|
||||
pyblish.api.register_target("automated")
|
||||
|
||||
project_name = os.environ.get("AVALON_PROJECT")
|
||||
host_name = os.environ.get("AVALON_APP")
|
||||
|
||||
# Give option to handle host installation
|
||||
|
|
@ -256,8 +248,6 @@ def uninstall_host():
|
|||
|
||||
deregister_host()
|
||||
|
||||
legacy_io.uninstall()
|
||||
|
||||
log.info("Successfully uninstalled Avalon!")
|
||||
|
||||
|
||||
|
|
@ -482,13 +472,17 @@ def get_template_data_from_session(session=None, system_settings=None):
|
|||
Dict[str, Any]: All available data from session.
|
||||
"""
|
||||
|
||||
if session is None:
|
||||
session = legacy_io.Session
|
||||
|
||||
project_name = session["AVALON_PROJECT"]
|
||||
asset_name = session["AVALON_ASSET"]
|
||||
task_name = session["AVALON_TASK"]
|
||||
host_name = session["AVALON_APP"]
|
||||
if session is not None:
|
||||
project_name = session["AVALON_PROJECT"]
|
||||
asset_name = session["AVALON_ASSET"]
|
||||
task_name = session["AVALON_TASK"]
|
||||
host_name = session["AVALON_APP"]
|
||||
else:
|
||||
context = get_current_context()
|
||||
project_name = context["project_name"]
|
||||
asset_name = context["asset_name"]
|
||||
task_name = context["task_name"]
|
||||
host_name = get_current_host_name()
|
||||
|
||||
return get_template_data_with_names(
|
||||
project_name, asset_name, task_name, host_name, system_settings
|
||||
|
|
@ -529,10 +523,12 @@ def get_workdir_from_session(session=None, template_key=None):
|
|||
str: Workdir path.
|
||||
"""
|
||||
|
||||
if session is None:
|
||||
session = legacy_io.Session
|
||||
project_name = session["AVALON_PROJECT"]
|
||||
host_name = session["AVALON_APP"]
|
||||
if session is not None:
|
||||
project_name = session["AVALON_PROJECT"]
|
||||
host_name = session["AVALON_APP"]
|
||||
else:
|
||||
project_name = get_current_project_name()
|
||||
host_name = get_current_host_name()
|
||||
template_data = get_template_data_from_session(session)
|
||||
|
||||
if not template_key:
|
||||
|
|
@ -556,86 +552,39 @@ def get_custom_workfile_template_from_session(
|
|||
):
|
||||
"""Filter and fill workfile template profiles by current context.
|
||||
|
||||
Current context is defined by `legacy_io.Session`. That's why this
|
||||
function should be used only inside host where context is set and stable.
|
||||
This function cab be used only inside host where context is set.
|
||||
|
||||
Args:
|
||||
session (Union[None, Dict[str, str]]): Session from which are taken
|
||||
session (Optional[Dict[str, str]]): Session from which are taken
|
||||
data.
|
||||
project_settings(Dict[str, Any]): Template profiles from settings.
|
||||
project_settings(Optional[Dict[str, Any]]): Project settings.
|
||||
|
||||
Returns:
|
||||
str: Path to template or None if none of profiles match current
|
||||
context. (Existence of formatted path is not validated.)
|
||||
"""
|
||||
|
||||
if session is None:
|
||||
session = legacy_io.Session
|
||||
if session is not None:
|
||||
project_name = session["AVALON_PROJECT"]
|
||||
asset_name = session["AVALON_ASSET"]
|
||||
task_name = session["AVALON_TASK"]
|
||||
host_name = session["AVALON_APP"]
|
||||
else:
|
||||
context = get_current_context()
|
||||
project_name = context["project_name"]
|
||||
asset_name = context["asset_name"]
|
||||
task_name = context["task_name"]
|
||||
host_name = get_current_host_name()
|
||||
|
||||
return get_custom_workfile_template_by_string_context(
|
||||
session["AVALON_PROJECT"],
|
||||
session["AVALON_ASSET"],
|
||||
session["AVALON_TASK"],
|
||||
session["AVALON_APP"],
|
||||
project_name,
|
||||
asset_name,
|
||||
task_name,
|
||||
host_name,
|
||||
project_settings=project_settings
|
||||
)
|
||||
|
||||
|
||||
def compute_session_changes(
|
||||
session, asset_doc, task_name, template_key=None
|
||||
):
|
||||
"""Compute the changes for a session object on task under asset.
|
||||
|
||||
Function does not change the session object, only returns changes.
|
||||
|
||||
Args:
|
||||
session (Dict[str, str]): The initial session to compute changes to.
|
||||
This is required for computing the full Work Directory, as that
|
||||
also depends on the values that haven't changed.
|
||||
asset_doc (Dict[str, Any]): Asset document to switch to.
|
||||
task_name (str): Name of task to switch to.
|
||||
template_key (Union[str, None]): Prepare workfile template key in
|
||||
anatomy templates.
|
||||
|
||||
Returns:
|
||||
Dict[str, str]: Changes in the Session dictionary.
|
||||
"""
|
||||
|
||||
# Get asset document and asset
|
||||
if not asset_doc:
|
||||
task_name = None
|
||||
asset_name = None
|
||||
else:
|
||||
asset_name = get_asset_name_identifier(asset_doc)
|
||||
|
||||
# Detect any changes compared session
|
||||
mapping = {
|
||||
"AVALON_ASSET": asset_name,
|
||||
"AVALON_TASK": task_name,
|
||||
}
|
||||
changes = {
|
||||
key: value
|
||||
for key, value in mapping.items()
|
||||
if value != session.get(key)
|
||||
}
|
||||
if not changes:
|
||||
return changes
|
||||
|
||||
# Compute work directory (with the temporary changed session so far)
|
||||
changed_session = session.copy()
|
||||
changed_session.update(changes)
|
||||
|
||||
workdir = None
|
||||
if asset_doc:
|
||||
workdir = get_workdir_from_session(
|
||||
changed_session, template_key
|
||||
)
|
||||
|
||||
changes["AVALON_WORKDIR"] = workdir
|
||||
|
||||
return changes
|
||||
|
||||
|
||||
def change_current_context(asset_doc, task_name, template_key=None):
|
||||
"""Update active Session to a new task work area.
|
||||
|
||||
|
|
@ -651,32 +600,47 @@ def change_current_context(asset_doc, task_name, template_key=None):
|
|||
Dict[str, str]: The changed key, values in the current Session.
|
||||
"""
|
||||
|
||||
changes = compute_session_changes(
|
||||
legacy_io.Session,
|
||||
asset_doc,
|
||||
task_name,
|
||||
template_key=template_key
|
||||
)
|
||||
project_name = get_current_project_name()
|
||||
workdir = None
|
||||
if asset_doc:
|
||||
project_doc = get_project(project_name)
|
||||
host_name = get_current_host_name()
|
||||
workdir = get_workdir(
|
||||
project_doc,
|
||||
asset_doc,
|
||||
task_name,
|
||||
host_name,
|
||||
template_key=template_key
|
||||
)
|
||||
|
||||
folder_path = get_asset_name_identifier(asset_doc)
|
||||
envs = {
|
||||
"AVALON_PROJECT": project_name,
|
||||
"AVALON_ASSET": folder_path,
|
||||
"AVALON_TASK": task_name,
|
||||
"AVALON_WORKDIR": workdir,
|
||||
}
|
||||
|
||||
# Update the Session and environments. Pop from environments all keys with
|
||||
# value set to None.
|
||||
for key, value in changes.items():
|
||||
legacy_io.Session[key] = value
|
||||
for key, value in envs.items():
|
||||
if value is None:
|
||||
os.environ.pop(key, None)
|
||||
else:
|
||||
os.environ[key] = value
|
||||
|
||||
data = changes.copy()
|
||||
data = envs.copy()
|
||||
|
||||
# Convert env keys to human readable keys
|
||||
data["project_name"] = legacy_io.Session["AVALON_PROJECT"]
|
||||
data["asset_name"] = legacy_io.Session["AVALON_ASSET"]
|
||||
data["task_name"] = legacy_io.Session["AVALON_TASK"]
|
||||
data["project_name"] = project_name
|
||||
data["asset_name"] = get_asset_name_identifier(asset_doc)
|
||||
data["task_name"] = task_name
|
||||
data["workdir_path"] = workdir
|
||||
|
||||
# Emit session change
|
||||
emit_event("taskChanged", data)
|
||||
|
||||
return changes
|
||||
return data
|
||||
|
||||
|
||||
def get_process_id():
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ from ayon_core.lib.attribute_definitions import (
|
|||
get_default_values,
|
||||
)
|
||||
from ayon_core.host import IPublishHost, IWorkfileHost
|
||||
from ayon_core.pipeline import legacy_io, Anatomy
|
||||
from ayon_core.pipeline import Anatomy
|
||||
from ayon_core.pipeline.plugin_discover import DiscoverResult
|
||||
|
||||
from .creator_plugins import (
|
||||
|
|
@ -1684,25 +1684,16 @@ class CreateContext:
|
|||
if isinstance(self.host, IWorkfileHost):
|
||||
workfile_path = self.host.get_current_workfile()
|
||||
|
||||
# --- TODO remove these conditions ---
|
||||
if not project_name:
|
||||
project_name = legacy_io.Session.get("AVALON_PROJECT")
|
||||
if not asset_name:
|
||||
asset_name = legacy_io.Session.get("AVALON_ASSET")
|
||||
if not task_name:
|
||||
task_name = legacy_io.Session.get("AVALON_TASK")
|
||||
# ---
|
||||
return project_name, asset_name, task_name, workfile_path
|
||||
|
||||
def reset_current_context(self):
|
||||
"""Refresh current context.
|
||||
|
||||
Reset is based on optional host implementation of `get_current_context`
|
||||
function or using `legacy_io.Session`.
|
||||
function.
|
||||
|
||||
Some hosts have ability to change context file without using workfiles
|
||||
tool but that change is not propagated to 'legacy_io.Session'
|
||||
nor 'os.environ'.
|
||||
tool but that change is not propagated to 'os.environ'.
|
||||
|
||||
Todos:
|
||||
UI: Current context should be also checked on save - compare
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import os
|
|||
|
||||
from ayon_core.settings import get_project_settings
|
||||
from ayon_core.lib import filter_profiles, prepare_template_data
|
||||
from ayon_core.pipeline import legacy_io
|
||||
|
||||
from .constants import DEFAULT_SUBSET_TEMPLATE
|
||||
|
||||
|
|
@ -135,7 +134,7 @@ def get_subset_name(
|
|||
family = family.rsplit(".", 1)[-1]
|
||||
|
||||
if project_name is None:
|
||||
project_name = legacy_io.Session["AVALON_PROJECT"]
|
||||
project_name = os.environ.get("AVALON_PROJECT")
|
||||
|
||||
asset_tasks = asset_doc.get("data", {}).get("tasks") or {}
|
||||
task_info = asset_tasks.get(task_name) or {}
|
||||
|
|
|
|||
|
|
@ -2,10 +2,7 @@ import os
|
|||
import logging
|
||||
|
||||
from ayon_core.settings import get_system_settings, get_project_settings
|
||||
from ayon_core.pipeline import (
|
||||
schema,
|
||||
legacy_io,
|
||||
)
|
||||
from ayon_core.pipeline import schema
|
||||
from ayon_core.pipeline.plugin_discover import (
|
||||
discover,
|
||||
register_plugin,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import os
|
|||
import pyblish.api
|
||||
|
||||
from ayon_core.host import IPublishHost
|
||||
from ayon_core.pipeline import legacy_io, registered_host
|
||||
from ayon_core.pipeline import registered_host
|
||||
from ayon_core.pipeline.create import CreateContext
|
||||
|
||||
|
||||
|
|
@ -61,7 +61,6 @@ class CollectFromCreateContext(pyblish.api.ContextPlugin):
|
|||
("AVALON_ASSET", asset_name),
|
||||
("AVALON_TASK", task_name)
|
||||
):
|
||||
legacy_io.Session[key] = value
|
||||
os.environ[key] = value
|
||||
|
||||
def create_instance(
|
||||
|
|
|
|||
|
|
@ -14,8 +14,7 @@ from .models import SiteSyncModel
|
|||
class SceneInventoryController:
|
||||
"""This is a temporary controller for AYON.
|
||||
|
||||
Goal of this temporary controller is to provide a way to get current
|
||||
context instead of using 'AvalonMongoDB' object (or 'legacy_io').
|
||||
Goal of this controller is to provide a way to get current context.
|
||||
|
||||
Also provides (hopefully) cleaner api for site sync.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import speedcopy
|
|||
|
||||
from ayon_core.client import get_project, get_asset_by_name
|
||||
from ayon_core.lib import Terminal
|
||||
from ayon_core.pipeline import legacy_io, Anatomy
|
||||
from ayon_core.pipeline import Anatomy
|
||||
|
||||
|
||||
t = Terminal()
|
||||
|
|
@ -16,11 +16,6 @@ texture_extensions = ['.tif', '.tiff', '.jpg', '.jpeg', '.tx', '.png', '.tga',
|
|||
|
||||
|
||||
class TextureCopy:
|
||||
|
||||
def __init__(self):
|
||||
if not legacy_io.Session:
|
||||
legacy_io.install()
|
||||
|
||||
def _get_textures(self, path):
|
||||
textures = []
|
||||
for dir, subdir, files in os.walk(path):
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
import os
|
||||
|
||||
from qtpy import QtWidgets
|
||||
|
||||
from ayon_core import style
|
||||
from ayon_core.lib import Logger
|
||||
from ayon_core.pipeline import legacy_io
|
||||
from ayon_core.tools.attribute_defs import AttributeDefinitionsWidget
|
||||
|
||||
|
||||
|
|
@ -26,7 +27,7 @@ class WorkfileBuildPlaceholderDialog(QtWidgets.QDialog):
|
|||
|
||||
host_name = getattr(self._host, "name", None)
|
||||
if not host_name:
|
||||
host_name = legacy_io.Session.get("AVALON_APP") or "NA"
|
||||
host_name = os.getenv("AVALON_APP") or "NA"
|
||||
self._host_name = host_name
|
||||
|
||||
plugins_combo = QtWidgets.QComboBox(self)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue