mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
removed silo references
This commit is contained in:
parent
22f1a30710
commit
5e5fc4ec55
12 changed files with 10 additions and 80 deletions
|
|
@ -308,7 +308,6 @@ class ContextDialog(QtWidgets.QDialog):
|
|||
self._validate_strict()
|
||||
|
||||
def _set_asset_to_tasks_widget(self):
|
||||
# filter None docs they are silo
|
||||
asset_id = self._assets_widget.get_selected_asset_id()
|
||||
|
||||
self._tasks_widget.set_asset_id(asset_id)
|
||||
|
|
|
|||
|
|
@ -1,19 +1,3 @@
|
|||
"""Utility script for updating database with configuration files
|
||||
|
||||
Until assets are created entirely in the database, this script
|
||||
provides a bridge between the file-based project inventory and configuration.
|
||||
|
||||
- Migrating an old project:
|
||||
$ python -m avalon.inventory --extract --silo-parent=f02_prod
|
||||
$ python -m avalon.inventory --upload
|
||||
|
||||
- Managing an existing project:
|
||||
1. Run `python -m avalon.inventory --load`
|
||||
2. Update the .inventory.toml or .config.toml
|
||||
3. Run `python -m avalon.inventory --save`
|
||||
|
||||
"""
|
||||
|
||||
import os
|
||||
from Qt import QtGui
|
||||
import qtawesome
|
||||
|
|
|
|||
|
|
@ -290,7 +290,6 @@ class LoaderWindow(QtWidgets.QDialog):
|
|||
subsets_model.clear()
|
||||
self.clear_assets_underlines()
|
||||
|
||||
# filter None docs they are silo
|
||||
asset_ids = self._assets_widget.get_selected_asset_ids()
|
||||
# Start loading
|
||||
subsets_widget.set_loading_state(
|
||||
|
|
@ -381,17 +380,9 @@ class LoaderWindow(QtWidgets.QDialog):
|
|||
|
||||
The context must contain `asset` data by name.
|
||||
|
||||
Note: Prior to setting context ensure `refresh` is triggered so that
|
||||
the "silos" are listed correctly, aside from that setting the
|
||||
context will force a refresh further down because it changes
|
||||
the active silo and asset.
|
||||
|
||||
Args:
|
||||
context (dict): The context to apply.
|
||||
|
||||
Returns:
|
||||
None
|
||||
|
||||
refrest (bool): Trigger refresh on context set.
|
||||
"""
|
||||
|
||||
asset = context.get("asset", None)
|
||||
|
|
@ -399,12 +390,6 @@ class LoaderWindow(QtWidgets.QDialog):
|
|||
return
|
||||
|
||||
if refresh:
|
||||
# Workaround:
|
||||
# Force a direct (non-scheduled) refresh prior to setting the
|
||||
# asset widget's silo and asset selection to ensure it's correctly
|
||||
# displaying the silo tabs. Calling `window.refresh()` and directly
|
||||
# `window.set_context()` the `set_context()` seems to override the
|
||||
# scheduled refresh and the silo tabs are not shown.
|
||||
self._refresh()
|
||||
|
||||
self._assets_widget.select_asset_by_name(asset)
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ def _iter_model_rows(model,
|
|||
|
||||
|
||||
class AssetModel(TreeModel):
|
||||
"""A model listing assets in the silo in the active project.
|
||||
"""A model listing assets in the active project.
|
||||
|
||||
The assets are displayed in a treeview, they are visually parented by
|
||||
a `visualParent` field in the database containing an `_id` to a parent
|
||||
|
|
@ -64,7 +64,7 @@ class AssetModel(TreeModel):
|
|||
|
||||
self.refresh()
|
||||
|
||||
def _add_hierarchy(self, assets, parent=None, silos=None):
|
||||
def _add_hierarchy(self, assets, parent=None):
|
||||
"""Add the assets that are related to the parent as children items.
|
||||
|
||||
This method does *not* query the database. These instead are queried
|
||||
|
|
@ -72,27 +72,8 @@ class AssetModel(TreeModel):
|
|||
queries. Resulting in up to 10x speed increase.
|
||||
|
||||
Args:
|
||||
assets (dict): All assets in the currently active silo stored
|
||||
by key/value
|
||||
|
||||
Returns:
|
||||
None
|
||||
|
||||
assets (dict): All assets from current project.
|
||||
"""
|
||||
if silos:
|
||||
# WARNING: Silo item "_id" is set to silo value
|
||||
# mainly because GUI issue with preserve selection and expanded row
|
||||
# and because of easier hierarchy parenting (in "assets")
|
||||
for silo in silos:
|
||||
node = Node({
|
||||
"_id": silo,
|
||||
"name": silo,
|
||||
"label": silo,
|
||||
"type": "silo"
|
||||
})
|
||||
self.add_child(node, parent=parent)
|
||||
self._add_hierarchy(assets, parent=node)
|
||||
|
||||
parent_id = parent["_id"] if parent else None
|
||||
current_assets = assets.get(parent_id, list())
|
||||
|
||||
|
|
@ -132,27 +113,19 @@ class AssetModel(TreeModel):
|
|||
|
||||
self.beginResetModel()
|
||||
|
||||
# Get all assets in current silo sorted by name
|
||||
# Get all assets in current project sorted by name
|
||||
db_assets = self.dbcon.find({"type": "asset"}).sort("name", 1)
|
||||
silos = db_assets.distinct("silo") or None
|
||||
# if any silo is set to None then it's expected it should not be used
|
||||
if silos and None in silos:
|
||||
silos = None
|
||||
|
||||
# Group the assets by their visual parent's id
|
||||
assets_by_parent = collections.defaultdict(list)
|
||||
for asset in db_assets:
|
||||
parent_id = (
|
||||
asset.get("data", {}).get("visualParent") or
|
||||
asset.get("silo")
|
||||
)
|
||||
parent_id = asset.get("data", {}).get("visualParent")
|
||||
assets_by_parent[parent_id].append(asset)
|
||||
|
||||
# Build the hierarchical tree items recursively
|
||||
self._add_hierarchy(
|
||||
assets_by_parent,
|
||||
parent=None,
|
||||
silos=silos
|
||||
parent=None
|
||||
)
|
||||
|
||||
self.endResetModel()
|
||||
|
|
@ -173,9 +146,7 @@ class AssetModel(TreeModel):
|
|||
|
||||
# Allow a custom icon and custom icon color to be defined
|
||||
data = node.get("_document", {}).get("data", {})
|
||||
icon = data.get("icon", None)
|
||||
if icon is None and node.get("type") == "silo":
|
||||
icon = "database"
|
||||
icon = data.get("icon", None)
|
||||
color = data.get("color", self._default_asset_icon_color)
|
||||
|
||||
if icon is None:
|
||||
|
|
|
|||
|
|
@ -229,7 +229,6 @@ class AssetWidget(QtWidgets.QWidget):
|
|||
data = {
|
||||
'project': project['name'],
|
||||
'asset': asset['name'],
|
||||
'silo': asset.get("silo"),
|
||||
'parents': self.get_parents(asset),
|
||||
'task': task
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,6 @@ class TextureCopy:
|
|||
"name": project_name,
|
||||
"code": project['data']['code']
|
||||
},
|
||||
"silo": asset.get('silo'),
|
||||
"asset": asset['name'],
|
||||
"family": 'texture',
|
||||
"subset": 'Main',
|
||||
|
|
@ -155,7 +154,6 @@ def texture_copy(asset, project, path):
|
|||
t.echo(">>> Initializing avalon session ...")
|
||||
os.environ["AVALON_PROJECT"] = project
|
||||
os.environ["AVALON_ASSET"] = asset
|
||||
os.environ["AVALON_SILO"] = ""
|
||||
TextureCopy().process(asset, project, path)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1266,7 +1266,6 @@ def show(root=None, debug=False, parent=None, use_context=True, save=True):
|
|||
if use_context:
|
||||
context = {
|
||||
"asset": api.Session["AVALON_ASSET"],
|
||||
"silo": api.Session["AVALON_SILO"],
|
||||
"task": api.Session["AVALON_TASK"]
|
||||
}
|
||||
window.set_context(context)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue