Merge pull request #2886 from pypeclub/enhancement/OP-2848_move-loader-logic-from-avalon-to-openpype

General: Move loader logic from avalon to openpype
This commit is contained in:
Jakub Trllo 2022-03-16 09:26:30 +01:00 committed by GitHub
commit d1208cbebc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
131 changed files with 1676 additions and 429 deletions

View file

@ -75,7 +75,10 @@ def install():
"""Install Pype to Avalon."""
from pyblish.lib import MessageHandler
from openpype.modules import load_modules
from openpype.pipeline import LegacyCreator
from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
)
from avalon import pipeline
# Make sure modules are loaded
@ -91,7 +94,7 @@ def install():
log.info("Registering global plug-ins..")
pyblish.register_plugin_path(PUBLISH_PATH)
pyblish.register_discovery_filter(filter_pyblish_plugins)
avalon.register_plugin_path(avalon.Loader, LOAD_PATH)
register_loader_plugin_path(LOAD_PATH)
project_name = os.environ.get("AVALON_PROJECT")
@ -119,7 +122,7 @@ def install():
continue
pyblish.register_plugin_path(path)
avalon.register_plugin_path(avalon.Loader, path)
register_loader_plugin_path(path)
avalon.register_plugin_path(LegacyCreator, path)
avalon.register_plugin_path(avalon.InventoryAction, path)
@ -139,10 +142,12 @@ def _on_task_change():
@import_wrapper
def uninstall():
"""Uninstall Pype from Avalon."""
from openpype.pipeline import deregister_loader_plugin_path
log.info("Deregistering global plug-ins..")
pyblish.deregister_plugin_path(PUBLISH_PATH)
pyblish.deregister_discovery_filter(filter_pyblish_plugins)
avalon.deregister_plugin_path(avalon.Loader, LOAD_PATH)
deregister_loader_plugin_path(LOAD_PATH)
log.info("Global plug-ins unregistred")
# restore original discover

View file

@ -9,7 +9,11 @@ from avalon import io, pipeline
from openpype import lib
from openpype.api import Logger
from openpype.pipeline import LegacyCreator
from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
deregister_loader_plugin_path,
)
import openpype.hosts.aftereffects
from openpype.lib import register_event_callback
@ -67,7 +71,7 @@ def install():
pyblish.api.register_host("aftereffects")
pyblish.api.register_plugin_path(PUBLISH_PATH)
avalon.api.register_plugin_path(avalon.api.Loader, LOAD_PATH)
register_loader_plugin_path(LOAD_PATH)
avalon.api.register_plugin_path(LegacyCreator, CREATE_PATH)
log.info(PUBLISH_PATH)
@ -80,7 +84,7 @@ def install():
def uninstall():
pyblish.api.deregister_plugin_path(PUBLISH_PATH)
avalon.api.deregister_plugin_path(avalon.api.Loader, LOAD_PATH)
deregister_loader_plugin_path(LOAD_PATH)
avalon.api.deregister_plugin_path(LegacyCreator, CREATE_PATH)

View file

@ -1,9 +1,8 @@
import avalon.api
from openpype.pipeline import LoaderPlugin
from .launch_logic import get_stub
class AfterEffectsLoader(avalon.api.Loader):
class AfterEffectsLoader(LoaderPlugin):
@staticmethod
def get_stub():
return get_stub()

View file

@ -1,11 +1,10 @@
import re
import avalon.api
from openpype.lib import (
get_background_layers,
get_unique_layer_name
)
from openpype.pipeline import get_representation_path
from openpype.hosts.aftereffects.api import (
AfterEffectsLoader,
containerise
@ -78,7 +77,7 @@ class BackgroundLoader(AfterEffectsLoader):
else: # switching version - keep same name
comp_name = container["namespace"]
path = avalon.api.get_representation_path(representation)
path = get_representation_path(representation)
layers = get_background_layers(path)
comp = stub.reload_background(container["members"][1],

View file

@ -1,8 +1,8 @@
import re
import avalon.api
from openpype import lib
from openpype.pipeline import get_representation_path
from openpype.hosts.aftereffects.api import (
AfterEffectsLoader,
containerise
@ -92,7 +92,7 @@ class FileLoader(AfterEffectsLoader):
"{}_{}".format(context["asset"], context["subset"]))
else: # switching version - keep same name
layer_name = container["namespace"]
path = avalon.api.get_representation_path(representation)
path = get_representation_path(representation)
# with aftereffects.maintained_selection(): # TODO
stub.replace_item(layer.id, path, stub.LOADED_ICON + layer_name)
stub.imprint(

View file

@ -14,7 +14,11 @@ import avalon.api
from avalon import io, schema
from avalon.pipeline import AVALON_CONTAINER_ID
from openpype.pipeline import LegacyCreator
from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
deregister_loader_plugin_path,
)
from openpype.api import Logger
from openpype.lib import (
register_event_callback,
@ -50,7 +54,7 @@ def install():
pyblish.api.register_host("blender")
pyblish.api.register_plugin_path(str(PUBLISH_PATH))
avalon.api.register_plugin_path(avalon.api.Loader, str(LOAD_PATH))
register_loader_plugin_path(str(LOAD_PATH))
avalon.api.register_plugin_path(LegacyCreator, str(CREATE_PATH))
lib.append_user_scripts()
@ -72,7 +76,7 @@ def uninstall():
pyblish.api.deregister_host("blender")
pyblish.api.deregister_plugin_path(str(PUBLISH_PATH))
avalon.api.deregister_plugin_path(avalon.api.Loader, str(LOAD_PATH))
deregister_loader_plugin_path(str(LOAD_PATH))
avalon.api.deregister_plugin_path(LegacyCreator, str(CREATE_PATH))
if not IS_HEADLESS:

View file

@ -5,8 +5,10 @@ from typing import Dict, List, Optional
import bpy
import avalon.api
from openpype.pipeline import LegacyCreator
from openpype.pipeline import (
LegacyCreator,
LoaderPlugin,
)
from .pipeline import AVALON_CONTAINERS
from .ops import (
MainThreadItem,
@ -145,13 +147,13 @@ class Creator(LegacyCreator):
return collection
class Loader(avalon.api.Loader):
class Loader(LoaderPlugin):
"""Base class for Loader plug-ins."""
hosts = ["blender"]
class AssetLoader(avalon.api.Loader):
class AssetLoader(LoaderPlugin):
"""A basic AssetLoader for Blender
This will implement the basic logic for linking/appending assets

View file

@ -6,7 +6,7 @@ from typing import Dict, List, Optional
import bpy
from avalon import api
from openpype.pipeline import get_representation_path
from openpype.hosts.blender.api.pipeline import (
AVALON_CONTAINERS,
AVALON_PROPERTY,
@ -178,7 +178,7 @@ class CacheModelLoader(plugin.AssetLoader):
"""
object_name = container["objectName"]
asset_group = bpy.data.objects.get(object_name)
libpath = Path(api.get_representation_path(representation))
libpath = Path(get_representation_path(representation))
extension = libpath.suffix.lower()
self.log.info(

View file

@ -5,9 +5,13 @@ from pathlib import Path
from pprint import pformat
from typing import Dict, List, Optional
from avalon import api, blender
import bpy
from openpype.pipeline import get_representation_path
import openpype.hosts.blender.api.plugin
from openpype.hosts.blender.api.pipeline import (
containerise_existing,
AVALON_PROPERTY,
)
logger = logging.getLogger("openpype").getChild("blender").getChild("load_action")
@ -49,7 +53,7 @@ class BlendActionLoader(openpype.hosts.blender.api.plugin.AssetLoader):
container = bpy.data.collections.new(lib_container)
container.name = container_name
blender.pipeline.containerise_existing(
containerise_existing(
container,
name,
namespace,
@ -57,8 +61,7 @@ class BlendActionLoader(openpype.hosts.blender.api.plugin.AssetLoader):
self.__class__.__name__,
)
container_metadata = container.get(
blender.pipeline.AVALON_PROPERTY)
container_metadata = container.get(AVALON_PROPERTY)
container_metadata["libpath"] = libpath
container_metadata["lib_container"] = lib_container
@ -90,16 +93,16 @@ class BlendActionLoader(openpype.hosts.blender.api.plugin.AssetLoader):
anim_data.action.make_local()
if not obj.get(blender.pipeline.AVALON_PROPERTY):
if not obj.get(AVALON_PROPERTY):
obj[blender.pipeline.AVALON_PROPERTY] = dict()
obj[AVALON_PROPERTY] = dict()
avalon_info = obj[blender.pipeline.AVALON_PROPERTY]
avalon_info = obj[AVALON_PROPERTY]
avalon_info.update({"container_name": container_name})
objects_list.append(obj)
animation_container.pop(blender.pipeline.AVALON_PROPERTY)
animation_container.pop(AVALON_PROPERTY)
# Save the list of objects in the metadata container
container_metadata["objects"] = objects_list
@ -128,7 +131,7 @@ class BlendActionLoader(openpype.hosts.blender.api.plugin.AssetLoader):
container["objectName"]
)
libpath = Path(api.get_representation_path(representation))
libpath = Path(get_representation_path(representation))
extension = libpath.suffix.lower()
logger.info(
@ -153,8 +156,7 @@ class BlendActionLoader(openpype.hosts.blender.api.plugin.AssetLoader):
f"Unsupported file: {libpath}"
)
collection_metadata = collection.get(
blender.pipeline.AVALON_PROPERTY)
collection_metadata = collection.get(AVALON_PROPERTY)
collection_libpath = collection_metadata["libpath"]
normalized_collection_libpath = (
@ -225,16 +227,16 @@ class BlendActionLoader(openpype.hosts.blender.api.plugin.AssetLoader):
strip.action = anim_data.action
strip.action_frame_end = anim_data.action.frame_range[1]
if not obj.get(blender.pipeline.AVALON_PROPERTY):
if not obj.get(AVALON_PROPERTY):
obj[blender.pipeline.AVALON_PROPERTY] = dict()
obj[AVALON_PROPERTY] = dict()
avalon_info = obj[blender.pipeline.AVALON_PROPERTY]
avalon_info = obj[AVALON_PROPERTY]
avalon_info.update({"container_name": collection.name})
objects_list.append(obj)
anim_container.pop(blender.pipeline.AVALON_PROPERTY)
anim_container.pop(AVALON_PROPERTY)
# Save the list of objects in the metadata container
collection_metadata["objects"] = objects_list
@ -266,8 +268,7 @@ class BlendActionLoader(openpype.hosts.blender.api.plugin.AssetLoader):
"Nested collections are not supported."
)
collection_metadata = collection.get(
blender.pipeline.AVALON_PROPERTY)
collection_metadata = collection.get(AVALON_PROPERTY)
objects = collection_metadata["objects"]
lib_container = collection_metadata["lib_container"]

View file

@ -6,7 +6,7 @@ from typing import Dict, List, Optional
import bpy
from avalon import api
from openpype.pipeline import get_representation_path
from openpype.hosts.blender.api import plugin
from openpype.hosts.blender.api.pipeline import (
AVALON_CONTAINERS,
@ -102,7 +102,7 @@ class AudioLoader(plugin.AssetLoader):
"""
object_name = container["objectName"]
asset_group = bpy.data.objects.get(object_name)
libpath = Path(api.get_representation_path(representation))
libpath = Path(get_representation_path(representation))
self.log.info(
"Container: %s\nRepresentation: %s",

View file

@ -7,7 +7,7 @@ from typing import Dict, List, Optional
import bpy
from avalon import api
from openpype.pipeline import get_representation_path
from openpype.hosts.blender.api import plugin
from openpype.hosts.blender.api.pipeline import (
AVALON_CONTAINERS,
@ -155,7 +155,7 @@ class BlendCameraLoader(plugin.AssetLoader):
"""
object_name = container["objectName"]
asset_group = bpy.data.objects.get(object_name)
libpath = Path(api.get_representation_path(representation))
libpath = Path(get_representation_path(representation))
extension = libpath.suffix.lower()
self.log.info(

View file

@ -6,7 +6,7 @@ from typing import Dict, List, Optional
import bpy
from avalon import api
from openpype.pipeline import get_representation_path
from openpype.hosts.blender.api import plugin, lib
from openpype.hosts.blender.api.pipeline import (
AVALON_CONTAINERS,
@ -143,7 +143,7 @@ class FbxCameraLoader(plugin.AssetLoader):
"""
object_name = container["objectName"]
asset_group = bpy.data.objects.get(object_name)
libpath = Path(api.get_representation_path(representation))
libpath = Path(get_representation_path(representation))
extension = libpath.suffix.lower()
self.log.info(

View file

@ -6,7 +6,7 @@ from typing import Dict, List, Optional
import bpy
from avalon import api
from openpype.pipeline import get_representation_path
from openpype.hosts.blender.api import plugin, lib
from openpype.hosts.blender.api.pipeline import (
AVALON_CONTAINERS,
@ -187,7 +187,7 @@ class FbxModelLoader(plugin.AssetLoader):
"""
object_name = container["objectName"]
asset_group = bpy.data.objects.get(object_name)
libpath = Path(api.get_representation_path(representation))
libpath = Path(get_representation_path(representation))
extension = libpath.suffix.lower()
self.log.info(

View file

@ -6,9 +6,11 @@ from typing import Dict, List, Optional
import bpy
from avalon import api
from openpype import lib
from openpype.pipeline import legacy_create
from openpype.pipeline import (
legacy_create,
get_representation_path,
)
from openpype.hosts.blender.api import plugin
from openpype.hosts.blender.api.pipeline import (
AVALON_CONTAINERS,
@ -309,7 +311,7 @@ class BlendLayoutLoader(plugin.AssetLoader):
"""
object_name = container["objectName"]
asset_group = bpy.data.objects.get(object_name)
libpath = Path(api.get_representation_path(representation))
libpath = Path(get_representation_path(representation))
extension = libpath.suffix.lower()
self.log.info(

View file

@ -7,7 +7,13 @@ from typing import Dict, Optional
import bpy
from avalon import api
from openpype.pipeline import (
discover_loader_plugins,
remove_container,
load_container,
get_representation_path,
loaders_from_representation,
)
from openpype.hosts.blender.api.pipeline import (
AVALON_INSTANCES,
AVALON_CONTAINERS,
@ -33,7 +39,7 @@ class JsonLayoutLoader(plugin.AssetLoader):
objects = list(asset_group.children)
for obj in objects:
api.remove(obj.get(AVALON_PROPERTY))
remove_container(obj.get(AVALON_PROPERTY))
def _remove_animation_instances(self, asset_group):
instances = bpy.data.collections.get(AVALON_INSTANCES)
@ -66,13 +72,13 @@ class JsonLayoutLoader(plugin.AssetLoader):
with open(libpath, "r") as fp:
data = json.load(fp)
all_loaders = api.discover(api.Loader)
all_loaders = discover_loader_plugins()
for element in data:
reference = element.get('reference')
family = element.get('family')
loaders = api.loaders_from_representation(all_loaders, reference)
loaders = loaders_from_representation(all_loaders, reference)
loader = self._get_loader(loaders, family)
if not loader:
@ -102,7 +108,7 @@ class JsonLayoutLoader(plugin.AssetLoader):
# at this time it will not return anything. The assets will be
# loaded in the next Blender cycle, so we use the options to
# set the transform, parent and assign the action, if there is one.
api.load(
load_container(
loader,
reference,
namespace=instance_name,
@ -188,7 +194,7 @@ class JsonLayoutLoader(plugin.AssetLoader):
"""
object_name = container["objectName"]
asset_group = bpy.data.objects.get(object_name)
libpath = Path(api.get_representation_path(representation))
libpath = Path(get_representation_path(representation))
extension = libpath.suffix.lower()
self.log.info(

View file

@ -8,7 +8,7 @@ import os
import json
import bpy
from avalon import api
from openpype.pipeline import get_representation_path
from openpype.hosts.blender.api import plugin
from openpype.hosts.blender.api.pipeline import (
containerise_existing,
@ -140,7 +140,7 @@ class BlendLookLoader(plugin.AssetLoader):
def update(self, container: Dict, representation: Dict):
collection = bpy.data.collections.get(container["objectName"])
libpath = Path(api.get_representation_path(representation))
libpath = Path(get_representation_path(representation))
extension = libpath.suffix.lower()
self.log.info(

View file

@ -6,7 +6,7 @@ from typing import Dict, List, Optional
import bpy
from avalon import api
from openpype.pipeline import get_representation_path
from openpype.hosts.blender.api import plugin
from openpype.hosts.blender.api.pipeline import (
AVALON_CONTAINERS,
@ -195,7 +195,7 @@ class BlendModelLoader(plugin.AssetLoader):
"""
object_name = container["objectName"]
asset_group = bpy.data.objects.get(object_name)
libpath = Path(api.get_representation_path(representation))
libpath = Path(get_representation_path(representation))
extension = libpath.suffix.lower()
self.log.info(

View file

@ -6,11 +6,15 @@ from typing import Dict, List, Optional
import bpy
from avalon import api
from avalon.blender import lib as avalon_lib
from openpype import lib
from openpype.pipeline import legacy_create
from openpype.hosts.blender.api import plugin
from openpype.pipeline import (
legacy_create,
get_representation_path,
)
from openpype.hosts.blender.api import (
plugin,
get_selection,
)
from openpype.hosts.blender.api.pipeline import (
AVALON_CONTAINERS,
AVALON_PROPERTY,
@ -263,7 +267,7 @@ class BlendRigLoader(plugin.AssetLoader):
if anim_file:
bpy.ops.import_scene.fbx(filepath=anim_file, anim_offset=0.0)
imported = avalon_lib.get_selection()
imported = get_selection()
armature = [
o for o in asset_group.children if o.type == 'ARMATURE'][0]
@ -307,7 +311,7 @@ class BlendRigLoader(plugin.AssetLoader):
"""
object_name = container["objectName"]
asset_group = bpy.data.objects.get(object_name)
libpath = Path(api.get_representation_path(representation))
libpath = Path(get_representation_path(representation))
extension = libpath.suffix.lower()
self.log.info(

View file

@ -7,7 +7,11 @@ 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
from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
deregister_loader_plugin_path,
)
from .lib import (
set_segment_data_marker,
set_publish_attribute,
@ -33,7 +37,7 @@ def install():
pyblish.register_host("flame")
pyblish.register_plugin_path(PUBLISH_PATH)
avalon.register_plugin_path(avalon.Loader, LOAD_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 ...")
@ -48,7 +52,7 @@ def uninstall():
log.info("Deregistering Flame plug-ins..")
pyblish.deregister_plugin_path(PUBLISH_PATH)
avalon.deregister_plugin_path(avalon.Loader, LOAD_PATH)
deregister_loader_plugin_path(LOAD_PATH)
avalon.deregister_plugin_path(LegacyCreator, CREATE_PATH)
avalon.deregister_plugin_path(avalon.InventoryAction, INVENTORY_PATH)

View file

@ -7,9 +7,11 @@ import six
import qargparse
from Qt import QtWidgets, QtCore
import openpype.api as openpype
from openpype.pipeline import LegacyCreator
from openpype.pipeline import (
LegacyCreator,
LoaderPlugin,
)
from openpype import style
import avalon.api as avalon
from . import (
lib as flib,
pipeline as fpipeline,
@ -660,7 +662,7 @@ class PublishableClip:
# Publishing plugin functions
# Loader plugin functions
class ClipLoader(avalon.Loader):
class ClipLoader(LoaderPlugin):
"""A basic clip loader for Flame
This will implement the basic behavior for a loader to inherit from that

View file

@ -172,7 +172,7 @@ class LoadClip(opfapi.ClipLoader):
# version_name = version.get("name", None)
# colorspace = version_data.get("colorspace", None)
# object_name = "{}_{}".format(name, namespace)
# file = api.get_representation_path(representation).replace("\\", "/")
# file = get_representation_path(representation).replace("\\", "/")
# clip = track_item.source()
# # reconnect media to new path

View file

@ -5,8 +5,8 @@ import contextlib
from Qt import QtGui
import avalon.api
from avalon import io
from openpype.pipeline import switch_container
from .pipeline import get_current_comp, comp_lock_and_undo_chunk
self = sys.modules[__name__]
@ -142,7 +142,7 @@ def switch_item(container,
assert representation, ("Could not find representation in the database "
"with the name '%s'" % representation_name)
avalon.api.switch(container, representation)
switch_container(container, representation)
return representation

View file

@ -11,7 +11,11 @@ import avalon.api
from avalon.pipeline import AVALON_CONTAINER_ID
from openpype.api import Logger
from openpype.pipeline import LegacyCreator
from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
deregister_loader_plugin_path,
)
import openpype.hosts.fusion
log = Logger().get_logger(__name__)
@ -63,7 +67,7 @@ def install():
pyblish.api.register_plugin_path(PUBLISH_PATH)
log.info("Registering Fusion plug-ins..")
avalon.api.register_plugin_path(avalon.api.Loader, LOAD_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)
@ -87,7 +91,7 @@ def uninstall():
pyblish.api.deregister_plugin_path(PUBLISH_PATH)
log.info("Deregistering Fusion plug-ins..")
avalon.api.deregister_plugin_path(avalon.api.Loader, LOAD_PATH)
deregister_loader_plugin_path(LOAD_PATH)
avalon.api.deregister_plugin_path(LegacyCreator, CREATE_PATH)
avalon.api.deregister_plugin_path(
avalon.api.InventoryAction, INVENTORY_PATH

View file

@ -2,10 +2,10 @@
"""
from avalon import api
from openpype.pipeline import load
class FusionSetFrameRangeLoader(api.Loader):
class FusionSetFrameRangeLoader(load.LoaderPlugin):
"""Specific loader of Alembic for the avalon.animation family"""
families = ["animation",
@ -39,7 +39,7 @@ class FusionSetFrameRangeLoader(api.Loader):
lib.update_frame_range(start, end)
class FusionSetFrameRangeWithHandlesLoader(api.Loader):
class FusionSetFrameRangeWithHandlesLoader(load.LoaderPlugin):
"""Specific loader of Alembic for the avalon.animation family"""
families = ["animation",

View file

@ -1,8 +1,12 @@
import os
import contextlib
from avalon import api, io
from avalon import io
from openpype.pipeline import (
load,
get_representation_path,
)
from openpype.hosts.fusion.api import (
imprint_container,
get_current_comp,
@ -117,7 +121,7 @@ def loader_shift(loader, frame, relative=True):
return int(shift)
class FusionLoadSequence(api.Loader):
class FusionLoadSequence(load.LoaderPlugin):
"""Load image sequence into Fusion"""
families = ["imagesequence", "review", "render"]
@ -204,7 +208,7 @@ class FusionLoadSequence(api.Loader):
assert tool.ID == "Loader", "Must be Loader"
comp = tool.Comp()
root = os.path.dirname(api.get_representation_path(representation))
root = os.path.dirname(get_representation_path(representation))
path = self._get_first_image(root)
# Get start frame from version data

View file

@ -575,7 +575,7 @@ replace_files = """function %s_replace_files(args)
""" % (signature, signature)
class ImageSequenceLoader(api.Loader):
class ImageSequenceLoader(load.LoaderPlugin):
"""Load images
Stores the imported asset in a container named after the asset.
"""

View file

@ -10,7 +10,11 @@ from avalon.pipeline import AVALON_CONTAINER_ID
from openpype import lib
from openpype.lib import register_event_callback
from openpype.pipeline import LegacyCreator
from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
deregister_loader_plugin_path,
)
import openpype.hosts.harmony
import openpype.hosts.harmony.api as harmony
@ -180,7 +184,7 @@ def install():
pyblish.api.register_host("harmony")
pyblish.api.register_plugin_path(PUBLISH_PATH)
avalon.api.register_plugin_path(avalon.api.Loader, LOAD_PATH)
register_loader_plugin_path(LOAD_PATH)
avalon.api.register_plugin_path(LegacyCreator, CREATE_PATH)
log.info(PUBLISH_PATH)
@ -194,7 +198,7 @@ def install():
def uninstall():
pyblish.api.deregister_plugin_path(PUBLISH_PATH)
avalon.api.deregister_plugin_path(avalon.api.Loader, LOAD_PATH)
deregister_loader_plugin_path(LOAD_PATH)
avalon.api.deregister_plugin_path(LegacyCreator, CREATE_PATH)

View file

@ -1,4 +1,7 @@
from avalon import api
from openpype.pipeline import (
load,
get_representation_path,
)
import openpype.hosts.harmony.api as harmony
sig = harmony.signature()
@ -29,7 +32,7 @@ function %s(args)
""" % (sig, sig)
class ImportAudioLoader(api.Loader):
class ImportAudioLoader(load.LoaderPlugin):
"""Import audio."""
families = ["shot", "audio"]
@ -37,7 +40,7 @@ class ImportAudioLoader(api.Loader):
label = "Import Audio"
def load(self, context, name=None, namespace=None, data=None):
wav_file = api.get_representation_path(context["representation"])
wav_file = get_representation_path(context["representation"])
harmony.send(
{"function": func, "args": [context["subset"]["name"], wav_file]}
)

View file

@ -1,7 +1,10 @@
import os
import json
from avalon import api
from openpype.pipeline import (
load,
get_representation_path,
)
import openpype.hosts.harmony.api as harmony
import openpype.lib
@ -226,7 +229,7 @@ replace_files
"""
class BackgroundLoader(api.Loader):
class BackgroundLoader(load.LoaderPlugin):
"""Load images
Stores the imported asset in a container named after the asset.
"""
@ -278,7 +281,7 @@ class BackgroundLoader(api.Loader):
def update(self, container, representation):
path = api.get_representation_path(representation)
path = get_representation_path(representation)
with open(path) as json_file:
data = json.load(json_file)
@ -297,7 +300,7 @@ class BackgroundLoader(api.Loader):
bg_folder = os.path.dirname(path)
path = api.get_representation_path(representation)
path = get_representation_path(representation)
print(container)

View file

@ -6,12 +6,15 @@ from pathlib import Path
import clique
from avalon import api
from openpype.pipeline import (
load,
get_representation_path,
)
import openpype.hosts.harmony.api as harmony
import openpype.lib
class ImageSequenceLoader(api.Loader):
class ImageSequenceLoader(load.LoaderPlugin):
"""Load image sequences.
Stores the imported asset in a container named after the asset.
@ -79,7 +82,7 @@ class ImageSequenceLoader(api.Loader):
self_name = self.__class__.__name__
node = container.get("nodes").pop()
path = api.get_representation_path(representation)
path = get_representation_path(representation)
collections, remainder = clique.assemble(
os.listdir(os.path.dirname(path))
)

View file

@ -1,11 +1,14 @@
import os
import shutil
from avalon import api
from openpype.pipeline import (
load,
get_representation_path,
)
import openpype.hosts.harmony.api as harmony
class ImportPaletteLoader(api.Loader):
class ImportPaletteLoader(load.LoaderPlugin):
"""Import palettes."""
families = ["palette", "harmony.palette"]
@ -31,7 +34,7 @@ class ImportPaletteLoader(api.Loader):
scene_path = harmony.send(
{"function": "scene.currentProjectPath"}
)["result"]
src = api.get_representation_path(representation)
src = get_representation_path(representation)
dst = os.path.join(
scene_path,
"palette-library",

View file

@ -6,12 +6,15 @@ import os
import shutil
import uuid
from avalon import api
from openpype.pipeline import (
load,
get_representation_path,
)
import openpype.hosts.harmony.api as harmony
import openpype.lib
class TemplateLoader(api.Loader):
class TemplateLoader(load.LoaderPlugin):
"""Load Harmony template as container.
.. todo::
@ -38,7 +41,7 @@ class TemplateLoader(api.Loader):
# Load template.
self_name = self.__class__.__name__
temp_dir = tempfile.mkdtemp()
zip_file = api.get_representation_path(context["representation"])
zip_file = get_representation_path(context["representation"])
template_path = os.path.join(temp_dir, "temp.tpl")
with zipfile.ZipFile(zip_file, "r") as zip_ref:
zip_ref.extractall(template_path)

View file

@ -3,11 +3,14 @@ import zipfile
import os
import shutil
from avalon import api
from openpype.pipeline import (
load,
get_representation_path,
)
import openpype.hosts.harmony.api as harmony
class ImportTemplateLoader(api.Loader):
class ImportTemplateLoader(load.LoaderPlugin):
"""Import templates."""
families = ["harmony.template", "workfile"]
@ -17,7 +20,7 @@ class ImportTemplateLoader(api.Loader):
def load(self, context, name=None, namespace=None, data=None):
# Import template.
temp_dir = tempfile.mkdtemp()
zip_file = api.get_representation_path(context["representation"])
zip_file = get_representation_path(context["representation"])
template_path = os.path.join(temp_dir, "temp.tpl")
with zipfile.ZipFile(zip_file, "r") as zip_ref:
zip_ref.extractall(template_path)

View file

@ -9,7 +9,11 @@ from avalon import api as avalon
from avalon import schema
from pyblish import api as pyblish
from openpype.api import Logger
from openpype.pipeline import LegacyCreator
from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
deregister_loader_plugin_path,
)
from openpype.tools.utils import host_tools
from . import lib, menu, events
@ -45,7 +49,7 @@ def install():
log.info("Registering Hiero plug-ins..")
pyblish.register_host("hiero")
pyblish.register_plugin_path(PUBLISH_PATH)
avalon.register_plugin_path(avalon.Loader, LOAD_PATH)
register_loader_plugin_path(LOAD_PATH)
avalon.register_plugin_path(LegacyCreator, CREATE_PATH)
avalon.register_plugin_path(avalon.InventoryAction, INVENTORY_PATH)
@ -67,7 +71,7 @@ def uninstall():
log.info("Deregistering Hiero plug-ins..")
pyblish.deregister_host("hiero")
pyblish.deregister_plugin_path(PUBLISH_PATH)
avalon.deregister_plugin_path(avalon.Loader, LOAD_PATH)
deregister_loader_plugin_path(LOAD_PATH)
avalon.deregister_plugin_path(LegacyCreator, CREATE_PATH)
# register callback for switching publishable

View file

@ -6,9 +6,9 @@ import hiero
from Qt import QtWidgets, QtCore
import qargparse
import avalon.api as avalon
import openpype.api as openpype
from openpype.pipeline import LegacyCreator
from openpype.pipeline import LoaderPlugin, LegacyCreator
from . import lib
log = openpype.Logger().get_logger(__name__)
@ -306,7 +306,7 @@ def get_reference_node_parents(ref):
return parents
class SequenceLoader(avalon.Loader):
class SequenceLoader(LoaderPlugin):
"""A basic SequenceLoader for Resolve
This will implement the basic behavior for a loader to inherit from that

View file

@ -1,4 +1,5 @@
from avalon import io, api
from avalon import io
from openpype.pipeline import get_representation_path
import openpype.hosts.hiero.api as phiero
# from openpype.hosts.hiero.api import plugin, lib
# reload(lib)
@ -112,7 +113,7 @@ class LoadClip(phiero.SequenceLoader):
version_name = version.get("name", None)
colorspace = version_data.get("colorspace", None)
object_name = "{}_{}".format(name, namespace)
file = api.get_representation_path(representation).replace("\\", "/")
file = get_representation_path(representation).replace("\\", "/")
clip = track_item.source()
# reconnect media to new path

View file

@ -11,7 +11,10 @@ import avalon.api
from avalon.pipeline import AVALON_CONTAINER_ID
from avalon.lib import find_submodule
from openpype.pipeline import LegacyCreator
from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
)
import openpype.hosts.houdini
from openpype.hosts.houdini.api import lib
@ -50,7 +53,7 @@ def install():
pyblish.api.register_host("hpython")
pyblish.api.register_plugin_path(PUBLISH_PATH)
avalon.api.register_plugin_path(avalon.api.Loader, LOAD_PATH)
register_loader_plugin_path(LOAD_PATH)
avalon.api.register_plugin_path(LegacyCreator, CREATE_PATH)
log.info("Installing callbacks ... ")

View file

@ -2,10 +2,10 @@
"""
from avalon import api
from openpype.pipeline import load
class SetFrameRangeLoader(api.Loader):
class SetFrameRangeLoader(load.LoaderPlugin):
"""Set Houdini frame range"""
families = [
@ -43,7 +43,7 @@ class SetFrameRangeLoader(api.Loader):
hou.playbar.setPlaybackRange(start, end)
class SetFrameRangeWithHandlesLoader(api.Loader):
class SetFrameRangeWithHandlesLoader(load.LoaderPlugin):
"""Set Maya frame range including pre- and post-handles"""
families = [

View file

@ -1,10 +1,12 @@
import os
from avalon import api
from openpype.pipeline import (
load,
get_representation_path,
)
from openpype.hosts.houdini.api import pipeline
class AbcLoader(api.Loader):
class AbcLoader(load.LoaderPlugin):
"""Specific loader of Alembic for the avalon.animation family"""
families = ["model", "animation", "pointcache", "gpuCache"]
@ -90,7 +92,7 @@ class AbcLoader(api.Loader):
return
# Update the file path
file_path = api.get_representation_path(representation)
file_path = get_representation_path(representation)
file_path = file_path.replace("\\", "/")
alembic_node.setParms({"fileName": file_path})

View file

@ -1,11 +1,15 @@
import os
from avalon import api
from avalon.houdini import pipeline
import clique
from openpype.pipeline import (
load,
get_representation_path,
)
from openpype.hosts.houdini.api import pipeline
class AssLoader(api.Loader):
class AssLoader(load.LoaderPlugin):
"""Load .ass with Arnold Procedural"""
families = ["ass"]
@ -88,7 +92,7 @@ class AssLoader(api.Loader):
def update(self, container, representation):
# Update the file path
file_path = api.get_representation_path(representation)
file_path = get_representation_path(representation)
file_path = file_path.replace("\\", "/")
procedural = container["node"]

View file

@ -1,4 +1,7 @@
from avalon import api
from openpype.pipeline import (
load,
get_representation_path,
)
from openpype.hosts.houdini.api import pipeline
@ -74,7 +77,7 @@ def transfer_non_default_values(src, dest, ignore=None):
dest_parm.setFromParm(parm)
class CameraLoader(api.Loader):
class CameraLoader(load.LoaderPlugin):
"""Specific loader of Alembic for the avalon.animation family"""
families = ["camera"]
@ -129,7 +132,7 @@ class CameraLoader(api.Loader):
node = container["node"]
# Update the file path
file_path = api.get_representation_path(representation)
file_path = get_representation_path(representation)
file_path = file_path.replace("\\", "/")
# Update attributes

View file

@ -1,10 +1,13 @@
# -*- coding: utf-8 -*-
from avalon import api
import os
from openpype.pipeline import (
load,
get_representation_path,
)
from openpype.hosts.houdini.api import pipeline
class HdaLoader(api.Loader):
class HdaLoader(load.LoaderPlugin):
"""Load Houdini Digital Asset file."""
families = ["hda"]
@ -15,7 +18,6 @@ class HdaLoader(api.Loader):
color = "orange"
def load(self, context, name=None, namespace=None, data=None):
import os
import hou
# Format file name, Houdini only wants forward slashes
@ -49,7 +51,7 @@ class HdaLoader(api.Loader):
import hou
hda_node = container["node"]
file_path = api.get_representation_path(representation)
file_path = get_representation_path(representation)
file_path = file_path.replace("\\", "/")
hou.hda.installFile(file_path)
defs = hda_node.type().allInstalledDefinitions()

View file

@ -1,6 +1,9 @@
import os
from avalon import api
from openpype.pipeline import (
load,
get_representation_path,
)
from openpype.hosts.houdini.api import lib, pipeline
import hou
@ -37,7 +40,7 @@ def get_image_avalon_container():
return image_container
class ImageLoader(api.Loader):
class ImageLoader(load.LoaderPlugin):
"""Specific loader of Alembic for the avalon.animation family"""
families = ["colorbleed.imagesequence"]
@ -87,7 +90,7 @@ class ImageLoader(api.Loader):
node = container["node"]
# Update the file path
file_path = api.get_representation_path(representation)
file_path = get_representation_path(representation)
file_path = file_path.replace("\\", "/")
file_path = self._get_file_sequence(file_path)

View file

@ -1,8 +1,11 @@
from avalon import api
from openpype.pipeline import (
load,
get_representation_path,
)
from openpype.hosts.houdini.api import lib, pipeline
class USDSublayerLoader(api.Loader):
class USDSublayerLoader(load.LoaderPlugin):
"""Sublayer USD file in Solaris"""
families = [
@ -57,7 +60,7 @@ class USDSublayerLoader(api.Loader):
node = container["node"]
# Update the file path
file_path = api.get_representation_path(representation)
file_path = get_representation_path(representation)
file_path = file_path.replace("\\", "/")
# Update attributes

View file

@ -1,8 +1,11 @@
from avalon import api
from openpype.pipeline import (
load,
get_representation_path,
)
from openpype.hosts.houdini.api import lib, pipeline
class USDReferenceLoader(api.Loader):
class USDReferenceLoader(load.LoaderPlugin):
"""Reference USD file in Solaris"""
families = [
@ -57,7 +60,7 @@ class USDReferenceLoader(api.Loader):
node = container["node"]
# Update the file path
file_path = api.get_representation_path(representation)
file_path = get_representation_path(representation)
file_path = file_path.replace("\\", "/")
# Update attributes

View file

@ -1,11 +1,14 @@
import os
import re
from avalon import api
from openpype.pipeline import (
load,
get_representation_path,
)
from openpype.hosts.houdini.api import pipeline
class VdbLoader(api.Loader):
class VdbLoader(load.LoaderPlugin):
"""Specific loader of Alembic for the avalon.animation family"""
families = ["vdbcache"]
@ -96,7 +99,7 @@ class VdbLoader(api.Loader):
return
# Update the file path
file_path = api.get_representation_path(representation)
file_path = get_representation_path(representation)
file_path = self.format_path(file_path)
file_node.setParms({"fileName": file_path})

View file

@ -1,7 +1,7 @@
from avalon import api
from openpype.pipeline import load
class ShowInUsdview(api.Loader):
class ShowInUsdview(load.LoaderPlugin):
"""Open USD file in usdview"""
families = ["colorbleed.usd"]

View file

@ -7,6 +7,7 @@ from collections import deque
import pyblish.api
import openpype.api
from openpype.pipeline import get_representation_path
import openpype.hosts.houdini.api.usd as hou_usdlib
from openpype.hosts.houdini.api.lib import render_rop
@ -308,7 +309,7 @@ class ExtractUSDLayered(openpype.api.Extractor):
self.log.debug("No existing representation..")
return False
old_file = api.get_representation_path(representation)
old_file = get_representation_path(representation)
if not os.path.exists(old_file):
return False

View file

@ -17,10 +17,16 @@ import bson
from maya import cmds, mel
import maya.api.OpenMaya as om
from avalon import api, io, pipeline
from avalon import api, io
from openpype import lib
from openpype.api import get_anatomy_settings
from openpype.pipeline import (
discover_loader_plugins,
loaders_from_representation,
get_representation_path,
load_container,
)
from .commands import reset_frame_range
@ -1580,21 +1586,21 @@ def assign_look_by_version(nodes, version_id):
log.info("Using look for the first time ..")
# Load file
loaders = api.loaders_from_representation(api.discover(api.Loader),
representation_id)
_loaders = discover_loader_plugins()
loaders = loaders_from_representation(_loaders, representation_id)
Loader = next((i for i in loaders if i.__name__ == "LookLoader"), None)
if Loader is None:
raise RuntimeError("Could not find LookLoader, this is a bug")
# Reference the look file
with maintained_selection():
container_node = pipeline.load(Loader, look_representation)
container_node = load_container(Loader, look_representation)
# Get container members
shader_nodes = get_container_members(container_node)
# Load relationships
shader_relation = api.get_representation_path(json_representation)
shader_relation = get_representation_path(json_representation)
with open(shader_relation, "r") as f:
relationships = json.load(f)

View file

@ -20,7 +20,11 @@ from openpype.lib import (
emit_event
)
from openpype.lib.path_tools import HostDirmap
from openpype.pipeline import LegacyCreator
from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
deregister_loader_plugin_path,
)
from openpype.hosts.maya.lib import copy_workspace_mel
from . import menu, lib
@ -53,7 +57,7 @@ def install():
pyblish.api.register_host("mayapy")
pyblish.api.register_host("maya")
avalon.api.register_plugin_path(avalon.api.Loader, LOAD_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)
log.info(PUBLISH_PATH)
@ -182,7 +186,7 @@ def uninstall():
pyblish.api.deregister_host("mayapy")
pyblish.api.deregister_host("maya")
avalon.api.deregister_plugin_path(avalon.api.Loader, LOAD_PATH)
deregister_loader_plugin_path(LOAD_PATH)
avalon.api.deregister_plugin_path(LegacyCreator, CREATE_PATH)
avalon.api.deregister_plugin_path(
avalon.api.InventoryAction, INVENTORY_PATH

View file

@ -4,9 +4,12 @@ from maya import cmds
import qargparse
from avalon import api
from avalon.pipeline import AVALON_CONTAINER_ID
from openpype.pipeline import LegacyCreator
from openpype.pipeline import (
LegacyCreator,
LoaderPlugin,
get_representation_path,
)
from .pipeline import containerise
from . import lib
@ -95,7 +98,7 @@ class Creator(LegacyCreator):
return instance
class Loader(api.Loader):
class Loader(LoaderPlugin):
hosts = ["maya"]
@ -194,7 +197,7 @@ class ReferenceLoader(Loader):
node = container["objectName"]
path = api.get_representation_path(representation)
path = get_representation_path(representation)
# Get reference node from container members
members = get_container_members(node)

View file

@ -8,7 +8,15 @@ import copy
import six
from maya import cmds
from avalon import api, io
from avalon import io
from openpype.pipeline import (
discover_loader_plugins,
loaders_from_representation,
load_container,
update_container,
remove_container,
get_representation_path,
)
from openpype.hosts.maya.api.lib import (
matrix_equals,
unique_namespace
@ -120,12 +128,13 @@ def load_package(filepath, name, namespace=None):
root = "{}:{}".format(namespace, name)
containers = []
all_loaders = api.discover(api.Loader)
all_loaders = discover_loader_plugins()
for representation_id, instances in data.items():
# Find the compatible loaders
loaders = api.loaders_from_representation(all_loaders,
representation_id)
loaders = loaders_from_representation(
all_loaders, representation_id
)
for instance in instances:
container = _add(instance=instance,
@ -180,9 +189,11 @@ def _add(instance, representation_id, loaders, namespace, root="|"):
instance['loader'], instance)
raise RuntimeError("Loader is missing.")
container = api.load(Loader,
representation_id,
namespace=instance['namespace'])
container = load_container(
Loader,
representation_id,
namespace=instance['namespace']
)
# Get the root from the loaded container
loaded_root = get_container_transforms({"objectName": container},
@ -320,13 +331,13 @@ def update_package(set_container, representation):
"type": "representation"
})
current_file = api.get_representation_path(current_representation)
current_file = get_representation_path(current_representation)
assert current_file.endswith(".json")
with open(current_file, "r") as fp:
current_data = json.load(fp)
# Load the new package data
new_file = api.get_representation_path(representation)
new_file = get_representation_path(representation)
assert new_file.endswith(".json")
with open(new_file, "r") as fp:
new_data = json.load(fp)
@ -460,12 +471,12 @@ def update_scene(set_container, containers, current_data, new_data, new_file):
# considered as new element and added afterwards.
processed_containers.pop()
processed_namespaces.remove(container_ns)
api.remove(container)
remove_container(container)
continue
# Check whether the conversion can be done by the Loader.
# They *must* use the same asset, subset and Loader for
# `api.update` to make sense.
# `update_container` to make sense.
old = io.find_one({
"_id": io.ObjectId(representation_current)
})
@ -479,20 +490,21 @@ def update_scene(set_container, containers, current_data, new_data, new_file):
continue
new_version = new["context"]["version"]
api.update(container, version=new_version)
update_container(container, version=new_version)
else:
# Remove this container because it's not in the new data
log.warning("Removing content: %s", container_ns)
api.remove(container)
remove_container(container)
# Add new assets
all_loaders = api.discover(api.Loader)
all_loaders = discover_loader_plugins()
for representation_id, instances in new_data.items():
# Find the compatible loaders
loaders = api.loaders_from_representation(all_loaders,
representation_id)
loaders = loaders_from_representation(
all_loaders, representation_id
)
for instance in instances:
# Already processed in update functionality
@ -517,7 +529,7 @@ def update_scene(set_container, containers, current_data, new_data, new_file):
def compare_representations(old, new):
"""Check if the old representation given can be updated
Due to limitations of the `api.update` function we cannot allow
Due to limitations of the `update_container` function we cannot allow
differences in the following data:
* Representation name (extension)

View file

@ -1,5 +1,9 @@
import json
from avalon import api, io, pipeline
from avalon import api, io
from openpype.pipeline import (
get_representation_context,
get_representation_path_from_context,
)
from openpype.hosts.maya.api.lib import (
maintained_selection,
apply_shaders
@ -73,11 +77,11 @@ class ImportModelRender(api.InventoryAction):
"name": self.look_data_type,
})
context = pipeline.get_representation_context(look_repr["_id"])
maya_file = pipeline.get_representation_path_from_context(context)
context = get_representation_context(look_repr["_id"])
maya_file = get_representation_path_from_context(context)
context = pipeline.get_representation_context(json_repr["_id"])
json_file = pipeline.get_representation_path_from_context(context)
context = get_representation_context(json_repr["_id"])
json_file = get_representation_path_from_context(context)
# Import the look file
with maintained_selection():

View file

@ -2,14 +2,14 @@
"""
from avalon import api
from openpype.pipeline import load
from openpype.hosts.maya.api.lib import (
maintained_selection,
unique_namespace
)
class SetFrameRangeLoader(api.Loader):
class SetFrameRangeLoader(load.LoaderPlugin):
"""Specific loader of Alembic for the avalon.animation family"""
families = ["animation",
@ -43,7 +43,7 @@ class SetFrameRangeLoader(api.Loader):
animationEndTime=end)
class SetFrameRangeWithHandlesLoader(api.Loader):
class SetFrameRangeWithHandlesLoader(load.LoaderPlugin):
"""Specific loader of Alembic for the avalon.animation family"""
families = ["animation",
@ -81,7 +81,7 @@ class SetFrameRangeWithHandlesLoader(api.Loader):
animationEndTime=end)
class ImportMayaLoader(api.Loader):
class ImportMayaLoader(load.LoaderPlugin):
"""Import action for Maya (unmanaged)
Warning:

View file

@ -1,8 +1,11 @@
import os
import clique
from avalon import api
from openpype.api import get_project_settings
from openpype.pipeline import (
load,
get_representation_path
)
import openpype.hosts.maya.api.plugin
from openpype.hosts.maya.api.plugin import get_reference_node
from openpype.hosts.maya.api.lib import (
@ -106,7 +109,7 @@ class AssProxyLoader(openpype.hosts.maya.api.plugin.ReferenceLoader):
node = container["objectName"]
representation["context"].pop("frame", None)
path = api.get_representation_path(representation)
path = get_representation_path(representation)
print(path)
# path = self.fname
print(self.fname)
@ -164,7 +167,7 @@ class AssProxyLoader(openpype.hosts.maya.api.plugin.ReferenceLoader):
type="string")
class AssStandinLoader(api.Loader):
class AssStandinLoader(load.LoaderPlugin):
"""Load .ASS file as standin"""
families = ["ass"]
@ -240,7 +243,7 @@ class AssStandinLoader(api.Loader):
import pymel.core as pm
path = api.get_representation_path(representation)
path = get_representation_path(representation)
files_in_path = os.listdir(os.path.split(path)[0])
sequence = 0

View file

@ -1,7 +1,10 @@
from avalon import api
from openpype.pipeline import (
load,
remove_container
)
class AssemblyLoader(api.Loader):
class AssemblyLoader(load.LoaderPlugin):
families = ["assembly"]
representations = ["json"]
@ -48,13 +51,11 @@ class AssemblyLoader(api.Loader):
def update(self, container, representation):
from openpype import setdress
return setdress.update_package(container,
representation)
return setdress.update_package(container, representation)
def remove(self, container):
"""Remove all sub containers"""
from avalon import api
from openpype import setdress
import maya.cmds as cmds
@ -63,7 +64,7 @@ class AssemblyLoader(api.Loader):
for member_container in member_containers:
self.log.info("Removing container %s",
member_container['objectName'])
api.remove(member_container)
remove_container(member_container)
# Remove alembic hierarchy reference
# TODO: Check whether removing all contained references is safe enough

View file

@ -1,10 +1,14 @@
from maya import cmds, mel
from avalon import api, io
from avalon import io
from openpype.pipeline import (
load,
get_representation_path
)
from openpype.hosts.maya.api.pipeline import containerise
from openpype.hosts.maya.api.lib import unique_namespace
class AudioLoader(api.Loader):
class AudioLoader(load.LoaderPlugin):
"""Specific loader of audio."""
families = ["audio"]
@ -51,7 +55,7 @@ class AudioLoader(api.Loader):
assert audio_node is not None, "Audio node not found."
path = api.get_representation_path(representation)
path = get_representation_path(representation)
audio_node.filename.set(path)
cmds.setAttr(
container["objectName"] + ".representation",

View file

@ -1,9 +1,13 @@
import os
from avalon import api
from openpype.pipeline import (
load,
get_representation_path
)
from openpype.api import get_project_settings
class GpuCacheLoader(api.Loader):
class GpuCacheLoader(load.LoaderPlugin):
"""Load model Alembic as gpuCache"""
families = ["model"]
@ -73,7 +77,7 @@ class GpuCacheLoader(api.Loader):
import maya.cmds as cmds
path = api.get_representation_path(representation)
path = get_representation_path(representation)
# Update the cache
members = cmds.sets(container['objectName'], query=True)

View file

@ -1,6 +1,10 @@
from Qt import QtWidgets, QtCore
from avalon import api, io
from avalon import io
from openpype.pipeline import (
load,
get_representation_path
)
from openpype.hosts.maya.api.pipeline import containerise
from openpype.hosts.maya.api.lib import unique_namespace
@ -74,7 +78,7 @@ class CameraWindow(QtWidgets.QDialog):
self.close()
class ImagePlaneLoader(api.Loader):
class ImagePlaneLoader(load.LoaderPlugin):
"""Specific loader of plate for image planes on selected camera."""
families = ["image", "plate", "render"]
@ -203,7 +207,7 @@ class ImagePlaneLoader(api.Loader):
assert image_plane_shape is not None, "Image plane not found."
path = api.get_representation_path(representation)
path = get_representation_path(representation)
image_plane_shape.imageName.set(path)
cmds.setAttr(
container["objectName"] + ".representation",

View file

@ -5,7 +5,8 @@ from collections import defaultdict
from Qt import QtWidgets
from avalon import api, io
from avalon import io
from openpype.pipeline import get_representation_path
import openpype.hosts.maya.api.plugin
from openpype.hosts.maya.api import lib
from openpype.widgets.message_window import ScrollMessageBox
@ -77,7 +78,7 @@ class LookLoader(openpype.hosts.maya.api.plugin.ReferenceLoader):
})
# Load relationships
shader_relation = api.get_representation_path(json_representation)
shader_relation = get_representation_path(json_representation)
with open(shader_relation, "r") as f:
json_data = json.load(f)

View file

@ -1,8 +1,8 @@
from avalon import api
from maya import mel
from openpype.pipeline import load
class MatchmoveLoader(api.Loader):
class MatchmoveLoader(load.LoaderPlugin):
"""
This will run matchmove script to create track in scene.

View file

@ -5,8 +5,11 @@ import clique
import maya.cmds as cmds
from avalon import api
from openpype.api import get_project_settings
from openpype.pipeline import (
load,
get_representation_path
)
from openpype.hosts.maya.api.lib import (
namespaced,
maintained_selection,
@ -15,7 +18,7 @@ from openpype.hosts.maya.api.lib import (
from openpype.hosts.maya.api.pipeline import containerise
class RedshiftProxyLoader(api.Loader):
class RedshiftProxyLoader(load.LoaderPlugin):
"""Load Redshift proxy"""
families = ["redshiftproxy"]
@ -78,7 +81,7 @@ class RedshiftProxyLoader(api.Loader):
rs_meshes = cmds.ls(members, type="RedshiftProxyMesh")
assert rs_meshes, "Cannot find RedshiftProxyMesh in container"
filename = api.get_representation_path(representation)
filename = get_representation_path(representation)
for rs_mesh in rs_meshes:
cmds.setAttr("{}.fileName".format(rs_mesh),

View file

@ -7,10 +7,13 @@ instance.
"""
import json
import six
import sys
import six
from avalon import api
from openpype.pipeline import (
load,
get_representation_path
)
from openpype.hosts.maya.api import lib
from openpype.hosts.maya.api.pipeline import containerise
@ -18,7 +21,7 @@ from maya import cmds
import maya.app.renderSetup.model.renderSetup as renderSetup
class RenderSetupLoader(api.Loader):
class RenderSetupLoader(load.LoaderPlugin):
"""Load json preset for RenderSetup overwriting current one."""
families = ["rendersetup"]
@ -87,7 +90,7 @@ class RenderSetupLoader(api.Loader):
"Render setup setting will be overwritten by new version. All "
"setting specified by user not included in loaded version "
"will be lost.")
path = api.get_representation_path(representation)
path = get_representation_path(representation)
with open(path, "r") as file:
try:
renderSetup.instance().decode(

View file

@ -1,9 +1,10 @@
import os
from avalon import api
from openpype.api import get_project_settings
from openpype.pipeline import load
class LoadVDBtoRedShift(api.Loader):
class LoadVDBtoRedShift(load.LoaderPlugin):
"""Load OpenVDB in a Redshift Volume Shape"""
families = ["vdbcache"]

View file

@ -1,6 +1,10 @@
import os
from avalon import api
from openpype.api import get_project_settings
from openpype.pipeline import (
load,
get_representation_path
)
from maya import cmds
@ -69,7 +73,7 @@ def _fix_duplicate_vvg_callbacks():
matched.add(callback)
class LoadVDBtoVRay(api.Loader):
class LoadVDBtoVRay(load.LoaderPlugin):
families = ["vdbcache"]
representations = ["vdb"]
@ -252,7 +256,7 @@ class LoadVDBtoVRay(api.Loader):
def update(self, container, representation):
path = api.get_representation_path(representation)
path = get_representation_path(representation)
# Find VRayVolumeGrid
members = cmds.sets(container['objectName'], query=True)

View file

@ -9,8 +9,12 @@ import os
import maya.cmds as cmds
from avalon import api, io
from avalon import io
from openpype.api import get_project_settings
from openpype.pipeline import (
load,
get_representation_path
)
from openpype.hosts.maya.api.lib import (
maintained_selection,
namespaced,
@ -19,7 +23,7 @@ from openpype.hosts.maya.api.lib import (
from openpype.hosts.maya.api.pipeline import containerise
class VRayProxyLoader(api.Loader):
class VRayProxyLoader(load.LoaderPlugin):
"""Load VRay Proxy with Alembic or VrayMesh."""
families = ["vrayproxy", "model", "pointcache", "animation"]
@ -100,7 +104,10 @@ class VRayProxyLoader(api.Loader):
assert vraymeshes, "Cannot find VRayMesh in container"
# get all representations for this version
filename = self._get_abc(representation["parent"]) or api.get_representation_path(representation) # noqa: E501
filename = (
self._get_abc(representation["parent"])
or get_representation_path(representation)
)
for vray_mesh in vraymeshes:
cmds.setAttr("{}.fileName".format(vray_mesh),
@ -185,7 +192,7 @@ class VRayProxyLoader(api.Loader):
if abc_rep:
self.log.debug("Found, we'll link alembic to vray proxy.")
file_name = api.get_representation_path(abc_rep)
file_name = get_representation_path(abc_rep)
self.log.debug("File: {}".format(self.fname))
return file_name

View file

@ -1,8 +1,11 @@
# -*- coding: utf-8 -*-
import os
import maya.cmds as cmds # noqa
from avalon import api
from openpype.api import get_project_settings
from openpype.pipeline import (
load,
get_representation_path
)
from openpype.hosts.maya.api.lib import (
maintained_selection,
namespaced,
@ -11,7 +14,7 @@ from openpype.hosts.maya.api.lib import (
from openpype.hosts.maya.api.pipeline import containerise
class VRaySceneLoader(api.Loader):
class VRaySceneLoader(load.LoaderPlugin):
"""Load Vray scene"""
families = ["vrayscene_layer"]
@ -78,7 +81,7 @@ class VRaySceneLoader(api.Loader):
vraymeshes = cmds.ls(members, type="VRayScene")
assert vraymeshes, "Cannot find VRayScene in container"
filename = api.get_representation_path(representation)
filename = get_representation_path(representation)
for vray_mesh in vraymeshes:
cmds.setAttr("{}.FilePath".format(vray_mesh),

View file

@ -7,13 +7,17 @@ from pprint import pprint
from maya import cmds
from avalon import api, io
from avalon import io
from openpype.api import get_project_settings
from openpype.pipeline import (
load,
get_representation_path
)
from openpype.hosts.maya.api import lib
from openpype.hosts.maya.api.pipeline import containerise
class YetiCacheLoader(api.Loader):
class YetiCacheLoader(load.LoaderPlugin):
families = ["yeticache", "yetiRig"]
representations = ["fur"]
@ -121,8 +125,8 @@ class YetiCacheLoader(api.Loader):
"cannot find fursettings representation"
)
settings_fname = api.get_representation_path(fur_settings)
path = api.get_representation_path(representation)
settings_fname = get_representation_path(fur_settings)
path = get_representation_path(representation)
# Get all node data
with open(settings_fname, "r") as fp:
settings = json.load(fp)

View file

@ -15,7 +15,11 @@ from openpype.api import (
get_current_project_settings
)
from openpype.lib import register_event_callback
from openpype.pipeline import LegacyCreator
from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
deregister_loader_plugin_path,
)
from openpype.tools.utils import host_tools
from .command import viewer_update_and_undo_stop
@ -99,7 +103,7 @@ def install():
log.info("Registering Nuke plug-ins..")
pyblish.api.register_plugin_path(PUBLISH_PATH)
avalon.api.register_plugin_path(avalon.api.Loader, LOAD_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)
@ -125,7 +129,7 @@ def uninstall():
log.info("Deregistering Nuke plug-ins..")
pyblish.deregister_host("nuke")
pyblish.api.deregister_plugin_path(PUBLISH_PATH)
avalon.api.deregister_plugin_path(avalon.api.Loader, LOAD_PATH)
deregister_loader_plugin_path(LOAD_PATH)
avalon.api.deregister_plugin_path(LegacyCreator, CREATE_PATH)
pyblish.api.deregister_callback(

View file

@ -4,10 +4,11 @@ import string
import nuke
import avalon.api
from openpype.api import get_current_project_settings
from openpype.pipeline import LegacyCreator
from openpype.pipeline import (
LegacyCreator,
LoaderPlugin,
)
from .lib import (
Knobby,
check_subsetname_exists,
@ -85,7 +86,7 @@ def get_review_presets_config():
return [str(name) for name, _prop in outputs.items()]
class NukeLoader(avalon.api.Loader):
class NukeLoader(LoaderPlugin):
container_id_knob = "containerId"
container_id = None

View file

@ -2,13 +2,13 @@
"""
from avalon import api
from openpype.api import Logger
from openpype.pipeline import load
log = Logger().get_logger(__name__)
class SetFrameRangeLoader(api.Loader):
class SetFrameRangeLoader(load.LoaderPlugin):
"""Specific loader of Alembic for the avalon.animation family"""
families = ["animation",
@ -42,7 +42,7 @@ class SetFrameRangeLoader(api.Loader):
lib.update_frame_range(start, end)
class SetFrameRangeWithHandlesLoader(api.Loader):
class SetFrameRangeWithHandlesLoader(load.LoaderPlugin):
"""Specific loader of Alembic for the avalon.animation family"""
families = ["animation",

View file

@ -1,7 +1,11 @@
from avalon import api, io
from avalon import io
import nuke
import nukescripts
from openpype.pipeline import (
load,
get_representation_path,
)
from openpype.hosts.nuke.api.lib import (
find_free_space_to_paste_nodes,
maintained_selection,
@ -14,7 +18,7 @@ from openpype.hosts.nuke.api.commands import viewer_update_and_undo_stop
from openpype.hosts.nuke.api import containerise, update_container
class LoadBackdropNodes(api.Loader):
class LoadBackdropNodes(load.LoaderPlugin):
"""Loading Published Backdrop nodes (workfile, nukenodes)"""
representations = ["nk"]
@ -191,7 +195,7 @@ class LoadBackdropNodes(api.Loader):
# get corresponding node
GN = nuke.toNode(container['objectName'])
file = api.get_representation_path(representation).replace("\\", "/")
file = get_representation_path(representation).replace("\\", "/")
context = representation["context"]
name = container['name']
version_data = version.get("data", {})

View file

@ -1,6 +1,10 @@
import nuke
from avalon import api, io
from avalon import io
from openpype.pipeline import (
load,
get_representation_path,
)
from openpype.hosts.nuke.api import (
containerise,
update_container,
@ -11,7 +15,7 @@ from openpype.hosts.nuke.api.lib import (
)
class AlembicCameraLoader(api.Loader):
class AlembicCameraLoader(load.LoaderPlugin):
"""
This will load alembic camera into script.
"""
@ -127,7 +131,7 @@ class AlembicCameraLoader(api.Loader):
data_imprint.update({k: version_data[k]})
# getting file path
file = api.get_representation_path(representation).replace("\\", "/")
file = get_representation_path(representation).replace("\\", "/")
with maintained_selection():
camera_node = nuke.toNode(object_name)

View file

@ -1,7 +1,8 @@
import nuke
import qargparse
from avalon import api, io
from avalon import io
from openpype.pipeline import get_representation_path
from openpype.hosts.nuke.api.lib import (
get_imageio_input_colorspace,
maintained_selection
@ -41,6 +42,9 @@ class LoadClip(plugin.NukeLoader):
icon = "file-video-o"
color = "white"
# Loaded from settings
_representations = []
script_start = int(nuke.root()["first_frame"].value())
# option gui
@ -186,7 +190,7 @@ class LoadClip(plugin.NukeLoader):
is_sequence = len(representation["files"]) > 1
read_node = nuke.toNode(container['objectName'])
file = api.get_representation_path(representation).replace("\\", "/")
file = get_representation_path(representation).replace("\\", "/")
start_at_workfile = bool("start at" in read_node['frame_mode'].value())

View file

@ -1,8 +1,13 @@
import json
from collections import OrderedDict
import nuke
from avalon import api, io
from avalon import io
from openpype.pipeline import (
load,
get_representation_path,
)
from openpype.hosts.nuke.api import (
containerise,
update_container,
@ -10,7 +15,7 @@ from openpype.hosts.nuke.api import (
)
class LoadEffects(api.Loader):
class LoadEffects(load.LoaderPlugin):
"""Loading colorspace soft effect exported from nukestudio"""
representations = ["effectJson"]
@ -150,7 +155,7 @@ class LoadEffects(api.Loader):
# get corresponding node
GN = nuke.toNode(container['objectName'])
file = api.get_representation_path(representation).replace("\\", "/")
file = get_representation_path(representation).replace("\\", "/")
name = container['name']
version_data = version.get("data", {})
vname = version.get("name", None)

View file

@ -3,8 +3,12 @@ from collections import OrderedDict
import nuke
from avalon import api, io
from avalon import io
from openpype.pipeline import (
load,
get_representation_path,
)
from openpype.hosts.nuke.api import lib
from openpype.hosts.nuke.api import (
containerise,
@ -13,7 +17,7 @@ from openpype.hosts.nuke.api import (
)
class LoadEffectsInputProcess(api.Loader):
class LoadEffectsInputProcess(load.LoaderPlugin):
"""Loading colorspace soft effect exported from nukestudio"""
representations = ["effectJson"]
@ -157,7 +161,7 @@ class LoadEffectsInputProcess(api.Loader):
# get corresponding node
GN = nuke.toNode(container['objectName'])
file = api.get_representation_path(representation).replace("\\", "/")
file = get_representation_path(representation).replace("\\", "/")
name = container['name']
version_data = version.get("data", {})
vname = version.get("name", None)

View file

@ -1,6 +1,11 @@
import nuke
from avalon import api, io
from avalon import io
from openpype.pipeline import (
load,
get_representation_path,
)
from openpype.hosts.nuke.api.lib import (
maintained_selection,
get_avalon_knob_data,
@ -13,7 +18,7 @@ from openpype.hosts.nuke.api import (
)
class LoadGizmo(api.Loader):
class LoadGizmo(load.LoaderPlugin):
"""Loading nuke Gizmo"""
representations = ["gizmo"]
@ -104,7 +109,7 @@ class LoadGizmo(api.Loader):
# get corresponding node
GN = nuke.toNode(container['objectName'])
file = api.get_representation_path(representation).replace("\\", "/")
file = get_representation_path(representation).replace("\\", "/")
name = container['name']
version_data = version.get("data", {})
vname = version.get("name", None)

View file

@ -1,6 +1,11 @@
from avalon import api, io
import nuke
from avalon import io
from openpype.pipeline import (
load,
get_representation_path,
)
from openpype.hosts.nuke.api.lib import (
maintained_selection,
create_backdrop,
@ -14,7 +19,7 @@ from openpype.hosts.nuke.api import (
)
class LoadGizmoInputProcess(api.Loader):
class LoadGizmoInputProcess(load.LoaderPlugin):
"""Loading colorspace soft effect exported from nukestudio"""
representations = ["gizmo"]
@ -110,7 +115,7 @@ class LoadGizmoInputProcess(api.Loader):
# get corresponding node
GN = nuke.toNode(container['objectName'])
file = api.get_representation_path(representation).replace("\\", "/")
file = get_representation_path(representation).replace("\\", "/")
name = container['name']
version_data = version.get("data", {})
vname = version.get("name", None)

View file

@ -1,8 +1,12 @@
import nuke
import qargparse
from avalon import api, io
from avalon import io
from openpype.pipeline import (
load,
get_representation_path,
)
from openpype.hosts.nuke.api.lib import (
get_imageio_input_colorspace
)
@ -13,7 +17,7 @@ from openpype.hosts.nuke.api import (
)
class LoadImage(api.Loader):
class LoadImage(load.LoaderPlugin):
"""Load still image into Nuke"""
families = [
@ -32,6 +36,9 @@ class LoadImage(api.Loader):
icon = "image"
color = "white"
# Loaded from settings
_representations = []
node_name_template = "{class_name}_{ext}"
options = [
@ -161,7 +168,7 @@ class LoadImage(api.Loader):
repr_cont = representation["context"]
file = api.get_representation_path(representation)
file = get_representation_path(representation)
if not file:
repr_id = representation["_id"]

View file

@ -1,8 +1,8 @@
from avalon import api
import nuke
from openpype.pipeline import load
class MatchmoveLoader(api.Loader):
class MatchmoveLoader(load.LoaderPlugin):
"""
This will run matchmove script to create track in script.
"""

View file

@ -1,5 +1,9 @@
import nuke
from avalon import api, io
from avalon import io
from openpype.pipeline import (
load,
get_representation_path,
)
from openpype.hosts.nuke.api.lib import maintained_selection
from openpype.hosts.nuke.api import (
containerise,
@ -8,7 +12,7 @@ from openpype.hosts.nuke.api import (
)
class AlembicModelLoader(api.Loader):
class AlembicModelLoader(load.LoaderPlugin):
"""
This will load alembic model into script.
"""
@ -124,7 +128,7 @@ class AlembicModelLoader(api.Loader):
data_imprint.update({k: version_data[k]})
# getting file path
file = api.get_representation_path(representation).replace("\\", "/")
file = get_representation_path(representation).replace("\\", "/")
with maintained_selection():
model_node = nuke.toNode(object_name)

View file

@ -1,6 +1,11 @@
import nuke
from avalon import api, io
from avalon import io
from openpype.pipeline import (
load,
get_representation_path,
)
from openpype.hosts.nuke.api.lib import get_avalon_knob_data
from openpype.hosts.nuke.api import (
containerise,
@ -9,7 +14,7 @@ from openpype.hosts.nuke.api import (
)
class LinkAsGroup(api.Loader):
class LinkAsGroup(load.LoaderPlugin):
"""Copy the published file to be pasted at the desired location"""
representations = ["nk"]
@ -109,7 +114,7 @@ class LinkAsGroup(api.Loader):
"""
node = nuke.toNode(container['objectName'])
root = api.get_representation_path(representation).replace("\\", "/")
root = get_representation_path(representation).replace("\\", "/")
# Get start frame from version data
version = io.find_one({

View file

@ -3,8 +3,9 @@ import re
from pprint import pformat
import nuke
import pyblish.api
from avalon import io
import openpype.api as pype
from avalon import io, api
from openpype.pipeline import get_representation_path
@pyblish.api.log
@ -182,7 +183,7 @@ class CollectNukeWrites(pyblish.api.InstancePlugin):
if repre_doc:
instance.data["audio"] = [{
"offset": 0,
"filename": api.get_representation_path(repre_doc)
"filename": get_representation_path(repre_doc)
}]
self.log.debug("instance.data: {}".format(pformat(instance.data)))

View file

@ -1,12 +1,16 @@
import os
import toml
import nuke
import toml
import pyblish.api
from avalon import api
from bson.objectid import ObjectId
from openpype.pipeline import (
discover_loader_plugins,
load_container,
)
class RepairReadLegacyAction(pyblish.api.Action):
@ -49,13 +53,13 @@ class RepairReadLegacyAction(pyblish.api.Action):
loader_name = "LoadMov"
loader_plugin = None
for Loader in api.discover(api.Loader):
for Loader in discover_loader_plugins():
if Loader.__name__ != loader_name:
continue
loader_plugin = Loader
api.load(
load_container(
Loader=loader_plugin,
representation=ObjectId(data["representation"])
)

View file

@ -195,11 +195,12 @@ class ExtractImage(openpype.api.Extractor):
#### Loader Plugin
```python
from avalon import api, photoshop
from openpype.pipeline import load, get_representation_path
stub = photoshop.stub()
class ImageLoader(api.Loader):
class ImageLoader(load.LoaderPlugin):
"""Load images
Stores the imported asset in a container named after the asset.
@ -227,7 +228,7 @@ class ImageLoader(api.Loader):
with photoshop.maintained_selection():
stub.replace_smart_object(
layer, api.get_representation_path(representation)
layer, get_representation_path(representation)
)
stub.imprint(
@ -245,7 +246,7 @@ https://community.adobe.com/t5/download-install/adobe-extension-debuger-problem/
Add --enable-blink-features=ShadowDOMV0,CustomElementsV0 when starting Chrome
then localhost:8078 (port set in `photoshop\extension\.debug`)
Or use Visual Studio Code https://medium.com/adobetech/extendscript-debugger-for-visual-studio-code-public-release-a2ff6161fa01
Or use Visual Studio Code https://medium.com/adobetech/extendscript-debugger-for-visual-studio-code-public-release-a2ff6161fa01
Or install CEF client from https://github.com/Adobe-CEP/CEP-Resources/tree/master/CEP_9.x
## Resources

View file

@ -6,9 +6,12 @@ import avalon.api
from avalon import pipeline, io
from openpype.api import Logger
from openpype.lib import register_event_callback
from openpype.pipeline import LegacyCreator
from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
deregister_loader_plugin_path,
)
import openpype.hosts.photoshop
from . import lib
@ -69,7 +72,7 @@ def install():
pyblish.api.register_host("photoshop")
pyblish.api.register_plugin_path(PUBLISH_PATH)
avalon.api.register_plugin_path(avalon.api.Loader, LOAD_PATH)
register_loader_plugin_path(LOAD_PATH)
avalon.api.register_plugin_path(LegacyCreator, CREATE_PATH)
log.info(PUBLISH_PATH)
@ -82,7 +85,7 @@ def install():
def uninstall():
pyblish.api.deregister_plugin_path(PUBLISH_PATH)
avalon.api.deregister_plugin_path(avalon.api.Loader, LOAD_PATH)
deregister_loader_plugin_path(LOAD_PATH)
avalon.api.deregister_plugin_path(LegacyCreator, CREATE_PATH)

View file

@ -1,6 +1,6 @@
import re
import avalon.api
from openpype.pipeline import LoaderPlugin
from .launch_logic import stub
@ -29,7 +29,7 @@ def get_unique_layer_name(layers, asset_name, subset_name):
return "{}_{:0>3d}".format(name, occurrences + 1)
class PhotoshopLoader(avalon.api.Loader):
class PhotoshopLoader(LoaderPlugin):
@staticmethod
def get_stub():
return stub()

View file

@ -1,6 +1,6 @@
import re
from avalon import api
from openpype.pipeline import get_representation_path
from openpype.hosts.photoshop import api as photoshop
from openpype.hosts.photoshop.api import get_unique_layer_name
@ -54,7 +54,7 @@ class ImageLoader(photoshop.PhotoshopLoader):
else: # switching version - keep same name
layer_name = container["namespace"]
path = api.get_representation_path(representation)
path = get_representation_path(representation)
with photoshop.maintained_selection():
stub.replace_smart_object(
layer, path, layer_name

View file

@ -1,8 +1,8 @@
import os
import qargparse
from avalon.pipeline import get_representation_path_from_context
from openpype.pipeline import get_representation_path_from_context
from openpype.hosts.photoshop import api as photoshop
from openpype.hosts.photoshop.api import get_unique_layer_name

View file

@ -1,7 +1,6 @@
import re
from avalon import api
from openpype.pipeline import get_representation_path
from openpype.hosts.photoshop import api as photoshop
from openpype.hosts.photoshop.api import get_unique_layer_name
@ -55,7 +54,7 @@ class ReferenceLoader(photoshop.PhotoshopLoader):
else: # switching version - keep same name
layer_name = container["namespace"]
path = api.get_representation_path(representation)
path = get_representation_path(representation)
with photoshop.maintained_selection():
stub.replace_smart_object(
layer, path, layer_name

View file

@ -9,7 +9,11 @@ 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
from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
deregister_loader_plugin_path,
)
from . import lib
from . import PLUGINS_DIR
from openpype.tools.utils import host_tools
@ -42,7 +46,7 @@ def install():
pyblish.register_plugin_path(PUBLISH_PATH)
log.info("Registering DaVinci Resovle plug-ins..")
avalon.register_plugin_path(avalon.Loader, LOAD_PATH)
register_loader_plugin_path(LOAD_PATH)
avalon.register_plugin_path(LegacyCreator, CREATE_PATH)
avalon.register_plugin_path(avalon.InventoryAction, INVENTORY_PATH)
@ -67,7 +71,7 @@ def uninstall():
pyblish.deregister_plugin_path(PUBLISH_PATH)
log.info("Deregistering DaVinci Resovle plug-ins..")
avalon.deregister_plugin_path(avalon.Loader, LOAD_PATH)
deregister_loader_plugin_path(LOAD_PATH)
avalon.deregister_plugin_path(LegacyCreator, CREATE_PATH)
avalon.deregister_plugin_path(avalon.InventoryAction, INVENTORY_PATH)

View file

@ -4,14 +4,15 @@ import uuid
import qargparse
from Qt import QtWidgets, QtCore
from avalon import api
import openpype.api as pype
from openpype.pipeline import LegacyCreator
from openpype.pipeline import (
LegacyCreator,
LoaderPlugin,
)
from openpype.hosts import resolve
from . import lib
class CreatorWidget(QtWidgets.QDialog):
# output items
@ -292,7 +293,7 @@ class ClipLoader:
""" Initialize object
Arguments:
cls (avalon.api.Loader): plugin object
cls (openpype.pipeline.load.LoaderPlugin): plugin object
context (dict): loader plugin context
options (dict)[optional]: possible keys:
projectBinPath: "path/to/binItem"
@ -448,7 +449,7 @@ class ClipLoader:
return timeline_item
class TimelineItemLoader(api.Loader):
class TimelineItemLoader(LoaderPlugin):
"""A basic SequenceLoader for Resolve
This will implement the basic behavior for a loader to inherit from that

View file

@ -1,11 +1,14 @@
from avalon import io, api
from openpype.hosts import resolve
from copy import deepcopy
from importlib import reload
from avalon import io
from openpype.hosts import resolve
from openpype.pipeline import get_representation_path
from openpype.hosts.resolve.api import lib, plugin
reload(plugin)
reload(lib)
class LoadClip(resolve.TimelineItemLoader):
"""Load a subset to timeline as clip
@ -99,7 +102,7 @@ class LoadClip(resolve.TimelineItemLoader):
version_name = version.get("name", None)
colorspace = version_data.get("colorspace", None)
object_name = "{}_{}".format(name, namespace)
self.fname = api.get_representation_path(representation)
self.fname = get_representation_path(representation)
context["version"] = {"data": version_data}
loader = resolve.ClipLoader(self, context)

View file

@ -15,7 +15,11 @@ from avalon.pipeline import AVALON_CONTAINER_ID
from openpype.hosts import tvpaint
from openpype.api import get_current_project_settings
from openpype.lib import register_event_callback
from openpype.pipeline import LegacyCreator
from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
deregister_loader_plugin_path,
)
from .lib import (
execute_george,
@ -77,7 +81,7 @@ def install():
pyblish.api.register_host("tvpaint")
pyblish.api.register_plugin_path(PUBLISH_PATH)
avalon.api.register_plugin_path(avalon.api.Loader, LOAD_PATH)
register_loader_plugin_path(LOAD_PATH)
avalon.api.register_plugin_path(LegacyCreator, CREATE_PATH)
registered_callbacks = (
@ -99,7 +103,7 @@ def uninstall():
log.info("OpenPype - Uninstalling TVPaint integration")
pyblish.api.deregister_host("tvpaint")
pyblish.api.deregister_plugin_path(PUBLISH_PATH)
avalon.api.deregister_plugin_path(avalon.api.Loader, LOAD_PATH)
deregister_loader_plugin_path(LOAD_PATH)
avalon.api.deregister_plugin_path(LegacyCreator, CREATE_PATH)

View file

@ -1,9 +1,10 @@
import re
import uuid
import avalon.api
from openpype.pipeline import LegacyCreator
from openpype.pipeline import (
LegacyCreator,
LoaderPlugin,
)
from openpype.hosts.tvpaint.api import (
pipeline,
lib
@ -74,7 +75,7 @@ class Creator(LegacyCreator):
self.write_instances(data)
class Loader(avalon.api.Loader):
class Loader(LoaderPlugin):
hosts = ["tvpaint"]
@staticmethod

View file

@ -7,7 +7,11 @@ import pyblish.api
from avalon.pipeline import AVALON_CONTAINER_ID
from avalon import api
from openpype.pipeline import LegacyCreator
from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
deregister_loader_plugin_path,
)
from openpype.tools.utils import host_tools
import openpype.hosts.unreal
@ -44,7 +48,7 @@ def install():
print("-=" * 40)
logger.info("installing OpenPype for Unreal")
pyblish.api.register_plugin_path(str(PUBLISH_PATH))
api.register_plugin_path(api.Loader, str(LOAD_PATH))
register_loader_plugin_path(str(LOAD_PATH))
api.register_plugin_path(LegacyCreator, str(CREATE_PATH))
_register_callbacks()
_register_events()
@ -53,7 +57,7 @@ def install():
def uninstall():
"""Uninstall Unreal configuration for Avalon."""
pyblish.api.deregister_plugin_path(str(PUBLISH_PATH))
api.deregister_plugin_path(api.Loader, str(LOAD_PATH))
deregister_loader_plugin_path(str(LOAD_PATH))
api.deregister_plugin_path(LegacyCreator, str(CREATE_PATH))

View file

@ -1,8 +1,10 @@
# -*- coding: utf-8 -*-
from abc import ABC
from openpype.pipeline import LegacyCreator
import avalon.api
from openpype.pipeline import (
LegacyCreator,
LoaderPlugin,
)
class Creator(LegacyCreator):
@ -10,6 +12,6 @@ class Creator(LegacyCreator):
defaults = ['Main']
class Loader(avalon.api.Loader, ABC):
class Loader(LoaderPlugin, ABC):
"""This serves as skeleton for future OpenPype specific functionality"""
pass

View file

@ -2,7 +2,8 @@
"""Loader for published alembics."""
import os
from avalon import api, pipeline
from avalon import pipeline
from openpype.pipeline import get_representation_path
from openpype.hosts.unreal.api import plugin
from openpype.hosts.unreal.api import pipeline as unreal_pipeline
@ -140,7 +141,7 @@ class PointCacheAlembicLoader(plugin.Loader):
def update(self, container, representation):
name = container["asset_name"]
source_path = api.get_representation_path(representation)
source_path = get_representation_path(representation)
destination_path = container["namespace"]
task = self.get_task(source_path, destination_path, name, True)

View file

@ -2,7 +2,8 @@
"""Load Skeletal Mesh alembics."""
import os
from avalon import api, pipeline
from avalon import pipeline
from openpype.pipeline import get_representation_path
from openpype.hosts.unreal.api import plugin
from openpype.hosts.unreal.api import pipeline as unreal_pipeline
import unreal # noqa
@ -104,7 +105,7 @@ class SkeletalMeshAlembicLoader(plugin.Loader):
def update(self, container, representation):
name = container["asset_name"]
source_path = api.get_representation_path(representation)
source_path = get_representation_path(representation)
destination_path = container["namespace"]
task = unreal.AssetImportTask()

View file

@ -2,7 +2,8 @@
"""Loader for Static Mesh alembics."""
import os
from avalon import api, pipeline
from avalon import pipeline
from openpype.pipeline import get_representation_path
from openpype.hosts.unreal.api import plugin
from openpype.hosts.unreal.api import pipeline as unreal_pipeline
import unreal # noqa
@ -123,7 +124,7 @@ class StaticMeshAlembicLoader(plugin.Loader):
def update(self, container, representation):
name = container["asset_name"]
source_path = api.get_representation_path(representation)
source_path = get_representation_path(representation)
destination_path = container["namespace"]
task = self.get_task(source_path, destination_path, name, True)

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