Merge branch 'bugfix/task_data_with_correct_short_key' into feature/OP-1566_Flame-Create-Batch-Group

This commit is contained in:
Jakub Jezek 2022-03-24 14:56:40 +01:00
commit c57765dd62
No known key found for this signature in database
GPG key ID: D8548FBF690B100A
117 changed files with 2835 additions and 2159 deletions

View file

@ -78,6 +78,7 @@ def install():
from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
register_inventory_action,
)
from avalon import pipeline
@ -124,7 +125,7 @@ def install():
pyblish.register_plugin_path(path)
register_loader_plugin_path(path)
avalon.register_plugin_path(LegacyCreator, path)
avalon.register_plugin_path(avalon.InventoryAction, path)
register_inventory_action(path)
# apply monkey patched discover to original one
log.info("Patching discovery")

View file

@ -2,10 +2,11 @@ import os
import sys
from Qt import QtWidgets
from bson.objectid import ObjectId
import pyblish.api
import avalon.api
from avalon import io, pipeline
from avalon import io
from openpype import lib
from openpype.api import Logger
@ -13,6 +14,7 @@ from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
deregister_loader_plugin_path,
AVALON_CONTAINER_ID,
)
import openpype.hosts.aftereffects
from openpype.lib import register_event_callback
@ -29,7 +31,6 @@ PLUGINS_DIR = os.path.join(HOST_DIR, "plugins")
PUBLISH_PATH = os.path.join(PLUGINS_DIR, "publish")
LOAD_PATH = os.path.join(PLUGINS_DIR, "load")
CREATE_PATH = os.path.join(PLUGINS_DIR, "create")
INVENTORY_PATH = os.path.join(PLUGINS_DIR, "inventory")
def check_inventory():
@ -42,7 +43,7 @@ def check_inventory():
representation = container['representation']
representation_doc = io.find_one(
{
"_id": io.ObjectId(representation),
"_id": ObjectId(representation),
"type": "representation"
},
projection={"parent": True}
@ -149,7 +150,7 @@ def containerise(name,
"""
data = {
"schema": "openpype:container-2.0",
"id": pipeline.AVALON_CONTAINER_ID,
"id": AVALON_CONTAINER_ID,
"name": name,
"namespace": namespace,
"loader": str(loader),

View file

@ -1,8 +1,8 @@
"""Host API required Work Files tool"""
import os
from openpype.pipeline import HOST_WORKFILE_EXTENSIONS
from .launch_logic import get_stub
from avalon import api
def _active_document():
@ -14,7 +14,7 @@ def _active_document():
def file_extensions():
return api.HOST_WORKFILE_EXTENSIONS["aftereffects"]
return HOST_WORKFILE_EXTENSIONS["aftereffects"]
def has_unsaved_changes():

View file

@ -328,7 +328,6 @@ class LaunchWorkFiles(LaunchQtApp):
result = super().execute(context)
self._window.set_context({
"asset": avalon.api.Session["AVALON_ASSET"],
"silo": avalon.api.Session["AVALON_SILO"],
"task": avalon.api.Session["AVALON_TASK"]
})
return result

View file

@ -12,12 +12,12 @@ from . import ops
import pyblish.api
import avalon.api
from avalon import io, schema
from avalon.pipeline import AVALON_CONTAINER_ID
from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
deregister_loader_plugin_path,
AVALON_CONTAINER_ID,
)
from openpype.api import Logger
from openpype.lib import (
@ -31,7 +31,6 @@ PLUGINS_DIR = os.path.join(HOST_DIR, "plugins")
PUBLISH_PATH = os.path.join(PLUGINS_DIR, "publish")
LOAD_PATH = os.path.join(PLUGINS_DIR, "load")
CREATE_PATH = os.path.join(PLUGINS_DIR, "create")
INVENTORY_PATH = os.path.join(PLUGINS_DIR, "inventory")
ORIGINAL_EXCEPTHOOK = sys.excepthook

View file

@ -4,7 +4,8 @@ from pathlib import Path
from typing import List, Optional
import bpy
from avalon import api
from openpype.pipeline import HOST_WORKFILE_EXTENSIONS
class OpenFileCacher:
@ -77,7 +78,7 @@ def has_unsaved_changes() -> bool:
def file_extensions() -> List[str]:
"""Return the supported file extensions for Blender scene files."""
return api.HOST_WORKFILE_EXTENSIONS["blender"]
return HOST_WORKFILE_EXTENSIONS["blender"]
def work_root(session: dict) -> str:

View file

@ -6,11 +6,14 @@ from typing import Dict, List, Optional
import bpy
from openpype.pipeline import get_representation_path
from openpype.pipeline import (
get_representation_path,
AVALON_CONTAINER_ID,
)
from openpype.hosts.blender.api.pipeline import (
AVALON_CONTAINERS,
AVALON_PROPERTY,
AVALON_CONTAINER_ID
)
from openpype.hosts.blender.api import plugin, lib

View file

@ -6,12 +6,14 @@ from typing import Dict, List, Optional
import bpy
from openpype.pipeline import get_representation_path
from openpype.pipeline import (
get_representation_path,
AVALON_CONTAINER_ID,
)
from openpype.hosts.blender.api import plugin
from openpype.hosts.blender.api.pipeline import (
AVALON_CONTAINERS,
AVALON_PROPERTY,
AVALON_CONTAINER_ID
)

View file

@ -7,12 +7,14 @@ from typing import Dict, List, Optional
import bpy
from openpype.pipeline import get_representation_path
from openpype.pipeline import (
get_representation_path,
AVALON_CONTAINER_ID,
)
from openpype.hosts.blender.api import plugin
from openpype.hosts.blender.api.pipeline import (
AVALON_CONTAINERS,
AVALON_PROPERTY,
AVALON_CONTAINER_ID
)
logger = logging.getLogger("openpype").getChild(

View file

@ -6,12 +6,14 @@ from typing import Dict, List, Optional
import bpy
from openpype.pipeline import get_representation_path
from openpype.pipeline import (
get_representation_path,
AVALON_CONTAINER_ID,
)
from openpype.hosts.blender.api import plugin, lib
from openpype.hosts.blender.api.pipeline import (
AVALON_CONTAINERS,
AVALON_PROPERTY,
AVALON_CONTAINER_ID
)

View file

@ -6,12 +6,14 @@ from typing import Dict, List, Optional
import bpy
from openpype.pipeline import get_representation_path
from openpype.pipeline import (
get_representation_path,
AVALON_CONTAINER_ID,
)
from openpype.hosts.blender.api import plugin, lib
from openpype.hosts.blender.api.pipeline import (
AVALON_CONTAINERS,
AVALON_PROPERTY,
AVALON_CONTAINER_ID
)

View file

@ -10,12 +10,12 @@ from openpype import lib
from openpype.pipeline import (
legacy_create,
get_representation_path,
AVALON_CONTAINER_ID,
)
from openpype.hosts.blender.api import plugin
from openpype.hosts.blender.api.pipeline import (
AVALON_CONTAINERS,
AVALON_PROPERTY,
AVALON_CONTAINER_ID
)

View file

@ -13,12 +13,12 @@ from openpype.pipeline import (
load_container,
get_representation_path,
loaders_from_representation,
AVALON_CONTAINER_ID,
)
from openpype.hosts.blender.api.pipeline import (
AVALON_INSTANCES,
AVALON_CONTAINERS,
AVALON_PROPERTY,
AVALON_CONTAINER_ID
)
from openpype.hosts.blender.api import plugin

View file

@ -6,12 +6,14 @@ from typing import Dict, List, Optional
import bpy
from openpype.pipeline import get_representation_path
from openpype.pipeline import (
get_representation_path,
AVALON_CONTAINER_ID,
)
from openpype.hosts.blender.api import plugin
from openpype.hosts.blender.api.pipeline import (
AVALON_CONTAINERS,
AVALON_PROPERTY,
AVALON_CONTAINER_ID
)

View file

@ -10,6 +10,7 @@ from openpype import lib
from openpype.pipeline import (
legacy_create,
get_representation_path,
AVALON_CONTAINER_ID,
)
from openpype.hosts.blender.api import (
plugin,
@ -18,7 +19,6 @@ from openpype.hosts.blender.api import (
from openpype.hosts.blender.api.pipeline import (
AVALON_CONTAINERS,
AVALON_PROPERTY,
AVALON_CONTAINER_ID
)

View file

@ -1,6 +1,8 @@
import os
import json
from bson.objectid import ObjectId
import bpy
import bpy_extras
import bpy_extras.anim_utils
@ -140,7 +142,7 @@ class ExtractLayout(openpype.api.Extractor):
blend = io.find_one(
{
"type": "representation",
"parent": io.ObjectId(parent),
"parent": ObjectId(parent),
"name": "blend"
},
projection={"_id": True})
@ -151,7 +153,7 @@ class ExtractLayout(openpype.api.Extractor):
fbx = io.find_one(
{
"type": "representation",
"parent": io.ObjectId(parent),
"parent": ObjectId(parent),
"name": "fbx"
},
projection={"_id": True})
@ -162,7 +164,7 @@ class ExtractLayout(openpype.api.Extractor):
abc = io.find_one(
{
"type": "representation",
"parent": io.ObjectId(parent),
"parent": ObjectId(parent),
"name": "abc"
},
projection={"_id": True})

View file

@ -4,13 +4,14 @@ Basic avalon integration
import os
import contextlib
from avalon import api as avalon
from avalon.pipeline import AVALON_CONTAINER_ID
from pyblish import api as pyblish
from openpype.api import Logger
from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
deregister_loader_plugin_path,
AVALON_CONTAINER_ID,
)
from .lib import (
set_segment_data_marker,
@ -26,7 +27,6 @@ PLUGINS_DIR = os.path.join(HOST_DIR, "plugins")
PUBLISH_PATH = os.path.join(PLUGINS_DIR, "publish")
LOAD_PATH = os.path.join(PLUGINS_DIR, "load")
CREATE_PATH = os.path.join(PLUGINS_DIR, "create")
INVENTORY_PATH = os.path.join(PLUGINS_DIR, "inventory")
AVALON_CONTAINERS = "AVALON_CONTAINERS"
@ -34,12 +34,10 @@ log = Logger.get_logger(__name__)
def install():
pyblish.register_host("flame")
pyblish.register_plugin_path(PUBLISH_PATH)
register_loader_plugin_path(LOAD_PATH)
avalon.register_plugin_path(LegacyCreator, CREATE_PATH)
avalon.register_plugin_path(avalon.InventoryAction, INVENTORY_PATH)
log.info("OpenPype Flame plug-ins registred ...")
# register callback for switching publishable
@ -47,6 +45,7 @@ def install():
log.info("OpenPype Flame host installed ...")
def uninstall():
pyblish.deregister_host("flame")
@ -54,7 +53,6 @@ def uninstall():
pyblish.deregister_plugin_path(PUBLISH_PATH)
deregister_loader_plugin_path(LOAD_PATH)
avalon.deregister_plugin_path(LegacyCreator, CREATE_PATH)
avalon.deregister_plugin_path(avalon.InventoryAction, INVENTORY_PATH)
# register callback for switching publishable
pyblish.deregister_callback("instanceToggled", on_pyblish_instance_toggled)

View file

@ -3,6 +3,7 @@ import sys
import re
import contextlib
from bson.objectid import ObjectId
from Qt import QtGui
from avalon import io
@ -92,7 +93,7 @@ def switch_item(container,
# Collect any of current asset, subset and representation if not provided
# so we can use the original name from those.
if any(not x for x in [asset_name, subset_name, representation_name]):
_id = io.ObjectId(container["representation"])
_id = ObjectId(container["representation"])
representation = io.find_one({"type": "representation", "_id": _id})
version, subset, asset, project = io.parenthood(representation)

View file

@ -8,13 +8,15 @@ import contextlib
import pyblish.api
import avalon.api
from avalon.pipeline import AVALON_CONTAINER_ID
from openpype.api import Logger
from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
deregister_loader_plugin_path,
register_inventory_action_path,
deregister_inventory_action_path,
AVALON_CONTAINER_ID,
)
import openpype.hosts.fusion
@ -69,7 +71,7 @@ def install():
register_loader_plugin_path(LOAD_PATH)
avalon.api.register_plugin_path(LegacyCreator, CREATE_PATH)
avalon.api.register_plugin_path(avalon.api.InventoryAction, INVENTORY_PATH)
register_inventory_action_path(INVENTORY_PATH)
pyblish.api.register_callback(
"instanceToggled", on_pyblish_instance_toggled
@ -93,9 +95,7 @@ def uninstall():
deregister_loader_plugin_path(LOAD_PATH)
avalon.api.deregister_plugin_path(LegacyCreator, CREATE_PATH)
avalon.api.deregister_plugin_path(
avalon.api.InventoryAction, INVENTORY_PATH
)
deregister_inventory_action_path(INVENTORY_PATH)
pyblish.api.deregister_callback(
"instanceToggled", on_pyblish_instance_toggled

View file

@ -1,12 +1,14 @@
"""Host API required Work Files tool"""
import sys
import os
from avalon import api
from openpype.pipeline import HOST_WORKFILE_EXTENSIONS
from .pipeline import get_current_comp
def file_extensions():
return api.HOST_WORKFILE_EXTENSIONS["fusion"]
return HOST_WORKFILE_EXTENSIONS["fusion"]
def has_unsaved_changes():

View file

@ -1,7 +1,7 @@
from avalon import api
from openpype.pipeline import InventoryAction
class FusionSelectContainers(api.InventoryAction):
class FusionSelectContainers(InventoryAction):
label = "Select Containers"
icon = "mouse-pointer"

View file

@ -1,6 +1,6 @@
from avalon import api
from Qt import QtGui, QtWidgets
from openpype.pipeline import InventoryAction
from openpype import style
from openpype.hosts.fusion.api import (
get_current_comp,
@ -8,7 +8,7 @@ from openpype.hosts.fusion.api import (
)
class FusionSetToolColor(api.InventoryAction):
class FusionSetToolColor(InventoryAction):
"""Update the color of the selected tools"""
label = "Set Tool Color"

View file

@ -2,11 +2,11 @@ import os
from pathlib import Path
import logging
from bson.objectid import ObjectId
import pyblish.api
from avalon import io
import avalon.api
from avalon.pipeline import AVALON_CONTAINER_ID
from openpype import lib
from openpype.lib import register_event_callback
@ -14,6 +14,7 @@ from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
deregister_loader_plugin_path,
AVALON_CONTAINER_ID,
)
import openpype.hosts.harmony
import openpype.hosts.harmony.api as harmony
@ -113,7 +114,7 @@ def check_inventory():
representation = container['representation']
representation_doc = io.find_one(
{
"_id": io.ObjectId(representation),
"_id": ObjectId(representation),
"type": "representation"
},
projection={"parent": True}

View file

@ -2,20 +2,21 @@
import os
import shutil
from openpype.pipeline import HOST_WORKFILE_EXTENSIONS
from .lib import (
ProcessContext,
get_local_harmony_path,
zip_and_move,
launch_zip_file
)
from avalon import api
# used to lock saving until previous save is done.
save_disabled = False
def file_extensions():
return api.HOST_WORKFILE_EXTENSIONS["harmony"]
return HOST_WORKFILE_EXTENSIONS["harmony"]
def has_unsaved_changes():

View file

@ -8,7 +8,10 @@ import platform
import ast
import shutil
import hiero
from Qt import QtWidgets
from bson.objectid import ObjectId
import avalon.api as avalon
import avalon.io
from openpype.api import (Logger, Anatomy, get_anatomy_settings)
@ -1006,7 +1009,7 @@ def check_inventory_versions():
# get representation from io
representation = io.find_one({
"type": "representation",
"_id": io.ObjectId(container["representation"])
"_id": ObjectId(container["representation"])
})
# Get start frame from version data

View file

@ -4,7 +4,7 @@ Basic avalon integration
import os
import contextlib
from collections import OrderedDict
from avalon.pipeline import AVALON_CONTAINER_ID
from avalon import api as avalon
from avalon import schema
from pyblish import api as pyblish
@ -13,6 +13,7 @@ from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
deregister_loader_plugin_path,
AVALON_CONTAINER_ID,
)
from openpype.tools.utils import host_tools
from . import lib, menu, events
@ -28,7 +29,6 @@ PLUGINS_DIR = os.path.join(HOST_DIR, "plugins")
PUBLISH_PATH = os.path.join(PLUGINS_DIR, "publish").replace("\\", "/")
LOAD_PATH = os.path.join(PLUGINS_DIR, "load").replace("\\", "/")
CREATE_PATH = os.path.join(PLUGINS_DIR, "create").replace("\\", "/")
INVENTORY_PATH = os.path.join(PLUGINS_DIR, "inventory").replace("\\", "/")
AVALON_CONTAINERS = ":AVALON_CONTAINERS"
@ -51,7 +51,6 @@ def install():
pyblish.register_plugin_path(PUBLISH_PATH)
register_loader_plugin_path(LOAD_PATH)
avalon.register_plugin_path(LegacyCreator, CREATE_PATH)
avalon.register_plugin_path(avalon.InventoryAction, INVENTORY_PATH)
# register callback for switching publishable
pyblish.register_callback("instanceToggled", on_pyblish_instance_toggled)

View file

@ -1,14 +1,14 @@
import os
import hiero
from avalon import api
from openpype.api import Logger
from openpype.pipeline import HOST_WORKFILE_EXTENSIONS
log = Logger().get_logger(__name__)
log = Logger.get_logger(__name__)
def file_extensions():
return api.HOST_WORKFILE_EXTENSIONS["hiero"]
return HOST_WORKFILE_EXTENSIONS["hiero"]
def has_unsaved_changes():

View file

@ -8,12 +8,12 @@ import hdefereval
import pyblish.api
import avalon.api
from avalon.pipeline import AVALON_CONTAINER_ID
from avalon.lib import find_submodule
from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
AVALON_CONTAINER_ID,
)
import openpype.hosts.houdini
from openpype.hosts.houdini.api import lib

View file

@ -2,11 +2,11 @@
import os
import hou
from avalon import api
from openpype.pipeline import HOST_WORKFILE_EXTENSIONS
def file_extensions():
return api.HOST_WORKFILE_EXTENSIONS["houdini"]
return HOST_WORKFILE_EXTENSIONS["houdini"]
def has_unsaved_changes():

View file

@ -3,6 +3,7 @@ import os
from openpype.pipeline import (
load,
get_representation_path,
AVALON_CONTAINER_ID,
)
from openpype.hosts.houdini.api import lib, pipeline
@ -73,7 +74,7 @@ class ImageLoader(load.LoaderPlugin):
# Imprint it manually
data = {
"schema": "avalon-core:container-2.0",
"id": pipeline.AVALON_CONTAINER_ID,
"id": AVALON_CONTAINER_ID,
"name": node_name,
"namespace": namespace,
"loader": str(self.__class__.__name__),

View file

@ -1,8 +1,9 @@
from openpype.pipeline import (
load,
get_representation_path,
AVALON_CONTAINER_ID,
)
from openpype.hosts.houdini.api import lib, pipeline
from openpype.hosts.houdini.api import lib
class USDSublayerLoader(load.LoaderPlugin):
@ -43,7 +44,7 @@ class USDSublayerLoader(load.LoaderPlugin):
# Imprint it manually
data = {
"schema": "avalon-core:container-2.0",
"id": pipeline.AVALON_CONTAINER_ID,
"id": AVALON_CONTAINER_ID,
"name": node_name,
"namespace": namespace,
"loader": str(self.__class__.__name__),

View file

@ -1,8 +1,9 @@
from openpype.pipeline import (
load,
get_representation_path,
AVALON_CONTAINER_ID,
)
from openpype.hosts.houdini.api import lib, pipeline
from openpype.hosts.houdini.api import lib
class USDReferenceLoader(load.LoaderPlugin):
@ -43,7 +44,7 @@ class USDReferenceLoader(load.LoaderPlugin):
# Imprint it manually
data = {
"schema": "avalon-core:container-2.0",
"id": pipeline.AVALON_CONTAINER_ID,
"id": AVALON_CONTAINER_ID,
"name": node_name,
"namespace": namespace,
"loader": str(self.__class__.__name__),

View file

@ -145,7 +145,6 @@ class AvalonURIOutputProcessor(base.OutputProcessorBase):
path = self._template.format(**{
"root": root,
"project": PROJECT,
"silo": asset_doc["silo"],
"asset": asset_doc["name"],
"subset": subset,
"representation": ext,
@ -165,4 +164,3 @@ output_processor = AvalonURIOutputProcessor()
def usdOutputProcessor():
return output_processor

View file

@ -10,7 +10,6 @@ import pyblish.api
import avalon.api
from avalon.lib import find_submodule
from avalon.pipeline import AVALON_CONTAINER_ID
import openpype.hosts.maya
from openpype.tools.utils import host_tools
@ -23,7 +22,10 @@ from openpype.lib.path_tools import HostDirmap
from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
register_inventory_action_path,
deregister_loader_plugin_path,
deregister_inventory_action_path,
AVALON_CONTAINER_ID,
)
from openpype.hosts.maya.lib import copy_workspace_mel
from . import menu, lib
@ -59,7 +61,7 @@ def install():
register_loader_plugin_path(LOAD_PATH)
avalon.api.register_plugin_path(LegacyCreator, CREATE_PATH)
avalon.api.register_plugin_path(avalon.api.InventoryAction, INVENTORY_PATH)
register_inventory_action_path(INVENTORY_PATH)
log.info(PUBLISH_PATH)
log.info("Installing callbacks ... ")
@ -188,9 +190,7 @@ def uninstall():
deregister_loader_plugin_path(LOAD_PATH)
avalon.api.deregister_plugin_path(LegacyCreator, CREATE_PATH)
avalon.api.deregister_plugin_path(
avalon.api.InventoryAction, INVENTORY_PATH
)
deregister_inventory_action_path(INVENTORY_PATH)
menu.uninstall()

View file

@ -4,11 +4,11 @@ from maya import cmds
import qargparse
from avalon.pipeline import AVALON_CONTAINER_ID
from openpype.pipeline import (
LegacyCreator,
LoaderPlugin,
get_representation_path,
AVALON_CONTAINER_ID,
)
from .pipeline import containerise

View file

@ -6,6 +6,8 @@ import contextlib
import copy
import six
from bson.objectid import ObjectId
from maya import cmds
from avalon import io
@ -282,7 +284,7 @@ def update_package_version(container, version):
# Versioning (from `core.maya.pipeline`)
current_representation = io.find_one({
"_id": io.ObjectId(container["representation"])
"_id": ObjectId(container["representation"])
})
assert current_representation is not None, "This is a bug"
@ -327,7 +329,7 @@ def update_package(set_container, representation):
# Load the original package data
current_representation = io.find_one({
"_id": io.ObjectId(set_container['representation']),
"_id": ObjectId(set_container['representation']),
"type": "representation"
})
@ -478,10 +480,10 @@ def update_scene(set_container, containers, current_data, new_data, new_file):
# They *must* use the same asset, subset and Loader for
# `update_container` to make sense.
old = io.find_one({
"_id": io.ObjectId(representation_current)
"_id": ObjectId(representation_current)
})
new = io.find_one({
"_id": io.ObjectId(representation_new)
"_id": ObjectId(representation_new)
})
is_valid = compare_representations(old=old, new=new)
if not is_valid:

View file

@ -1,11 +1,12 @@
"""Host API required Work Files tool"""
import os
from maya import cmds
from avalon import api
from openpype.pipeline import HOST_WORKFILE_EXTENSIONS
def file_extensions():
return api.HOST_WORKFILE_EXTENSIONS["maya"]
return HOST_WORKFILE_EXTENSIONS["maya"]
def has_unsaved_changes():

View file

@ -1,6 +1,8 @@
import json
from avalon import api, io
from avalon import io
from bson.objectid import ObjectId
from openpype.pipeline import (
InventoryAction,
get_representation_context,
get_representation_path_from_context,
)
@ -10,7 +12,7 @@ from openpype.hosts.maya.api.lib import (
)
class ImportModelRender(api.InventoryAction):
class ImportModelRender(InventoryAction):
label = "Import Model Render Sets"
icon = "industry"
@ -39,7 +41,7 @@ class ImportModelRender(api.InventoryAction):
nodes.append(n)
repr_doc = io.find_one({
"_id": io.ObjectId(container["representation"]),
"_id": ObjectId(container["representation"]),
})
version_id = repr_doc["parent"]

View file

@ -1,11 +1,10 @@
from maya import cmds
from avalon import api
from openpype.pipeline import InventoryAction
from openpype.hosts.maya.api.plugin import get_reference_node
class ImportReference(api.InventoryAction):
class ImportReference(InventoryAction):
"""Imports selected reference to inside of the file."""
label = "Import Reference"

View file

@ -7,6 +7,8 @@ loader will use them instead of native vray vrmesh format.
"""
import os
from bson.objectid import ObjectId
import maya.cmds as cmds
from avalon import io
@ -186,7 +188,7 @@ class VRayProxyLoader(load.LoaderPlugin):
abc_rep = io.find_one(
{
"type": "representation",
"parent": io.ObjectId(version_id),
"parent": ObjectId(version_id),
"name": "abc"
})

View file

@ -6,7 +6,7 @@ from maya import cmds
import openpype.api
from openpype.hosts.maya.api.lib import maintained_selection
from avalon.pipeline import AVALON_CONTAINER_ID
from openpype.pipeline import AVALON_CONTAINER_ID
class ExtractMayaSceneRaw(openpype.api.Extractor):

View file

@ -1,6 +1,7 @@
import logging
import contextlib
import nuke
from bson.objectid import ObjectId
from avalon import api, io
@ -70,10 +71,10 @@ def get_handles(asset):
if "visualParent" in data:
vp = data["visualParent"]
if vp is not None:
parent_asset = io.find_one({"_id": io.ObjectId(vp)})
parent_asset = io.find_one({"_id": ObjectId(vp)})
if parent_asset is None:
parent_asset = io.find_one({"_id": io.ObjectId(asset["parent"])})
parent_asset = io.find_one({"_id": ObjectId(asset["parent"])})
if parent_asset is not None:
return get_handles(parent_asset)

View file

@ -6,10 +6,11 @@ import contextlib
from collections import OrderedDict
import clique
from bson.objectid import ObjectId
import nuke
from avalon import api, io, lib
from avalon import api, io
from openpype.api import (
Logger,
@ -20,7 +21,6 @@ from openpype.api import (
get_workdir_data,
get_asset,
get_current_project_settings,
ApplicationManager
)
from openpype.tools.utils import host_tools
from openpype.lib.path_tools import HostDirmap
@ -570,7 +570,7 @@ def check_inventory_versions():
# get representation from io
representation = io.find_one({
"type": "representation",
"_id": io.ObjectId(avalon_knob_data["representation"])
"_id": ObjectId(avalon_knob_data["representation"])
})
# Failsafe for not finding the representation.

View file

@ -6,7 +6,6 @@ import nuke
import pyblish.api
import avalon.api
from avalon import pipeline
import openpype
from openpype.api import (
@ -18,7 +17,10 @@ from openpype.lib import register_event_callback
from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
register_inventory_action_path,
deregister_loader_plugin_path,
deregister_inventory_action_path,
AVALON_CONTAINER_ID,
)
from openpype.tools.utils import host_tools
@ -105,7 +107,7 @@ def install():
pyblish.api.register_plugin_path(PUBLISH_PATH)
register_loader_plugin_path(LOAD_PATH)
avalon.api.register_plugin_path(LegacyCreator, CREATE_PATH)
avalon.api.register_plugin_path(avalon.api.InventoryAction, INVENTORY_PATH)
register_inventory_action_path(INVENTORY_PATH)
# Register Avalon event for workfiles loading.
register_event_callback("workio.open_file", check_inventory_versions)
@ -131,6 +133,7 @@ def uninstall():
pyblish.api.deregister_plugin_path(PUBLISH_PATH)
deregister_loader_plugin_path(LOAD_PATH)
avalon.api.deregister_plugin_path(LegacyCreator, CREATE_PATH)
deregister_inventory_action_path(INVENTORY_PATH)
pyblish.api.deregister_callback(
"instanceToggled", on_pyblish_instance_toggled)
@ -330,7 +333,7 @@ def containerise(node,
data = OrderedDict(
[
("schema", "openpype:container-2.0"),
("id", pipeline.AVALON_CONTAINER_ID),
("id", AVALON_CONTAINER_ID),
("name", name),
("namespace", namespace),
("loader", str(loader)),

View file

@ -1,11 +1,12 @@
"""Host API required Work Files tool"""
import os
import nuke
import avalon.api
from openpype.pipeline import HOST_WORKFILE_EXTENSIONS
def file_extensions():
return avalon.api.HOST_WORKFILE_EXTENSIONS["nuke"]
return HOST_WORKFILE_EXTENSIONS["nuke"]
def has_unsaved_changes():

View file

@ -1,9 +1,9 @@
from avalon import api
from openpype.api import Logger
from openpype.pipeline import InventoryAction
from openpype.hosts.nuke.api.lib import set_avalon_knob_data
class RepairOldLoaders(api.InventoryAction):
class RepairOldLoaders(InventoryAction):
label = "Repair Old Loaders"
icon = "gears"

View file

@ -1,8 +1,8 @@
from avalon import api
from openpype.pipeline import InventoryAction
from openpype.hosts.nuke.api.commands import viewer_update_and_undo_stop
class SelectContainers(api.InventoryAction):
class SelectContainers(InventoryAction):
label = "Select Containers"
icon = "mouse-pointer"

View file

@ -1,9 +1,10 @@
import os
from Qt import QtWidgets
from bson.objectid import ObjectId
import pyblish.api
import avalon.api
from avalon import pipeline, io
from avalon import io
from openpype.api import Logger
from openpype.lib import register_event_callback
@ -11,6 +12,7 @@ from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
deregister_loader_plugin_path,
AVALON_CONTAINER_ID,
)
import openpype.hosts.photoshop
@ -36,7 +38,7 @@ def check_inventory():
representation = container['representation']
representation_doc = io.find_one(
{
"_id": io.ObjectId(representation),
"_id": ObjectId(representation),
"type": "representation"
},
projection={"parent": True}
@ -221,7 +223,7 @@ def containerise(
data = {
"schema": "openpype:container-2.0",
"id": pipeline.AVALON_CONTAINER_ID,
"id": AVALON_CONTAINER_ID,
"name": name,
"namespace": namespace,
"loader": str(loader),

View file

@ -1,8 +1,7 @@
"""Host API required Work Files tool"""
import os
import avalon.api
from openpype.pipeline import HOST_WORKFILE_EXTENSIONS
from . import lib
@ -15,7 +14,7 @@ def _active_document():
def file_extensions():
return avalon.api.HOST_WORKFILE_EXTENSIONS["photoshop"]
return HOST_WORKFILE_EXTENSIONS["photoshop"]
def has_unsaved_changes():

View file

@ -6,13 +6,13 @@ import contextlib
from collections import OrderedDict
from avalon import api as avalon
from avalon import schema
from avalon.pipeline import AVALON_CONTAINER_ID
from pyblish import api as pyblish
from openpype.api import Logger
from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
deregister_loader_plugin_path,
AVALON_CONTAINER_ID,
)
from . import lib
from . import PLUGINS_DIR
@ -22,7 +22,6 @@ log = Logger().get_logger(__name__)
PUBLISH_PATH = os.path.join(PLUGINS_DIR, "publish")
LOAD_PATH = os.path.join(PLUGINS_DIR, "load")
CREATE_PATH = os.path.join(PLUGINS_DIR, "create")
INVENTORY_PATH = os.path.join(PLUGINS_DIR, "inventory")
AVALON_CONTAINERS = ":AVALON_CONTAINERS"
@ -48,7 +47,6 @@ def install():
register_loader_plugin_path(LOAD_PATH)
avalon.register_plugin_path(LegacyCreator, CREATE_PATH)
avalon.register_plugin_path(avalon.InventoryAction, INVENTORY_PATH)
# register callback for switching publishable
pyblish.register_callback("instanceToggled", on_pyblish_instance_toggled)
@ -73,7 +71,6 @@ def uninstall():
deregister_loader_plugin_path(LOAD_PATH)
avalon.deregister_plugin_path(LegacyCreator, CREATE_PATH)
avalon.deregister_plugin_path(avalon.InventoryAction, INVENTORY_PATH)
# register callback for switching publishable
pyblish.deregister_callback("instanceToggled", on_pyblish_instance_toggled)

View file

@ -1,10 +1,10 @@
from avalon import io
from openpype.lib import NumberDef
from openpype.hosts.testhost.api import pipeline
from openpype.pipeline import (
AutoCreator,
CreatedInstance,
lib
)
from avalon import io
class MyAutoCreator(AutoCreator):
@ -13,7 +13,7 @@ class MyAutoCreator(AutoCreator):
def get_instance_attr_defs(self):
output = [
lib.NumberDef("number_key", label="Number")
NumberDef("number_key", label="Number")
]
return output

View file

@ -1,10 +1,16 @@
import json
from openpype import resources
from openpype.hosts.testhost.api import pipeline
from openpype.lib import (
UISeparatorDef,
UILabelDef,
BoolDef,
NumberDef,
FileDef,
)
from openpype.pipeline import (
Creator,
CreatedInstance,
lib
)
@ -54,17 +60,17 @@ class TestCreatorOne(Creator):
def get_instance_attr_defs(self):
output = [
lib.NumberDef("number_key", label="Number"),
NumberDef("number_key", label="Number"),
]
return output
def get_pre_create_attr_defs(self):
output = [
lib.BoolDef("use_selection", label="Use selection"),
lib.UISeparatorDef(),
lib.UILabelDef("Testing label"),
lib.FileDef("filepath", folders=True, label="Filepath"),
lib.FileDef(
BoolDef("use_selection", label="Use selection"),
UISeparatorDef(),
UILabelDef("Testing label"),
FileDef("filepath", folders=True, label="Filepath"),
FileDef(
"filepath_2", multipath=True, folders=True, label="Filepath 2"
)
]

View file

@ -1,8 +1,8 @@
from openpype.lib import NumberDef, TextDef
from openpype.hosts.testhost.api import pipeline
from openpype.pipeline import (
Creator,
CreatedInstance,
lib
)
@ -40,8 +40,8 @@ class TestCreatorTwo(Creator):
def get_instance_attr_defs(self):
output = [
lib.NumberDef("number_key"),
lib.TextDef("text_key")
NumberDef("number_key"),
TextDef("text_key")
]
return output

View file

@ -1,10 +1,8 @@
import json
import pyblish.api
from openpype.pipeline import (
OpenPypePyblishPluginMixin,
attribute_definitions
)
from openpype.lib import attribute_definitions
from openpype.pipeline import OpenPypePyblishPluginMixin
class CollectInstanceOneTestHost(

View file

@ -10,7 +10,6 @@ import pyblish.api
import avalon.api
from avalon import io
from avalon.pipeline import AVALON_CONTAINER_ID
from openpype.hosts import tvpaint
from openpype.api import get_current_project_settings
@ -19,6 +18,7 @@ from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
deregister_loader_plugin_path,
AVALON_CONTAINER_ID,
)
from .lib import (

View file

@ -4,6 +4,7 @@
"""
from avalon import api
from openpype.pipeline import HOST_WORKFILE_EXTENSIONS
from .lib import (
execute_george,
execute_george_through_file
@ -47,7 +48,7 @@ def has_unsaved_changes():
def file_extensions():
"""Return the supported file extensions for Blender scene files."""
return api.HOST_WORKFILE_EXTENSIONS["tvpaint"]
return HOST_WORKFILE_EXTENSIONS["tvpaint"]
def work_root(session):

View file

@ -4,13 +4,13 @@ import logging
from typing import List
import pyblish.api
from avalon.pipeline import AVALON_CONTAINER_ID
from avalon import api
from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
deregister_loader_plugin_path,
AVALON_CONTAINER_ID,
)
from openpype.tools.utils import host_tools
import openpype.hosts.unreal

View file

@ -2,8 +2,10 @@
"""Loader for published alembics."""
import os
from avalon import pipeline
from openpype.pipeline import get_representation_path
from openpype.pipeline import (
get_representation_path,
AVALON_CONTAINER_ID
)
from openpype.hosts.unreal.api import plugin
from openpype.hosts.unreal.api import pipeline as unreal_pipeline
@ -117,7 +119,7 @@ class PointCacheAlembicLoader(plugin.Loader):
data = {
"schema": "openpype:container-2.0",
"id": pipeline.AVALON_CONTAINER_ID,
"id": AVALON_CONTAINER_ID,
"asset": asset,
"namespace": asset_dir,
"container_name": container_name,

View file

@ -2,8 +2,10 @@
"""Load Skeletal Mesh alembics."""
import os
from avalon import pipeline
from openpype.pipeline import get_representation_path
from openpype.pipeline import (
get_representation_path,
AVALON_CONTAINER_ID
)
from openpype.hosts.unreal.api import plugin
from openpype.hosts.unreal.api import pipeline as unreal_pipeline
import unreal # noqa
@ -81,7 +83,7 @@ class SkeletalMeshAlembicLoader(plugin.Loader):
data = {
"schema": "openpype:container-2.0",
"id": pipeline.AVALON_CONTAINER_ID,
"id": AVALON_CONTAINER_ID,
"asset": asset,
"namespace": asset_dir,
"container_name": container_name,

View file

@ -2,8 +2,10 @@
"""Loader for Static Mesh alembics."""
import os
from avalon import pipeline
from openpype.pipeline import get_representation_path
from openpype.pipeline import (
get_representation_path,
AVALON_CONTAINER_ID
)
from openpype.hosts.unreal.api import plugin
from openpype.hosts.unreal.api import pipeline as unreal_pipeline
import unreal # noqa
@ -100,7 +102,7 @@ class StaticMeshAlembicLoader(plugin.Loader):
data = {
"schema": "openpype:container-2.0",
"id": pipeline.AVALON_CONTAINER_ID,
"id": AVALON_CONTAINER_ID,
"asset": asset,
"namespace": asset_dir,
"container_name": container_name,

View file

@ -3,8 +3,10 @@
import os
import json
from avalon import pipeline
from openpype.pipeline import get_representation_path
from openpype.pipeline import (
get_representation_path,
AVALON_CONTAINER_ID
)
from openpype.hosts.unreal.api import plugin
from openpype.hosts.unreal.api import pipeline as unreal_pipeline
import unreal # noqa
@ -135,7 +137,7 @@ class AnimationFBXLoader(plugin.Loader):
data = {
"schema": "openpype:container-2.0",
"id": pipeline.AVALON_CONTAINER_ID,
"id": AVALON_CONTAINER_ID,
"asset": asset,
"namespace": asset_dir,
"container_name": container_name,

View file

@ -2,7 +2,8 @@
"""Load camera from FBX."""
import os
from avalon import io, pipeline
from avalon import io
from openpype.pipeline import AVALON_CONTAINER_ID
from openpype.hosts.unreal.api import plugin
from openpype.hosts.unreal.api import pipeline as unreal_pipeline
import unreal # noqa
@ -116,7 +117,7 @@ class CameraLoader(plugin.Loader):
data = {
"schema": "openpype:container-2.0",
"id": pipeline.AVALON_CONTAINER_ID,
"id": AVALON_CONTAINER_ID,
"asset": asset,
"namespace": asset_dir,
"container_name": container_name,

View file

@ -11,12 +11,12 @@ from unreal import AssetToolsHelpers
from unreal import FBXImportType
from unreal import MathLibrary as umath
from avalon.pipeline import AVALON_CONTAINER_ID
from openpype.pipeline import (
discover_loader_plugins,
loaders_from_representation,
load_container,
get_representation_path,
AVALON_CONTAINER_ID,
)
from openpype.hosts.unreal.api import plugin
from openpype.hosts.unreal.api import pipeline as unreal_pipeline

View file

@ -2,8 +2,10 @@
"""Load Skeletal Meshes form FBX."""
import os
from avalon import pipeline
from openpype.pipeline import get_representation_path
from openpype.pipeline import (
get_representation_path,
AVALON_CONTAINER_ID
)
from openpype.hosts.unreal.api import plugin
from openpype.hosts.unreal.api import pipeline as unreal_pipeline
import unreal # noqa
@ -101,7 +103,7 @@ class SkeletalMeshFBXLoader(plugin.Loader):
data = {
"schema": "openpype:container-2.0",
"id": pipeline.AVALON_CONTAINER_ID,
"id": AVALON_CONTAINER_ID,
"asset": asset,
"namespace": asset_dir,
"container_name": container_name,

View file

@ -2,8 +2,10 @@
"""Load Static meshes form FBX."""
import os
from avalon import pipeline
from openpype.pipeline import get_representation_path
from openpype.pipeline import (
get_representation_path,
AVALON_CONTAINER_ID
)
from openpype.hosts.unreal.api import plugin
from openpype.hosts.unreal.api import pipeline as unreal_pipeline
import unreal # noqa
@ -95,7 +97,7 @@ class StaticMeshFBXLoader(plugin.Loader):
data = {
"schema": "openpype:container-2.0",
"id": pipeline.AVALON_CONTAINER_ID,
"id": AVALON_CONTAINER_ID,
"asset": asset,
"namespace": asset_dir,
"container_name": container_name,

View file

@ -3,6 +3,8 @@ import os
import json
import math
from bson.objectid import ObjectId
import unreal
from unreal import EditorLevelLibrary as ell
from unreal import EditorAssetLibrary as eal
@ -62,7 +64,7 @@ class ExtractLayout(openpype.api.Extractor):
blend = io.find_one(
{
"type": "representation",
"parent": io.ObjectId(parent),
"parent": ObjectId(parent),
"name": "blend"
},
projection={"_id": True})

View file

@ -29,6 +29,21 @@ from .vendor_bin_utils import (
is_oiio_supported
)
from .attribute_definitions import (
AbtractAttrDef,
UIDef,
UISeparatorDef,
UILabelDef,
UnknownDef,
NumberDef,
TextDef,
EnumDef,
BoolDef,
FileDef,
)
from .env_tools import (
env_value_to_bool,
get_paths_from_environ,
@ -233,6 +248,19 @@ __all__ = [
"get_ffmpeg_tool_path",
"is_oiio_supported",
"AbtractAttrDef",
"UIDef",
"UISeparatorDef",
"UILabelDef",
"UnknownDef",
"NumberDef",
"TextDef",
"EnumDef",
"BoolDef",
"FileDef",
"import_filepath",
"modules_from_path",
"recursive_bases_from_class",

View file

@ -1545,6 +1545,7 @@ def _prepare_last_workfile(data, workdir):
workdir (str): Path to folder where workfiles should be stored.
"""
import avalon.api
from openpype.pipeline import HOST_WORKFILE_EXTENSIONS
log = data["log"]
@ -1593,7 +1594,7 @@ def _prepare_last_workfile(data, workdir):
# Last workfile path
last_workfile_path = data.get("last_workfile_path") or ""
if not last_workfile_path:
extensions = avalon.api.HOST_WORKFILE_EXTENSIONS.get(app.host_name)
extensions = HOST_WORKFILE_EXTENSIONS.get(app.host_name)
if extensions:
anatomy = data["anatomy"]
project_settings = data["project_settings"]

View file

@ -9,6 +9,8 @@ import collections
import functools
import getpass
from bson.objectid import ObjectId
from openpype.settings import (
get_project_settings,
get_system_settings
@ -169,7 +171,7 @@ def any_outdated():
representation_doc = avalon.io.find_one(
{
"_id": avalon.io.ObjectId(representation),
"_id": ObjectId(representation),
"type": "representation"
},
projection={"parent": True}
@ -1703,7 +1705,7 @@ def _get_task_context_data_for_anatomy(
"task": {
"name": task_name,
"type": task_type,
"short_name": project_task_type_data["short_name"]
"short": project_task_type_data["short_name"]
}
}

View file

@ -98,6 +98,10 @@ class PypeStreamHandler(logging.StreamHandler):
self.flush()
except (KeyboardInterrupt, SystemExit):
raise
except OSError:
self.handleError(record)
except Exception:
print(repr(record))
self.handleError(record)

View file

@ -1,413 +0,0 @@
*
.*
*
.*
*
.
*
.*
*
.
.
*
.*
.*
.*
*
.
.
*
.*
.*
.*
*
.
_.
/**
\ *
\*
*
*
.
__.
---*
\ \*
\ *
\*
*
.
\___.
/* *
\ \ *
\ \*
\ *
\*
.
|____.
/* *
\|\ *
\ \ *
\ \ *
\ \*
\/.
_/_____.
/* *
/ \ *
\ \ *
\ \ *
\ \__*
\/__.
__________.
--*-- ___*
\ \ \/_*
\ \ __*
\ \ \_*
\ \____\*
\/____/.
\____________ .
/* ___ \*
\ \ \/_\ *
\ \ _____*
\ \ \___/*
\ \____\ *
\/____/ .
|___________ .
/* ___ \ *
\|\ \/_\ \ *
\ \ _____/ *
\ \ \___/ *
\ \____\ / *
\/____/ \.
_/__________ .
/* ___ \ *
/ \ \/_\ \ *
\ \ _____/ *
\ \ \___/ ---*
\ \____\ / \__*
\/____/ \/__.
____________ .
--*-- ___ \ *
\ \ \/_\ \ *
\ \ _____/ *
\ \ \___/ ---- *
\ \____\ / \____\*
\/____/ \/____/.
____________
/\ ___ \ .
\ \ \/_\ \ *
\ \ _____/ *
\ \ \___/ ---- *
\ \____\ / \____\ .
\/____/ \/____/
____________
/\ ___ \
\ \ \/_\ \ .
\ \ _____/ *
\ \ \___/ ---- *
\ \____\ / \____\ .
\/____/ \/____/
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ .
\ \ \___/ ---- *
\ \____\ / \____\ .
\/____/ \/____/
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/
\ \ \___/ ---- *
\ \____\ / \____\
\/____/ \/____/
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/
\ \ \___/ ---- .
\ \____\ / \____\
\/____/ \/____/
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ _
\ \ \___/ ----
\ \____\ / \____\
\/____/ \/____/
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___
\ \ \___/ ----
\ \____\ / \____\
\/____/ \/____/
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___
\ \ \___/ ---- \
\ \____\ / \____\
\/____/ \/____/
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___
\ \ \___/ ---- \
\ \____\ / \____\ \
\/____/ \/____/
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___
\ \ \___/ ---- \
\ \____\ / \____\ __\
\/____/ \/____/
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___
\ \ \___/ ---- \
\ \____\ / \____\ \__\
\/____/ \/____/
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___
\ \ \___/ ---- \ \
\ \____\ / \____\ \__\
\/____/ \/____/
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___
\ \ \___/ ---- \ \
\ \____\ / \____\ \__\
\/____/ \/____/
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___.
\ \ \___/ ---- \ \\
\ \____\ / \____\ \__\,
\/____/ \/____/
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___ .
\ \ \___/ ---- \ \\
\ \____\ / \____\ \__\\,
\/____/ \/____/
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___ _.
\ \ \___/ ---- \ \\\
\ \____\ / \____\ \__\\\
\/____/ \/____/
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___ __.
\ \ \___/ ---- \ \\ \
\ \____\ / \____\ \__\\_/.
\/____/ \/____/
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___ ___.
\ \ \___/ ---- \ \\ \\
\ \____\ / \____\ \__\\__\.
\/____/ \/____/
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___ ___ .
\ \ \___/ ---- \ \\ \\
\ \____\ / \____\ \__\\__\\.
\/____/ \/____/
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___ ___ _.
\ \ \___/ ---- \ \\ \\\
\ \____\ / \____\ \__\\__\\.
\/____/ \/____/
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___ ___ __.
\ \ \___/ ---- \ \\ \\ \
\ \____\ / \____\ \__\\__\\_.
\/____/ \/____/
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___ ___ __.
\ \ \___/ ---- \ \\ \\ \
\ \____\ / \____\ \__\\__\\__.
\/____/ \/____/
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___ ___ ___
\ \ \___/ ---- \ \\ \\ \
\ \____\ / \____\ \__\\__\\__\
\/____/ \/____/ .
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___ ___ ___
\ \ \___/ ---- \ \\ \\ \
\ \____\ / \____\ \__\\__\\__\
\/____/ \/____/ *
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___ ___ ___
\ \ \___/ ---- \ \\ \\ \
\ \____\ / \____\ \__\\__\\__\
\/____/ \/____/ O*
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___ ___ ___
\ \ \___/ ---- \ \\ \\ \
\ \____\ / \____\ \__\\__\\__\
\/____/ \/____/ oO*
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___ ___ ___
\ \ \___/ ---- \ \\ \\ \
\ \____\ / \____\ \__\\__\\__\
\/____/ \/____/ .oO*
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___ ___ ___
\ \ \___/ ---- \ \\ \\ \
\ \____\ / \____\ \__\\__\\__\
\/____/ \/____/ ..oO*
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___ ___ ___
\ \ \___/ ---- \ \\ \\ \
\ \____\ / \____\ \__\\__\\__\
\/____/ \/____/ . .oO*
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___ ___ ___
\ \ \___/ ---- \ \\ \\ \
\ \____\ / \____\ \__\\__\\__\
\/____/ \/____/ . p.oO*
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___ ___ ___
\ \ \___/ ---- \ \\ \\ \
\ \____\ / \____\ \__\\__\\__\
\/____/ \/____/ . Py.oO*
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___ ___ ___
\ \ \___/ ---- \ \\ \\ \
\ \____\ / \____\ \__\\__\\__\
\/____/ \/____/ . PYp.oO*
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___ ___ ___
\ \ \___/ ---- \ \\ \\ \
\ \____\ / \____\ \__\\__\\__\
\/____/ \/____/ . PYPe.oO*
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___ ___ ___
\ \ \___/ ---- \ \\ \\ \
\ \____\ / \____\ \__\\__\\__\
\/____/ \/____/ . PYPE .oO*
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___ ___ ___
\ \ \___/ ---- \ \\ \\ \
\ \____\ / \____\ \__\\__\\__\
\/____/ \/____/ . PYPE c.oO*
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___ ___ ___
\ \ \___/ ---- \ \\ \\ \
\ \____\ / \____\ \__\\__\\__\
\/____/ \/____/ . PYPE C1.oO*
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___ ___ ___
\ \ \___/ ---- \ \\ \\ \
\ \____\ / \____\ \__\\__\\__\
\/____/ \/____/ . PYPE ClU.oO*
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___ ___ ___
\ \ \___/ ---- \ \\ \\ \
\ \____\ / \____\ \__\\__\\__\
\/____/ \/____/ . PYPE CluB.oO*
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___ ___ ___
\ \ \___/ ---- \ \\ \\ \
\ \____\ / \____\ \__\\__\\__\
\/____/ \/____/ . PYPE Club .oO*
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___ ___ ___
\ \ \___/ ---- \ \\ \\ \
\ \____\ / \____\ \__\\__\\__\
\/____/ \/____/ . PYPE Club . ..
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___ ___ ___
\ \ \___/ ---- \ \\ \\ \
\ \____\ / \____\ \__\\__\\__\
\/____/ \/____/ . PYPE Club . ..
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___ ___ ___
\ \ \___/ ---- \ \\ \\ \
\ \____\ / \____\ \__\\__\\__\
\/____/ \/____/ . PYPE Club . .
____________
/\ ___ \
\ \ \/_\ \
\ \ _____/ ___ ___ ___
\ \ \___/ ---- \ \\ \\ \
\ \____\ / \____\ \__\\__\\__\
\/____/ \/____/ . PYPE Club .

View file

@ -1,43 +0,0 @@
# -*- coding: utf-8 -*-
"""Pype terminal animation."""
import blessed
from pathlib import Path
from time import sleep
NO_TERMINAL = False
try:
term = blessed.Terminal()
except AttributeError:
# this happens when blessed cannot find proper terminal.
# If so, skip printing ascii art animation.
NO_TERMINAL = True
def play_animation():
"""Play ASCII art Pype animation."""
if NO_TERMINAL:
return
print(term.home + term.clear)
frame_size = 7
splash_file = Path(__file__).parent / "splash.txt"
with splash_file.open("r") as sf:
animation = sf.readlines()
animation_length = int(len(animation) / frame_size)
current_frame = 0
for _ in range(animation_length):
frame = "".join(
scanline
for y, scanline in enumerate(
animation[current_frame: current_frame + frame_size]
)
)
with term.location(0, 0):
# term.aquamarine3_bold(frame)
print(f"{term.bold}{term.aquamarine3}{frame}{term.normal}")
sleep(0.02)
current_frame += frame_size
print(term.move_y(7))

View file

@ -315,7 +315,7 @@ def get_usd_master_path(asset, subset, representation):
)
template = project["config"]["template"]["publish"]
if isinstance(asset, dict) and "silo" in asset and "name" in asset:
if isinstance(asset, dict) and "name" in asset:
# Allow explicitly passing asset document
asset_doc = asset
else:
@ -325,7 +325,6 @@ def get_usd_master_path(asset, subset, representation):
**{
"root": api.registered_root(),
"project": api.Session["AVALON_PROJECT"],
"silo": asset_doc["silo"],
"asset": asset_doc["name"],
"subset": subset,
"representation": representation,

View file

@ -210,6 +210,9 @@ class IntegrateSlackAPI(pyblish.api.InstancePlugin):
# You will get a SlackApiError if "ok" is False
error_str = self._enrich_error(str(e.response["error"]), channel)
self.log.warning("Error happened {}".format(error_str))
except Exception as e:
error_str = self._enrich_error(str(e), channel)
self.log.warning("Not SlackAPI error", exc_info=True)
return None, []

View file

@ -1,4 +1,7 @@
from .lib import attribute_definitions
from .constants import (
AVALON_CONTAINER_ID,
HOST_WORKFILE_EXTENSIONS,
)
from .create import (
BaseCreator,
@ -41,8 +44,27 @@ from .publish import (
OpenPypePyblishPluginMixin
)
from .actions import (
LauncherAction,
InventoryAction,
discover_launcher_actions,
register_launcher_action,
register_launcher_action_path,
discover_inventory_actions,
register_inventory_action,
register_inventory_action_path,
deregister_inventory_action,
deregister_inventory_action_path,
)
__all__ = (
"AVALON_CONTAINER_ID",
"HOST_WORKFILE_EXTENSIONS",
"attribute_definitions",
# --- Create ---
@ -82,5 +104,19 @@ __all__ = (
"PublishValidationError",
"PublishXmlValidationError",
"KnownPublishError",
"OpenPypePyblishPluginMixin"
"OpenPypePyblishPluginMixin",
# --- Actions ---
"LauncherAction",
"InventoryAction",
"discover_launcher_actions",
"register_launcher_action",
"register_launcher_action_path",
"discover_inventory_actions",
"register_inventory_action",
"register_inventory_action_path",
"deregister_inventory_action",
"deregister_inventory_action_path",
)

View file

@ -0,0 +1,144 @@
import logging
class LauncherAction(object):
"""A custom action available"""
name = None
label = None
icon = None
color = None
order = 0
log = logging.getLogger("LauncherAction")
log.propagate = True
def is_compatible(self, session):
"""Return whether the class is compatible with the Session."""
return True
def process(self, session, **kwargs):
pass
class InventoryAction(object):
"""A custom action for the scene inventory tool
If registered the action will be visible in the Right Mouse Button menu
under the submenu "Actions".
"""
label = None
icon = None
color = None
order = 0
log = logging.getLogger("InventoryAction")
log.propagate = True
@staticmethod
def is_compatible(container):
"""Override function in a custom class
This method is specifically used to ensure the action can operate on
the container.
Args:
container(dict): the data of a loaded asset, see host.ls()
Returns:
bool
"""
return bool(container.get("objectName"))
def process(self, containers):
"""Override function in a custom class
This method will receive all containers even those which are
incompatible. It is advised to create a small filter along the lines
of this example:
valid_containers = filter(self.is_compatible(c) for c in containers)
The return value will need to be a True-ish value to trigger
the data_changed signal in order to refresh the view.
You can return a list of container names to trigger GUI to select
treeview items.
You can return a dict to carry extra GUI options. For example:
{
"objectNames": [container names...],
"options": {"mode": "toggle",
"clear": False}
}
Currently workable GUI options are:
- clear (bool): Clear current selection before selecting by action.
Default `True`.
- mode (str): selection mode, use one of these:
"select", "deselect", "toggle". Default is "select".
Args:
containers (list): list of dictionaries
Return:
bool, list or dict
"""
return True
# Launcher action
def discover_launcher_actions():
import avalon.api
return avalon.api.discover(LauncherAction)
def register_launcher_action(plugin):
import avalon.api
return avalon.api.register_plugin(LauncherAction, plugin)
def register_launcher_action_path(path):
import avalon.api
return avalon.api.register_plugin_path(LauncherAction, path)
# Inventory action
def discover_inventory_actions():
import avalon.api
actions = avalon.api.discover(InventoryAction)
filtered_actions = []
for action in actions:
if action is not InventoryAction:
filtered_actions.append(action)
return filtered_actions
def register_inventory_action(plugin):
import avalon.api
return avalon.api.register_plugin(InventoryAction, plugin)
def deregister_inventory_action(plugin):
import avalon.api
avalon.api.deregister_plugin(InventoryAction, plugin)
def register_inventory_action_path(path):
import avalon.api
return avalon.api.register_plugin_path(InventoryAction, path)
def deregister_inventory_action_path(path):
import avalon.api
return avalon.api.deregister_plugin_path(InventoryAction, path)

View file

@ -0,0 +1,19 @@
# Metadata ID of loaded container into scene
AVALON_CONTAINER_ID = "pyblish.avalon.container"
# TODO get extensions from host implementations
HOST_WORKFILE_EXTENSIONS = {
"blender": [".blend"],
"celaction": [".scn"],
"tvpaint": [".tvpp"],
"fusion": [".comp"],
"harmony": [".zip"],
"houdini": [".hip", ".hiplc", ".hipnc"],
"maya": [".ma", ".mb"],
"nuke": [".nk"],
"hiero": [".hrox"],
"photoshop": [".psd", ".psb"],
"premiere": [".prproj"],
"resolve": [".drp"],
"aftereffects": [".aep"]
}

View file

@ -6,7 +6,6 @@ import inspect
from uuid import uuid4
from contextlib import contextmanager
from ..lib import UnknownDef
from .creator_plugins import (
BaseCreator,
Creator,
@ -87,6 +86,8 @@ class AttributeValues:
origin_data(dict): Values loaded from host before conversion.
"""
def __init__(self, attr_defs, values, origin_data=None):
from openpype.lib.attribute_definitions import UnknownDef
if origin_data is None:
origin_data = copy.deepcopy(values)
self._origin_data = origin_data

View file

@ -1,30 +0,0 @@
from .attribute_definitions import (
AbtractAttrDef,
UIDef,
UISeparatorDef,
UILabelDef,
UnknownDef,
NumberDef,
TextDef,
EnumDef,
BoolDef,
FileDef,
)
__all__ = (
"AbtractAttrDef",
"UIDef",
"UISeparatorDef",
"UILabelDef",
"UnknownDef",
"NumberDef",
"TextDef",
"EnumDef",
"BoolDef",
"FileDef",
)

View file

@ -127,4 +127,5 @@ def register_loader_plugin_path(path):
def deregister_loader_plugin(plugin):
import avalon.api
avalon.api.deregister_plugin(LoaderPlugin, plugin)

View file

@ -7,6 +7,7 @@ import inspect
import numbers
import six
from bson.objectid import ObjectId
from avalon import io, schema
from avalon.api import Session, registered_root
@ -67,7 +68,7 @@ def get_repres_contexts(representation_ids, dbcon=None):
_representation_ids = []
for repre_id in representation_ids:
if isinstance(repre_id, six.string_types):
repre_id = io.ObjectId(repre_id)
repre_id = ObjectId(repre_id)
_representation_ids.append(repre_id)
repre_docs = dbcon.find({
@ -174,7 +175,7 @@ def get_subset_contexts(subset_ids, dbcon=None):
_subset_ids = set()
for subset_id in subset_ids:
if isinstance(subset_id, six.string_types):
subset_id = io.ObjectId(subset_id)
subset_id = ObjectId(subset_id)
_subset_ids.add(subset_id)
subset_docs = dbcon.find({
@ -217,7 +218,7 @@ def get_representation_context(representation):
"""Return parenthood context for representation.
Args:
representation (str or io.ObjectId or dict): The representation id
representation (str or ObjectId or dict): The representation id
or full representation as returned by the database.
Returns:
@ -227,9 +228,9 @@ def get_representation_context(representation):
assert representation is not None, "This is a bug"
if isinstance(representation, (six.string_types, io.ObjectId)):
if isinstance(representation, (six.string_types, ObjectId)):
representation = io.find_one(
{"_id": io.ObjectId(str(representation))})
{"_id": ObjectId(str(representation))})
version, subset, asset, project = io.parenthood(representation)
@ -340,7 +341,7 @@ def load_container(
Args:
Loader (Loader): The loader class to trigger.
representation (str or io.ObjectId or dict): The representation id
representation (str or ObjectId or dict): The representation id
or full representation as returned by the database.
namespace (str, Optional): The namespace to assign. Defaults to None.
name (str, Optional): The name to assign. Defaults to subset name.
@ -404,7 +405,7 @@ def update_container(container, version=-1):
# Compute the different version from 'representation'
current_representation = io.find_one({
"_id": io.ObjectId(container["representation"])
"_id": ObjectId(container["representation"])
})
assert current_representation is not None, "This is a bug"
@ -593,7 +594,6 @@ def get_representation_path(representation, root=None, dbcon=None):
"code": project.get("data", {}).get("code")
},
"asset": asset["name"],
"silo": asset.get("silo"),
"hierarchy": hierarchy,
"subset": subset["name"],
"version": version_["name"],

View file

@ -0,0 +1,147 @@
import os
import copy
import logging
log = logging.getLogger(__name__)
def get_thumbnail_binary(thumbnail_entity, thumbnail_type, dbcon=None):
if not thumbnail_entity:
return
resolvers = discover_thumbnail_resolvers()
resolvers = sorted(resolvers, key=lambda cls: cls.priority)
if dbcon is None:
from avalon import io
dbcon = io
for Resolver in resolvers:
available_types = Resolver.thumbnail_types
if (
thumbnail_type not in available_types
and "*" not in available_types
and (
isinstance(available_types, (list, tuple))
and len(available_types) == 0
)
):
continue
try:
instance = Resolver(dbcon)
result = instance.process(thumbnail_entity, thumbnail_type)
if result:
return result
except Exception:
log.warning("Resolver {0} failed durring process.".format(
Resolver.__class__.__name__, exc_info=True
))
class ThumbnailResolver(object):
"""Determine how to get data from thumbnail entity.
"priority" - determines the order of processing in `get_thumbnail_binary`,
lower number is processed earlier.
"thumbnail_types" - it is expected that thumbnails will be used in more
more than one level, there is only ["thumbnail"] type at the moment
of creating this docstring but it is expected to add "ico" and "full"
in future.
"""
priority = 100
thumbnail_types = ["*"]
def __init__(self, dbcon):
self._log = None
self.dbcon = dbcon
@property
def log(self):
if self._log is None:
self._log = logging.getLogger(self.__class__.__name__)
return self._log
def process(self, thumbnail_entity, thumbnail_type):
pass
class TemplateResolver(ThumbnailResolver):
priority = 90
def process(self, thumbnail_entity, thumbnail_type):
if not os.environ.get("AVALON_THUMBNAIL_ROOT"):
return
template = thumbnail_entity["data"].get("template")
if not template:
self.log.debug("Thumbnail entity does not have set template")
return
project = self.dbcon.find_one(
{"type": "project"},
{
"name": True,
"data.code": True
}
)
template_data = copy.deepcopy(
thumbnail_entity["data"].get("template_data") or {}
)
template_data.update({
"_id": str(thumbnail_entity["_id"]),
"thumbnail_type": thumbnail_type,
"thumbnail_root": os.environ.get("AVALON_THUMBNAIL_ROOT"),
"project": {
"name": project["name"],
"code": project["data"].get("code")
}
})
try:
filepath = os.path.normpath(template.format(**template_data))
except KeyError:
self.log.warning((
"Missing template data keys for template <{0}> || Data: {1}"
).format(template, str(template_data)))
return
if not os.path.exists(filepath):
self.log.warning("File does not exist \"{0}\"".format(filepath))
return
with open(filepath, "rb") as _file:
content = _file.read()
return content
class BinaryThumbnail(ThumbnailResolver):
def process(self, thumbnail_entity, thumbnail_type):
return thumbnail_entity["data"].get("binary_data")
# Thumbnail resolvers
def discover_thumbnail_resolvers():
import avalon.api
return avalon.api.discover(ThumbnailResolver)
def register_thumbnail_resolver(plugin):
import avalon.api
return avalon.api.register_plugin(ThumbnailResolver, plugin)
def register_thumbnail_resolver_path(path):
import avalon.api
return avalon.api.register_plugin_path(ThumbnailResolver, path)
register_thumbnail_resolver(TemplateResolver)
register_thumbnail_resolver(BinaryThumbnail)

View file

@ -1,3 +1,4 @@
from bson.objectid import ObjectId
import pyblish.api
from avalon import api, io
@ -35,7 +36,7 @@ class CollectSceneLoadedVersions(pyblish.api.ContextPlugin):
loaded_versions = []
_containers = list(host.ls())
_repr_ids = [io.ObjectId(c["representation"]) for c in _containers]
_repr_ids = [ObjectId(c["representation"]) for c in _containers]
version_by_repr = {
str(doc["_id"]): doc["parent"] for doc in
io.find({"_id": {"$in": _repr_ids}}, projection={"parent": 1})
@ -46,7 +47,7 @@ class CollectSceneLoadedVersions(pyblish.api.ContextPlugin):
# may have more then one representation that are same version
version = {
"subsetName": con["name"],
"representation": io.ObjectId(con["representation"]),
"representation": ObjectId(con["representation"]),
"version": version_by_repr[con["representation"]], # _id
}
loaded_versions.append(version)

View file

@ -64,7 +64,7 @@ class ExtractHierarchyToAvalon(pyblish.api.ContextPlugin):
data["tasks"] = tasks
parents = []
visualParent = None
# do not store project"s id as visualParent (silo asset)
# do not store project"s id as visualParent
if self.project is not None:
if self.project["_id"] != parent["_id"]:
visualParent = parent["_id"]

View file

@ -4,6 +4,7 @@ import clique
import errno
import shutil
from bson.objectid import ObjectId
from pymongo import InsertOne, ReplaceOne
import pyblish.api
from avalon import api, io, schema
@ -161,7 +162,7 @@ class IntegrateHeroVersion(pyblish.api.InstancePlugin):
if old_version:
new_version_id = old_version["_id"]
else:
new_version_id = io.ObjectId()
new_version_id = ObjectId()
new_hero_version = {
"_id": new_version_id,
@ -384,7 +385,7 @@ class IntegrateHeroVersion(pyblish.api.InstancePlugin):
# Create representation
else:
repre["_id"] = io.ObjectId()
repre["_id"] = ObjectId()
bulk_writes.append(
InsertOne(repre)
)
@ -420,7 +421,7 @@ class IntegrateHeroVersion(pyblish.api.InstancePlugin):
else:
repre["old_id"] = repre["_id"]
repre["_id"] = io.ObjectId()
repre["_id"] = ObjectId()
repre["type"] = "archived_representation"
bulk_writes.append(
InsertOne(repre)

View file

@ -1,8 +1,10 @@
from collections import OrderedDict
from avalon import io
from bson.objectid import ObjectId
import pyblish.api
from avalon import io
class IntegrateInputLinks(pyblish.api.ContextPlugin):
"""Connecting version level dependency links"""
@ -104,7 +106,7 @@ class IntegrateInputLinks(pyblish.api.ContextPlugin):
# future.
link = OrderedDict()
link["type"] = link_type
link["id"] = io.ObjectId(input_id)
link["id"] = ObjectId(input_id)
link["linkedBy"] = "publish"
if "inputLinks" not in version_doc["data"]:

View file

@ -9,6 +9,7 @@ import six
import re
import shutil
from bson.objectid import ObjectId
from pymongo import DeleteOne, InsertOne
import pyblish.api
from avalon import io
@ -294,7 +295,7 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
bulk_writes.append(DeleteOne({"_id": repre_id}))
repre["orig_id"] = repre_id
repre["_id"] = io.ObjectId()
repre["_id"] = ObjectId()
repre["type"] = "archived_representation"
bulk_writes.append(InsertOne(repre))
@ -573,7 +574,7 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
# Create new id if existing representations does not match
if repre_id is None:
repre_id = io.ObjectId()
repre_id = ObjectId()
data = repre.get("data") or {}
data.update({'path': dst, 'template': template})
@ -782,7 +783,7 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
families = [instance.data["family"]]
families.extend(instance.data.get("families", []))
io.update_many(
{"type": "subset", "_id": io.ObjectId(subset["_id"])},
{"type": "subset", "_id": ObjectId(subset["_id"])},
{"$set": {"data.families": families}}
)
@ -807,7 +808,7 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
if subset_group:
io.update_many({
'type': 'subset',
'_id': io.ObjectId(subset_id)
'_id': ObjectId(subset_id)
}, {'$set': {'data.subsetGroup': subset_group}})
def _get_subset_group(self, instance):
@ -1054,7 +1055,7 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin):
sync_project_presets = None
rec = {
"_id": io.ObjectId(),
"_id": ObjectId(),
"path": path
}
if size:

View file

@ -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)

View file

@ -1,6 +1,7 @@
import os
from avalon import api
from Qt import QtWidgets, QtGui
from openpype import PLUGINS_DIR
from openpype import style
from openpype.api import Logger, resources
@ -8,7 +9,10 @@ from openpype.lib import (
ApplictionExecutableNotFound,
ApplicationLaunchFailed
)
from Qt import QtWidgets, QtGui
from openpype.pipeline import (
LauncherAction,
register_launcher_action_path,
)
def register_actions_from_paths(paths):
@ -29,14 +33,15 @@ def register_actions_from_paths(paths):
print("Path was not found: {}".format(path))
continue
api.register_plugin_path(api.Action, path)
register_launcher_action_path(path)
def register_config_actions():
"""Register actions from the configuration for Launcher"""
actions_dir = os.path.join(PLUGINS_DIR, "actions")
register_actions_from_paths([actions_dir])
if os.path.exists(actions_dir):
register_actions_from_paths([actions_dir])
def register_environment_actions():
@ -46,7 +51,9 @@ def register_environment_actions():
register_actions_from_paths(paths_str.split(os.pathsep))
class ApplicationAction(api.Action):
# TODO move to 'openpype.pipeline.actions'
# - remove Qt related stuff and implement exceptions to show error in launcher
class ApplicationAction(LauncherAction):
"""Pype's application launcher
Application action based on pype's ApplicationManager system.
@ -74,7 +81,7 @@ class ApplicationAction(api.Action):
@property
def log(self):
if self._log is None:
self._log = Logger().get_logger(self.__class__.__name__)
self._log = Logger.get_logger(self.__class__.__name__)
return self._log
def is_compatible(self, session):

View file

@ -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

View file

@ -8,12 +8,13 @@ import time
import appdirs
from Qt import QtCore, QtGui
import qtawesome
from avalon import api
from openpype.lib import JSONSettingRegistry
from openpype.lib.applications import (
CUSTOM_LAUNCH_APP_GROUPS,
ApplicationManager
)
from openpype.pipeline import discover_launcher_actions
from openpype.tools.utils.lib import (
DynamicQThread,
get_project_icon,
@ -68,7 +69,7 @@ class ActionModel(QtGui.QStandardItemModel):
def discover(self):
"""Set up Actions cache. Run this for each new project."""
# Discover all registered actions
actions = api.discover(api.Action)
actions = discover_launcher_actions()
# Get available project actions and the application actions
app_actions = self.get_application_actions()

View file

@ -9,14 +9,14 @@ from openpype.tools.loader.widgets import (
ThumbnailWidget,
VersionWidget,
FamilyListView,
RepresentationWidget
RepresentationWidget,
SubsetWidget
)
from openpype.tools.utils.assets_widget import MultiSelectAssetsWidget
from openpype.modules import ModulesManager
from . import lib
from .widgets import LibrarySubsetWidget
module = sys.modules[__name__]
module.window = None
@ -92,7 +92,7 @@ class LibraryLoaderWindow(QtWidgets.QDialog):
# --- Middle part ---
# Subsets widget
subsets_widget = LibrarySubsetWidget(
subsets_widget = SubsetWidget(
dbcon,
self.groups_config,
self.family_config_cache,
@ -448,10 +448,7 @@ class LibraryLoaderWindow(QtWidgets.QDialog):
def _set_context(self, context, refresh=True):
"""Set the selection in the interface using a context.
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:
@ -463,12 +460,6 @@ class LibraryLoaderWindow(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_assets()
self._assets_widget.select_asset_by_name(asset_name)

View file

@ -1,7 +1,6 @@
import os
import importlib
import logging
from openpype.api import Anatomy
log = logging.getLogger(__name__)
@ -20,14 +19,3 @@ def find_config():
log.info("Found %s, loading.." % config)
return importlib.import_module(config)
class RegisteredRoots:
roots_per_project = {}
@classmethod
def registered_root(cls, project_name):
if project_name not in cls.roots_per_project:
cls.roots_per_project[project_name] = Anatomy(project_name).roots
return cls.roots_per_project[project_name]

View file

@ -1,18 +0,0 @@
from Qt import QtWidgets
from .lib import RegisteredRoots
from openpype.tools.loader.widgets import SubsetWidget
class LibrarySubsetWidget(SubsetWidget):
def on_copy_source(self):
"""Copy formatted source path to clipboard"""
source = self.data.get("source", None)
if not source:
return
project_name = self.dbcon.Session["AVALON_PROJECT"]
root = RegisteredRoots.registered_root(project_name)
path = source.format(root=root)
clipboard = QtWidgets.QApplication.clipboard()
clipboard.setText(path)

View file

@ -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)

View file

@ -7,9 +7,9 @@ import collections
from Qt import QtWidgets, QtCore, QtGui
from avalon import api, pipeline
from openpype.api import Anatomy
from openpype.pipeline import HeroVersionType
from openpype.pipeline.thumbnail import get_thumbnail_binary
from openpype.pipeline.load import (
discover_loader_plugins,
SubsetLoaderPlugin,
@ -640,6 +640,7 @@ class VersionTextEdit(QtWidgets.QTextEdit):
"source": None,
"raw": None
}
self._anatomy = None
# Reset
self.set_version(None)
@ -730,20 +731,20 @@ class VersionTextEdit(QtWidgets.QTextEdit):
# Add additional actions when any text so we can assume
# the version is set.
if self.toPlainText().strip():
menu.addSeparator()
action = QtWidgets.QAction("Copy source path to clipboard",
menu)
action = QtWidgets.QAction(
"Copy source path to clipboard", menu
)
action.triggered.connect(self.on_copy_source)
menu.addAction(action)
action = QtWidgets.QAction("Copy raw data to clipboard",
menu)
action = QtWidgets.QAction(
"Copy raw data to clipboard", menu
)
action.triggered.connect(self.on_copy_raw)
menu.addAction(action)
menu.exec_(event.globalPos())
del menu
def on_copy_source(self):
"""Copy formatted source path to clipboard"""
@ -751,7 +752,11 @@ class VersionTextEdit(QtWidgets.QTextEdit):
if not source:
return
path = source.format(root=api.registered_root())
project_name = self.dbcon.Session["AVALON_PROJECT"]
if self._anatomy is None or self._anatomy.project_name != project_name:
self._anatomy = Anatomy(project_name)
path = source.format(root=self._anatomy.roots)
clipboard = QtWidgets.QApplication.clipboard()
clipboard.setText(path)
@ -771,7 +776,6 @@ class VersionTextEdit(QtWidgets.QTextEdit):
class ThumbnailWidget(QtWidgets.QLabel):
aspect_ratio = (16, 9)
max_width = 300
@ -863,7 +867,7 @@ class ThumbnailWidget(QtWidgets.QLabel):
if not thumbnail_ent:
return
thumbnail_bin = pipeline.get_thumbnail_binary(
thumbnail_bin = get_thumbnail_binary(
thumbnail_ent, "thumbnail", self.dbcon
)
if not thumbnail_bin:

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)

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