Merge branch 'develop' into enhancement/OP-8199_Do-not-convert-AYON-settings-of-separated-addons

# Conflicts:
#	client/ayon_core/settings/ayon_settings.py
This commit is contained in:
Jakub Trllo 2024-02-15 14:42:55 +01:00
commit d76fc71515
108 changed files with 616 additions and 692 deletions

View file

@ -788,6 +788,7 @@ class AddonsManager:
addon_classes.append(modules_item)
aliased_names = []
for addon_cls in addon_classes:
name = addon_cls.__name__
if issubclass(addon_cls, OpenPypeModule):
@ -807,6 +808,13 @@ class AddonsManager:
self._addons.append(addon)
self._addons_by_id[addon.id] = addon
self._addons_by_name[addon.name] = addon
# NOTE This will be removed with release 1.0.0 of ayon-core
# please use carefully.
# Gives option to use alias name for addon for cases when
# name in OpenPype was not the same as in AYON.
name_alias = getattr(addon, "openpype_alias", None)
if name_alias:
aliased_names.append((name_alias, addon))
enabled_str = "X"
if not addon.enabled:
enabled_str = " "
@ -822,6 +830,17 @@ class AddonsManager:
exc_info=True
)
for item in aliased_names:
name_alias, addon = item
if name_alias not in self._addons_by_name:
self._addons_by_name[name_alias] = addon
continue
self.log.warning(
"Alias name '{}' of addon '{}' is already assigned.".format(
name_alias, addon.name
)
)
if self._report is not None:
report[self._report_total_key] = time.time() - time_start
self._report["Initialization"] = report

View file

@ -73,6 +73,20 @@ class Commands:
import pyblish.api
import pyblish.util
# Fix older jobs
for src_key, dst_key in (
("AVALON_PROJECT", "AYON_PROJECT_NAME"),
("AVALON_ASSET", "AYON_FOLDER_PATH"),
("AVALON_TASK", "AYON_TASK_NAME"),
("AVALON_WORKDIR", "AYON_WORKDIR"),
("AVALON_APP_NAME", "AYON_APP_NAME"),
("AVALON_APP", "AYON_HOST_NAME"),
):
if src_key in os.environ and dst_key not in os.environ:
os.environ[dst_key] = os.environ[src_key]
# Remove old keys, so we're sure they're not used
os.environ.pop(src_key, None)
log = Logger.get_logger("CLI-publish")
install_ayon_plugins()
@ -87,7 +101,7 @@ class Commands:
if not any(paths):
raise RuntimeError("No publish paths specified")
app_full_name = os.getenv("AVALON_APP_NAME")
app_full_name = os.getenv("AYON_APP_NAME")
if app_full_name:
context = get_global_context()
env = get_app_environments_for_context(

View file

@ -21,7 +21,7 @@ class CreateWorkdirExtraFolders(PreLaunchHook):
return
env = self.data.get("env") or {}
workdir = env.get("AVALON_WORKDIR")
workdir = env.get("AYON_WORKDIR")
if not workdir or not os.path.exists(workdir):
return

View file

@ -106,7 +106,7 @@ class HostBase(object):
Union[str, None]: Current project name.
"""
return os.environ.get("AVALON_PROJECT")
return os.environ.get("AYON_PROJECT_NAME")
def get_current_asset_name(self):
"""
@ -114,7 +114,7 @@ class HostBase(object):
Union[str, None]: Current asset name.
"""
return os.environ.get("AVALON_ASSET")
return os.environ.get("AYON_FOLDER_PATH")
def get_current_task_name(self):
"""
@ -122,7 +122,7 @@ class HostBase(object):
Union[str, None]: Current task name.
"""
return os.environ.get("AVALON_TASK")
return os.environ.get("AYON_TASK_NAME")
def get_current_context(self):
"""Get current context information.

View file

@ -234,7 +234,7 @@ class IWorkfileHost:
str: Path to new workdir.
"""
return session["AVALON_WORKDIR"]
return session["AYON_WORKDIR"]
# --- Deprecated method names ---
def file_extensions(self):

View file

@ -297,11 +297,11 @@ class AfterEffectsRoute(WebSocketRoute):
log.info("Setting context change")
log.info("project {} asset {} ".format(project, asset))
if project:
os.environ["AVALON_PROJECT"] = project
os.environ["AYON_PROJECT_NAME"] = project
if asset:
os.environ["AVALON_ASSET"] = asset
os.environ["AYON_FOLDER_PATH"] = asset
if task:
os.environ["AVALON_TASK"] = task
os.environ["AYON_TASK_NAME"] = task
async def read(self):
log.debug("aftereffects.read client calls server server calls "

View file

@ -272,7 +272,7 @@ def set_resolution(data):
def on_new():
project = os.environ.get("AVALON_PROJECT")
project = os.environ.get("AYON_PROJECT_NAME")
settings = get_project_settings(project).get("blender")
set_resolution_startup = settings.get("set_resolution_startup")
@ -293,7 +293,7 @@ def on_new():
def on_open():
project = os.environ.get("AVALON_PROJECT")
project = os.environ.get("AYON_PROJECT_NAME")
settings = get_project_settings(project).get("blender")
set_resolution_startup = settings.get("set_resolution_startup")
@ -379,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 = os.getenv("AVALON_WORKDIR")
workdir = os.getenv("AYON_WORKDIR")
log.debug("New working directory: %s", workdir)

View file

@ -82,7 +82,7 @@ def file_extensions() -> List[str]:
def work_root(session: dict) -> str:
"""Return the default root to browse for work files."""
work_dir = session["AVALON_WORKDIR"]
work_dir = session["AYON_WORKDIR"]
scene_dir = session.get("AVALON_SCENEDIR")
if scene_dir:
return str(Path(work_dir, scene_dir))

View file

@ -34,4 +34,4 @@ def current_file():
def work_root(session):
return os.path.normpath(session["AVALON_WORKDIR"]).replace("\\", "/")
return os.path.normpath(session["AYON_WORKDIR"]).replace("\\", "/")

View file

@ -70,7 +70,7 @@ class LoadClip(opfapi.ClipLoader):
self.log.info("Loading with colorspace: `{}`".format(colorspace))
# create workfile path
workfile_dir = os.environ["AVALON_WORKDIR"]
workfile_dir = os.environ["AYON_WORKDIR"]
openclip_dir = os.path.join(
workfile_dir, clip_name
)

View file

@ -80,7 +80,7 @@ class LoadClipBatch(opfapi.ClipLoader):
self.log.info("Loading with colorspace: `{}`".format(colorspace))
# create workfile path
workfile_dir = options.get("workdir") or os.environ["AVALON_WORKDIR"]
workfile_dir = options.get("workdir") or os.environ["AYON_WORKDIR"]
openclip_dir = os.path.join(
workfile_dir, clip_name
)

View file

@ -22,7 +22,7 @@ def get_fusion_version(app_name):
The function is triggered by the prelaunch hooks to get the fusion version.
`app_name` is obtained by prelaunch hooks from the
`launch_context.env.get("AVALON_APP_NAME")`.
`launch_context.env.get("AYON_APP_NAME")`.
To get a correct Fusion version, a version number should be present
in the `applications/fusion/variants` key

View file

@ -135,7 +135,7 @@ class FusionHost(HostBase, IWorkfileHost, ILoadHost, IPublishHost):
return current_filepath
def work_root(self, session):
work_dir = session["AVALON_WORKDIR"]
work_dir = session["AYON_WORKDIR"]
scene_dir = session.get("AVALON_SCENEDIR")
if scene_dir:
return os.path.join(work_dir, scene_dir)

View file

@ -135,7 +135,7 @@ class GenericCreateSaver(Creator):
ext = data["creator_attributes"]["image_format"]
# Subset change detected
workdir = os.path.normpath(os.getenv("AVALON_WORKDIR"))
workdir = os.path.normpath(os.getenv("AYON_WORKDIR"))
formatting_data.update({
"workdir": workdir,
"frame": "0" * frame_padding,

View file

@ -131,7 +131,7 @@ class FusionCopyPrefsPrelaunch(PreLaunchHook):
) = self.get_copy_fusion_prefs_settings()
# Get launched application context and return correct app version
app_name = self.launch_context.env.get("AVALON_APP_NAME")
app_name = self.launch_context.env.get("AYON_APP_NAME")
app_version = get_fusion_version(app_name)
if app_version is None:
version_names = ", ".join(str(x) for x in FUSION_VERSIONS_DICT)

View file

@ -28,7 +28,7 @@ class FusionPrelaunch(PreLaunchHook):
def execute(self):
# making sure python 3 is installed at provided path
# Py 3.3-3.10 for Fusion 18+ or Py 3.6 for Fu 16-17
app_data = self.launch_context.env.get("AVALON_APP_NAME")
app_data = self.launch_context.env.get("AYON_APP_NAME")
app_version = get_fusion_version(app_data)
if not app_version:
raise ApplicationLaunchFailed(

View file

@ -74,4 +74,4 @@ def current_file():
def work_root(session):
return os.path.normpath(session["AVALON_WORKDIR"]).replace("\\", "/")
return os.path.normpath(session["AYON_WORKDIR"]).replace("\\", "/")

View file

@ -77,7 +77,7 @@ class ValidateSceneSettings(pyblish.api.InstancePlugin):
expected_settings.pop("resolutionWidth")
expected_settings.pop("resolutionHeight")
if (any(re.search(pattern, os.getenv('AVALON_TASK'))
if (any(re.search(pattern, os.getenv('AYON_TASK_NAME'))
for pattern in self.skip_timelines_check)):
self.log.info("Skipping frames check because of "
"task name and pattern {}".format(

View file

@ -70,4 +70,4 @@ def current_file():
def work_root(session):
return os.path.normpath(session["AVALON_WORKDIR"]).replace("\\", "/")
return os.path.normpath(session["AYON_WORKDIR"]).replace("\\", "/")

View file

@ -10,7 +10,7 @@ class SetPath(PreLaunchHook):
launch_types = {LaunchTypes.local}
def execute(self):
workdir = self.launch_context.env.get("AVALON_WORKDIR", "")
workdir = self.launch_context.env.get("AYON_WORKDIR", "")
if not workdir:
self.log.warning("BUG: Workdir is not filled.")
return

View file

@ -63,9 +63,8 @@ class MaxHost(HostBase, IWorkfileHost, ILoadHost, IPublishHost):
rt.callbacks.addScript(rt.Name('postWorkspaceChange'),
self._deferred_menu_creation)
def has_unsaved_changes(self):
# TODO: how to get it from 3dsmax?
return True
def workfile_has_unsaved_changes(self):
return rt.getSaveRequired()
def get_workfile_extensions(self):
return [".max"]

View file

@ -10,7 +10,7 @@ class SetPath(PreLaunchHook):
launch_types = {LaunchTypes.local}
def execute(self):
workdir = self.launch_context.env.get("AVALON_WORKDIR", "")
workdir = self.launch_context.env.get("AYON_WORKDIR", "")
if not workdir:
self.log.warning("BUG: Workdir is not filled.")
return

View file

@ -1,11 +1,9 @@
import pyblish.api
import os
from ayon_core.pipeline import registered_host
class SaveCurrentScene(pyblish.api.ContextPlugin):
"""Save current scene
"""
"""Save current scene"""
label = "Save current file"
order = pyblish.api.ExtractorOrder - 0.49
@ -13,9 +11,13 @@ class SaveCurrentScene(pyblish.api.ContextPlugin):
families = ["maxrender", "workfile"]
def process(self, context):
from pymxs import runtime as rt
folder = rt.maxFilePath
file = rt.maxFileName
current = os.path.join(folder, file)
assert context.data["currentFile"] == current
rt.saveMaxFile(current)
host = registered_host()
current_file = host.get_current_workfile()
assert context.data["currentFile"] == current_file
if host.workfile_has_unsaved_changes():
self.log.info(f"Saving current file: {current_file}")
host.save_workfile(current_file)
else:
self.log.debug("No unsaved changes, skipping file save..")

View file

@ -8,5 +8,8 @@
local pythonpath = systemTools.getEnvVariable "MAX_PYTHONPATH"
systemTools.setEnvVariable "PYTHONPATH" pythonpath
/*opens the create menu on startup to ensure users are presented with a useful default view.*/
max create mode
python.ExecuteFile startup
)

View file

@ -246,7 +246,7 @@ def _set_project():
None
"""
workdir = os.getenv("AVALON_WORKDIR")
workdir = os.getenv("AYON_WORKDIR")
try:
os.makedirs(workdir)
@ -628,7 +628,7 @@ def on_task_changed():
# Run
menu.update_menu_task_label()
workdir = os.getenv("AVALON_WORKDIR")
workdir = os.getenv("AYON_WORKDIR")
if os.path.exists(workdir):
log.info("Updating Maya workspace for task change to %s", workdir)
_set_project()
@ -677,7 +677,7 @@ def workfile_save_before_xgen(event):
import xgenm
current_work_dir = os.getenv("AVALON_WORKDIR").replace("\\", "/")
current_work_dir = os.getenv("AYON_WORKDIR").replace("\\", "/")
expected_work_dir = event.data["workdir_path"].replace("\\", "/")
if current_work_dir == expected_work_dir:
return

View file

@ -12,7 +12,7 @@ import gridfs
DEFINITION_FILENAME = "{}/maya/shader_definition.txt".format(
os.getenv("AVALON_PROJECT"))
os.getenv("AYON_PROJECT_NAME"))
class ShaderDefinitionsEditor(QtWidgets.QWidget):

View file

@ -35,7 +35,7 @@ def current_file():
def work_root(session):
work_dir = session["AVALON_WORKDIR"]
work_dir = session["AYON_WORKDIR"]
scene_dir = None
# Query scene file rule from workspace.mel if it exists in WORKDIR

View file

@ -12,7 +12,7 @@ class PreCopyMel(PreLaunchHook):
def execute(self):
project_doc = self.data["project_doc"]
workdir = self.launch_context.env.get("AVALON_WORKDIR")
workdir = self.launch_context.env.get("AYON_WORKDIR")
if not workdir:
self.log.warning("BUG: Workdir is not filled.")
return

View file

@ -8,13 +8,12 @@ publishing on farm.
Requires:
instance -> families
instance -> setMembers
instance -> asset
context -> currentFile
context -> workspaceDir
context -> user
session -> AVALON_ASSET
Optional:
Provides:

View file

@ -38,7 +38,7 @@ if explicit_plugins_loading["enabled"]:
key = "AYON_OPEN_WORKFILE_POST_INITIALIZATION"
if bool(int(os.environ.get(key, "0"))):
def _log_and_open():
path = os.environ["AVALON_LAST_WORKFILE"]
path = os.environ["AYON_LAST_WORKFILE"]
print("Opening \"{}\"".format(path))
cmds.file(path, open=True, force=True)
cmds.evalDeferred(

View file

@ -120,7 +120,7 @@ def deprecated(new_destination):
class Context:
main_window = None
context_action_item = None
project_name = os.getenv("AVALON_PROJECT")
project_name = os.getenv("AYON_PROJECT_NAME")
# Workfile related code
workfiles_launched = False
workfiles_tool_timer = None
@ -2605,7 +2605,7 @@ Reopening Nuke should synchronize these paths and resolve any discrepancies.
def set_favorites(self):
from .utils import set_context_favorites
work_dir = os.getenv("AVALON_WORKDIR")
work_dir = os.getenv("AYON_WORKDIR")
asset = get_current_asset_name()
favorite_items = OrderedDict()
@ -2953,7 +2953,7 @@ def process_workfile_builder():
create_fv_on = workfile_builder.get("create_first_version") or None
builder_on = workfile_builder.get("builder_on_start") or None
last_workfile_path = os.environ.get("AVALON_LAST_WORKFILE")
last_workfile_path = os.environ.get("AYON_LAST_WORKFILE")
# generate first version in file not existing and feature is enabled
if create_fv_on and not os.path.exists(last_workfile_path):
@ -3203,7 +3203,7 @@ class DirmapCache:
@classmethod
def project_name(cls):
if cls._project_name is None:
cls._project_name = os.getenv("AVALON_PROJECT")
cls._project_name = os.getenv("AYON_PROJECT_NAME")
return cls._project_name
@classmethod

View file

@ -179,7 +179,7 @@ def add_nuke_callbacks():
nuke.addOnScriptLoad(WorkfileSettings().set_context_settings)
if nuke_settings["nuke_dirmap"]["enabled"]:
if nuke_settings["dirmap"]["enabled"]:
log.info("Added Nuke's dir-mapping callback ...")
# Add dirmap for file paths.
nuke.addFilenameFilter(dirmap_file_name_filter)

View file

@ -68,7 +68,7 @@ def current_file():
def work_root(session):
work_dir = session["AVALON_WORKDIR"]
work_dir = session["AYON_WORKDIR"]
scene_dir = session.get("AVALON_SCENEDIR")
if scene_dir:
path = os.path.join(work_dir, scene_dir)

View file

@ -112,7 +112,7 @@ class WriteNodeKnobSettingPanel(nukescripts.PythonPanel):
for write_node in write_selected_nodes:
# data for mapping the path
data = {
"work": os.getenv("AVALON_WORKDIR"),
"work": os.getenv("AYON_WORKDIR"),
"subset": write_node["name"].value(),
"frame": "#" * frame_padding,
"ext": ext

View file

@ -62,7 +62,7 @@ class PhotoshopHost(HostBase, IWorkfileHost, ILoadHost, IPublishHost):
return None
def work_root(self, session):
return os.path.normpath(session["AVALON_WORKDIR"]).replace("\\", "/")
return os.path.normpath(session["AYON_WORKDIR"]).replace("\\", "/")
def open_workfile(self, filepath):
lib.stub().open(filepath)

View file

@ -52,10 +52,10 @@ class CollectBatchData(pyblish.api.ContextPlugin):
assert os.path.exists(batch_dir), \
"Folder {} doesn't exist".format(batch_dir)
project_name = os.environ.get("AVALON_PROJECT")
project_name = os.environ.get("AYON_PROJECT_NAME")
if project_name is None:
raise AssertionError(
"Environment `AVALON_PROJECT` was not found."
"Environment `AYON_PROJECT_NAME` was not found."
"Could not set project `root` which may cause issues."
)
@ -68,8 +68,8 @@ class CollectBatchData(pyblish.api.ContextPlugin):
batch_data["context"]
)
os.environ["AVALON_ASSET"] = asset_name
os.environ["AVALON_TASK"] = task_name
os.environ["AYON_FOLDER_PATH"] = asset_name
os.environ["AYON_TASK_NAME"] = task_name
context.data["asset"] = asset_name
context.data["task"] = task_name

View file

@ -79,7 +79,7 @@ def open_file(filepath):
def current_file():
pm = get_project_manager()
file_ext = file_extensions()[0]
workdir_path = os.getenv("AVALON_WORKDIR")
workdir_path = os.getenv("AYON_WORKDIR")
project = pm.GetCurrentProject()
project_name = project.GetName()
file_name = project_name + file_ext
@ -93,4 +93,4 @@ def current_file():
def work_root(session):
return os.path.normpath(session["AVALON_WORKDIR"]).replace("\\", "/")
return os.path.normpath(session["AYON_WORKDIR"]).replace("\\", "/")

View file

@ -22,7 +22,7 @@ class TrayPublisherHost(HostBase, IPublishHost):
name = "traypublisher"
def install(self):
os.environ["AVALON_APP"] = self.name
os.environ["AYON_HOST_NAME"] = self.name
pyblish.api.register_host("traypublisher")
pyblish.api.register_plugin_path(PUBLISH_PATH)
@ -40,7 +40,7 @@ class TrayPublisherHost(HostBase, IPublishHost):
def set_project_name(self, project_name):
# TODO Deregister project specific plugins and register new project
# plugins
os.environ["AVALON_PROJECT"] = project_name
os.environ["AYON_PROJECT_NAME"] = project_name
HostContext.set_project_name(project_name)

View file

@ -8,7 +8,7 @@ log = Logger.get_logger(__name__)
def initialize():
from ayon_core.hosts.traypublisher.api.plugin import SettingsCreator
project_name = os.environ["AVALON_PROJECT"]
project_name = os.environ["AYON_PROJECT_NAME"]
project_settings = get_project_settings(project_name)
simple_creators = project_settings["traypublisher"]["simple_creators"]

View file

@ -68,7 +68,7 @@ class TVPaintHost(HostBase, IWorkfileHost, ILoadHost, IPublishHost):
log.info("AYON - Installing TVPaint integration")
# Create workdir folder if does not exist yet
workdir = os.getenv("AVALON_WORKDIR")
workdir = os.getenv("AYON_WORKDIR")
if not os.path.exists(workdir):
os.makedirs(workdir)
@ -155,7 +155,7 @@ class TVPaintHost(HostBase, IWorkfileHost, ILoadHost, IPublishHost):
return execute_george(george_script)
def work_root(self, session):
return session["AVALON_WORKDIR"]
return session["AYON_WORKDIR"]
def get_current_workfile(self):
return execute_george("tv_GetProjectName")
@ -174,7 +174,7 @@ class TVPaintHost(HostBase, IWorkfileHost, ILoadHost, IPublishHost):
# Setup project settings if its the template that's launched.
# TODO also check for template creation when it's possible to define
# templates
last_workfile = os.environ.get("AVALON_LAST_WORKFILE")
last_workfile = os.environ.get("AYON_LAST_WORKFILE")
if not last_workfile or os.path.exists(last_workfile):
return

View file

@ -85,8 +85,8 @@ class CollectWorkfileData(pyblish.api.ContextPlugin):
if workfile_context:
# Change current context with context from workfile
key_map = (
("AVALON_ASSET", "asset_name"),
("AVALON_TASK", "task_name")
("AYON_FOLDER_PATH", "asset_name"),
("AYON_TASK_NAME", "task_name")
)
for env_key, key in key_map:
os.environ[env_key] = workfile_context[key]

View file

@ -31,7 +31,7 @@ class ExtractSequence(pyblish.api.Extractor):
families = ["review", "render"]
# Modifiable with settings
review_bg = [255, 255, 255, 255]
review_bg = [255, 255, 255, 1.0]
def process(self, instance):
self.log.info(

View file

@ -6,7 +6,7 @@ class ValidateWorkfileProjectName(pyblish.api.ContextPlugin):
"""Validate project name stored in workfile metadata.
It is not possible to publish from different project than is set in
environment variable "AVALON_PROJECT".
environment variable "AYON_PROJECT_NAME".
"""
label = "Validate Workfile Project Name"

View file

@ -60,7 +60,7 @@ def start_rendering():
inst_data.append(data)
try:
project = os.environ.get("AVALON_PROJECT")
project = os.environ.get("AYON_PROJECT_NAME")
anatomy = Anatomy(project)
root = anatomy.roots['renders']
except Exception as e:

View file

@ -146,7 +146,7 @@ class UnrealPrelaunchHook(PreLaunchHook):
def execute(self):
"""Hook entry method."""
workdir = self.launch_context.env["AVALON_WORKDIR"]
workdir = self.launch_context.env["AYON_WORKDIR"]
executable = str(self.launch_context.executable)
engine_version = self.app_name.split("/")[-1].replace("-", ".")
try:

View file

@ -419,7 +419,14 @@ class ApplicationManager:
# Prepare known applications
app_defs = applications_addon_settings["applications"]
additional_apps = app_defs.pop("additional_apps")
app_defs.update(additional_apps)
for additional_app in additional_apps:
app_name = additional_app.pop("name")
if app_name in app_defs:
self.log.warning((
"Additional application '{}' is already"
" in built-in applications."
).format(app_name))
app_defs[app_name] = additional_app
for group_name, variant_defs in app_defs.items():
group = ApplicationGroup(group_name, variant_defs, self)
@ -1691,15 +1698,15 @@ def prepare_context_environments(data, env_group=None, addons_manager=None):
app = data["app"]
context_env = {
"AVALON_PROJECT": project_doc["name"],
"AVALON_APP_NAME": app.full_name
"AYON_PROJECT_NAME": project_doc["name"],
"AYON_APP_NAME": app.full_name
}
if asset_doc:
asset_name = get_asset_name_identifier(asset_doc)
context_env["AVALON_ASSET"] = asset_name
context_env["AYON_FOLDER_PATH"] = asset_name
if task_name:
context_env["AVALON_TASK"] = task_name
context_env["AYON_TASK_NAME"] = task_name
log.debug(
"Context environments set:\n{}".format(
@ -1717,7 +1724,7 @@ def prepare_context_environments(data, env_group=None, addons_manager=None):
if not app.is_host:
return
data["env"]["AVALON_APP"] = app.host_name
data["env"]["AYON_HOST_NAME"] = app.host_name
if not asset_doc or not task_name:
# QUESTION replace with log.info and skip workfile discovery?
@ -1763,7 +1770,7 @@ def prepare_context_environments(data, env_group=None, addons_manager=None):
"Couldn't create workdir because: {}".format(str(exc))
)
data["env"]["AVALON_WORKDIR"] = workdir
data["env"]["AYON_WORKDIR"] = workdir
_prepare_last_workfile(data, workdir, addons_manager)
@ -1880,7 +1887,7 @@ def _prepare_last_workfile(data, workdir, addons_manager):
"Setting last workfile path: {}".format(last_workfile_path)
)
data["env"]["AVALON_LAST_WORKFILE"] = last_workfile_path
data["env"]["AYON_LAST_WORKFILE"] = last_workfile_path
data["last_workfile_path"] = last_workfile_path

View file

@ -257,7 +257,7 @@ class Logger:
return cls._process_name
# Get process name
process_name = os.environ.get("AVALON_APP_NAME")
process_name = os.environ.get("AYON_APP_NAME")
if not process_name:
try:
import psutil

View file

@ -2,22 +2,27 @@ import os
import threading
import time
from ayon_core.modules import OpenPypeModule, ITrayModule, IPluginPaths
from ayon_core.modules import AYONAddon, ITrayModule, IPluginPaths
from ayon_core.client import get_asset_by_name
from .constants import CLOCKIFY_FTRACK_USER_PATH, CLOCKIFY_FTRACK_SERVER_PATH
class ClockifyModule(OpenPypeModule, ITrayModule, IPluginPaths):
class ClockifyModule(AYONAddon, ITrayModule, IPluginPaths):
name = "clockify"
def initialize(self, modules_settings):
clockify_settings = modules_settings[self.name]
self.enabled = clockify_settings["enabled"]
self.workspace_name = clockify_settings["workspace_name"]
def initialize(self, studio_settings):
enabled = self.name in studio_settings
workspace_name = None
if enabled:
clockify_settings = studio_settings[self.name]
workspace_name = clockify_settings["workspace_name"]
if self.enabled and not self.workspace_name:
raise Exception("Clockify Workspace is not set in settings.")
if enabled and workspace_name:
self.log.warning("Clockify Workspace is not set in settings.")
enabled = False
self.enabled = enabled
self.workspace_name = workspace_name
self.timer_manager = None
self.MessageWidgetClass = None

View file

@ -12,7 +12,7 @@ class ClockifyStart(LauncherAction):
def is_compatible(self, session):
"""Return whether the action is compatible with the session"""
if "AVALON_TASK" in session:
if "AYON_TASK_NAME" in session:
return True
return False
@ -20,9 +20,9 @@ class ClockifyStart(LauncherAction):
self.clockify_api.set_api()
user_id = self.clockify_api.user_id
workspace_id = self.clockify_api.workspace_id
project_name = session["AVALON_PROJECT"]
asset_name = session["AVALON_ASSET"]
task_name = session["AVALON_TASK"]
project_name = session["AYON_PROJECT_NAME"]
asset_name = session["AYON_FOLDER_PATH"]
task_name = session["AYON_TASK_NAME"]
description = asset_name
# fetch asset docs

View file

@ -36,7 +36,7 @@ class ClockifySync(LauncherAction):
raise ClockifyPermissionsCheckFailed(
"Current CLockify user is missing permissions for this action!"
)
project_name = session.get("AVALON_PROJECT") or ""
project_name = session.get("AYON_PROJECT_NAME") or ""
projects_to_sync = []
if project_name.strip():

View file

@ -80,11 +80,11 @@ class AfterEffectsSubmitDeadline(
"FTRACK_API_KEY",
"FTRACK_API_USER",
"FTRACK_SERVER",
"AVALON_PROJECT",
"AVALON_ASSET",
"AVALON_TASK",
"AVALON_WORKDIR",
"AVALON_APP_NAME",
"AYON_PROJECT_NAME",
"AYON_FOLDER_PATH",
"AYON_TASK_NAME",
"AYON_WORKDIR",
"AYON_APP_NAME",
"AYON_LOG_NO_COLORS",
"IS_TEST"
]

View file

@ -102,11 +102,11 @@ class BlenderSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline,
"FTRACK_API_USER",
"FTRACK_SERVER",
"OPENPYPE_SG_USER",
"AVALON_PROJECT",
"AVALON_ASSET",
"AVALON_TASK",
"AVALON_WORKDIR",
"AVALON_APP_NAME",
"AYON_PROJECT_NAME",
"AYON_FOLDER_PATH",
"AYON_TASK_NAME",
"AYON_WORKDIR",
"AYON_APP_NAME",
"IS_TEST"
]

View file

@ -220,11 +220,11 @@ class FusionSubmitDeadline(
"FTRACK_API_KEY",
"FTRACK_API_USER",
"FTRACK_SERVER",
"AVALON_PROJECT",
"AVALON_ASSET",
"AVALON_TASK",
"AVALON_WORKDIR",
"AVALON_APP_NAME",
"AYON_PROJECT_NAME",
"AYON_FOLDER_PATH",
"AYON_TASK_NAME",
"AYON_WORKDIR",
"AYON_APP_NAME",
"AYON_LOG_NO_COLORS",
"IS_TEST",
"AYON_BUNDLE_NAME",

View file

@ -273,11 +273,11 @@ class HarmonySubmitDeadline(
"FTRACK_API_KEY",
"FTRACK_API_USER",
"FTRACK_SERVER",
"AVALON_PROJECT",
"AVALON_ASSET",
"AVALON_TASK",
"AVALON_WORKDIR",
"AVALON_APP_NAME",
"AYON_PROJECT_NAME",
"AYON_FOLDER_PATH",
"AYON_TASK_NAME",
"AYON_WORKDIR",
"AYON_APP_NAME",
"AYON_LOG_NO_COLORS"
"IS_TEST"
]

View file

@ -98,11 +98,11 @@ class HoudiniCacheSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline
"FTRACK_API_USER",
"FTRACK_SERVER",
"OPENPYPE_SG_USER",
"AVALON_PROJECT",
"AVALON_ASSET",
"AVALON_TASK",
"AVALON_WORKDIR",
"AVALON_APP_NAME",
"AYON_PROJECT_NAME",
"AYON_FOLDER_PATH",
"AYON_TASK_NAME",
"AYON_WORKDIR",
"AYON_APP_NAME",
"AYON_LOG_NO_COLORS",
]

View file

@ -204,11 +204,11 @@ class HoudiniSubmitDeadline(
"FTRACK_API_USER",
"FTRACK_SERVER",
"OPENPYPE_SG_USER",
"AVALON_PROJECT",
"AVALON_ASSET",
"AVALON_TASK",
"AVALON_WORKDIR",
"AVALON_APP_NAME",
"AYON_PROJECT_NAME",
"AYON_FOLDER_PATH",
"AYON_TASK_NAME",
"AYON_WORKDIR",
"AYON_APP_NAME",
"AYON_LOG_NO_COLORS",
]

View file

@ -106,11 +106,11 @@ class MaxSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline,
"FTRACK_API_USER",
"FTRACK_SERVER",
"OPENPYPE_SG_USER",
"AVALON_PROJECT",
"AVALON_ASSET",
"AVALON_TASK",
"AVALON_WORKDIR",
"AVALON_APP_NAME",
"AYON_PROJECT_NAME",
"AYON_FOLDER_PATH",
"AYON_TASK_NAME",
"AYON_WORKDIR",
"AYON_APP_NAME",
"IS_TEST"
]

View file

@ -207,11 +207,11 @@ class MayaSubmitDeadline(abstract_submit_deadline.AbstractSubmitDeadline,
"FTRACK_API_USER",
"FTRACK_SERVER",
"OPENPYPE_SG_USER",
"AVALON_PROJECT",
"AVALON_ASSET",
"AVALON_TASK",
"AVALON_WORKDIR",
"AVALON_APP_NAME",
"AYON_PROJECT_NAME",
"AYON_FOLDER_PATH",
"AYON_TASK_NAME",
"AYON_WORKDIR",
"AYON_APP_NAME",
"IS_TEST"
]

View file

@ -104,10 +104,10 @@ class MayaSubmitRemotePublishDeadline(
if key in os.environ
}
environment["AVALON_PROJECT"] = project_name
environment["AVALON_ASSET"] = instance.context.data["asset"]
environment["AVALON_TASK"] = instance.context.data["task"]
environment["AVALON_APP_NAME"] = os.environ.get("AVALON_APP_NAME")
environment["AYON_PROJECT_NAME"] = project_name
environment["AYON_FOLDER_PATH"] = instance.context.data["asset"]
environment["AYON_TASK_NAME"] = instance.context.data["task"]
environment["AYON_APP_NAME"] = os.environ.get("AYON_APP_NAME")
environment["OPENPYPE_PUBLISH_SUBSET"] = instance.data["subset"]
environment["AYON_LOG_NO_COLORS"] = "1"
environment["AYON_USERNAME"] = instance.context.data["user"]

View file

@ -373,10 +373,10 @@ class NukeSubmitDeadline(pyblish.api.InstancePlugin,
keys = [
"PYTHONPATH",
"PATH",
"AVALON_PROJECT",
"AVALON_ASSET",
"AVALON_TASK",
"AVALON_APP_NAME",
"AYON_PROJECT_NAME",
"AYON_FOLDER_PATH",
"AYON_TASK_NAME",
"AYON_APP_NAME",
"FTRACK_API_KEY",
"FTRACK_API_USER",
"FTRACK_SERVER",

View file

@ -67,7 +67,7 @@ class ProcessSubmittedCacheJobOnFarm(pyblish.api.InstancePlugin,
"FTRACK_API_USER",
"FTRACK_API_KEY",
"FTRACK_SERVER",
"AVALON_APP_NAME",
"AYON_APP_NAME",
"AYON_USERNAME",
"OPENPYPE_SG_USER",
"KITSU_LOGIN",
@ -125,9 +125,9 @@ class ProcessSubmittedCacheJobOnFarm(pyblish.api.InstancePlugin,
create_metadata_path(instance, anatomy)
environment = {
"AVALON_PROJECT": instance.context.data["projectName"],
"AVALON_ASSET": instance.context.data["asset"],
"AVALON_TASK": instance.context.data["task"],
"AYON_PROJECT_NAME": instance.context.data["projectName"],
"AYON_FOLDER_PATH": instance.context.data["asset"],
"AYON_TASK_NAME": instance.context.data["task"],
"AYON_USERNAME": instance.context.data["user"],
"AYON_LOG_NO_COLORS": "1",
"IS_TEST": str(int(is_in_tests())),

View file

@ -130,7 +130,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin,
"FTRACK_API_USER",
"FTRACK_API_KEY",
"FTRACK_SERVER",
"AVALON_APP_NAME",
"AYON_APP_NAME",
"AYON_USERNAME",
"OPENPYPE_SG_USER",
"KITSU_LOGIN",
@ -202,9 +202,9 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin,
create_metadata_path(instance, anatomy)
environment = {
"AVALON_PROJECT": instance.context.data["projectName"],
"AVALON_ASSET": instance.context.data["asset"],
"AVALON_TASK": instance.context.data["task"],
"AYON_PROJECT_NAME": instance.context.data["projectName"],
"AYON_FOLDER_PATH": instance.context.data["asset"],
"AYON_TASK_NAME": instance.context.data["task"],
"AYON_USERNAME": instance.context.data["user"],
"AYON_LOG_NO_COLORS": "1",
"IS_TEST": str(int(is_in_tests())),

View file

@ -14,7 +14,7 @@ from Deadline.Scripting import (
DirectoryUtils,
ProcessUtils,
)
__version__ = "1.0.0"
__version__ = "1.0.1"
VERSION_REGEX = re.compile(
r"(?P<major>0|[1-9]\d*)"
r"\.(?P<minor>0|[1-9]\d*)"
@ -471,12 +471,21 @@ def inject_ayon_environment(deadlinePlugin):
]
add_kwargs = {
"project": job.GetJobEnvironmentKeyValue("AVALON_PROJECT"),
"asset": job.GetJobEnvironmentKeyValue("AVALON_ASSET"),
"task": job.GetJobEnvironmentKeyValue("AVALON_TASK"),
"app": job.GetJobEnvironmentKeyValue("AVALON_APP_NAME"),
"envgroup": "farm",
}
# Support backwards compatible keys
for key, env_keys in (
("project", ["AYON_PROJECT_NAME", "AVALON_PROJECT"]),
("asset", ["AYON_FOLDER_PATH", "AVALON_ASSET"]),
("task", ["AYON_TASK_NAME", "AVALON_TASK"]),
("app", ["AYON_APP_NAME", "AVALON_APP_NAME"]),
):
value = ""
for env_key in env_keys:
value = job.GetJobEnvironmentKeyValue(env_key)
if value:
break
add_kwargs[key] = value
if job.GetJobEnvironmentKeyValue("IS_TEST"):
args.append("--automatic-tests")
@ -486,8 +495,8 @@ def inject_ayon_environment(deadlinePlugin):
args.extend(["--{}".format(key), value])
else:
raise RuntimeError((
"Missing required env vars: AVALON_PROJECT, AVALON_ASSET,"
" AVALON_TASK, AVALON_APP_NAME"
"Missing required env vars: AYON_PROJECT_NAME,"
" AYON_FOLDER_PATH, AYON_TASK_NAME, AYON_APP_NAME"
))
environment = {

View file

@ -361,8 +361,8 @@ class BaseCreateRoyalRenderJob(pyblish.api.InstancePlugin,
if not all(add_kwargs.values()):
raise RuntimeError((
"Missing required env vars: AVALON_PROJECT, AVALON_ASSET,"
" AVALON_TASK, AVALON_APP_NAME"
"Missing required env vars: AYON_PROJECT_NAME, AYON_FOLDER_PATH,"
" AYON_TASK_NAME, AYON_APP_NAME"
))
for key, value in add_kwargs.items():

View file

@ -63,7 +63,7 @@ class CreatePublishRoyalRenderJob(pyblish.api.InstancePlugin,
"FTRACK_API_USER",
"FTRACK_API_KEY",
"FTRACK_SERVER",
"AVALON_APP_NAME",
"AYON_APP_NAME",
"AYON_USERNAME",
"OPENPYPE_SG_USER",
]
@ -179,9 +179,9 @@ class CreatePublishRoyalRenderJob(pyblish.api.InstancePlugin,
anatomy_data = instance.context.data["anatomyData"]
environment = RREnvList({
"AVALON_PROJECT": anatomy_data["project"]["name"],
"AVALON_ASSET": instance.context.data["asset"],
"AVALON_TASK": anatomy_data["task"]["name"],
"AYON_PROJECT_NAME": anatomy_data["project"]["name"],
"AYON_FOLDER_PATH": instance.context.data["asset"],
"AYON_TASK_NAME": anatomy_data["task"]["name"],
"AYON_USERNAME": anatomy_data["user"]
})

View file

@ -136,10 +136,10 @@ class OpenPypeContextSelector:
def run_publish(self):
"""Run publish process."""
env = {"AVALON_PROJECT": str(self.context.get("project")),
"AVALON_ASSET": str(self.context.get("asset")),
"AVALON_TASK": str(self.context.get("task")),
# "AVALON_APP_NAME": str(self.context.get("app_name"))
env = {"AYON_PROJECT_NAME": str(self.context.get("project")),
"AYON_FOLDER_PATH": str(self.context.get("asset")),
"AYON_TASK_NAME": str(self.context.get("task")),
# "AYON_APP_NAME": str(self.context.get("app_name"))
}
print(">>> setting environment:")
@ -182,10 +182,18 @@ print("running selector")
selector = OpenPypeContextSelector()
# try to set context from environment
selector.context["project"] = os.getenv("AVALON_PROJECT")
selector.context["asset"] = os.getenv("AVALON_ASSET")
selector.context["task"] = os.getenv("AVALON_TASK")
# selector.context["app_name"] = os.getenv("AVALON_APP_NAME")
for key, env_keys in (
("project", ["AYON_PROJECT_NAME", "AVALON_PROJECT"]),
("asset", ["AYON_FOLDER_PATH", "AVALON_ASSET"]),
("task", ["AYON_TASK_NAME", "AVALON_TASK"]),
# ("app_name", ["AYON_APP_NAME", "AVALON_APP_NAME"])
):
value = ""
for env_key in env_keys:
value = os.getenv(env_key)
if value:
break
selector.context[key] = value
# if anything inside is None, scratch the whole thing and
# ask user for context.

View file

@ -3,8 +3,8 @@ import platform
from ayon_core.client import get_asset_by_name
from ayon_core.modules import (
OpenPypeModule,
from ayon_core.addon import (
AYONAddon,
ITrayService,
IPluginPaths
)
@ -76,7 +76,7 @@ class ExampleTimersManagerConnector:
class TimersManager(
OpenPypeModule,
AYONAddon,
ITrayService,
IPluginPaths
):
@ -99,23 +99,27 @@ class TimersManager(
"start_timer"
)
def initialize(self, modules_settings):
timers_settings = modules_settings[self.name]
def initialize(self, studio_settings):
timers_settings = studio_settings.get(self.name)
enabled = timers_settings is not None
self.enabled = timers_settings["enabled"]
auto_stop = False
full_time = 0
message_time = 0
if enabled:
# When timer will stop if idle manager is running (minutes)
full_time = int(timers_settings["full_time"] * 60)
# How many minutes before the timer is stopped will popup the message
message_time = int(timers_settings["message_time"] * 60)
# When timer will stop if idle manager is running (minutes)
full_time = int(timers_settings["full_time"] * 60)
# How many minutes before the timer is stopped will popup the message
message_time = int(timers_settings["message_time"] * 60)
auto_stop = timers_settings["auto_stop"]
platform_name = platform.system().lower()
# Turn of auto stop on MacOs because pynput requires root permissions
# and on linux can cause thread locks on application close
if full_time <= 0 or platform_name in ("darwin", "linux"):
auto_stop = False
auto_stop = timers_settings["auto_stop"]
platform_name = platform.system().lower()
# Turn of auto stop on MacOs because pynput requires root permissions
# and on linux can cause thread locks on application close
if full_time <= 0 or platform_name in ("darwin", "linux"):
auto_stop = False
self.enabled = enabled
self.auto_stop = auto_stop
self.time_show_message = full_time - message_time
self.time_stop_timer = full_time

View file

@ -26,7 +26,7 @@ class LauncherAction(object):
Args:
session (dict[str, Union[str, None]]): Session data with
AVALON_PROJECT, AVALON_ASSET and AVALON_TASK.
AYON_PROJECT_NAME, AYON_FOLDER_PATH and AYON_TASK_NAME.
"""
return True

View file

@ -423,7 +423,7 @@ class Anatomy(BaseAnatomy):
def __init__(self, project_name=None, site_name=None):
if not project_name:
project_name = os.environ.get("AVALON_PROJECT")
project_name = os.environ.get("AYON_PROJECT_NAME")
if not project_name:
raise ProjectNotSet((

View file

@ -254,7 +254,7 @@ def get_imageio_file_rules_colorspace_from_filepath(
# match file rule from path
colorspace_name = None
for file_rule in file_rules.values():
for file_rule in file_rules:
pattern = file_rule["pattern"]
extension = file_rule["ext"]
ext_match = re.match(
@ -281,7 +281,7 @@ def get_config_file_rules_colorspace_from_filepath(config_path, filepath):
filepath (str): path leading to a file
Returns:
Any[str, None]: matching colorspace name
Union[str, None]: matching colorspace name
"""
if not compatibility_check():
# python environment is not compatible with PyOpenColorIO
@ -918,28 +918,13 @@ def get_imageio_file_rules(project_name, host_name, project_settings=None):
Defaults to None.
Returns:
dict: file rules data
list[dict[str, Any]]: file rules data
"""
project_settings = project_settings or get_project_settings(project_name)
imageio_global, imageio_host = _get_imageio_settings(
project_settings, host_name)
# get file rules from global and host_name
frules_global = imageio_global["file_rules"]
activate_global_rules = (
frules_global.get("activate_global_file_rules", False)
# TODO: remove this in future - backward compatibility
or frules_global.get("enabled")
)
global_rules = frules_global["rules"]
if not activate_global_rules:
log.info(
"Colorspace global file rules are disabled."
)
global_rules = {}
# host is optional, some might not have any settings
frules_host = imageio_host.get("file_rules", {})
@ -949,8 +934,24 @@ def get_imageio_file_rules(project_name, host_name, project_settings=None):
# TODO: remove this in future - backward compatibility
activate_host_rules = frules_host.get("enabled", False)
# return host rules if activated or global rules
return frules_host["rules"] if activate_host_rules else global_rules
if activate_host_rules:
return frules_host["rules"]
# get file rules from global and host_name
frules_global = imageio_global["file_rules"]
activate_global_rules = (
frules_global.get("activate_global_file_rules", False)
# TODO: remove this in future - backward compatibility
or frules_global.get("enabled")
)
if not activate_global_rules:
log.info(
"Colorspace global file rules are disabled."
)
return []
return frules_global["rules"]
def get_remapped_colorspace_to_native(

View file

@ -117,12 +117,12 @@ def install_host(host):
addons_manager = _get_addons_manager()
project_name = os.getenv("AVALON_PROJECT")
project_name = os.getenv("AYON_PROJECT_NAME")
# WARNING: This might be an issue
# - commented out because 'traypublisher' does not have set project
# if not project_name:
# raise ValueError(
# "AVALON_PROJECT is missing in environment variables."
# "AYON_PROJECT_NAME is missing in environment variables."
# )
log.info("Activating {}..".format(project_name))
@ -152,7 +152,7 @@ def install_host(host):
print("Registering pyblish target: automated")
pyblish.api.register_target("automated")
host_name = os.environ.get("AVALON_APP")
host_name = os.environ.get("AYON_HOST_NAME")
# Give option to handle host installation
for addon in addons_manager.get_enabled_addons():
@ -172,7 +172,7 @@ def install_ayon_plugins(project_name=None, host_name=None):
register_inventory_action_path(INVENTORY_PATH)
if host_name is None:
host_name = os.environ.get("AVALON_APP")
host_name = os.environ.get("AYON_HOST_NAME")
addons_manager = _get_addons_manager()
publish_plugin_dirs = addons_manager.collect_publish_plugin_paths(
@ -196,7 +196,7 @@ def install_ayon_plugins(project_name=None, host_name=None):
register_inventory_action_path(path)
if project_name is None:
project_name = os.environ.get("AVALON_PROJECT")
project_name = os.environ.get("AYON_PROJECT_NAME")
# Register studio specific plugins
if project_name:
@ -331,7 +331,7 @@ def get_current_host_name():
"""Current host name.
Function is based on currently registered host integration or environment
variable 'AVALON_APP'.
variable 'AYON_HOST_NAME'.
Returns:
Union[str, None]: Name of host integration in current process or None.
@ -340,7 +340,7 @@ def get_current_host_name():
host = registered_host()
if isinstance(host, HostBase):
return host.name
return os.environ.get("AVALON_APP")
return os.environ.get("AYON_HOST_NAME")
def get_global_context():
@ -365,9 +365,9 @@ def get_global_context():
"""
return {
"project_name": os.environ.get("AVALON_PROJECT"),
"asset_name": os.environ.get("AVALON_ASSET"),
"task_name": os.environ.get("AVALON_TASK"),
"project_name": os.environ.get("AYON_PROJECT_NAME"),
"asset_name": os.environ.get("AYON_FOLDER_PATH"),
"task_name": os.environ.get("AYON_TASK_NAME"),
}
@ -474,10 +474,10 @@ def get_template_data_from_session(session=None, system_settings=None):
"""
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"]
project_name = session["AYON_PROJECT_NAME"]
asset_name = session["AYON_FOLDER_PATH"]
task_name = session["AYON_TASK_NAME"]
host_name = session["AYON_HOST_NAME"]
else:
context = get_current_context()
project_name = context["project_name"]
@ -525,8 +525,8 @@ def get_workdir_from_session(session=None, template_key=None):
"""
if session is not None:
project_name = session["AVALON_PROJECT"]
host_name = session["AVALON_APP"]
project_name = session["AYON_PROJECT_NAME"]
host_name = session["AYON_HOST_NAME"]
else:
project_name = get_current_project_name()
host_name = get_current_host_name()
@ -566,10 +566,10 @@ def get_custom_workfile_template_from_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"]
project_name = session["AYON_PROJECT_NAME"]
asset_name = session["AYON_FOLDER_PATH"]
task_name = session["AYON_TASK_NAME"]
host_name = session["AYON_HOST_NAME"]
else:
context = get_current_context()
project_name = context["project_name"]
@ -616,10 +616,10 @@ def change_current_context(asset_doc, task_name, template_key=None):
folder_path = get_asset_name_identifier(asset_doc)
envs = {
"AVALON_PROJECT": project_name,
"AVALON_ASSET": folder_path,
"AVALON_TASK": task_name,
"AVALON_WORKDIR": workdir,
"AYON_PROJECT_NAME": project_name,
"AYON_FOLDER_PATH": folder_path,
"AYON_TASK_NAME": task_name,
"AYON_WORKDIR": workdir,
}
# Update the Session and environments. Pop from environments all keys with

View file

@ -1536,7 +1536,7 @@ class CreateContext:
def host_name(self):
if hasattr(self.host, "name"):
return self.host.name
return os.environ["AVALON_APP"]
return os.environ["AYON_HOST_NAME"]
def get_current_project_name(self):
"""Project name which was used as current context on context reset.

View file

@ -45,7 +45,7 @@ class LegacyCreator(object):
def apply_settings(cls, project_settings, system_settings):
"""Apply OpenPype settings to a plugin class."""
host_name = os.environ.get("AVALON_APP")
host_name = os.environ.get("AYON_HOST_NAME")
plugin_type = "create"
plugin_type_settings = (
project_settings

View file

@ -128,13 +128,13 @@ def get_subset_name(
return ""
if not host_name:
host_name = os.environ.get("AVALON_APP")
host_name = os.environ.get("AYON_HOST_NAME")
# Use only last part of class family value split by dot (`.`)
family = family.rsplit(".", 1)[-1]
if project_name is None:
project_name = os.environ.get("AVALON_PROJECT")
project_name = os.environ.get("AYON_PROJECT_NAME")
asset_tasks = asset_doc.get("data", {}).get("tasks") or {}
task_info = asset_tasks.get(task_name) or {}

View file

@ -321,7 +321,7 @@ def prepare_representations(skeleton_data, exp_files, anatomy, aov_filter,
"""
representations = []
host_name = os.environ.get("AVALON_APP", "")
host_name = os.environ.get("AYON_HOST_NAME", "")
collections, remainders = clique.assemble(exp_files)
log = Logger.get_logger("farm_publishing")
@ -541,7 +541,7 @@ def _create_instances_for_aov(instance, skeleton, aov_filter, additional_data,
"""
# TODO: this needs to be taking the task from context or instance
task = os.environ["AVALON_TASK"]
task = os.environ["AYON_TASK_NAME"]
anatomy = instance.context.data["anatomy"]
subset = skeleton["subset"]
@ -611,7 +611,7 @@ def _create_instances_for_aov(instance, skeleton, aov_filter, additional_data,
log.info("Creating data for: {}".format(subset_name))
app = os.environ.get("AVALON_APP", "")
app = os.environ.get("AYON_HOST_NAME", "")
if isinstance(col, list):
render_file_name = os.path.basename(col[0])

View file

@ -38,7 +38,7 @@ class LoaderPlugin(list):
@classmethod
def apply_settings(cls, project_settings, system_settings):
host_name = os.environ.get("AVALON_APP")
host_name = os.environ.get("AYON_HOST_NAME")
plugin_type = "load"
plugin_type_settings = (
project_settings

View file

@ -437,7 +437,7 @@ def filter_pyblish_plugins(plugins):
# - kept becau on farm is probably used host 'shell' which propably
# affect how settings are applied there
host_name = pyblish.api.current_host()
project_name = os.environ.get("AVALON_PROJECT")
project_name = os.environ.get("AYON_PROJECT_NAME")
project_settings = get_project_settings(project_name)
system_settings = get_system_settings()

View file

@ -229,8 +229,8 @@ class BuildWorkfile:
def get_build_presets(self, task_name, asset_doc):
""" Returns presets to build workfile for task name.
Presets are loaded for current project set in
io.Session["AVALON_PROJECT"], filtered by registered host
Presets are loaded for current project received by
'get_current_project_name', filtered by registered host
and entered task name.
Args:

View file

@ -157,7 +157,7 @@ def get_workdir(
task_name (str): Task name for which are workdir data preapred.
host_name (str): Host which is used to workdir. This is required
because workdir template may contain `{app}` key. In `Session`
is stored under `AVALON_APP` key.
is stored under `AYON_HOST_NAME` key.
anatomy (Anatomy): Optional argument. Anatomy object is created using
project name from `project_doc`. It is preferred to pass this
argument as initialization of a new Anatomy object may be time

View file

@ -103,7 +103,7 @@ class AbstractTemplateBuilder(object):
if isinstance(host, HostBase):
host_name = host.name
else:
host_name = os.environ.get("AVALON_APP")
host_name = os.environ.get("AYON_HOST_NAME")
self._host = host
self._host_name = host_name
@ -129,19 +129,19 @@ class AbstractTemplateBuilder(object):
def project_name(self):
if isinstance(self._host, HostBase):
return self._host.get_current_project_name()
return os.getenv("AVALON_PROJECT")
return os.getenv("AYON_PROJECT_NAME")
@property
def current_asset_name(self):
if isinstance(self._host, HostBase):
return self._host.get_current_asset_name()
return os.getenv("AVALON_ASSET")
return os.getenv("AYON_FOLDER_PATH")
@property
def current_task_name(self):
if isinstance(self._host, HostBase):
return self._host.get_current_task_name()
return os.getenv("AVALON_TASK")
return os.getenv("AYON_TASK_NAME")
def get_current_context(self):
if isinstance(self._host, HostBase):
@ -585,7 +585,7 @@ class AbstractTemplateBuilder(object):
template_path (str): Fullpath for current task and
host's template file.
"""
last_workfile_path = os.environ.get("AVALON_LAST_WORKFILE")
last_workfile_path = os.environ.get("AYON_LAST_WORKFILE")
self.log.info("__ last_workfile_path: {}".format(last_workfile_path))
if os.path.exists(last_workfile_path):
# ignore in case workfile existence

View file

@ -22,14 +22,14 @@ class OpenTaskPath(LauncherAction):
def is_compatible(self, session):
"""Return whether the action is compatible with the session"""
return bool(session.get("AVALON_ASSET"))
return bool(session.get("AYON_FOLDER_PATH"))
def process(self, session, **kwargs):
from qtpy import QtCore, QtWidgets
project_name = session["AVALON_PROJECT"]
asset_name = session["AVALON_ASSET"]
task_name = session.get("AVALON_TASK", None)
project_name = session["AYON_PROJECT_NAME"]
asset_name = session["AYON_FOLDER_PATH"]
task_name = session.get("AYON_TASK_NAME", None)
path = self._get_workdir(project_name, asset_name, task_name)
if not path:

View file

@ -359,7 +359,7 @@
#
# if mongo_changes_bulk:
# dbcon = AvalonMongoDB()
# dbcon.Session["AVALON_PROJECT"] = project_name
# dbcon.Session["AYON_PROJECT_NAME"] = project_name
# dbcon.install()
# dbcon.bulk_write(mongo_changes_bulk)
# dbcon.uninstall()

View file

@ -4,9 +4,9 @@ Requires:
context -> anatomy
context -> projectEntity
context -> assetEntity
context -> task
context -> username
context -> datetimeData
session -> AVALON_TASK
Provides:
context -> anatomyData

View file

@ -1,7 +1,6 @@
"""Collect Anatomy and global anatomy data.
Requires:
session -> AVALON_ASSET
context -> projectName
context -> asset
context -> task

View file

@ -57,9 +57,9 @@ class CollectFromCreateContext(pyblish.api.ContextPlugin):
asset_name = create_context.get_current_asset_name()
task_name = create_context.get_current_task_name()
for key, value in (
("AVALON_PROJECT", project_name),
("AVALON_ASSET", asset_name),
("AVALON_TASK", task_name)
("AYON_PROJECT_NAME", project_name),
("AYON_FOLDER_PATH", asset_name),
("AYON_TASK_NAME", task_name)
):
if value is None:
os.environ.pop(key, None)

View file

@ -24,13 +24,13 @@ class CollectHostName(pyblish.api.ContextPlugin):
if host_name and app_name and app_label:
return
# Use AVALON_APP to get host name if available
# Use AYON_HOST_NAME to get host name if available
if not host_name:
host_name = os.environ.get("AVALON_APP")
host_name = os.environ.get("AYON_HOST_NAME")
# Use AVALON_APP_NAME to get full app name
# Use AYON_APP_NAME to get full app name
if not app_name:
app_name = os.environ.get("AVALON_APP_NAME")
app_name = os.environ.get("AYON_APP_NAME")
# Fill missing values based on app full name
if (not host_name or not app_label) and app_name:

View file

@ -179,14 +179,14 @@ class CollectRenderedFiles(pyblish.api.ContextPlugin):
)
# Remap workdir if it's set
workdir = os.getenv("AVALON_WORKDIR")
workdir = os.getenv("AYON_WORKDIR")
remapped_workdir = None
if workdir:
remapped_workdir = anatomy.roots_obj.path_remapper(
os.getenv("AVALON_WORKDIR")
os.getenv("AYON_WORKDIR")
)
if remapped_workdir:
os.environ["AVALON_WORKDIR"] = remapped_workdir
os.environ["AYON_WORKDIR"] = remapped_workdir
except Exception as e:
self.log.error(e, exc_info=True)
raise Exception("Error") from e

View file

@ -79,7 +79,7 @@ def main(argv):
if after_script_idx is not None:
launch_args = sys_args[after_script_idx:]
host_name = os.environ["AVALON_APP"].lower()
host_name = os.environ["AYON_HOST_NAME"].lower()
if host_name == "photoshop":
# TODO refactor launch logic according to AE
from ayon_core.hosts.photoshop.api.lib import main
@ -90,7 +90,7 @@ def main(argv):
else:
title = "Unknown host name"
message = (
"BUG: Environment variable AVALON_APP contains unknown"
"BUG: Environment variable AYON_HOST_NAME contains unknown"
" host name \"{}\""
).format(host_name)
show_error_messagebox(title, message)

View file

@ -9,6 +9,7 @@ from .lib import (
get_current_project_settings,
get_local_settings,
)
from .ayon_settings import get_ayon_settings
__all__ = (
@ -20,4 +21,6 @@ __all__ = (
"get_project_settings",
"get_current_project_settings",
"get_local_settings",
"get_ayon_settings",
)

View file

@ -52,26 +52,6 @@ def _convert_color(color_value):
return color_value
def _convert_host_imageio(host_settings):
if "imageio" not in host_settings:
return
# --- imageio ---
ayon_imageio = host_settings["imageio"]
# TODO remove when fixed on server
if "ocio_config" in ayon_imageio["ocio_config"]:
ayon_imageio["ocio_config"]["filepath"] = (
ayon_imageio["ocio_config"].pop("ocio_config")
)
# Convert file rules
imageio_file_rules = ayon_imageio["file_rules"]
new_rules = {}
for rule in imageio_file_rules["rules"]:
name = rule.pop("name")
new_rules[name] = rule
imageio_file_rules["rules"] = new_rules
def _convert_general(ayon_settings, output, default_settings):
output["core"] = ayon_settings["core"]
version_check_interval = (
@ -82,39 +62,6 @@ def _convert_general(ayon_settings, output, default_settings):
}
def _convert_timers_manager_system_settings(
ayon_settings, output, addon_versions, default_settings
):
enabled = addon_versions.get("timers_manager") is not None
manager_settings = default_settings["modules"]["timers_manager"]
manager_settings["enabled"] = enabled
if enabled:
ayon_manager = ayon_settings["timers_manager"]
manager_settings.update({
key: ayon_manager[key]
for key in {
"auto_stop",
"full_time",
"message_time",
"disregard_publishing"
}
})
output["modules"]["timers_manager"] = manager_settings
def _convert_clockify_system_settings(
ayon_settings, output, addon_versions, default_settings
):
enabled = addon_versions.get("clockify") is not None
clockify_settings = default_settings["modules"]["clockify"]
clockify_settings["enabled"] = enabled
if enabled:
clockify_settings["workspace_name"] = (
ayon_settings["clockify"]["workspace_name"]
)
output["modules"]["clockify"] = clockify_settings
def _convert_deadline_system_settings(
ayon_settings, output, addon_versions, default_settings
):
@ -152,21 +99,24 @@ def _convert_modules_system(
# TODO add all modules
# TODO add 'enabled' values
for func in (
_convert_timers_manager_system_settings,
_convert_clockify_system_settings,
_convert_deadline_system_settings,
_convert_royalrender_system_settings,
):
func(ayon_settings, output, addon_versions, default_settings)
for key in {
"timers_manager",
"clockify",
}:
if addon_versions.get(key):
output[key] = ayon_settings
else:
output.pop(key, None)
modules_settings = output["modules"]
for module_name in (
"sync_server",
"log_viewer",
"standalonepublish_tool",
"project_manager",
"job_queue",
"avalon",
"addon_paths",
):
settings = default_settings["modules"][module_name]
@ -199,9 +149,6 @@ def convert_system_settings(ayon_settings, default_settings, addon_versions):
output = {
"modules": {}
}
if "applications" in ayon_settings:
output["applications"] = ayon_settings["applications"]
if "core" in ayon_settings:
_convert_general(ayon_settings, output, default_settings)
@ -223,67 +170,6 @@ def convert_system_settings(ayon_settings, default_settings, addon_versions):
# --------- Project settings ---------
def _convert_blender_project_settings(ayon_settings, output):
if "blender" not in ayon_settings:
return
ayon_blender = ayon_settings["blender"]
_convert_host_imageio(ayon_blender)
output["blender"] = ayon_blender
def _convert_celaction_project_settings(ayon_settings, output):
if "celaction" not in ayon_settings:
return
ayon_celaction = ayon_settings["celaction"]
_convert_host_imageio(ayon_celaction)
output["celaction"] = ayon_celaction
def _convert_flame_project_settings(ayon_settings, output):
if "flame" not in ayon_settings:
return
ayon_flame = ayon_settings["flame"]
_convert_host_imageio(ayon_flame)
output["flame"] = ayon_flame
def _convert_fusion_project_settings(ayon_settings, output):
if "fusion" not in ayon_settings:
return
ayon_fusion = ayon_settings["fusion"]
_convert_host_imageio(ayon_fusion)
output["fusion"] = ayon_fusion
def _convert_maya_project_settings(ayon_settings, output):
if "maya" not in ayon_settings:
return
ayon_maya = ayon_settings["maya"]
_convert_host_imageio(ayon_maya)
output["maya"] = ayon_maya
def _convert_3dsmax_project_settings(ayon_settings, output):
if "max" not in ayon_settings:
return
ayon_max = ayon_settings["max"]
_convert_host_imageio(ayon_max)
output["max"] = ayon_max
def _convert_nuke_knobs(knobs):
new_knobs = []
for knob in knobs:
@ -427,7 +313,6 @@ def _convert_nuke_project_settings(ayon_settings, output):
# --- ImageIO ---
# NOTE 'monitorOutLut' is maybe not yet in v3 (ut should be)
_convert_host_imageio(ayon_nuke)
ayon_imageio = ayon_nuke["imageio"]
# workfile
@ -476,7 +361,6 @@ def _convert_hiero_project_settings(ayon_settings, output):
return
ayon_hiero = ayon_settings["hiero"]
_convert_host_imageio(ayon_hiero)
new_gui_filters = {}
for item in ayon_hiero.pop("filters", []):
@ -501,53 +385,6 @@ def _convert_hiero_project_settings(ayon_settings, output):
output["hiero"] = ayon_hiero
def _convert_photoshop_project_settings(ayon_settings, output):
if "photoshop" not in ayon_settings:
return
ayon_photoshop = ayon_settings["photoshop"]
_convert_host_imageio(ayon_photoshop)
output["photoshop"] = ayon_photoshop
def _convert_substancepainter_project_settings(ayon_settings, output):
if "substancepainter" not in ayon_settings:
return
ayon_substance_painter = ayon_settings["substancepainter"]
_convert_host_imageio(ayon_substance_painter)
output["substancepainter"] = ayon_substance_painter
def _convert_tvpaint_project_settings(ayon_settings, output):
if "tvpaint" not in ayon_settings:
return
ayon_tvpaint = ayon_settings["tvpaint"]
_convert_host_imageio(ayon_tvpaint)
output["tvpaint"] = ayon_tvpaint
def _convert_traypublisher_project_settings(ayon_settings, output):
if "traypublisher" not in ayon_settings:
return
ayon_traypublisher = ayon_settings["traypublisher"]
_convert_host_imageio(ayon_traypublisher)
output["traypublisher"] = ayon_traypublisher
def _convert_webpublisher_project_settings(ayon_settings, output):
if "webpublisher" not in ayon_settings:
return
ayon_webpublisher = ayon_settings["webpublisher"]
_convert_host_imageio(ayon_webpublisher)
output["webpublisher"] = ayon_webpublisher
def _convert_royalrender_project_settings(ayon_settings, output):
if "royalrender" not in ayon_settings:
return
@ -566,7 +403,6 @@ def _convert_global_project_settings(ayon_settings, output, default_settings):
ayon_core = ayon_settings["core"]
_convert_host_imageio(ayon_core)
# Publish conversion
ayon_publish = ayon_core["publish"]
@ -734,37 +570,11 @@ def _convert_global_project_settings(ayon_settings, output, default_settings):
def convert_project_settings(ayon_settings, default_settings):
# Missing settings
# - standalonepublisher
default_settings = copy.deepcopy(default_settings)
output = {}
exact_match = {
"aftereffects",
"harmony",
"houdini",
"resolve",
"unreal",
"applications",
"deadline",
}
for key in exact_match:
if key in ayon_settings:
output[key] = ayon_settings[key]
_convert_host_imageio(output[key])
_convert_blender_project_settings(ayon_settings, output)
_convert_celaction_project_settings(ayon_settings, output)
_convert_flame_project_settings(ayon_settings, output)
_convert_fusion_project_settings(ayon_settings, output)
_convert_maya_project_settings(ayon_settings, output)
_convert_3dsmax_project_settings(ayon_settings, output)
_convert_nuke_project_settings(ayon_settings, output)
_convert_hiero_project_settings(ayon_settings, output)
_convert_photoshop_project_settings(ayon_settings, output)
_convert_substancepainter_project_settings(ayon_settings, output)
_convert_tvpaint_project_settings(ayon_settings, output)
_convert_traypublisher_project_settings(ayon_settings, output)
_convert_webpublisher_project_settings(ayon_settings, output)
_convert_royalrender_project_settings(ayon_settings, output)

View file

@ -241,15 +241,15 @@ def get_site_local_overrides(project_name, site_name, local_settings=None):
def get_current_project_settings():
"""Project settings for current context project.
Project name should be stored in environment variable `AVALON_PROJECT`.
Project name should be stored in environment variable `AYON_PROJECT_NAME`.
This function should be used only in host context where environment
variable must be set and should not happen that any part of process will
change the value of the enviornment variable.
"""
project_name = os.environ.get("AVALON_PROJECT")
project_name = os.environ.get("AYON_PROJECT_NAME")
if not project_name:
raise ValueError(
"Missing context project in environemt variable `AVALON_PROJECT`."
"Missing context project in environemt variable `AYON_PROJECT_NAME`."
)
return get_project_settings(project_name)

View file

@ -139,7 +139,7 @@ class ExperimentalTools:
def get_tools_for_host(self, host_name=None):
if not host_name:
host_name = os.environ.get("AVALON_APP")
host_name = os.environ.get("AYON_HOST_NAME")
tools = []
for tool in self.tools:
if (

View file

@ -69,9 +69,9 @@ class ApplicationAction(LauncherAction):
_log = None
required_session_keys = (
"AVALON_PROJECT",
"AVALON_ASSET",
"AVALON_TASK"
"AYON_PROJECT_NAME",
"AYON_FOLDER_PATH",
"AYON_TASK_NAME"
)
@property
@ -85,7 +85,7 @@ class ApplicationAction(LauncherAction):
if not session.get(key):
return False
project_name = session["AVALON_PROJECT"]
project_name = session["AYON_PROJECT_NAME"]
project_entity = self.project_entities[project_name]
apps = project_entity["attrib"].get("applications")
if not apps or self.application.full_name not in apps:
@ -119,9 +119,9 @@ class ApplicationAction(LauncherAction):
ApplicationLaunchFailed,
)
project_name = session["AVALON_PROJECT"]
asset_name = session["AVALON_ASSET"]
task_name = session["AVALON_TASK"]
project_name = session["AYON_PROJECT_NAME"]
asset_name = session["AYON_FOLDER_PATH"]
task_name = session["AYON_TASK_NAME"]
try:
self.application.launch(
project_name=project_name,
@ -416,6 +416,10 @@ class ActionsModel:
task_name = task["name"]
return {
"AYON_PROJECT_NAME": project_name,
"AYON_FOLDER_PATH": folder_path,
"AYON_TASK_NAME": task_name,
# Deprecated - kept for backwards compatibility
"AVALON_PROJECT": project_name,
"AVALON_ASSET": folder_path,
"AVALON_TASK": task_name,

View file

@ -1807,9 +1807,9 @@ class PublisherController(BasePublisherController):
context_title = self._host.get_context_title()
if context_title is None:
context_title = os.environ.get("AVALON_APP_NAME")
context_title = os.environ.get("AYON_APP_NAME")
if context_title is None:
context_title = os.environ.get("AVALON_APP")
context_title = os.environ.get("AYON_HOST_NAME")
return context_title

View file

@ -5,13 +5,13 @@ from qtpy import QtWidgets, QtCore, QtGui
from ayon_core.tools.utils import (
PlaceholderLineEdit,
RecursiveSortFilterProxyModel,
get_asset_icon,
)
from ayon_core.tools.utils.assets_widget import (
SingleSelectAssetsWidget,
ASSET_ID_ROLE,
ASSET_NAME_ROLE,
ASSET_PATH_ROLE,
get_asset_icon,
)

View file

@ -132,8 +132,8 @@ class TextureCopy:
def texture_copy(asset, project, path):
t.echo("*** Running Texture tool ***")
t.echo(">>> Initializing avalon session ...")
os.environ["AVALON_PROJECT"] = project
os.environ["AVALON_ASSET"] = asset
os.environ["AYON_PROJECT_NAME"] = project
os.environ["AYON_FOLDER_PATH"] = asset
TextureCopy().process(asset, project, path)

View file

@ -37,10 +37,6 @@ from .lib import (
get_qt_app,
get_ayon_qt_app,
get_openpype_qt_app,
get_asset_icon,
get_asset_icon_by_name,
get_asset_icon_name_from_doc,
get_asset_icon_color_from_doc,
)
from .models import (
@ -100,10 +96,6 @@ __all__ = (
"get_qt_app",
"get_ayon_qt_app",
"get_openpype_qt_app",
"get_asset_icon",
"get_asset_icon_by_name",
"get_asset_icon_name_from_doc",
"get_asset_icon_color_from_doc",
"RecursiveSortFilterProxyModel",

View file

@ -10,6 +10,7 @@ from ayon_core.client import (
)
from ayon_core.style import (
get_default_tools_icon_color,
get_default_entity_icon_color,
)
from ayon_core.tools.flickcharm import FlickCharm
@ -21,7 +22,7 @@ from .widgets import PlaceholderLineEdit
from .models import RecursiveSortFilterProxyModel
from .lib import (
DynamicQThread,
get_asset_icon
get_qta_icon_by_name_and_color
)
ASSET_ID_ROLE = QtCore.Qt.UserRole + 1
@ -31,6 +32,59 @@ ASSET_UNDERLINE_COLORS_ROLE = QtCore.Qt.UserRole + 4
ASSET_PATH_ROLE = QtCore.Qt.UserRole + 5
def _get_default_asset_icon_name(has_children):
if has_children:
return "fa.folder"
return "fa.folder-o"
def _get_asset_icon_color_from_doc(asset_doc):
if asset_doc:
return asset_doc["data"].get("color")
return None
def _get_asset_icon_name_from_doc(asset_doc):
if asset_doc:
return asset_doc["data"].get("icon")
return None
def _get_asset_icon_color(asset_doc):
icon_color = _get_asset_icon_color_from_doc(asset_doc)
if icon_color:
return icon_color
return get_default_entity_icon_color()
def _get_asset_icon_name(asset_doc, has_children=True):
icon_name = _get_asset_icon_name_from_doc(asset_doc)
if icon_name:
return icon_name
return _get_default_asset_icon_name(has_children)
def get_asset_icon(asset_doc, has_children=False):
"""Get asset icon.
Deprecated:
This function will be removed in future releases. Use on your own
risk.
Args:
asset_doc (dict): Asset document.
has_children (Optional[bool]): Asset has children assets.
Returns:
QIcon: Asset icon.
"""
icon_name = _get_asset_icon_name(asset_doc, has_children)
icon_color = _get_asset_icon_color(asset_doc)
return get_qta_icon_by_name_and_color(icon_name, icon_color)
class _AssetsView(TreeViewSpinner, DeselectableTreeView):
"""Asset items view.

View file

@ -234,62 +234,6 @@ def get_qta_icon_by_name_and_color(icon_name, icon_color):
return icon
def get_asset_icon_name(asset_doc, has_children=True):
icon_name = get_asset_icon_name_from_doc(asset_doc)
if icon_name:
return icon_name
return get_default_asset_icon_name(has_children)
def get_asset_icon_color(asset_doc):
icon_color = get_asset_icon_color_from_doc(asset_doc)
if icon_color:
return icon_color
return get_default_entity_icon_color()
def get_default_asset_icon_name(has_children):
if has_children:
return "fa.folder"
return "fa.folder-o"
def get_asset_icon_name_from_doc(asset_doc):
if asset_doc:
return asset_doc["data"].get("icon")
return None
def get_asset_icon_color_from_doc(asset_doc):
if asset_doc:
return asset_doc["data"].get("color")
return None
def get_asset_icon_by_name(icon_name, icon_color, has_children=False):
if not icon_name:
icon_name = get_default_asset_icon_name(has_children)
if icon_color:
icon_color = QtGui.QColor(icon_color)
else:
icon_color = get_default_entity_icon_color()
icon = get_qta_icon_by_name_and_color(icon_name, icon_color)
if icon is not None:
return icon
return get_qta_icon_by_name_and_color(
get_default_asset_icon_name(has_children),
icon_color
)
def get_asset_icon(asset_doc, has_children=False):
icon_name = get_asset_icon_name(asset_doc, has_children)
icon_color = get_asset_icon_color(asset_doc)
return get_qta_icon_by_name_and_color(icon_name, icon_color)
def get_default_task_icon(color=None):
if color is None:
color = get_default_entity_icon_color()

View file

@ -27,7 +27,7 @@ class WorkfileBuildPlaceholderDialog(QtWidgets.QDialog):
host_name = getattr(self._host, "name", None)
if not host_name:
host_name = os.getenv("AVALON_APP") or "NA"
host_name = os.getenv("AYON_HOST_NAME") or "NA"
self._host_name = host_name
plugins_combo = QtWidgets.QComboBox(self)

Some files were not shown because too many files have changed in this diff Show more