mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
replaced avalon imports in tools
This commit is contained in:
parent
066d6123d6
commit
213ab8a811
17 changed files with 232 additions and 210 deletions
|
|
@ -16,7 +16,7 @@ from wsrpc_aiohttp import (
|
|||
WSRPCClient
|
||||
)
|
||||
|
||||
from avalon import api
|
||||
from openpype.pipeline import legacy_io
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
|
@ -80,9 +80,9 @@ class WebServerTool:
|
|||
loop=asyncio.get_event_loop())
|
||||
await client.connect()
|
||||
|
||||
project = api.Session["AVALON_PROJECT"]
|
||||
asset = api.Session["AVALON_ASSET"]
|
||||
task = api.Session["AVALON_TASK"]
|
||||
project = legacy_io.Session["AVALON_PROJECT"]
|
||||
asset = legacy_io.Session["AVALON_ASSET"]
|
||||
task = legacy_io.Session["AVALON_TASK"]
|
||||
log.info("Sending context change to {}-{}-{}".format(project,
|
||||
asset,
|
||||
task))
|
||||
|
|
|
|||
|
|
@ -4,16 +4,14 @@ import re
|
|||
|
||||
from Qt import QtWidgets, QtCore
|
||||
|
||||
from avalon import api, io
|
||||
|
||||
from openpype import style
|
||||
from openpype.api import get_current_project_settings
|
||||
from openpype.tools.utils.lib import qt_app_context
|
||||
from openpype.pipeline import legacy_io
|
||||
from openpype.pipeline.create import (
|
||||
SUBSET_NAME_ALLOWED_SYMBOLS,
|
||||
legacy_create,
|
||||
CreatorError,
|
||||
LegacyCreator,
|
||||
)
|
||||
|
||||
from .model import CreatorsModel
|
||||
|
|
@ -220,7 +218,7 @@ class CreatorWindow(QtWidgets.QDialog):
|
|||
asset_doc = None
|
||||
if creator_plugin:
|
||||
# Get the asset from the database which match with the name
|
||||
asset_doc = io.find_one(
|
||||
asset_doc = legacy_io.find_one(
|
||||
{"name": asset_name, "type": "asset"},
|
||||
projection={"_id": 1}
|
||||
)
|
||||
|
|
@ -237,9 +235,9 @@ class CreatorWindow(QtWidgets.QDialog):
|
|||
self._set_valid_state(False)
|
||||
return
|
||||
|
||||
project_name = io.Session["AVALON_PROJECT"]
|
||||
project_name = legacy_io.Session["AVALON_PROJECT"]
|
||||
asset_id = asset_doc["_id"]
|
||||
task_name = io.Session["AVALON_TASK"]
|
||||
task_name = legacy_io.Session["AVALON_TASK"]
|
||||
|
||||
# Calculate subset name with Creator plugin
|
||||
subset_name = creator_plugin.get_subset_name(
|
||||
|
|
@ -271,7 +269,7 @@ class CreatorWindow(QtWidgets.QDialog):
|
|||
self._subset_name_input.setText(subset_name)
|
||||
|
||||
# Get all subsets of the current asset
|
||||
subset_docs = io.find(
|
||||
subset_docs = legacy_io.find(
|
||||
{
|
||||
"type": "subset",
|
||||
"parent": asset_id
|
||||
|
|
@ -372,7 +370,7 @@ class CreatorWindow(QtWidgets.QDialog):
|
|||
self.setStyleSheet(style.load_stylesheet())
|
||||
|
||||
def refresh(self):
|
||||
self._asset_name_input.setText(io.Session["AVALON_ASSET"])
|
||||
self._asset_name_input.setText(legacy_io.Session["AVALON_ASSET"])
|
||||
|
||||
self._creators_model.reset()
|
||||
|
||||
|
|
@ -385,7 +383,7 @@ class CreatorWindow(QtWidgets.QDialog):
|
|||
)
|
||||
current_index = None
|
||||
family = None
|
||||
task_name = io.Session.get("AVALON_TASK", None)
|
||||
task_name = legacy_io.Session.get("AVALON_TASK", None)
|
||||
lowered_task_name = task_name.lower()
|
||||
if task_name:
|
||||
for _family, _task_names in pype_project_setting.items():
|
||||
|
|
@ -471,7 +469,7 @@ class CreatorWindow(QtWidgets.QDialog):
|
|||
self._msg_timer.start()
|
||||
|
||||
|
||||
def show(debug=False, parent=None):
|
||||
def show(parent=None):
|
||||
"""Display asset creator GUI
|
||||
|
||||
Arguments:
|
||||
|
|
@ -488,24 +486,6 @@ def show(debug=False, parent=None):
|
|||
except (AttributeError, RuntimeError):
|
||||
pass
|
||||
|
||||
if debug:
|
||||
from avalon import mock
|
||||
for creator in mock.creators:
|
||||
api.register_plugin(LegacyCreator, creator)
|
||||
|
||||
import traceback
|
||||
sys.excepthook = lambda typ, val, tb: traceback.print_last()
|
||||
|
||||
io.install()
|
||||
|
||||
any_project = next(
|
||||
project for project in io.projects()
|
||||
if project.get("active", True) is not False
|
||||
)
|
||||
|
||||
api.Session["AVALON_PROJECT"] = any_project["name"]
|
||||
module.project = any_project["name"]
|
||||
|
||||
with qt_app_context():
|
||||
window = CreatorWindow(parent)
|
||||
window.refresh()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
import sys
|
||||
import traceback
|
||||
|
||||
from Qt import QtWidgets, QtCore
|
||||
from avalon import api, io
|
||||
|
||||
from openpype import style
|
||||
from openpype.lib import register_event_callback
|
||||
from openpype.pipeline import install_openpype_plugins
|
||||
from openpype.pipeline import (
|
||||
install_openpype_plugins,
|
||||
legacy_io,
|
||||
)
|
||||
from openpype.tools.utils import (
|
||||
lib,
|
||||
PlaceholderLineEdit
|
||||
|
|
@ -36,14 +39,14 @@ class LoaderWindow(QtWidgets.QDialog):
|
|||
def __init__(self, parent=None):
|
||||
super(LoaderWindow, self).__init__(parent)
|
||||
title = "Asset Loader 2.1"
|
||||
project_name = api.Session.get("AVALON_PROJECT")
|
||||
project_name = legacy_io.Session.get("AVALON_PROJECT")
|
||||
if project_name:
|
||||
title += " - {}".format(project_name)
|
||||
self.setWindowTitle(title)
|
||||
|
||||
# Groups config
|
||||
self.groups_config = lib.GroupsConfig(io)
|
||||
self.family_config_cache = lib.FamilyConfigCache(io)
|
||||
self.groups_config = lib.GroupsConfig(legacy_io)
|
||||
self.family_config_cache = lib.FamilyConfigCache(legacy_io)
|
||||
|
||||
# Enable minimize and maximize for app
|
||||
window_flags = QtCore.Qt.Window
|
||||
|
|
@ -60,13 +63,13 @@ class LoaderWindow(QtWidgets.QDialog):
|
|||
|
||||
# Assets widget
|
||||
assets_widget = MultiSelectAssetsWidget(
|
||||
io, parent=left_side_splitter
|
||||
legacy_io, parent=left_side_splitter
|
||||
)
|
||||
assets_widget.set_current_asset_btn_visibility(True)
|
||||
|
||||
# Families widget
|
||||
families_filter_view = FamilyListView(
|
||||
io, self.family_config_cache, left_side_splitter
|
||||
legacy_io, self.family_config_cache, left_side_splitter
|
||||
)
|
||||
left_side_splitter.addWidget(assets_widget)
|
||||
left_side_splitter.addWidget(families_filter_view)
|
||||
|
|
@ -76,7 +79,7 @@ class LoaderWindow(QtWidgets.QDialog):
|
|||
# --- Middle part ---
|
||||
# Subsets widget
|
||||
subsets_widget = SubsetWidget(
|
||||
io,
|
||||
legacy_io,
|
||||
self.groups_config,
|
||||
self.family_config_cache,
|
||||
tool_name=self.tool_name,
|
||||
|
|
@ -87,8 +90,12 @@ class LoaderWindow(QtWidgets.QDialog):
|
|||
thumb_ver_splitter = QtWidgets.QSplitter(main_splitter)
|
||||
thumb_ver_splitter.setOrientation(QtCore.Qt.Vertical)
|
||||
|
||||
thumbnail_widget = ThumbnailWidget(io, parent=thumb_ver_splitter)
|
||||
version_info_widget = VersionWidget(io, parent=thumb_ver_splitter)
|
||||
thumbnail_widget = ThumbnailWidget(
|
||||
legacy_io, parent=thumb_ver_splitter
|
||||
)
|
||||
version_info_widget = VersionWidget(
|
||||
legacy_io, parent=thumb_ver_splitter
|
||||
)
|
||||
|
||||
thumb_ver_splitter.addWidget(thumbnail_widget)
|
||||
thumb_ver_splitter.addWidget(version_info_widget)
|
||||
|
|
@ -105,7 +112,7 @@ class LoaderWindow(QtWidgets.QDialog):
|
|||
repres_widget = None
|
||||
if sync_server_enabled:
|
||||
repres_widget = RepresentationWidget(
|
||||
io, self.tool_name, parent=thumb_ver_splitter
|
||||
legacy_io, self.tool_name, parent=thumb_ver_splitter
|
||||
)
|
||||
thumb_ver_splitter.addWidget(repres_widget)
|
||||
|
||||
|
|
@ -259,13 +266,15 @@ class LoaderWindow(QtWidgets.QDialog):
|
|||
# Refresh families config
|
||||
self._families_filter_view.refresh()
|
||||
# Change to context asset on context change
|
||||
self._assets_widget.select_asset_by_name(io.Session["AVALON_ASSET"])
|
||||
self._assets_widget.select_asset_by_name(
|
||||
legacy_io.Session["AVALON_ASSET"]
|
||||
)
|
||||
|
||||
def _refresh(self):
|
||||
"""Load assets from database"""
|
||||
|
||||
# Ensure a project is loaded
|
||||
project = io.find_one({"type": "project"}, {"type": 1})
|
||||
project = legacy_io.find_one({"type": "project"}, {"type": 1})
|
||||
assert project, "Project was not found! This is a bug"
|
||||
|
||||
self._assets_widget.refresh()
|
||||
|
|
@ -562,17 +571,16 @@ def show(debug=False, parent=None, use_context=False):
|
|||
module.window = None
|
||||
|
||||
if debug:
|
||||
import traceback
|
||||
sys.excepthook = lambda typ, val, tb: traceback.print_last()
|
||||
|
||||
io.install()
|
||||
legacy_io.install()
|
||||
|
||||
any_project = next(
|
||||
project for project in io.projects()
|
||||
project for project in legacy_io.projects()
|
||||
if project.get("active", True) is not False
|
||||
)
|
||||
|
||||
api.Session["AVALON_PROJECT"] = any_project["name"]
|
||||
legacy_io.Session["AVALON_PROJECT"] = any_project["name"]
|
||||
module.project = any_project["name"]
|
||||
|
||||
with lib.qt_app_context():
|
||||
|
|
@ -580,7 +588,7 @@ def show(debug=False, parent=None, use_context=False):
|
|||
window.show()
|
||||
|
||||
if use_context:
|
||||
context = {"asset": api.Session["AVALON_ASSET"]}
|
||||
context = {"asset": legacy_io.Session["AVALON_ASSET"]}
|
||||
window.set_context(context, refresh=True)
|
||||
else:
|
||||
window.refresh()
|
||||
|
|
@ -604,10 +612,10 @@ def cli(args):
|
|||
|
||||
print("Entering Project: %s" % project)
|
||||
|
||||
io.install()
|
||||
legacy_io.install()
|
||||
|
||||
# Store settings
|
||||
api.Session["AVALON_PROJECT"] = project
|
||||
legacy_io.Session["AVALON_PROJECT"] = project
|
||||
|
||||
install_openpype_plugins(project)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import logging
|
|||
|
||||
from Qt import QtWidgets, QtCore
|
||||
|
||||
from avalon import io
|
||||
from openpype import style
|
||||
from openpype.pipeline import legacy_io
|
||||
from openpype.tools.utils.lib import qt_app_context
|
||||
from openpype.hosts.maya.api.lib import assign_look_by_version
|
||||
|
||||
|
|
@ -227,9 +227,13 @@ class MayaLookAssignerWindow(QtWidgets.QWidget):
|
|||
continue
|
||||
|
||||
# Get the latest version of this asset's look subset
|
||||
version = io.find_one({"type": "version",
|
||||
"parent": assign_look["_id"]},
|
||||
sort=[("name", -1)])
|
||||
version = legacy_io.find_one(
|
||||
{
|
||||
"type": "version",
|
||||
"parent": assign_look["_id"]
|
||||
},
|
||||
sort=[("name", -1)]
|
||||
)
|
||||
|
||||
subset_name = assign_look["name"]
|
||||
self.echo("{} Assigning {} to {}\t".format(prefix,
|
||||
|
|
|
|||
|
|
@ -5,9 +5,8 @@ import os
|
|||
from bson.objectid import ObjectId
|
||||
import maya.cmds as cmds
|
||||
|
||||
from avalon import io
|
||||
|
||||
from openpype.pipeline import (
|
||||
legacy_io,
|
||||
remove_container,
|
||||
registered_host,
|
||||
)
|
||||
|
|
@ -161,8 +160,10 @@ def create_items_from_nodes(nodes):
|
|||
return asset_view_items
|
||||
|
||||
for _id, id_nodes in id_hashes.items():
|
||||
asset = io.find_one({"_id": ObjectId(_id)},
|
||||
projection={"name": True})
|
||||
asset = legacy_io.find_one(
|
||||
{"_id": ObjectId(_id)},
|
||||
projection={"name": True}
|
||||
)
|
||||
|
||||
# Skip if asset id is not found
|
||||
if not asset:
|
||||
|
|
|
|||
|
|
@ -11,9 +11,8 @@ from bson.objectid import ObjectId
|
|||
import alembic.Abc
|
||||
from maya import cmds
|
||||
|
||||
from avalon import io
|
||||
|
||||
from openpype.pipeline import (
|
||||
legacy_io,
|
||||
load_container,
|
||||
loaders_from_representation,
|
||||
discover_loader_plugins,
|
||||
|
|
@ -158,9 +157,11 @@ def get_look_relationships(version_id):
|
|||
dict: Dictionary of relations.
|
||||
|
||||
"""
|
||||
json_representation = io.find_one({"type": "representation",
|
||||
"parent": version_id,
|
||||
"name": "json"})
|
||||
json_representation = legacy_io.find_one({
|
||||
"type": "representation",
|
||||
"parent": version_id,
|
||||
"name": "json"
|
||||
})
|
||||
|
||||
# Load relationships
|
||||
shader_relation = get_representation_path(json_representation)
|
||||
|
|
@ -184,9 +185,11 @@ def load_look(version_id):
|
|||
|
||||
"""
|
||||
# Get representations of shader file and relationships
|
||||
look_representation = io.find_one({"type": "representation",
|
||||
"parent": version_id,
|
||||
"name": "ma"})
|
||||
look_representation = legacy_io.find_one({
|
||||
"type": "representation",
|
||||
"parent": version_id,
|
||||
"name": "ma"
|
||||
})
|
||||
|
||||
# See if representation is already loaded, if so reuse it.
|
||||
host = registered_host()
|
||||
|
|
@ -232,15 +235,21 @@ def get_latest_version(asset_id, subset):
|
|||
RuntimeError: When subset or version doesn't exist.
|
||||
|
||||
"""
|
||||
subset = io.find_one({"name": subset,
|
||||
"parent": ObjectId(asset_id),
|
||||
"type": "subset"})
|
||||
subset = legacy_io.find_one({
|
||||
"name": subset,
|
||||
"parent": ObjectId(asset_id),
|
||||
"type": "subset"
|
||||
})
|
||||
if not subset:
|
||||
raise RuntimeError("Subset does not exist: %s" % subset)
|
||||
|
||||
version = io.find_one({"type": "version",
|
||||
"parent": subset["_id"]},
|
||||
sort=[("name", -1)])
|
||||
version = legacy_io.find_one(
|
||||
{
|
||||
"type": "version",
|
||||
"parent": subset["_id"]
|
||||
},
|
||||
sort=[("name", -1)]
|
||||
)
|
||||
if not version:
|
||||
raise RuntimeError("Version does not exist.")
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ from Qt import QtCore, QtGui
|
|||
import qtawesome
|
||||
from bson.objectid import ObjectId
|
||||
|
||||
from avalon import io
|
||||
from openpype.pipeline import (
|
||||
legacy_io,
|
||||
schema,
|
||||
HeroVersionType,
|
||||
registered_host,
|
||||
|
|
@ -55,7 +55,7 @@ class InventoryModel(TreeModel):
|
|||
if not self.sync_enabled:
|
||||
return
|
||||
|
||||
project_name = io.Session["AVALON_PROJECT"]
|
||||
project_name = legacy_io.Session["AVALON_PROJECT"]
|
||||
active_site = sync_server.get_active_site(project_name)
|
||||
remote_site = sync_server.get_remote_site(project_name)
|
||||
|
||||
|
|
@ -304,32 +304,32 @@ class InventoryModel(TreeModel):
|
|||
for repre_id, group_dict in sorted(grouped.items()):
|
||||
group_items = group_dict["items"]
|
||||
# Get parenthood per group
|
||||
representation = io.find_one({"_id": ObjectId(repre_id)})
|
||||
representation = legacy_io.find_one({"_id": ObjectId(repre_id)})
|
||||
if not representation:
|
||||
not_found["representation"].append(group_items)
|
||||
not_found_ids.append(repre_id)
|
||||
continue
|
||||
|
||||
version = io.find_one({"_id": representation["parent"]})
|
||||
version = legacy_io.find_one({"_id": representation["parent"]})
|
||||
if not version:
|
||||
not_found["version"].append(group_items)
|
||||
not_found_ids.append(repre_id)
|
||||
continue
|
||||
|
||||
elif version["type"] == "hero_version":
|
||||
_version = io.find_one({
|
||||
_version = legacy_io.find_one({
|
||||
"_id": version["version_id"]
|
||||
})
|
||||
version["name"] = HeroVersionType(_version["name"])
|
||||
version["data"] = _version["data"]
|
||||
|
||||
subset = io.find_one({"_id": version["parent"]})
|
||||
subset = legacy_io.find_one({"_id": version["parent"]})
|
||||
if not subset:
|
||||
not_found["subset"].append(group_items)
|
||||
not_found_ids.append(repre_id)
|
||||
continue
|
||||
|
||||
asset = io.find_one({"_id": subset["parent"]})
|
||||
asset = legacy_io.find_one({"_id": subset["parent"]})
|
||||
if not asset:
|
||||
not_found["asset"].append(group_items)
|
||||
not_found_ids.append(repre_id)
|
||||
|
|
@ -390,7 +390,7 @@ class InventoryModel(TreeModel):
|
|||
|
||||
# Store the highest available version so the model can know
|
||||
# whether current version is currently up-to-date.
|
||||
highest_version = io.find_one({
|
||||
highest_version = legacy_io.find_one({
|
||||
"type": "version",
|
||||
"parent": version["parent"]
|
||||
}, sort=[("name", -1)])
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ from Qt import QtWidgets, QtCore
|
|||
import qtawesome
|
||||
from bson.objectid import ObjectId
|
||||
|
||||
from avalon import io
|
||||
from openpype.pipeline import legacy_io
|
||||
from openpype.pipeline.load import (
|
||||
discover_loader_plugins,
|
||||
switch_container,
|
||||
|
|
@ -151,7 +151,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
repre_ids.add(ObjectId(item["representation"]))
|
||||
content_loaders.add(item["loader"])
|
||||
|
||||
repres = list(io.find({
|
||||
repres = list(legacy_io.find({
|
||||
"type": {"$in": ["representation", "archived_representation"]},
|
||||
"_id": {"$in": list(repre_ids)}
|
||||
}))
|
||||
|
|
@ -179,7 +179,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
content_repres[repre_id] = repres_by_id[repre_id]
|
||||
version_ids.append(repre["parent"])
|
||||
|
||||
versions = io.find({
|
||||
versions = legacy_io.find({
|
||||
"type": {"$in": ["version", "hero_version"]},
|
||||
"_id": {"$in": list(set(version_ids))}
|
||||
})
|
||||
|
|
@ -198,7 +198,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
else:
|
||||
subset_ids.append(content_versions[version_id]["parent"])
|
||||
|
||||
subsets = io.find({
|
||||
subsets = legacy_io.find({
|
||||
"type": {"$in": ["subset", "archived_subset"]},
|
||||
"_id": {"$in": subset_ids}
|
||||
})
|
||||
|
|
@ -220,7 +220,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
asset_ids.append(subset["parent"])
|
||||
content_subsets[subset_id] = subset
|
||||
|
||||
assets = io.find({
|
||||
assets = legacy_io.find({
|
||||
"type": {"$in": ["asset", "archived_asset"]},
|
||||
"_id": {"$in": list(asset_ids)}
|
||||
})
|
||||
|
|
@ -472,7 +472,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
# Prepare asset document if asset is selected
|
||||
asset_doc = None
|
||||
if selected_asset:
|
||||
asset_doc = io.find_one(
|
||||
asset_doc = legacy_io.find_one(
|
||||
{"type": "asset", "name": selected_asset},
|
||||
{"_id": True}
|
||||
)
|
||||
|
|
@ -523,7 +523,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
def _get_current_output_repre_ids_xxx(
|
||||
self, asset_doc, selected_subset, selected_repre
|
||||
):
|
||||
subset_doc = io.find_one(
|
||||
subset_doc = legacy_io.find_one(
|
||||
{
|
||||
"type": "subset",
|
||||
"name": selected_subset,
|
||||
|
|
@ -537,7 +537,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
if not version_doc:
|
||||
return []
|
||||
|
||||
repre_docs = io.find(
|
||||
repre_docs = legacy_io.find(
|
||||
{
|
||||
"type": "representation",
|
||||
"parent": version_doc["_id"],
|
||||
|
|
@ -548,7 +548,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
return [repre_doc["_id"] for repre_doc in repre_docs]
|
||||
|
||||
def _get_current_output_repre_ids_xxo(self, asset_doc, selected_subset):
|
||||
subset_doc = io.find_one(
|
||||
subset_doc = legacy_io.find_one(
|
||||
{
|
||||
"type": "subset",
|
||||
"parent": asset_doc["_id"],
|
||||
|
|
@ -563,7 +563,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
for repre_doc in self.content_repres.values():
|
||||
repre_names.add(repre_doc["name"])
|
||||
|
||||
repre_docs = io.find(
|
||||
repre_docs = legacy_io.find(
|
||||
{
|
||||
"type": "representation",
|
||||
"parent": subset_doc["_id"],
|
||||
|
|
@ -578,7 +578,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
for subset_doc in self.content_subsets.values():
|
||||
susbet_names.add(subset_doc["name"])
|
||||
|
||||
subset_docs = io.find(
|
||||
subset_docs = legacy_io.find(
|
||||
{
|
||||
"type": "subset",
|
||||
"name": {"$in": list(susbet_names)},
|
||||
|
|
@ -587,7 +587,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
{"_id": True}
|
||||
)
|
||||
subset_ids = [subset_doc["_id"] for subset_doc in subset_docs]
|
||||
repre_docs = io.find(
|
||||
repre_docs = legacy_io.find(
|
||||
{
|
||||
"type": "representation",
|
||||
"parent": {"$in": subset_ids},
|
||||
|
|
@ -606,7 +606,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
subset_name = subset_doc["name"]
|
||||
repres_by_subset_name[subset_name].add(repre_name)
|
||||
|
||||
subset_docs = list(io.find(
|
||||
subset_docs = list(legacy_io.find(
|
||||
{
|
||||
"type": "subset",
|
||||
"parent": asset_doc["_id"],
|
||||
|
|
@ -637,7 +637,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
"parent": version_id,
|
||||
"name": {"$in": list(repre_names)}
|
||||
})
|
||||
repre_docs = io.find(
|
||||
repre_docs = legacy_io.find(
|
||||
{"$or": repre_or_query},
|
||||
{"_id": True}
|
||||
)
|
||||
|
|
@ -646,7 +646,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
def _get_current_output_repre_ids_oxx(
|
||||
self, selected_subset, selected_repre
|
||||
):
|
||||
subset_docs = list(io.find({
|
||||
subset_docs = list(legacy_io.find({
|
||||
"type": "subset",
|
||||
"parent": {"$in": list(self.content_assets.keys())},
|
||||
"name": selected_subset
|
||||
|
|
@ -657,7 +657,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
last_version["_id"]
|
||||
for last_version in last_versions_by_subset_id.values()
|
||||
]
|
||||
repre_docs = io.find({
|
||||
repre_docs = legacy_io.find({
|
||||
"type": "representation",
|
||||
"parent": {"$in": last_version_ids},
|
||||
"name": selected_repre
|
||||
|
|
@ -666,7 +666,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
return [repre_doc["_id"] for repre_doc in repre_docs]
|
||||
|
||||
def _get_current_output_repre_ids_oxo(self, selected_subset):
|
||||
subset_docs = list(io.find(
|
||||
subset_docs = list(legacy_io.find(
|
||||
{
|
||||
"type": "subset",
|
||||
"parent": {"$in": list(self.content_assets.keys())},
|
||||
|
|
@ -713,7 +713,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
"parent": last_version_id,
|
||||
"name": {"$in": list(repre_names)}
|
||||
})
|
||||
repre_docs = io.find(
|
||||
repre_docs = legacy_io.find(
|
||||
{
|
||||
"type": "representation",
|
||||
"$or": repre_or_query
|
||||
|
|
@ -724,7 +724,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
return [repre_doc["_id"] for repre_doc in repre_docs]
|
||||
|
||||
def _get_current_output_repre_ids_oox(self, selected_repre):
|
||||
repre_docs = io.find(
|
||||
repre_docs = legacy_io.find(
|
||||
{
|
||||
"name": selected_repre,
|
||||
"parent": {"$in": list(self.content_versions.keys())}
|
||||
|
|
@ -734,7 +734,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
return [repre_doc["_id"] for repre_doc in repre_docs]
|
||||
|
||||
def _get_asset_box_values(self):
|
||||
asset_docs = io.find(
|
||||
asset_docs = legacy_io.find(
|
||||
{"type": "asset"},
|
||||
{"_id": 1, "name": 1}
|
||||
)
|
||||
|
|
@ -742,7 +742,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
asset_doc["_id"]: asset_doc["name"]
|
||||
for asset_doc in asset_docs
|
||||
}
|
||||
subsets = io.find(
|
||||
subsets = legacy_io.find(
|
||||
{
|
||||
"type": "subset",
|
||||
"parent": {"$in": list(asset_names_by_id.keys())}
|
||||
|
|
@ -762,12 +762,15 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
def _get_subset_box_values(self):
|
||||
selected_asset = self._assets_box.get_valid_value()
|
||||
if selected_asset:
|
||||
asset_doc = io.find_one({"type": "asset", "name": selected_asset})
|
||||
asset_doc = legacy_io.find_one({
|
||||
"type": "asset",
|
||||
"name": selected_asset
|
||||
})
|
||||
asset_ids = [asset_doc["_id"]]
|
||||
else:
|
||||
asset_ids = list(self.content_assets.keys())
|
||||
|
||||
subsets = io.find(
|
||||
subsets = legacy_io.find(
|
||||
{
|
||||
"type": "subset",
|
||||
"parent": {"$in": asset_ids}
|
||||
|
|
@ -804,7 +807,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
# [ ] [ ] [?]
|
||||
if not selected_asset and not selected_subset:
|
||||
# Find all representations of selection's subsets
|
||||
possible_repres = list(io.find(
|
||||
possible_repres = list(legacy_io.find(
|
||||
{
|
||||
"type": "representation",
|
||||
"parent": {"$in": list(self.content_versions.keys())}
|
||||
|
|
@ -833,11 +836,11 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
|
||||
# [x] [x] [?]
|
||||
if selected_asset and selected_subset:
|
||||
asset_doc = io.find_one(
|
||||
asset_doc = legacy_io.find_one(
|
||||
{"type": "asset", "name": selected_asset},
|
||||
{"_id": 1}
|
||||
)
|
||||
subset_doc = io.find_one(
|
||||
subset_doc = legacy_io.find_one(
|
||||
{
|
||||
"type": "subset",
|
||||
"name": selected_subset,
|
||||
|
|
@ -848,7 +851,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
subset_id = subset_doc["_id"]
|
||||
last_versions_by_subset_id = self.find_last_versions([subset_id])
|
||||
version_doc = last_versions_by_subset_id.get(subset_id)
|
||||
repre_docs = io.find(
|
||||
repre_docs = legacy_io.find(
|
||||
{
|
||||
"type": "representation",
|
||||
"parent": version_doc["_id"]
|
||||
|
|
@ -865,7 +868,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
# [x] [ ] [?]
|
||||
# If asset only is selected
|
||||
if selected_asset:
|
||||
asset_doc = io.find_one(
|
||||
asset_doc = legacy_io.find_one(
|
||||
{"type": "asset", "name": selected_asset},
|
||||
{"_id": 1}
|
||||
)
|
||||
|
|
@ -876,7 +879,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
subset_names = set()
|
||||
for subset_doc in self.content_subsets.values():
|
||||
subset_names.add(subset_doc["name"])
|
||||
subset_docs = io.find(
|
||||
subset_docs = legacy_io.find(
|
||||
{
|
||||
"type": "subset",
|
||||
"parent": asset_doc["_id"],
|
||||
|
|
@ -900,7 +903,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
if not subset_id_by_version_id:
|
||||
return list()
|
||||
|
||||
repre_docs = list(io.find(
|
||||
repre_docs = list(legacy_io.find(
|
||||
{
|
||||
"type": "representation",
|
||||
"parent": {"$in": list(subset_id_by_version_id.keys())}
|
||||
|
|
@ -930,7 +933,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
return list(available_repres)
|
||||
|
||||
# [ ] [x] [?]
|
||||
subset_docs = list(io.find(
|
||||
subset_docs = list(legacy_io.find(
|
||||
{
|
||||
"type": "subset",
|
||||
"parent": {"$in": list(self.content_assets.keys())},
|
||||
|
|
@ -957,7 +960,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
if not subset_id_by_version_id:
|
||||
return list()
|
||||
|
||||
repre_docs = list(io.find(
|
||||
repre_docs = list(legacy_io.find(
|
||||
{
|
||||
"type": "representation",
|
||||
"parent": {"$in": list(subset_id_by_version_id.keys())}
|
||||
|
|
@ -1013,11 +1016,11 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
return
|
||||
|
||||
# [x] [ ] [?]
|
||||
asset_doc = io.find_one(
|
||||
asset_doc = legacy_io.find_one(
|
||||
{"type": "asset", "name": selected_asset},
|
||||
{"_id": 1}
|
||||
)
|
||||
subset_docs = io.find(
|
||||
subset_docs = legacy_io.find(
|
||||
{"type": "subset", "parent": asset_doc["_id"]},
|
||||
{"name": 1}
|
||||
)
|
||||
|
|
@ -1048,7 +1051,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
}}
|
||||
]
|
||||
last_versions_by_subset_id = dict()
|
||||
for doc in io.aggregate(_pipeline):
|
||||
for doc in legacy_io.aggregate(_pipeline):
|
||||
doc["parent"] = doc["_id"]
|
||||
doc["_id"] = doc.pop("_version_id")
|
||||
last_versions_by_subset_id[doc["parent"]] = doc
|
||||
|
|
@ -1076,11 +1079,11 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
|
||||
# [x] [x] [ ]
|
||||
if selected_asset is not None and selected_subset is not None:
|
||||
asset_doc = io.find_one(
|
||||
asset_doc = legacy_io.find_one(
|
||||
{"type": "asset", "name": selected_asset},
|
||||
{"_id": 1}
|
||||
)
|
||||
subset_doc = io.find_one(
|
||||
subset_doc = legacy_io.find_one(
|
||||
{
|
||||
"type": "subset",
|
||||
"parent": asset_doc["_id"],
|
||||
|
|
@ -1096,7 +1099,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
validation_state.repre_ok = False
|
||||
return
|
||||
|
||||
repre_docs = io.find(
|
||||
repre_docs = legacy_io.find(
|
||||
{
|
||||
"type": "representation",
|
||||
"parent": last_version["_id"]
|
||||
|
|
@ -1116,11 +1119,11 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
|
||||
# [x] [ ] [ ]
|
||||
if selected_asset is not None:
|
||||
asset_doc = io.find_one(
|
||||
asset_doc = legacy_io.find_one(
|
||||
{"type": "asset", "name": selected_asset},
|
||||
{"_id": 1}
|
||||
)
|
||||
subset_docs = list(io.find(
|
||||
subset_docs = list(legacy_io.find(
|
||||
{
|
||||
"type": "subset",
|
||||
"parent": asset_doc["_id"]
|
||||
|
|
@ -1142,7 +1145,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
version_id = last_version["_id"]
|
||||
subset_id_by_version_id[version_id] = subset_id
|
||||
|
||||
repre_docs = io.find(
|
||||
repre_docs = legacy_io.find(
|
||||
{
|
||||
"type": "representation",
|
||||
"parent": {"$in": list(subset_id_by_version_id.keys())}
|
||||
|
|
@ -1173,7 +1176,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
|
||||
# [ ] [x] [ ]
|
||||
# Subset documents
|
||||
subset_docs = io.find(
|
||||
subset_docs = legacy_io.find(
|
||||
{
|
||||
"type": "subset",
|
||||
"parent": {"$in": list(self.content_assets.keys())},
|
||||
|
|
@ -1194,7 +1197,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
version_id = last_version["_id"]
|
||||
subset_id_by_version_id[version_id] = subset_id
|
||||
|
||||
repre_docs = io.find(
|
||||
repre_docs = legacy_io.find(
|
||||
{
|
||||
"type": "representation",
|
||||
"parent": {"$in": list(subset_id_by_version_id.keys())}
|
||||
|
|
@ -1225,7 +1228,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
|
||||
def _on_current_asset(self):
|
||||
# Set initial asset as current.
|
||||
asset_name = io.Session["AVALON_ASSET"]
|
||||
asset_name = legacy_io.Session["AVALON_ASSET"]
|
||||
index = self._assets_box.findText(
|
||||
asset_name, QtCore.Qt.MatchFixedString
|
||||
)
|
||||
|
|
@ -1243,7 +1246,10 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
selected_representation = self._representations_box.get_valid_value()
|
||||
|
||||
if selected_asset:
|
||||
asset_doc = io.find_one({"type": "asset", "name": selected_asset})
|
||||
asset_doc = legacy_io.find_one({
|
||||
"type": "asset",
|
||||
"name": selected_asset
|
||||
})
|
||||
asset_docs_by_id = {asset_doc["_id"]: asset_doc}
|
||||
else:
|
||||
asset_docs_by_id = self.content_assets
|
||||
|
|
@ -1262,7 +1268,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
if selected_subset:
|
||||
subset_query["name"] = selected_subset
|
||||
|
||||
subset_docs = list(io.find(subset_query))
|
||||
subset_docs = list(legacy_io.find(subset_query))
|
||||
subset_ids = []
|
||||
subset_docs_by_parent_and_name = collections.defaultdict(dict)
|
||||
for subset in subset_docs:
|
||||
|
|
@ -1272,12 +1278,12 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
subset_docs_by_parent_and_name[parent_id][name] = subset
|
||||
|
||||
# versions
|
||||
version_docs = list(io.find({
|
||||
version_docs = list(legacy_io.find({
|
||||
"type": "version",
|
||||
"parent": {"$in": subset_ids}
|
||||
}, sort=[("name", -1)]))
|
||||
|
||||
hero_version_docs = list(io.find({
|
||||
hero_version_docs = list(legacy_io.find({
|
||||
"type": "hero_version",
|
||||
"parent": {"$in": subset_ids}
|
||||
}))
|
||||
|
|
@ -1297,7 +1303,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
|
|||
parent_id = hero_version_doc["parent"]
|
||||
hero_version_docs_by_parent_id[parent_id] = hero_version_doc
|
||||
|
||||
repre_docs = io.find({
|
||||
repre_docs = legacy_io.find({
|
||||
"type": "representation",
|
||||
"parent": {"$in": version_ids}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -6,10 +6,9 @@ from Qt import QtWidgets, QtCore
|
|||
import qtawesome
|
||||
from bson.objectid import ObjectId
|
||||
|
||||
from avalon import io
|
||||
|
||||
from openpype import style
|
||||
from openpype.pipeline import (
|
||||
legacy_io,
|
||||
HeroVersionType,
|
||||
update_container,
|
||||
remove_container,
|
||||
|
|
@ -84,7 +83,7 @@ class SceneInventoryView(QtWidgets.QTreeView):
|
|||
if item_id not in repre_ids:
|
||||
repre_ids.append(item_id)
|
||||
|
||||
repre_docs = io.find(
|
||||
repre_docs = legacy_io.find(
|
||||
{
|
||||
"type": "representation",
|
||||
"_id": {"$in": repre_ids}
|
||||
|
|
@ -98,7 +97,7 @@ class SceneInventoryView(QtWidgets.QTreeView):
|
|||
if version_id not in version_ids:
|
||||
version_ids.append(version_id)
|
||||
|
||||
loaded_versions = io.find({
|
||||
loaded_versions = legacy_io.find({
|
||||
"_id": {"$in": version_ids},
|
||||
"type": {"$in": ["version", "hero_version"]}
|
||||
})
|
||||
|
|
@ -115,7 +114,7 @@ class SceneInventoryView(QtWidgets.QTreeView):
|
|||
if parent_id not in version_parents:
|
||||
version_parents.append(parent_id)
|
||||
|
||||
all_versions = io.find({
|
||||
all_versions = legacy_io.find({
|
||||
"type": {"$in": ["hero_version", "version"]},
|
||||
"parent": {"$in": version_parents}
|
||||
})
|
||||
|
|
@ -151,7 +150,7 @@ class SceneInventoryView(QtWidgets.QTreeView):
|
|||
if item_id not in repre_ids:
|
||||
repre_ids.append(item_id)
|
||||
|
||||
repre_docs = io.find(
|
||||
repre_docs = legacy_io.find(
|
||||
{
|
||||
"type": "representation",
|
||||
"_id": {"$in": repre_ids}
|
||||
|
|
@ -166,7 +165,7 @@ class SceneInventoryView(QtWidgets.QTreeView):
|
|||
version_id_by_repre_id[repre_doc["_id"]] = version_id
|
||||
if version_id not in version_ids:
|
||||
version_ids.append(version_id)
|
||||
hero_versions = io.find(
|
||||
hero_versions = legacy_io.find(
|
||||
{
|
||||
"_id": {"$in": version_ids},
|
||||
"type": "hero_version"
|
||||
|
|
@ -184,7 +183,7 @@ class SceneInventoryView(QtWidgets.QTreeView):
|
|||
if current_version_id == hero_version_id:
|
||||
version_id_by_repre_id[_repre_id] = version_id
|
||||
|
||||
version_docs = io.find(
|
||||
version_docs = legacy_io.find(
|
||||
{
|
||||
"_id": {"$in": list(version_ids)},
|
||||
"type": "version"
|
||||
|
|
@ -367,11 +366,11 @@ class SceneInventoryView(QtWidgets.QTreeView):
|
|||
repre_ids (list)
|
||||
side (str): 'active_site'|'remote_site'
|
||||
"""
|
||||
project_name = io.Session["AVALON_PROJECT"]
|
||||
project_name = legacy_io.Session["AVALON_PROJECT"]
|
||||
active_site = self.sync_server.get_active_site(project_name)
|
||||
remote_site = self.sync_server.get_remote_site(project_name)
|
||||
|
||||
repre_docs = io.find({
|
||||
repre_docs = legacy_io.find({
|
||||
"type": "representation",
|
||||
"_id": {"$in": repre_ids}
|
||||
})
|
||||
|
|
@ -661,12 +660,12 @@ class SceneInventoryView(QtWidgets.QTreeView):
|
|||
|
||||
# Get available versions for active representation
|
||||
representation_id = ObjectId(active["representation"])
|
||||
representation = io.find_one({"_id": representation_id})
|
||||
version = io.find_one({
|
||||
representation = legacy_io.find_one({"_id": representation_id})
|
||||
version = legacy_io.find_one({
|
||||
"_id": representation["parent"]
|
||||
})
|
||||
|
||||
versions = list(io.find(
|
||||
versions = list(legacy_io.find(
|
||||
{
|
||||
"parent": version["parent"],
|
||||
"type": "version"
|
||||
|
|
@ -674,7 +673,7 @@ class SceneInventoryView(QtWidgets.QTreeView):
|
|||
sort=[("name", 1)]
|
||||
))
|
||||
|
||||
hero_version = io.find_one({
|
||||
hero_version = legacy_io.find_one({
|
||||
"parent": version["parent"],
|
||||
"type": "hero_version"
|
||||
})
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ import sys
|
|||
|
||||
from Qt import QtWidgets, QtCore
|
||||
import qtawesome
|
||||
from avalon import io, api
|
||||
|
||||
from openpype.pipeline import legacy_io
|
||||
from openpype import style
|
||||
from openpype.tools.utils.delegates import VersionDelegate
|
||||
from openpype.tools.utils.lib import (
|
||||
|
|
@ -72,7 +72,7 @@ class SceneInventoryWindow(QtWidgets.QDialog):
|
|||
control_layout.addWidget(refresh_button)
|
||||
|
||||
# endregion control
|
||||
family_config_cache = FamilyConfigCache(io)
|
||||
family_config_cache = FamilyConfigCache(legacy_io)
|
||||
|
||||
model = InventoryModel(family_config_cache)
|
||||
proxy = FilterProxyModel()
|
||||
|
|
@ -91,7 +91,7 @@ class SceneInventoryWindow(QtWidgets.QDialog):
|
|||
view.setColumnWidth(4, 100) # namespace
|
||||
|
||||
# apply delegates
|
||||
version_delegate = VersionDelegate(io, self)
|
||||
version_delegate = VersionDelegate(legacy_io, self)
|
||||
column = model.Columns.index("version")
|
||||
view.setItemDelegateForColumn(column, version_delegate)
|
||||
|
||||
|
|
@ -191,17 +191,18 @@ def show(root=None, debug=False, parent=None, items=None):
|
|||
pass
|
||||
|
||||
if debug is True:
|
||||
io.install()
|
||||
legacy_io.install()
|
||||
|
||||
if not os.environ.get("AVALON_PROJECT"):
|
||||
any_project = next(
|
||||
project for project in io.projects()
|
||||
project for project in legacy_io.projects()
|
||||
if project.get("active", True) is not False
|
||||
)
|
||||
|
||||
api.Session["AVALON_PROJECT"] = any_project["name"]
|
||||
project_name = any_project["name"]
|
||||
else:
|
||||
api.Session["AVALON_PROJECT"] = os.environ.get("AVALON_PROJECT")
|
||||
project_name = os.environ.get("AVALON_PROJECT")
|
||||
legacy_io.Session["AVALON_PROJECT"] = project_name
|
||||
|
||||
with qt_app_context():
|
||||
window = SceneInventoryWindow(parent)
|
||||
|
|
|
|||
|
|
@ -5,16 +5,18 @@ import random
|
|||
import string
|
||||
|
||||
from Qt import QtWidgets, QtCore
|
||||
from . import DropDataFrame
|
||||
from .constants import HOST_NAME
|
||||
from avalon import io
|
||||
|
||||
from openpype.api import execute, Logger
|
||||
from openpype.pipeline import legacy_io
|
||||
from openpype.lib import (
|
||||
get_openpype_execute_args,
|
||||
apply_project_environments_value
|
||||
)
|
||||
|
||||
log = Logger().get_logger("standalonepublisher")
|
||||
from . import DropDataFrame
|
||||
from .constants import HOST_NAME
|
||||
|
||||
log = Logger.get_logger("standalonepublisher")
|
||||
|
||||
|
||||
class ComponentsWidget(QtWidgets.QWidget):
|
||||
|
|
@ -152,18 +154,18 @@ def set_context(project, asset, task):
|
|||
:type asset: str
|
||||
'''
|
||||
os.environ["AVALON_PROJECT"] = project
|
||||
io.Session["AVALON_PROJECT"] = project
|
||||
legacy_io.Session["AVALON_PROJECT"] = project
|
||||
os.environ["AVALON_ASSET"] = asset
|
||||
io.Session["AVALON_ASSET"] = asset
|
||||
legacy_io.Session["AVALON_ASSET"] = asset
|
||||
if not task:
|
||||
task = ''
|
||||
os.environ["AVALON_TASK"] = task
|
||||
io.Session["AVALON_TASK"] = task
|
||||
legacy_io.Session["AVALON_TASK"] = task
|
||||
|
||||
io.Session["current_dir"] = os.path.normpath(os.getcwd())
|
||||
legacy_io.Session["current_dir"] = os.path.normpath(os.getcwd())
|
||||
|
||||
os.environ["AVALON_APP"] = HOST_NAME
|
||||
io.Session["AVALON_APP"] = HOST_NAME
|
||||
legacy_io.Session["AVALON_APP"] = HOST_NAME
|
||||
|
||||
|
||||
def cli_publish(data, publish_paths, gui=True):
|
||||
|
|
@ -171,7 +173,7 @@ def cli_publish(data, publish_paths, gui=True):
|
|||
os.path.dirname(os.path.dirname(__file__)),
|
||||
"publish.py"
|
||||
)
|
||||
io.install()
|
||||
legacy_io.install()
|
||||
|
||||
# Create hash name folder in temp
|
||||
chars = "".join([random.choice(string.ascii_letters) for i in range(15)])
|
||||
|
|
@ -203,6 +205,6 @@ def cli_publish(data, publish_paths, gui=True):
|
|||
|
||||
log.info(f"Publish result: {result}")
|
||||
|
||||
io.uninstall()
|
||||
legacy_io.uninstall()
|
||||
|
||||
return False
|
||||
|
|
|
|||
|
|
@ -1,14 +1,12 @@
|
|||
import os
|
||||
import re
|
||||
import click
|
||||
from avalon import io, api
|
||||
from pprint import pprint
|
||||
|
||||
import speedcopy
|
||||
|
||||
from openpype.lib import Terminal
|
||||
from openpype.api import Anatomy
|
||||
|
||||
import shutil
|
||||
import speedcopy
|
||||
from openpype.pipeline import legacy_io
|
||||
|
||||
|
||||
t = Terminal()
|
||||
|
|
@ -20,8 +18,8 @@ texture_extensions = ['.tif', '.tiff', '.jpg', '.jpeg', '.tx', '.png', '.tga',
|
|||
class TextureCopy:
|
||||
|
||||
def __init__(self):
|
||||
if not io.Session:
|
||||
io.install()
|
||||
if not legacy_io.Session:
|
||||
legacy_io.install()
|
||||
|
||||
def _get_textures(self, path):
|
||||
textures = []
|
||||
|
|
@ -32,14 +30,14 @@ class TextureCopy:
|
|||
return textures
|
||||
|
||||
def _get_project(self, project_name):
|
||||
project = io.find_one({
|
||||
project = legacy_io.find_one({
|
||||
'type': 'project',
|
||||
'name': project_name
|
||||
})
|
||||
return project
|
||||
|
||||
def _get_asset(self, asset_name):
|
||||
asset = io.find_one({
|
||||
asset = legacy_io.find_one({
|
||||
'type': 'asset',
|
||||
'name': asset_name
|
||||
})
|
||||
|
|
|
|||
|
|
@ -4,9 +4,14 @@ It is possible to create `HostToolsHelper` in host implementation or
|
|||
use singleton approach with global functions (using helper anyway).
|
||||
"""
|
||||
import os
|
||||
import avalon.api
|
||||
|
||||
import pyblish.api
|
||||
from openpype.pipeline import registered_host
|
||||
|
||||
from openpype.pipeline import (
|
||||
registered_host,
|
||||
legacy_io,
|
||||
)
|
||||
|
||||
from .lib import qt_app_context
|
||||
|
||||
|
||||
|
|
@ -73,8 +78,8 @@ class HostToolsHelper:
|
|||
|
||||
if use_context:
|
||||
context = {
|
||||
"asset": avalon.api.Session["AVALON_ASSET"],
|
||||
"task": avalon.api.Session["AVALON_TASK"]
|
||||
"asset": legacy_io.Session["AVALON_ASSET"],
|
||||
"task": legacy_io.Session["AVALON_TASK"]
|
||||
}
|
||||
workfiles_tool.set_context(context)
|
||||
|
||||
|
|
@ -105,7 +110,7 @@ class HostToolsHelper:
|
|||
use_context = False
|
||||
|
||||
if use_context:
|
||||
context = {"asset": avalon.api.Session["AVALON_ASSET"]}
|
||||
context = {"asset": legacy_io.Session["AVALON_ASSET"]}
|
||||
loader_tool.set_context(context, refresh=True)
|
||||
else:
|
||||
loader_tool.refresh()
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
import sys
|
||||
import logging
|
||||
|
||||
from avalon import api
|
||||
|
||||
from openpype.pipeline import registered_host
|
||||
from openpype.pipeline import (
|
||||
registered_host,
|
||||
legacy_io,
|
||||
)
|
||||
from openpype.tools.utils import qt_app_context
|
||||
from .window import Window
|
||||
|
||||
|
|
@ -52,8 +53,8 @@ def show(root=None, debug=False, parent=None, use_context=True, save=True):
|
|||
validate_host_requirements(host)
|
||||
|
||||
if debug:
|
||||
api.Session["AVALON_ASSET"] = "Mock"
|
||||
api.Session["AVALON_TASK"] = "Testing"
|
||||
legacy_io.Session["AVALON_ASSET"] = "Mock"
|
||||
legacy_io.Session["AVALON_TASK"] = "Testing"
|
||||
|
||||
with qt_app_context():
|
||||
window = Window(parent=parent)
|
||||
|
|
@ -61,8 +62,8 @@ def show(root=None, debug=False, parent=None, use_context=True, save=True):
|
|||
|
||||
if use_context:
|
||||
context = {
|
||||
"asset": api.Session["AVALON_ASSET"],
|
||||
"task": api.Session["AVALON_TASK"]
|
||||
"asset": legacy_io.Session["AVALON_ASSET"],
|
||||
"task": legacy_io.Session["AVALON_TASK"]
|
||||
}
|
||||
window.set_context(context)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import shutil
|
|||
|
||||
import Qt
|
||||
from Qt import QtWidgets, QtCore
|
||||
from avalon import io, api
|
||||
|
||||
from openpype.tools.utils import PlaceholderLineEdit
|
||||
from openpype.tools.utils.delegates import PrettyTimeDelegate
|
||||
|
|
@ -18,7 +17,10 @@ from openpype.lib.avalon_context import (
|
|||
update_current_task,
|
||||
compute_session_changes
|
||||
)
|
||||
from openpype.pipeline import registered_host
|
||||
from openpype.pipeline import (
|
||||
registered_host,
|
||||
legacy_io,
|
||||
)
|
||||
from .model import (
|
||||
WorkAreaFilesModel,
|
||||
PublishFilesModel,
|
||||
|
|
@ -87,7 +89,7 @@ class FilesWidget(QtWidgets.QWidget):
|
|||
self._task_type = None
|
||||
|
||||
# Pype's anatomy object for current project
|
||||
self.anatomy = Anatomy(io.Session["AVALON_PROJECT"])
|
||||
self.anatomy = Anatomy(legacy_io.Session["AVALON_PROJECT"])
|
||||
# Template key used to get work template from anatomy templates
|
||||
self.template_key = "work"
|
||||
|
||||
|
|
@ -147,7 +149,9 @@ class FilesWidget(QtWidgets.QWidget):
|
|||
workarea_files_view.setColumnWidth(0, 330)
|
||||
|
||||
# --- Publish files view ---
|
||||
publish_files_model = PublishFilesModel(extensions, io, self.anatomy)
|
||||
publish_files_model = PublishFilesModel(
|
||||
extensions, legacy_io, self.anatomy
|
||||
)
|
||||
|
||||
publish_proxy_model = QtCore.QSortFilterProxyModel()
|
||||
publish_proxy_model.setSourceModel(publish_files_model)
|
||||
|
|
@ -380,13 +384,13 @@ class FilesWidget(QtWidgets.QWidget):
|
|||
return None
|
||||
|
||||
if self._asset_doc is None:
|
||||
self._asset_doc = io.find_one({"_id": self._asset_id})
|
||||
self._asset_doc = legacy_io.find_one({"_id": self._asset_id})
|
||||
return self._asset_doc
|
||||
|
||||
def _get_session(self):
|
||||
"""Return a modified session for the current asset and task"""
|
||||
|
||||
session = api.Session.copy()
|
||||
session = legacy_io.Session.copy()
|
||||
self.template_key = get_workfile_template_key(
|
||||
self._task_type,
|
||||
session["AVALON_APP"],
|
||||
|
|
@ -405,7 +409,7 @@ class FilesWidget(QtWidgets.QWidget):
|
|||
def _enter_session(self):
|
||||
"""Enter the asset and task session currently selected"""
|
||||
|
||||
session = api.Session.copy()
|
||||
session = legacy_io.Session.copy()
|
||||
changes = compute_session_changes(
|
||||
session,
|
||||
asset=self._get_asset_doc(),
|
||||
|
|
@ -595,10 +599,10 @@ class FilesWidget(QtWidgets.QWidget):
|
|||
# Create extra folders
|
||||
create_workdir_extra_folders(
|
||||
self._workdir_path,
|
||||
api.Session["AVALON_APP"],
|
||||
legacy_io.Session["AVALON_APP"],
|
||||
self._task_type,
|
||||
self._task_name,
|
||||
api.Session["AVALON_PROJECT"]
|
||||
legacy_io.Session["AVALON_PROJECT"]
|
||||
)
|
||||
# Trigger after save events
|
||||
emit_event(
|
||||
|
|
|
|||
|
|
@ -5,13 +5,14 @@ import logging
|
|||
|
||||
from Qt import QtWidgets, QtCore
|
||||
|
||||
from avalon import api, io
|
||||
|
||||
from openpype.lib import (
|
||||
get_last_workfile_with_version,
|
||||
get_workdir_data,
|
||||
)
|
||||
from openpype.pipeline import registered_host
|
||||
from openpype.pipeline import (
|
||||
registered_host,
|
||||
legacy_io,
|
||||
)
|
||||
from openpype.tools.utils import PlaceholderLineEdit
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
|
@ -24,7 +25,7 @@ def build_workfile_data(session):
|
|||
asset_name = session["AVALON_ASSET"]
|
||||
task_name = session["AVALON_TASK"]
|
||||
host_name = session["AVALON_APP"]
|
||||
project_doc = io.find_one(
|
||||
project_doc = legacy_io.find_one(
|
||||
{"type": "project"},
|
||||
{
|
||||
"name": True,
|
||||
|
|
@ -33,7 +34,7 @@ def build_workfile_data(session):
|
|||
}
|
||||
)
|
||||
|
||||
asset_doc = io.find_one(
|
||||
asset_doc = legacy_io.find_one(
|
||||
{
|
||||
"type": "asset",
|
||||
"name": asset_name
|
||||
|
|
@ -208,7 +209,7 @@ class SaveAsDialog(QtWidgets.QDialog):
|
|||
|
||||
if not session:
|
||||
# Fallback to active session
|
||||
session = api.Session
|
||||
session = legacy_io.Session
|
||||
|
||||
self.data = build_workfile_data(session)
|
||||
|
||||
|
|
@ -283,7 +284,7 @@ class SaveAsDialog(QtWidgets.QDialog):
|
|||
if current_filepath:
|
||||
# We match the current filename against the current session
|
||||
# instead of the session where the user is saving to.
|
||||
current_data = build_workfile_data(api.Session)
|
||||
current_data = build_workfile_data(legacy_io.Session)
|
||||
matcher = CommentMatcher(anatomy, template_key, current_data)
|
||||
comment = matcher.parse_comment(current_filepath)
|
||||
if comment:
|
||||
|
|
|
|||
|
|
@ -2,14 +2,13 @@ import os
|
|||
import datetime
|
||||
from Qt import QtCore, QtWidgets
|
||||
|
||||
from avalon import io
|
||||
|
||||
from openpype import style
|
||||
from openpype.lib import (
|
||||
get_workfile_doc,
|
||||
create_workfile_doc,
|
||||
save_workfile_data_to_doc,
|
||||
)
|
||||
from openpype.pipeline import legacy_io
|
||||
from openpype.tools.utils.assets_widget import SingleSelectAssetsWidget
|
||||
from openpype.tools.utils.tasks_widget import TasksWidget
|
||||
|
||||
|
|
@ -158,10 +157,12 @@ class Window(QtWidgets.QMainWindow):
|
|||
home_page_widget = QtWidgets.QWidget(pages_widget)
|
||||
home_body_widget = QtWidgets.QWidget(home_page_widget)
|
||||
|
||||
assets_widget = SingleSelectAssetsWidget(io, parent=home_body_widget)
|
||||
assets_widget = SingleSelectAssetsWidget(
|
||||
legacy_io, parent=home_body_widget
|
||||
)
|
||||
assets_widget.set_current_asset_btn_visibility(True)
|
||||
|
||||
tasks_widget = TasksWidget(io, home_body_widget)
|
||||
tasks_widget = TasksWidget(legacy_io, home_body_widget)
|
||||
files_widget = FilesWidget(home_body_widget)
|
||||
side_panel = SidePanelWidget(home_body_widget)
|
||||
|
||||
|
|
@ -250,7 +251,7 @@ class Window(QtWidgets.QMainWindow):
|
|||
if asset_id and task_name and filepath:
|
||||
filename = os.path.split(filepath)[1]
|
||||
workfile_doc = get_workfile_doc(
|
||||
asset_id, task_name, filename, io
|
||||
asset_id, task_name, filename, legacy_io
|
||||
)
|
||||
self.side_panel.set_context(
|
||||
asset_id, task_name, filepath, workfile_doc
|
||||
|
|
@ -272,7 +273,7 @@ class Window(QtWidgets.QMainWindow):
|
|||
self._create_workfile_doc(filepath, force=True)
|
||||
workfile_doc = self._get_current_workfile_doc()
|
||||
|
||||
save_workfile_data_to_doc(workfile_doc, data, io)
|
||||
save_workfile_data_to_doc(workfile_doc, data, legacy_io)
|
||||
|
||||
def _get_current_workfile_doc(self, filepath=None):
|
||||
if filepath is None:
|
||||
|
|
@ -284,7 +285,7 @@ class Window(QtWidgets.QMainWindow):
|
|||
|
||||
filename = os.path.split(filepath)[1]
|
||||
return get_workfile_doc(
|
||||
asset_id, task_name, filename, io
|
||||
asset_id, task_name, filename, legacy_io
|
||||
)
|
||||
|
||||
def _create_workfile_doc(self, filepath, force=False):
|
||||
|
|
@ -295,9 +296,11 @@ class Window(QtWidgets.QMainWindow):
|
|||
if not workfile_doc:
|
||||
workdir, filename = os.path.split(filepath)
|
||||
asset_id = self.assets_widget.get_selected_asset_id()
|
||||
asset_doc = io.find_one({"_id": asset_id})
|
||||
asset_doc = legacy_io.find_one({"_id": asset_id})
|
||||
task_name = self.tasks_widget.get_selected_task_name()
|
||||
create_workfile_doc(asset_doc, task_name, filename, workdir, io)
|
||||
create_workfile_doc(
|
||||
asset_doc, task_name, filename, workdir, legacy_io
|
||||
)
|
||||
|
||||
def refresh(self):
|
||||
# Refresh asset widget
|
||||
|
|
@ -319,7 +322,7 @@ class Window(QtWidgets.QMainWindow):
|
|||
|
||||
self._context_to_set, context = None, self._context_to_set
|
||||
if "asset" in context:
|
||||
asset_doc = io.find_one(
|
||||
asset_doc = legacy_io.find_one(
|
||||
{
|
||||
"name": context["asset"],
|
||||
"type": "asset"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue