Merge pull request #2918 from pypeclub/enhancement/OP-2949_move-pipeline-constants

General: Move pipeline constants to OpenPype
This commit is contained in:
Jakub Trllo 2022-03-22 16:10:49 +01:00 committed by GitHub
commit 83fd67eb8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
68 changed files with 229 additions and 133 deletions

View file

@ -2,6 +2,7 @@ from collections import defaultdict
import logging
import os
from bson.objectid import ObjectId
import maya.cmds as cmds
from avalon import io, api
@ -157,7 +158,7 @@ def create_items_from_nodes(nodes):
return asset_view_items
for _id, id_nodes in id_hashes.items():
asset = io.find_one({"_id": io.ObjectId(_id)},
asset = io.find_one({"_id": ObjectId(_id)},
projection={"name": True})
# Skip if asset id is not found

View file

@ -6,6 +6,7 @@ import logging
import json
import six
from bson.objectid import ObjectId
import alembic.Abc
from maya import cmds
@ -231,7 +232,7 @@ def get_latest_version(asset_id, subset):
"""
subset = io.find_one({"name": subset,
"parent": io.ObjectId(asset_id),
"parent": ObjectId(asset_id),
"type": "subset"})
if not subset:
raise RuntimeError("Subset does not exist: %s" % subset)

View file

@ -5,6 +5,7 @@ from collections import defaultdict
from Qt import QtCore, QtGui
import qtawesome
from bson.objectid import ObjectId
from avalon import api, io, schema
from openpype.pipeline import HeroVersionType
@ -299,7 +300,7 @@ 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": io.ObjectId(repre_id)})
representation = io.find_one({"_id": ObjectId(repre_id)})
if not representation:
not_found["representation"].append(group_items)
not_found_ids.append(repre_id)

View file

@ -2,6 +2,7 @@ import collections
import logging
from Qt import QtWidgets, QtCore
import qtawesome
from bson.objectid import ObjectId
from avalon import io, pipeline
from openpype.pipeline import (
@ -146,7 +147,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
repre_ids = set()
content_loaders = set()
for item in self._items:
repre_ids.add(io.ObjectId(item["representation"]))
repre_ids.add(ObjectId(item["representation"]))
content_loaders.add(item["loader"])
repres = list(io.find({
@ -1306,7 +1307,7 @@ class SwitchAssetDialog(QtWidgets.QDialog):
repre_docs_by_parent_id_by_name[parent_id][name] = repre_doc
for container in self._items:
container_repre_id = io.ObjectId(container["representation"])
container_repre_id = ObjectId(container["representation"])
container_repre = self.content_repres[container_repre_id]
container_repre_name = container_repre["name"]

View file

@ -4,6 +4,7 @@ from functools import partial
from Qt import QtWidgets, QtCore
import qtawesome
from bson.objectid import ObjectId
from avalon import io, api
@ -78,7 +79,7 @@ class SceneInventoryView(QtWidgets.QTreeView):
repre_ids = []
for item in items:
item_id = io.ObjectId(item["representation"])
item_id = ObjectId(item["representation"])
if item_id not in repre_ids:
repre_ids.append(item_id)
@ -145,7 +146,7 @@ class SceneInventoryView(QtWidgets.QTreeView):
def _on_switch_to_versioned(items):
repre_ids = []
for item in items:
item_id = io.ObjectId(item["representation"])
item_id = ObjectId(item["representation"])
if item_id not in repre_ids:
repre_ids.append(item_id)
@ -195,7 +196,7 @@ class SceneInventoryView(QtWidgets.QTreeView):
version_doc["name"]
for item in items:
repre_id = io.ObjectId(item["representation"])
repre_id = ObjectId(item["representation"])
version_id = version_id_by_repre_id.get(repre_id)
version_name = version_name_by_id.get(version_id)
if version_name is not None:
@ -658,7 +659,7 @@ class SceneInventoryView(QtWidgets.QTreeView):
active = items[-1]
# Get available versions for active representation
representation_id = io.ObjectId(active["representation"])
representation_id = ObjectId(active["representation"])
representation = io.find_one({"_id": representation_id})
version = io.find_one({
"_id": representation["parent"]