Merge branch 'develop' into feature/OP-2731_Flame-rendering-presets-resolution-and-regex-comment-filter

This commit is contained in:
Jakub Jezek 2022-03-16 16:57:27 +01:00
commit 30d0347d90
No known key found for this signature in database
GPG key ID: D8548FBF690B100A
195 changed files with 3129 additions and 1136 deletions

View file

@ -1,16 +1,31 @@
# Changelog # Changelog
## [3.9.0-nightly.8](https://github.com/pypeclub/OpenPype/tree/HEAD) ## [3.9.1-nightly.1](https://github.com/pypeclub/OpenPype/tree/HEAD)
[Full Changelog](https://github.com/pypeclub/OpenPype/compare/3.8.2...HEAD) [Full Changelog](https://github.com/pypeclub/OpenPype/compare/3.9.0...HEAD)
**🐛 Bug fixes**
- Harmony - fixed creator issue [\#2891](https://github.com/pypeclub/OpenPype/pull/2891)
- General: Remove forgotten use of avalon Creator [\#2885](https://github.com/pypeclub/OpenPype/pull/2885)
- General: Avoid circular import [\#2884](https://github.com/pypeclub/OpenPype/pull/2884)
- Fixes for attaching loaded containers \(\#2837\) [\#2874](https://github.com/pypeclub/OpenPype/pull/2874)
**🔀 Refactored code**
- General: Reduce style usage to OpenPype repository [\#2889](https://github.com/pypeclub/OpenPype/pull/2889)
## [3.9.0](https://github.com/pypeclub/OpenPype/tree/3.9.0) (2022-03-14)
[Full Changelog](https://github.com/pypeclub/OpenPype/compare/CI/3.9.0-nightly.9...3.9.0)
**Deprecated:** **Deprecated:**
- AssetCreator: Remove the tool [\#2845](https://github.com/pypeclub/OpenPype/pull/2845) - AssetCreator: Remove the tool [\#2845](https://github.com/pypeclub/OpenPype/pull/2845)
- Houdini: Remove unused code [\#2779](https://github.com/pypeclub/OpenPype/pull/2779)
**🚀 Enhancements** **🚀 Enhancements**
- General: Subset name filtering in ExtractReview outpus [\#2872](https://github.com/pypeclub/OpenPype/pull/2872)
- NewPublisher: Descriptions and Icons in creator dialog [\#2867](https://github.com/pypeclub/OpenPype/pull/2867) - NewPublisher: Descriptions and Icons in creator dialog [\#2867](https://github.com/pypeclub/OpenPype/pull/2867)
- NewPublisher: Changing task on publishing instance [\#2863](https://github.com/pypeclub/OpenPype/pull/2863) - NewPublisher: Changing task on publishing instance [\#2863](https://github.com/pypeclub/OpenPype/pull/2863)
- TrayPublisher: Choose project widget is more clear [\#2859](https://github.com/pypeclub/OpenPype/pull/2859) - TrayPublisher: Choose project widget is more clear [\#2859](https://github.com/pypeclub/OpenPype/pull/2859)
@ -22,11 +37,12 @@
- global: letter box calculated on output as last process [\#2812](https://github.com/pypeclub/OpenPype/pull/2812) - global: letter box calculated on output as last process [\#2812](https://github.com/pypeclub/OpenPype/pull/2812)
- Nuke: adding Reformat to baking mov plugin [\#2811](https://github.com/pypeclub/OpenPype/pull/2811) - Nuke: adding Reformat to baking mov plugin [\#2811](https://github.com/pypeclub/OpenPype/pull/2811)
- Manager: Update all to latest button [\#2805](https://github.com/pypeclub/OpenPype/pull/2805) - Manager: Update all to latest button [\#2805](https://github.com/pypeclub/OpenPype/pull/2805)
- General: Set context environments for non host applications [\#2803](https://github.com/pypeclub/OpenPype/pull/2803)
**🐛 Bug fixes** **🐛 Bug fixes**
- General: Missing time function [\#2877](https://github.com/pypeclub/OpenPype/pull/2877)
- Deadline: Fix plugin name for tile assemble [\#2868](https://github.com/pypeclub/OpenPype/pull/2868) - Deadline: Fix plugin name for tile assemble [\#2868](https://github.com/pypeclub/OpenPype/pull/2868)
- Nuke: gizmo precollect fix [\#2866](https://github.com/pypeclub/OpenPype/pull/2866)
- General: Fix hardlink for windows [\#2864](https://github.com/pypeclub/OpenPype/pull/2864) - General: Fix hardlink for windows [\#2864](https://github.com/pypeclub/OpenPype/pull/2864)
- General: ffmpeg was crashing on slate merge [\#2860](https://github.com/pypeclub/OpenPype/pull/2860) - General: ffmpeg was crashing on slate merge [\#2860](https://github.com/pypeclub/OpenPype/pull/2860)
- WebPublisher: Video file was published with one too many frame [\#2858](https://github.com/pypeclub/OpenPype/pull/2858) - WebPublisher: Video file was published with one too many frame [\#2858](https://github.com/pypeclub/OpenPype/pull/2858)
@ -35,6 +51,7 @@
- Nuke: slate resolution to input video resolution [\#2853](https://github.com/pypeclub/OpenPype/pull/2853) - Nuke: slate resolution to input video resolution [\#2853](https://github.com/pypeclub/OpenPype/pull/2853)
- WebPublisher: Fix username stored in DB [\#2852](https://github.com/pypeclub/OpenPype/pull/2852) - WebPublisher: Fix username stored in DB [\#2852](https://github.com/pypeclub/OpenPype/pull/2852)
- WebPublisher: Fix wrong number of frames for video file [\#2851](https://github.com/pypeclub/OpenPype/pull/2851) - WebPublisher: Fix wrong number of frames for video file [\#2851](https://github.com/pypeclub/OpenPype/pull/2851)
- Nuke: Fix family test in validate\_write\_legacy to work with stillImage [\#2847](https://github.com/pypeclub/OpenPype/pull/2847)
- Nuke: fix multiple baking profile farm publishing [\#2842](https://github.com/pypeclub/OpenPype/pull/2842) - Nuke: fix multiple baking profile farm publishing [\#2842](https://github.com/pypeclub/OpenPype/pull/2842)
- Blender: Fixed parameters for FBX export of the camera [\#2840](https://github.com/pypeclub/OpenPype/pull/2840) - Blender: Fixed parameters for FBX export of the camera [\#2840](https://github.com/pypeclub/OpenPype/pull/2840)
- Maya: Stop creation of reviews for Cryptomattes [\#2832](https://github.com/pypeclub/OpenPype/pull/2832) - Maya: Stop creation of reviews for Cryptomattes [\#2832](https://github.com/pypeclub/OpenPype/pull/2832)
@ -47,23 +64,18 @@
- Ftrack: Job killer with missing user [\#2819](https://github.com/pypeclub/OpenPype/pull/2819) - Ftrack: Job killer with missing user [\#2819](https://github.com/pypeclub/OpenPype/pull/2819)
- Nuke: Use AVALON\_APP to get value for "app" key [\#2818](https://github.com/pypeclub/OpenPype/pull/2818) - Nuke: Use AVALON\_APP to get value for "app" key [\#2818](https://github.com/pypeclub/OpenPype/pull/2818)
- StandalonePublisher: use dynamic groups in subset names [\#2816](https://github.com/pypeclub/OpenPype/pull/2816) - StandalonePublisher: use dynamic groups in subset names [\#2816](https://github.com/pypeclub/OpenPype/pull/2816)
- Settings UI: Search case sensitivity [\#2810](https://github.com/pypeclub/OpenPype/pull/2810)
- Flame Babypublisher optimalization [\#2806](https://github.com/pypeclub/OpenPype/pull/2806)
**🔀 Refactored code** **🔀 Refactored code**
- Refactor: move webserver tool to openpype [\#2876](https://github.com/pypeclub/OpenPype/pull/2876)
- General: Move create logic from avalon to OpenPype [\#2854](https://github.com/pypeclub/OpenPype/pull/2854) - General: Move create logic from avalon to OpenPype [\#2854](https://github.com/pypeclub/OpenPype/pull/2854)
- General: Add vendors from avalon [\#2848](https://github.com/pypeclub/OpenPype/pull/2848) - General: Add vendors from avalon [\#2848](https://github.com/pypeclub/OpenPype/pull/2848)
- General: Basic event system [\#2846](https://github.com/pypeclub/OpenPype/pull/2846)
- General: Move change context functions [\#2839](https://github.com/pypeclub/OpenPype/pull/2839) - General: Move change context functions [\#2839](https://github.com/pypeclub/OpenPype/pull/2839)
- Tools: Don't use avalon tools code [\#2829](https://github.com/pypeclub/OpenPype/pull/2829) - Tools: Don't use avalon tools code [\#2829](https://github.com/pypeclub/OpenPype/pull/2829)
- Move Unreal Implementation to OpenPype [\#2823](https://github.com/pypeclub/OpenPype/pull/2823) - Move Unreal Implementation to OpenPype [\#2823](https://github.com/pypeclub/OpenPype/pull/2823)
- General: Extract template formatting from anatomy [\#2766](https://github.com/pypeclub/OpenPype/pull/2766) - General: Extract template formatting from anatomy [\#2766](https://github.com/pypeclub/OpenPype/pull/2766)
**Merged pull requests:**
- Nuke: gizmo precollect fix [\#2866](https://github.com/pypeclub/OpenPype/pull/2866)
- Nuke: Fix family test in validate\_write\_legacy to work with stillImage [\#2847](https://github.com/pypeclub/OpenPype/pull/2847)
## [3.8.2](https://github.com/pypeclub/OpenPype/tree/3.8.2) (2022-02-07) ## [3.8.2](https://github.com/pypeclub/OpenPype/tree/3.8.2) (2022-02-07)
[Full Changelog](https://github.com/pypeclub/OpenPype/compare/CI/3.8.2-nightly.3...3.8.2) [Full Changelog](https://github.com/pypeclub/OpenPype/compare/CI/3.8.2-nightly.3...3.8.2)

View file

@ -5,13 +5,13 @@ import platform
import functools import functools
import logging import logging
from openpype.pipeline import LegacyCreator
from .settings import get_project_settings from .settings import get_project_settings
from .lib import ( from .lib import (
Anatomy, Anatomy,
filter_pyblish_plugins, filter_pyblish_plugins,
set_plugin_attributes_from_settings, set_plugin_attributes_from_settings,
change_timer_to_current_context change_timer_to_current_context,
register_event_callback,
) )
pyblish = avalon = _original_discover = None pyblish = avalon = _original_discover = None
@ -75,6 +75,10 @@ def install():
"""Install Pype to Avalon.""" """Install Pype to Avalon."""
from pyblish.lib import MessageHandler from pyblish.lib import MessageHandler
from openpype.modules import load_modules from openpype.modules import load_modules
from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
)
from avalon import pipeline from avalon import pipeline
# Make sure modules are loaded # Make sure modules are loaded
@ -90,7 +94,7 @@ def install():
log.info("Registering global plug-ins..") log.info("Registering global plug-ins..")
pyblish.register_plugin_path(PUBLISH_PATH) pyblish.register_plugin_path(PUBLISH_PATH)
pyblish.register_discovery_filter(filter_pyblish_plugins) 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") project_name = os.environ.get("AVALON_PROJECT")
@ -118,7 +122,7 @@ def install():
continue continue
pyblish.register_plugin_path(path) 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(LegacyCreator, path)
avalon.register_plugin_path(avalon.InventoryAction, path) avalon.register_plugin_path(avalon.InventoryAction, path)
@ -128,20 +132,22 @@ def install():
avalon.discover = patched_discover avalon.discover = patched_discover
pipeline.discover = patched_discover pipeline.discover = patched_discover
avalon.on("taskChanged", _on_task_change) register_event_callback("taskChanged", _on_task_change)
def _on_task_change(*args): def _on_task_change():
change_timer_to_current_context() change_timer_to_current_context()
@import_wrapper @import_wrapper
def uninstall(): def uninstall():
"""Uninstall Pype from Avalon.""" """Uninstall Pype from Avalon."""
from openpype.pipeline import deregister_loader_plugin_path
log.info("Deregistering global plug-ins..") log.info("Deregistering global plug-ins..")
pyblish.deregister_plugin_path(PUBLISH_PATH) pyblish.deregister_plugin_path(PUBLISH_PATH)
pyblish.deregister_discovery_filter(filter_pyblish_plugins) 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") log.info("Global plug-ins unregistred")
# restore original discover # restore original discover

View file

@ -15,7 +15,7 @@ from Qt import QtCore
from openpype.tools.utils import host_tools from openpype.tools.utils import host_tools
from avalon import api from avalon import api
from avalon.tools.webserver.app import WebServerTool from openpype.tools.adobe_webserver.app import WebServerTool
from .ws_stub import AfterEffectsServerStub from .ws_stub import AfterEffectsServerStub

View file

@ -9,8 +9,13 @@ from avalon import io, pipeline
from openpype import lib from openpype import lib
from openpype.api import Logger 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 import openpype.hosts.aftereffects
from openpype.lib import register_event_callback
from .launch_logic import get_stub from .launch_logic import get_stub
@ -66,7 +71,7 @@ def install():
pyblish.api.register_host("aftereffects") pyblish.api.register_host("aftereffects")
pyblish.api.register_plugin_path(PUBLISH_PATH) 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(LegacyCreator, CREATE_PATH)
log.info(PUBLISH_PATH) log.info(PUBLISH_PATH)
@ -74,12 +79,12 @@ def install():
"instanceToggled", on_pyblish_instance_toggled "instanceToggled", on_pyblish_instance_toggled
) )
avalon.api.on("application.launched", application_launch) register_event_callback("application.launched", application_launch)
def uninstall(): def uninstall():
pyblish.api.deregister_plugin_path(PUBLISH_PATH) 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) 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 from .launch_logic import get_stub
class AfterEffectsLoader(avalon.api.Loader): class AfterEffectsLoader(LoaderPlugin):
@staticmethod @staticmethod
def get_stub(): def get_stub():
return get_stub() return get_stub()

View file

@ -8,7 +8,7 @@ import logging
import attr import attr
from wsrpc_aiohttp import WebSocketAsync from wsrpc_aiohttp import WebSocketAsync
from avalon.tools.webserver.app import WebServerTool from openpype.tools.adobe_webserver.app import WebServerTool
@attr.s @attr.s

View file

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

View file

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

View file

@ -14,8 +14,16 @@ import avalon.api
from avalon import io, schema from avalon import io, schema
from avalon.pipeline import AVALON_CONTAINER_ID 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.api import Logger
from openpype.lib import (
register_event_callback,
emit_event
)
import openpype.hosts.blender import openpype.hosts.blender
HOST_DIR = os.path.dirname(os.path.abspath(openpype.hosts.blender.__file__)) HOST_DIR = os.path.dirname(os.path.abspath(openpype.hosts.blender.__file__))
@ -46,13 +54,14 @@ def install():
pyblish.api.register_host("blender") pyblish.api.register_host("blender")
pyblish.api.register_plugin_path(str(PUBLISH_PATH)) 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)) avalon.api.register_plugin_path(LegacyCreator, str(CREATE_PATH))
lib.append_user_scripts() lib.append_user_scripts()
avalon.api.on("new", on_new) register_event_callback("new", on_new)
avalon.api.on("open", on_open) register_event_callback("open", on_open)
_register_callbacks() _register_callbacks()
_register_events() _register_events()
@ -67,7 +76,7 @@ def uninstall():
pyblish.api.deregister_host("blender") pyblish.api.deregister_host("blender")
pyblish.api.deregister_plugin_path(str(PUBLISH_PATH)) 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)) avalon.api.deregister_plugin_path(LegacyCreator, str(CREATE_PATH))
if not IS_HEADLESS: if not IS_HEADLESS:
@ -114,22 +123,22 @@ def set_start_end_frames():
scene.render.resolution_y = resolution_y scene.render.resolution_y = resolution_y
def on_new(arg1, arg2): def on_new():
set_start_end_frames() set_start_end_frames()
def on_open(arg1, arg2): def on_open():
set_start_end_frames() set_start_end_frames()
@bpy.app.handlers.persistent @bpy.app.handlers.persistent
def _on_save_pre(*args): def _on_save_pre(*args):
avalon.api.emit("before_save", args) emit_event("before.save")
@bpy.app.handlers.persistent @bpy.app.handlers.persistent
def _on_save_post(*args): def _on_save_post(*args):
avalon.api.emit("save", args) emit_event("save")
@bpy.app.handlers.persistent @bpy.app.handlers.persistent
@ -137,9 +146,9 @@ def _on_load_post(*args):
# Detect new file or opening an existing file # Detect new file or opening an existing file
if bpy.data.filepath: if bpy.data.filepath:
# Likely this was an open operation since it has a filepath # Likely this was an open operation since it has a filepath
avalon.api.emit("open", args) emit_event("open")
else: else:
avalon.api.emit("new", args) emit_event("new")
ops.OpenFileCacher.post_load() ops.OpenFileCacher.post_load()
@ -170,7 +179,7 @@ def _register_callbacks():
log.info("Installed event handler _on_load_post...") log.info("Installed event handler _on_load_post...")
def _on_task_changed(*args): def _on_task_changed():
"""Callback for when the task in the context is changed.""" """Callback for when the task in the context is changed."""
# TODO (jasper): Blender has no concept of projects or workspace. # TODO (jasper): Blender has no concept of projects or workspace.
@ -187,7 +196,7 @@ def _on_task_changed(*args):
def _register_events(): def _register_events():
"""Install callbacks for specific events.""" """Install callbacks for specific events."""
avalon.api.on("taskChanged", _on_task_changed) register_event_callback("taskChanged", _on_task_changed)
log.info("Installed event callback for 'taskChanged'...") log.info("Installed event callback for 'taskChanged'...")

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -7,9 +7,11 @@ import six
import qargparse import qargparse
from Qt import QtWidgets, QtCore from Qt import QtWidgets, QtCore
import openpype.api as openpype import openpype.api as openpype
from openpype.pipeline import LegacyCreator from openpype.pipeline import (
LegacyCreator,
LoaderPlugin,
)
from openpype import style from openpype import style
import avalon.api as avalon
from . import ( from . import (
lib as flib, lib as flib,
pipeline as fpipeline, pipeline as fpipeline,
@ -660,7 +662,7 @@ class PublishableClip:
# Publishing plugin functions # Publishing plugin functions
# Loader plugin functions # Loader plugin functions
class ClipLoader(avalon.Loader): class ClipLoader(LoaderPlugin):
"""A basic clip loader for Flame """A basic clip loader for Flame
This will implement the basic behavior for a loader to inherit from that 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) # version_name = version.get("name", None)
# colorspace = version_data.get("colorspace", None) # colorspace = version_data.get("colorspace", None)
# object_name = "{}_{}".format(name, namespace) # object_name = "{}_{}".format(name, namespace)
# file = api.get_representation_path(representation).replace("\\", "/") # file = get_representation_path(representation).replace("\\", "/")
# clip = track_item.source() # clip = track_item.source()
# # reconnect media to new path # # reconnect media to new path

View file

@ -226,16 +226,10 @@ class ExtractSubsetResources(openpype.api.Extractor):
# imagesequence as list # imagesequence as list
if ( if (
# first check if path in files is not mov extension # first check if path in files is not mov extension
next( [
# iter all paths in files f for f in files
# return only .mov positive test if os.path.splitext(f)[-1] == ".mov"
iter([ ]
f for f in files
if ".mov" in os.path.splitext(f)[-1]
]),
# if nothing return default
None
)
# then try if thumbnail is not in unique name # then try if thumbnail is not in unique name
or unique_name == "thumbnail" or unique_name == "thumbnail"
): ):

View file

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

View file

@ -11,7 +11,11 @@ import avalon.api
from avalon.pipeline import AVALON_CONTAINER_ID from avalon.pipeline import AVALON_CONTAINER_ID
from openpype.api import Logger 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 import openpype.hosts.fusion
log = Logger().get_logger(__name__) log = Logger().get_logger(__name__)
@ -63,7 +67,7 @@ def install():
pyblish.api.register_plugin_path(PUBLISH_PATH) pyblish.api.register_plugin_path(PUBLISH_PATH)
log.info("Registering Fusion plug-ins..") 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(LegacyCreator, CREATE_PATH)
avalon.api.register_plugin_path(avalon.api.InventoryAction, INVENTORY_PATH) avalon.api.register_plugin_path(avalon.api.InventoryAction, INVENTORY_PATH)
@ -87,7 +91,7 @@ def uninstall():
pyblish.api.deregister_plugin_path(PUBLISH_PATH) pyblish.api.deregister_plugin_path(PUBLISH_PATH)
log.info("Deregistering Fusion plug-ins..") 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(LegacyCreator, CREATE_PATH)
avalon.api.deregister_plugin_path( avalon.api.deregister_plugin_path(
avalon.api.InventoryAction, INVENTORY_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""" """Specific loader of Alembic for the avalon.animation family"""
families = ["animation", families = ["animation",
@ -39,7 +39,7 @@ class FusionSetFrameRangeLoader(api.Loader):
lib.update_frame_range(start, end) lib.update_frame_range(start, end)
class FusionSetFrameRangeWithHandlesLoader(api.Loader): class FusionSetFrameRangeWithHandlesLoader(load.LoaderPlugin):
"""Specific loader of Alembic for the avalon.animation family""" """Specific loader of Alembic for the avalon.animation family"""
families = ["animation", families = ["animation",

View file

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

View file

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

View file

@ -272,8 +272,8 @@ function Client() {
app.avalonClient.send( app.avalonClient.send(
{ {
'module': 'avalon.api', 'module': 'openpype.lib',
'method': 'emit', 'method': 'emit_event',
'args': ['application.launched'] 'args': ['application.launched']
}, false); }, false);
}; };

View file

@ -9,7 +9,12 @@ import avalon.api
from avalon.pipeline import AVALON_CONTAINER_ID from avalon.pipeline import AVALON_CONTAINER_ID
from openpype import lib from openpype import lib
from openpype.pipeline import LegacyCreator from openpype.lib import register_event_callback
from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
deregister_loader_plugin_path,
)
import openpype.hosts.harmony import openpype.hosts.harmony
import openpype.hosts.harmony.api as harmony import openpype.hosts.harmony.api as harmony
@ -130,7 +135,7 @@ def check_inventory():
harmony.send({"function": "PypeHarmony.message", "args": msg}) harmony.send({"function": "PypeHarmony.message", "args": msg})
def application_launch(): def application_launch(event):
"""Event that is executed after Harmony is launched.""" """Event that is executed after Harmony is launched."""
# FIXME: This is breaking server <-> client communication. # FIXME: This is breaking server <-> client communication.
# It is now moved so it it manually called. # It is now moved so it it manually called.
@ -179,7 +184,7 @@ def install():
pyblish.api.register_host("harmony") pyblish.api.register_host("harmony")
pyblish.api.register_plugin_path(PUBLISH_PATH) 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(LegacyCreator, CREATE_PATH)
log.info(PUBLISH_PATH) log.info(PUBLISH_PATH)
@ -188,12 +193,12 @@ def install():
"instanceToggled", on_pyblish_instance_toggled "instanceToggled", on_pyblish_instance_toggled
) )
avalon.api.on("application.launched", application_launch) register_event_callback("application.launched", application_launch)
def uninstall(): def uninstall():
pyblish.api.deregister_plugin_path(PUBLISH_PATH) 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) 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 import openpype.hosts.harmony.api as harmony
sig = harmony.signature() sig = harmony.signature()
@ -29,7 +32,7 @@ function %s(args)
""" % (sig, sig) """ % (sig, sig)
class ImportAudioLoader(api.Loader): class ImportAudioLoader(load.LoaderPlugin):
"""Import audio.""" """Import audio."""
families = ["shot", "audio"] families = ["shot", "audio"]
@ -37,7 +40,7 @@ class ImportAudioLoader(api.Loader):
label = "Import Audio" label = "Import Audio"
def load(self, context, name=None, namespace=None, data=None): 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( harmony.send(
{"function": func, "args": [context["subset"]["name"], wav_file]} {"function": func, "args": [context["subset"]["name"], wav_file]}
) )

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -5,6 +5,7 @@ from pathlib import Path
import attr import attr
from avalon import api from avalon import api
from openpype.lib import get_formatted_current_time
import openpype.lib.abstract_collect_render import openpype.lib.abstract_collect_render
import openpype.hosts.harmony.api as harmony import openpype.hosts.harmony.api as harmony
from openpype.lib.abstract_collect_render import RenderInstance from openpype.lib.abstract_collect_render import RenderInstance
@ -138,7 +139,7 @@ class CollectFarmRender(openpype.lib.abstract_collect_render.
render_instance = HarmonyRenderInstance( render_instance = HarmonyRenderInstance(
version=version, version=version,
time=api.time(), time=get_formatted_current_time(),
source=context.data["currentFile"], source=context.data["currentFile"],
label=node.split("/")[1], label=node.split("/")[1],
subset=subset_name, subset=subset_name,

View file

@ -1,12 +1,12 @@
import os import os
import hiero.core.events import hiero.core.events
import avalon.api as avalon
from openpype.api import Logger from openpype.api import Logger
from .lib import ( from .lib import (
sync_avalon_data_to_workfile, sync_avalon_data_to_workfile,
launch_workfiles_app, launch_workfiles_app,
selection_changed_timeline, selection_changed_timeline,
before_project_save before_project_save,
register_event_callback
) )
from .tags import add_tags_to_workfile from .tags import add_tags_to_workfile
from .menu import update_menu_task_label from .menu import update_menu_task_label
@ -126,5 +126,5 @@ def register_events():
""" """
# if task changed then change notext of hiero # if task changed then change notext of hiero
avalon.on("taskChanged", update_menu_task_label) register_event_callback("taskChanged", update_menu_task_label)
log.info("Installed event callback for 'taskChanged'..") log.info("Installed event callback for 'taskChanged'..")

View file

@ -14,7 +14,7 @@ self = sys.modules[__name__]
self._change_context_menu = None self._change_context_menu = None
def update_menu_task_label(*args): def update_menu_task_label():
"""Update the task label in Avalon menu to current session""" """Update the task label in Avalon menu to current session"""
object_name = self._change_context_menu object_name = self._change_context_menu

View file

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

View file

@ -6,9 +6,9 @@ import hiero
from Qt import QtWidgets, QtCore from Qt import QtWidgets, QtCore
import qargparse import qargparse
import avalon.api as avalon
import openpype.api as openpype import openpype.api as openpype
from openpype.pipeline import LegacyCreator from openpype.pipeline import LoaderPlugin, LegacyCreator
from . import lib from . import lib
log = openpype.Logger().get_logger(__name__) log = openpype.Logger().get_logger(__name__)
@ -306,7 +306,7 @@ def get_reference_node_parents(ref):
return parents return parents
class SequenceLoader(avalon.Loader): class SequenceLoader(LoaderPlugin):
"""A basic SequenceLoader for Resolve """A basic SequenceLoader for Resolve
This will implement the basic behavior for a loader to inherit from that 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 import openpype.hosts.hiero.api as phiero
# from openpype.hosts.hiero.api import plugin, lib # from openpype.hosts.hiero.api import plugin, lib
# reload(lib) # reload(lib)
@ -112,7 +113,7 @@ class LoadClip(phiero.SequenceLoader):
version_name = version.get("name", None) version_name = version.get("name", None)
colorspace = version_data.get("colorspace", None) colorspace = version_data.get("colorspace", None)
object_name = "{}_{}".format(name, namespace) object_name = "{}_{}".format(name, namespace)
file = api.get_representation_path(representation).replace("\\", "/") file = get_representation_path(representation).replace("\\", "/")
clip = track_item.source() clip = track_item.source()
# reconnect media to new path # reconnect media to new path

View file

@ -11,12 +11,17 @@ import avalon.api
from avalon.pipeline import AVALON_CONTAINER_ID from avalon.pipeline import AVALON_CONTAINER_ID
from avalon.lib import find_submodule from avalon.lib import find_submodule
from openpype.pipeline import LegacyCreator from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
)
import openpype.hosts.houdini import openpype.hosts.houdini
from openpype.hosts.houdini.api import lib from openpype.hosts.houdini.api import lib
from openpype.lib import ( from openpype.lib import (
any_outdated register_event_callback,
emit_event,
any_outdated,
) )
from .lib import get_asset_fps from .lib import get_asset_fps
@ -48,15 +53,15 @@ def install():
pyblish.api.register_host("hpython") pyblish.api.register_host("hpython")
pyblish.api.register_plugin_path(PUBLISH_PATH) 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(LegacyCreator, CREATE_PATH)
log.info("Installing callbacks ... ") log.info("Installing callbacks ... ")
# avalon.on("init", on_init) # register_event_callback("init", on_init)
avalon.api.before("save", before_save) register_event_callback("before.save", before_save)
avalon.api.on("save", on_save) register_event_callback("save", on_save)
avalon.api.on("open", on_open) register_event_callback("open", on_open)
avalon.api.on("new", on_new) register_event_callback("new", on_new)
pyblish.api.register_callback( pyblish.api.register_callback(
"instanceToggled", on_pyblish_instance_toggled "instanceToggled", on_pyblish_instance_toggled
@ -102,13 +107,13 @@ def _register_callbacks():
def on_file_event_callback(event): def on_file_event_callback(event):
if event == hou.hipFileEventType.AfterLoad: if event == hou.hipFileEventType.AfterLoad:
avalon.api.emit("open", [event]) emit_event("open")
elif event == hou.hipFileEventType.AfterSave: elif event == hou.hipFileEventType.AfterSave:
avalon.api.emit("save", [event]) emit_event("save")
elif event == hou.hipFileEventType.BeforeSave: elif event == hou.hipFileEventType.BeforeSave:
avalon.api.emit("before_save", [event]) emit_event("before.save")
elif event == hou.hipFileEventType.AfterClear: elif event == hou.hipFileEventType.AfterClear:
avalon.api.emit("new", [event]) emit_event("new")
def get_main_window(): def get_main_window():
@ -230,11 +235,11 @@ def ls():
yield data yield data
def before_save(*args): def before_save():
return lib.validate_fps() return lib.validate_fps()
def on_save(*args): def on_save():
log.info("Running callback on save..") log.info("Running callback on save..")
@ -243,7 +248,7 @@ def on_save(*args):
lib.set_id(node, new_id, overwrite=False) lib.set_id(node, new_id, overwrite=False)
def on_open(*args): def on_open():
if not hou.isUIAvailable(): if not hou.isUIAvailable():
log.debug("Batch mode detected, ignoring `on_open` callbacks..") log.debug("Batch mode detected, ignoring `on_open` callbacks..")
@ -280,7 +285,7 @@ def on_open(*args):
dialog.show() dialog.show()
def on_new(_): def on_new():
"""Set project resolution and fps when create a new file""" """Set project resolution and fps when create a new file"""
if hou.hipFile.isLoadingHipFile(): if hou.hipFile.isLoadingHipFile():

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""" """Set Houdini frame range"""
families = [ families = [
@ -43,7 +43,7 @@ class SetFrameRangeLoader(api.Loader):
hou.playbar.setPlaybackRange(start, end) hou.playbar.setPlaybackRange(start, end)
class SetFrameRangeWithHandlesLoader(api.Loader): class SetFrameRangeWithHandlesLoader(load.LoaderPlugin):
"""Set Maya frame range including pre- and post-handles""" """Set Maya frame range including pre- and post-handles"""
families = [ families = [

View file

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

View file

@ -1,11 +1,15 @@
import os import os
from avalon import api
from avalon.houdini import pipeline
import clique 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""" """Load .ass with Arnold Procedural"""
families = ["ass"] families = ["ass"]
@ -88,7 +92,7 @@ class AssLoader(api.Loader):
def update(self, container, representation): def update(self, container, representation):
# Update the file path # Update the file path
file_path = api.get_representation_path(representation) file_path = get_representation_path(representation)
file_path = file_path.replace("\\", "/") file_path = file_path.replace("\\", "/")
procedural = container["node"] 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 from openpype.hosts.houdini.api import pipeline
@ -74,7 +77,7 @@ def transfer_non_default_values(src, dest, ignore=None):
dest_parm.setFromParm(parm) dest_parm.setFromParm(parm)
class CameraLoader(api.Loader): class CameraLoader(load.LoaderPlugin):
"""Specific loader of Alembic for the avalon.animation family""" """Specific loader of Alembic for the avalon.animation family"""
families = ["camera"] families = ["camera"]
@ -129,7 +132,7 @@ class CameraLoader(api.Loader):
node = container["node"] node = container["node"]
# Update the file path # Update the file path
file_path = api.get_representation_path(representation) file_path = get_representation_path(representation)
file_path = file_path.replace("\\", "/") file_path = file_path.replace("\\", "/")
# Update attributes # Update attributes

View file

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

View file

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

View file

@ -1,11 +1,14 @@
import os import os
import re import re
from avalon import api
from openpype.pipeline import (
load,
get_representation_path,
)
from openpype.hosts.houdini.api import pipeline from openpype.hosts.houdini.api import pipeline
class VdbLoader(api.Loader): class VdbLoader(load.LoaderPlugin):
"""Specific loader of Alembic for the avalon.animation family""" """Specific loader of Alembic for the avalon.animation family"""
families = ["vdbcache"] families = ["vdbcache"]
@ -96,7 +99,7 @@ class VdbLoader(api.Loader):
return return
# Update the file path # 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_path = self.format_path(file_path)
file_node.setParms({"fileName": 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""" """Open USD file in usdview"""
families = ["colorbleed.usd"] families = ["colorbleed.usd"]

View file

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

View file

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

View file

@ -14,9 +14,17 @@ from avalon.pipeline import AVALON_CONTAINER_ID
import openpype.hosts.maya import openpype.hosts.maya
from openpype.tools.utils import host_tools from openpype.tools.utils import host_tools
from openpype.lib import any_outdated from openpype.lib import (
any_outdated,
register_event_callback,
emit_event
)
from openpype.lib.path_tools import HostDirmap 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 openpype.hosts.maya.lib import copy_workspace_mel
from . import menu, lib from . import menu, lib
@ -49,13 +57,13 @@ def install():
pyblish.api.register_host("mayapy") pyblish.api.register_host("mayapy")
pyblish.api.register_host("maya") 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(LegacyCreator, CREATE_PATH)
avalon.api.register_plugin_path(avalon.api.InventoryAction, INVENTORY_PATH) avalon.api.register_plugin_path(avalon.api.InventoryAction, INVENTORY_PATH)
log.info(PUBLISH_PATH) log.info(PUBLISH_PATH)
log.info("Installing callbacks ... ") log.info("Installing callbacks ... ")
avalon.api.on("init", on_init) register_event_callback("init", on_init)
# Callbacks below are not required for headless mode, the `init` however # Callbacks below are not required for headless mode, the `init` however
# is important to load referenced Alembics correctly at rendertime. # is important to load referenced Alembics correctly at rendertime.
@ -69,12 +77,12 @@ def install():
menu.install() menu.install()
avalon.api.on("save", on_save) register_event_callback("save", on_save)
avalon.api.on("open", on_open) register_event_callback("open", on_open)
avalon.api.on("new", on_new) register_event_callback("new", on_new)
avalon.api.before("save", on_before_save) register_event_callback("before.save", on_before_save)
avalon.api.on("taskChanged", on_task_changed) register_event_callback("taskChanged", on_task_changed)
avalon.api.on("before.workfile.save", before_workfile_save) register_event_callback("workfile.save.before", before_workfile_save)
def _set_project(): def _set_project():
@ -137,7 +145,7 @@ def _register_callbacks():
def _on_maya_initialized(*args): def _on_maya_initialized(*args):
avalon.api.emit("init", args) emit_event("init")
if cmds.about(batch=True): if cmds.about(batch=True):
log.warning("Running batch mode ...") log.warning("Running batch mode ...")
@ -148,15 +156,15 @@ def _on_maya_initialized(*args):
def _on_scene_new(*args): def _on_scene_new(*args):
avalon.api.emit("new", args) emit_event("new")
def _on_scene_save(*args): def _on_scene_save(*args):
avalon.api.emit("save", args) emit_event("save")
def _on_scene_open(*args): def _on_scene_open(*args):
avalon.api.emit("open", args) emit_event("open")
def _before_scene_save(return_code, client_data): def _before_scene_save(return_code, client_data):
@ -166,7 +174,10 @@ def _before_scene_save(return_code, client_data):
# in order to block the operation. # in order to block the operation.
OpenMaya.MScriptUtil.setBool(return_code, True) OpenMaya.MScriptUtil.setBool(return_code, True)
avalon.api.emit("before_save", [return_code, client_data]) emit_event(
"before.save",
{"return_code": return_code}
)
def uninstall(): def uninstall():
@ -175,7 +186,7 @@ def uninstall():
pyblish.api.deregister_host("mayapy") pyblish.api.deregister_host("mayapy")
pyblish.api.deregister_host("maya") 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(LegacyCreator, CREATE_PATH)
avalon.api.deregister_plugin_path( avalon.api.deregister_plugin_path(
avalon.api.InventoryAction, INVENTORY_PATH avalon.api.InventoryAction, INVENTORY_PATH
@ -343,7 +354,7 @@ def containerise(name,
return container return container
def on_init(_): def on_init():
log.info("Running callback on init..") log.info("Running callback on init..")
def safe_deferred(fn): def safe_deferred(fn):
@ -384,12 +395,12 @@ def on_init(_):
safe_deferred(override_toolbox_ui) safe_deferred(override_toolbox_ui)
def on_before_save(return_code, _): def on_before_save():
"""Run validation for scene's FPS prior to saving""" """Run validation for scene's FPS prior to saving"""
return lib.validate_fps() return lib.validate_fps()
def on_save(_): def on_save():
"""Automatically add IDs to new nodes """Automatically add IDs to new nodes
Any transform of a mesh, without an existing ID, is given one Any transform of a mesh, without an existing ID, is given one
@ -407,7 +418,7 @@ def on_save(_):
lib.set_id(node, new_id, overwrite=False) lib.set_id(node, new_id, overwrite=False)
def on_open(_): def on_open():
"""On scene open let's assume the containers have changed.""" """On scene open let's assume the containers have changed."""
from Qt import QtWidgets from Qt import QtWidgets
@ -455,7 +466,7 @@ def on_open(_):
dialog.show() dialog.show()
def on_new(_): def on_new():
"""Set project resolution and fps when create a new file""" """Set project resolution and fps when create a new file"""
log.info("Running callback on new..") log.info("Running callback on new..")
with lib.suspended_refresh(): with lib.suspended_refresh():
@ -471,7 +482,7 @@ def on_new(_):
lib.set_context_settings() lib.set_context_settings()
def on_task_changed(*args): def on_task_changed():
"""Wrapped function of app initialize and maya's on task changed""" """Wrapped function of app initialize and maya's on task changed"""
# Run # Run
menu.update_menu_task_label() menu.update_menu_task_label()
@ -509,7 +520,7 @@ def on_task_changed(*args):
def before_workfile_save(event): def before_workfile_save(event):
workdir_path = event.workdir_path workdir_path = event["workdir_path"]
if workdir_path: if workdir_path:
copy_workspace_mel(workdir_path) copy_workspace_mel(workdir_path)

View file

@ -4,9 +4,12 @@ from maya import cmds
import qargparse import qargparse
from avalon import api
from avalon.pipeline import AVALON_CONTAINER_ID 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 .pipeline import containerise
from . import lib from . import lib
@ -95,7 +98,7 @@ class Creator(LegacyCreator):
return instance return instance
class Loader(api.Loader): class Loader(LoaderPlugin):
hosts = ["maya"] hosts = ["maya"]
@ -178,7 +181,7 @@ class ReferenceLoader(Loader):
loader=self.__class__.__name__ loader=self.__class__.__name__
) )
loaded_containers.append(container) loaded_containers.append(container)
self._organize_containers([ref_node], container) self._organize_containers(nodes, container)
c += 1 c += 1
namespace = None namespace = None
@ -194,7 +197,7 @@ class ReferenceLoader(Loader):
node = container["objectName"] node = container["objectName"]
path = api.get_representation_path(representation) path = get_representation_path(representation)
# Get reference node from container members # Get reference node from container members
members = get_container_members(node) members = get_container_members(node)
@ -247,6 +250,8 @@ class ReferenceLoader(Loader):
self.log.warning("Ignoring file read error:\n%s", exc) self.log.warning("Ignoring file read error:\n%s", exc)
self._organize_containers(content, container["objectName"])
# Reapply alembic settings. # Reapply alembic settings.
if representation["name"] == "abc" and alembic_data: if representation["name"] == "abc" and alembic_data:
alembic_nodes = cmds.ls( alembic_nodes = cmds.ls(
@ -284,7 +289,6 @@ class ReferenceLoader(Loader):
to remove from scene. to remove from scene.
""" """
from maya import cmds from maya import cmds
node = container["objectName"] node = container["objectName"]
@ -318,6 +322,7 @@ class ReferenceLoader(Loader):
@staticmethod @staticmethod
def _organize_containers(nodes, container): def _organize_containers(nodes, container):
# type: (list, str) -> None # type: (list, str) -> None
"""Put containers in loaded data to correct hierarchy."""
for node in nodes: for node in nodes:
id_attr = "{}.id".format(node) id_attr = "{}.id".format(node)
if not cmds.attributeQuery("id", node=node, exists=True): if not cmds.attributeQuery("id", node=node, exists=True):

View file

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

View file

@ -1,5 +1,9 @@
import json 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 ( from openpype.hosts.maya.api.lib import (
maintained_selection, maintained_selection,
apply_shaders apply_shaders
@ -73,11 +77,11 @@ class ImportModelRender(api.InventoryAction):
"name": self.look_data_type, "name": self.look_data_type,
}) })
context = pipeline.get_representation_context(look_repr["_id"]) context = get_representation_context(look_repr["_id"])
maya_file = pipeline.get_representation_path_from_context(context) maya_file = get_representation_path_from_context(context)
context = pipeline.get_representation_context(json_repr["_id"]) context = get_representation_context(json_repr["_id"])
json_file = pipeline.get_representation_path_from_context(context) json_file = get_representation_path_from_context(context)
# Import the look file # Import the look file
with maintained_selection(): 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 ( from openpype.hosts.maya.api.lib import (
maintained_selection, maintained_selection,
unique_namespace unique_namespace
) )
class SetFrameRangeLoader(api.Loader): class SetFrameRangeLoader(load.LoaderPlugin):
"""Specific loader of Alembic for the avalon.animation family""" """Specific loader of Alembic for the avalon.animation family"""
families = ["animation", families = ["animation",
@ -43,7 +43,7 @@ class SetFrameRangeLoader(api.Loader):
animationEndTime=end) animationEndTime=end)
class SetFrameRangeWithHandlesLoader(api.Loader): class SetFrameRangeWithHandlesLoader(load.LoaderPlugin):
"""Specific loader of Alembic for the avalon.animation family""" """Specific loader of Alembic for the avalon.animation family"""
families = ["animation", families = ["animation",
@ -81,7 +81,7 @@ class SetFrameRangeWithHandlesLoader(api.Loader):
animationEndTime=end) animationEndTime=end)
class ImportMayaLoader(api.Loader): class ImportMayaLoader(load.LoaderPlugin):
"""Import action for Maya (unmanaged) """Import action for Maya (unmanaged)
Warning: Warning:

View file

@ -1,8 +1,11 @@
import os import os
import clique import clique
from avalon import api
from openpype.api import get_project_settings from openpype.api import get_project_settings
from openpype.pipeline import (
load,
get_representation_path
)
import openpype.hosts.maya.api.plugin import openpype.hosts.maya.api.plugin
from openpype.hosts.maya.api.plugin import get_reference_node from openpype.hosts.maya.api.plugin import get_reference_node
from openpype.hosts.maya.api.lib import ( from openpype.hosts.maya.api.lib import (
@ -106,7 +109,7 @@ class AssProxyLoader(openpype.hosts.maya.api.plugin.ReferenceLoader):
node = container["objectName"] node = container["objectName"]
representation["context"].pop("frame", None) representation["context"].pop("frame", None)
path = api.get_representation_path(representation) path = get_representation_path(representation)
print(path) print(path)
# path = self.fname # path = self.fname
print(self.fname) print(self.fname)
@ -164,7 +167,7 @@ class AssProxyLoader(openpype.hosts.maya.api.plugin.ReferenceLoader):
type="string") type="string")
class AssStandinLoader(api.Loader): class AssStandinLoader(load.LoaderPlugin):
"""Load .ASS file as standin""" """Load .ASS file as standin"""
families = ["ass"] families = ["ass"]
@ -240,7 +243,7 @@ class AssStandinLoader(api.Loader):
import pymel.core as pm 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]) files_in_path = os.listdir(os.path.split(path)[0])
sequence = 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"] families = ["assembly"]
representations = ["json"] representations = ["json"]
@ -48,13 +51,11 @@ class AssemblyLoader(api.Loader):
def update(self, container, representation): def update(self, container, representation):
from openpype import setdress from openpype import setdress
return setdress.update_package(container, return setdress.update_package(container, representation)
representation)
def remove(self, container): def remove(self, container):
"""Remove all sub containers""" """Remove all sub containers"""
from avalon import api
from openpype import setdress from openpype import setdress
import maya.cmds as cmds import maya.cmds as cmds
@ -63,7 +64,7 @@ class AssemblyLoader(api.Loader):
for member_container in member_containers: for member_container in member_containers:
self.log.info("Removing container %s", self.log.info("Removing container %s",
member_container['objectName']) member_container['objectName'])
api.remove(member_container) remove_container(member_container)
# Remove alembic hierarchy reference # Remove alembic hierarchy reference
# TODO: Check whether removing all contained references is safe enough # TODO: Check whether removing all contained references is safe enough

View file

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

View file

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

View file

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

View file

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

View file

@ -1,8 +1,8 @@
from avalon import api
from maya import mel 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. This will run matchmove script to create track in scene.

View file

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

View file

@ -121,18 +121,10 @@ class ReferenceLoader(openpype.hosts.maya.api.plugin.ReferenceLoader):
if family == "rig": if family == "rig":
self._post_process_rig(name, namespace, context, options) self._post_process_rig(name, namespace, context, options)
else: else:
if "translate" in options: if "translate" in options:
cmds.setAttr(group_name + ".t", *options["translate"]) cmds.setAttr(group_name + ".t", *options["translate"])
return new_nodes return new_nodes
def load(self, context, name=None, namespace=None, options=None):
container = super(ReferenceLoader, self).load(
context, name, namespace, options)
# clean containers if present to AVALON_CONTAINERS
self._organize_containers(self[:], container[0])
def switch(self, container, representation): def switch(self, container, representation):
self.update(container, representation) self.update(container, representation)

View file

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

View file

@ -1,9 +1,10 @@
import os import os
from avalon import api
from openpype.api import get_project_settings 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""" """Load OpenVDB in a Redshift Volume Shape"""
families = ["vdbcache"] families = ["vdbcache"]

View file

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

View file

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

View file

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

View file

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

View file

@ -50,6 +50,7 @@ import maya.app.renderSetup.model.renderSetup as renderSetup
import pyblish.api import pyblish.api
from avalon import api from avalon import api
from openpype.lib import get_formatted_current_time
from openpype.hosts.maya.api.lib_renderproducts import get as get_layer_render_products # noqa: E501 from openpype.hosts.maya.api.lib_renderproducts import get as get_layer_render_products # noqa: E501
from openpype.hosts.maya.api import lib from openpype.hosts.maya.api import lib
@ -328,7 +329,7 @@ class CollectMayaRender(pyblish.api.ContextPlugin):
"family": "renderlayer", "family": "renderlayer",
"families": ["renderlayer"], "families": ["renderlayer"],
"asset": asset, "asset": asset,
"time": api.time(), "time": get_formatted_current_time(),
"author": context.data["user"], "author": context.data["user"],
# Add source to allow tracing back to the scene from # Add source to allow tracing back to the scene from
# which was submitted originally # which was submitted originally

View file

@ -7,6 +7,7 @@ from maya import cmds
import pyblish.api import pyblish.api
from avalon import api from avalon import api
from openpype.lib import get_formatted_current_time
from openpype.hosts.maya.api import lib from openpype.hosts.maya.api import lib
@ -117,7 +118,7 @@ class CollectVrayScene(pyblish.api.InstancePlugin):
"family": "vrayscene_layer", "family": "vrayscene_layer",
"families": ["vrayscene_layer"], "families": ["vrayscene_layer"],
"asset": api.Session["AVALON_ASSET"], "asset": api.Session["AVALON_ASSET"],
"time": api.time(), "time": get_formatted_current_time(),
"author": context.data["user"], "author": context.data["user"],
# Add source to allow tracing back to the scene from # Add source to allow tracing back to the scene from
# which was submitted originally # which was submitted originally

View file

@ -58,16 +58,11 @@ class ExtractMayaSceneRaw(openpype.api.Extractor):
else: else:
members = instance[:] members = instance[:]
loaded_containers = None
if set(self.add_for_families).intersection(
set(instance.data.get("families")),
set(instance.data.get("family").lower())):
loaded_containers = self._add_loaded_containers(members)
selection = members selection = members
if loaded_containers: if set(self.add_for_families).intersection(
self.log.info(loaded_containers) set(instance.data.get("families", []))) or \
selection += loaded_containers instance.data.get("family") in self.add_for_families:
selection += self._get_loaded_containers(members)
# Perform extraction # Perform extraction
self.log.info("Performing extraction ...") self.log.info("Performing extraction ...")
@ -97,15 +92,15 @@ class ExtractMayaSceneRaw(openpype.api.Extractor):
self.log.info("Extracted instance '%s' to: %s" % (instance.name, path)) self.log.info("Extracted instance '%s' to: %s" % (instance.name, path))
@staticmethod @staticmethod
def _add_loaded_containers(members): def _get_loaded_containers(members):
# type: (list) -> list # type: (list) -> list
refs_to_include = [ refs_to_include = {
cmds.referenceQuery(ref, referenceNode=True) cmds.referenceQuery(node, referenceNode=True)
for ref in members for node in members
if cmds.referenceQuery(ref, isNodeReferenced=True) if cmds.referenceQuery(node, isNodeReferenced=True)
] }
refs_to_include = set(refs_to_include) members_with_refs = refs_to_include.union(members)
obj_sets = cmds.ls("*.id", long=True, type="objectSet", recursive=True, obj_sets = cmds.ls("*.id", long=True, type="objectSet", recursive=True,
objectsOnly=True) objectsOnly=True)
@ -121,7 +116,7 @@ class ExtractMayaSceneRaw(openpype.api.Extractor):
continue continue
set_content = set(cmds.sets(obj_set, query=True)) set_content = set(cmds.sets(obj_set, query=True))
if set_content.intersection(refs_to_include): if set_content.intersection(members_with_refs):
loaded_containers.append(obj_set) loaded_containers.append(obj_set)
return loaded_containers return loaded_containers

View file

@ -14,7 +14,12 @@ from openpype.api import (
BuildWorkfile, BuildWorkfile,
get_current_project_settings get_current_project_settings
) )
from openpype.pipeline import LegacyCreator from openpype.lib import register_event_callback
from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
deregister_loader_plugin_path,
)
from openpype.tools.utils import host_tools from openpype.tools.utils import host_tools
from .command import viewer_update_and_undo_stop from .command import viewer_update_and_undo_stop
@ -98,13 +103,13 @@ def install():
log.info("Registering Nuke plug-ins..") log.info("Registering Nuke plug-ins..")
pyblish.api.register_plugin_path(PUBLISH_PATH) 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(LegacyCreator, CREATE_PATH)
avalon.api.register_plugin_path(avalon.api.InventoryAction, INVENTORY_PATH) avalon.api.register_plugin_path(avalon.api.InventoryAction, INVENTORY_PATH)
# Register Avalon event for workfiles loading. # Register Avalon event for workfiles loading.
avalon.api.on("workio.open_file", check_inventory_versions) register_event_callback("workio.open_file", check_inventory_versions)
avalon.api.on("taskChanged", change_context_label) register_event_callback("taskChanged", change_context_label)
pyblish.api.register_callback( pyblish.api.register_callback(
"instanceToggled", on_pyblish_instance_toggled) "instanceToggled", on_pyblish_instance_toggled)
@ -124,7 +129,7 @@ def uninstall():
log.info("Deregistering Nuke plug-ins..") log.info("Deregistering Nuke plug-ins..")
pyblish.deregister_host("nuke") pyblish.deregister_host("nuke")
pyblish.api.deregister_plugin_path(PUBLISH_PATH) 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) avalon.api.deregister_plugin_path(LegacyCreator, CREATE_PATH)
pyblish.api.deregister_callback( pyblish.api.deregister_callback(
@ -227,7 +232,7 @@ def _uninstall_menu():
menu.removeItem(item.name()) menu.removeItem(item.name())
def change_context_label(*args): def change_context_label():
menubar = nuke.menu("Nuke") menubar = nuke.menu("Nuke")
menu = menubar.findItem(MENU_LABEL) menu = menubar.findItem(MENU_LABEL)

View file

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

View file

@ -1,4 +1,4 @@
from avalon import api, style from avalon import api
from openpype.api import Logger from openpype.api import Logger
from openpype.hosts.nuke.api.lib import set_avalon_knob_data from openpype.hosts.nuke.api.lib import set_avalon_knob_data
@ -7,7 +7,7 @@ class RepairOldLoaders(api.InventoryAction):
label = "Repair Old Loaders" label = "Repair Old Loaders"
icon = "gears" icon = "gears"
color = style.colors.alert color = "#cc0000"
log = Logger.get_logger(__name__) log = Logger.get_logger(__name__)

View file

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

View file

@ -1,7 +1,11 @@
from avalon import api, style, io from avalon import io
import nuke import nuke
import nukescripts import nukescripts
from openpype.pipeline import (
load,
get_representation_path,
)
from openpype.hosts.nuke.api.lib import ( from openpype.hosts.nuke.api.lib import (
find_free_space_to_paste_nodes, find_free_space_to_paste_nodes,
maintained_selection, 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 from openpype.hosts.nuke.api import containerise, update_container
class LoadBackdropNodes(api.Loader): class LoadBackdropNodes(load.LoaderPlugin):
"""Loading Published Backdrop nodes (workfile, nukenodes)""" """Loading Published Backdrop nodes (workfile, nukenodes)"""
representations = ["nk"] representations = ["nk"]
@ -23,7 +27,7 @@ class LoadBackdropNodes(api.Loader):
label = "Iport Nuke Nodes" label = "Iport Nuke Nodes"
order = 0 order = 0
icon = "eye" icon = "eye"
color = style.colors.light color = "white"
node_color = "0x7533c1ff" node_color = "0x7533c1ff"
def load(self, context, name, namespace, data): def load(self, context, name, namespace, data):
@ -191,7 +195,7 @@ class LoadBackdropNodes(api.Loader):
# get corresponding node # get corresponding node
GN = nuke.toNode(container['objectName']) GN = nuke.toNode(container['objectName'])
file = api.get_representation_path(representation).replace("\\", "/") file = get_representation_path(representation).replace("\\", "/")
context = representation["context"] context = representation["context"]
name = container['name'] name = container['name']
version_data = version.get("data", {}) version_data = version.get("data", {})

View file

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

View file

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

View file

@ -1,7 +1,13 @@
import json import json
from collections import OrderedDict from collections import OrderedDict
import nuke import nuke
from avalon import api, style, io
from avalon import io
from openpype.pipeline import (
load,
get_representation_path,
)
from openpype.hosts.nuke.api import ( from openpype.hosts.nuke.api import (
containerise, containerise,
update_container, update_container,
@ -9,7 +15,7 @@ from openpype.hosts.nuke.api import (
) )
class LoadEffects(api.Loader): class LoadEffects(load.LoaderPlugin):
"""Loading colorspace soft effect exported from nukestudio""" """Loading colorspace soft effect exported from nukestudio"""
representations = ["effectJson"] representations = ["effectJson"]
@ -18,7 +24,7 @@ class LoadEffects(api.Loader):
label = "Load Effects - nodes" label = "Load Effects - nodes"
order = 0 order = 0
icon = "cc" icon = "cc"
color = style.colors.light color = "white"
ignore_attr = ["useLifetime"] ignore_attr = ["useLifetime"]
@ -149,7 +155,7 @@ class LoadEffects(api.Loader):
# get corresponding node # get corresponding node
GN = nuke.toNode(container['objectName']) GN = nuke.toNode(container['objectName'])
file = api.get_representation_path(representation).replace("\\", "/") file = get_representation_path(representation).replace("\\", "/")
name = container['name'] name = container['name']
version_data = version.get("data", {}) version_data = version.get("data", {})
vname = version.get("name", None) vname = version.get("name", None)

View file

@ -3,7 +3,12 @@ from collections import OrderedDict
import nuke import nuke
from avalon import api, style, 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 lib
from openpype.hosts.nuke.api import ( from openpype.hosts.nuke.api import (
containerise, containerise,
@ -12,7 +17,7 @@ from openpype.hosts.nuke.api import (
) )
class LoadEffectsInputProcess(api.Loader): class LoadEffectsInputProcess(load.LoaderPlugin):
"""Loading colorspace soft effect exported from nukestudio""" """Loading colorspace soft effect exported from nukestudio"""
representations = ["effectJson"] representations = ["effectJson"]
@ -21,7 +26,7 @@ class LoadEffectsInputProcess(api.Loader):
label = "Load Effects - Input Process" label = "Load Effects - Input Process"
order = 0 order = 0
icon = "eye" icon = "eye"
color = style.colors.alert color = "#cc0000"
ignore_attr = ["useLifetime"] ignore_attr = ["useLifetime"]
def load(self, context, name, namespace, data): def load(self, context, name, namespace, data):
@ -156,7 +161,7 @@ class LoadEffectsInputProcess(api.Loader):
# get corresponding node # get corresponding node
GN = nuke.toNode(container['objectName']) GN = nuke.toNode(container['objectName'])
file = api.get_representation_path(representation).replace("\\", "/") file = get_representation_path(representation).replace("\\", "/")
name = container['name'] name = container['name']
version_data = version.get("data", {}) version_data = version.get("data", {})
vname = version.get("name", None) vname = version.get("name", None)

View file

@ -1,5 +1,11 @@
import nuke import nuke
from avalon import api, style, io
from avalon import io
from openpype.pipeline import (
load,
get_representation_path,
)
from openpype.hosts.nuke.api.lib import ( from openpype.hosts.nuke.api.lib import (
maintained_selection, maintained_selection,
get_avalon_knob_data, get_avalon_knob_data,
@ -12,7 +18,7 @@ from openpype.hosts.nuke.api import (
) )
class LoadGizmo(api.Loader): class LoadGizmo(load.LoaderPlugin):
"""Loading nuke Gizmo""" """Loading nuke Gizmo"""
representations = ["gizmo"] representations = ["gizmo"]
@ -21,7 +27,7 @@ class LoadGizmo(api.Loader):
label = "Load Gizmo" label = "Load Gizmo"
order = 0 order = 0
icon = "dropbox" icon = "dropbox"
color = style.colors.light color = "white"
node_color = "0x75338eff" node_color = "0x75338eff"
def load(self, context, name, namespace, data): def load(self, context, name, namespace, data):
@ -103,7 +109,7 @@ class LoadGizmo(api.Loader):
# get corresponding node # get corresponding node
GN = nuke.toNode(container['objectName']) GN = nuke.toNode(container['objectName'])
file = api.get_representation_path(representation).replace("\\", "/") file = get_representation_path(representation).replace("\\", "/")
name = container['name'] name = container['name']
version_data = version.get("data", {}) version_data = version.get("data", {})
vname = version.get("name", None) vname = version.get("name", None)

View file

@ -1,5 +1,11 @@
from avalon import api, style, io
import nuke import nuke
from avalon import io
from openpype.pipeline import (
load,
get_representation_path,
)
from openpype.hosts.nuke.api.lib import ( from openpype.hosts.nuke.api.lib import (
maintained_selection, maintained_selection,
create_backdrop, create_backdrop,
@ -13,7 +19,7 @@ from openpype.hosts.nuke.api import (
) )
class LoadGizmoInputProcess(api.Loader): class LoadGizmoInputProcess(load.LoaderPlugin):
"""Loading colorspace soft effect exported from nukestudio""" """Loading colorspace soft effect exported from nukestudio"""
representations = ["gizmo"] representations = ["gizmo"]
@ -22,7 +28,7 @@ class LoadGizmoInputProcess(api.Loader):
label = "Load Gizmo - Input Process" label = "Load Gizmo - Input Process"
order = 0 order = 0
icon = "eye" icon = "eye"
color = style.colors.alert color = "#cc0000"
node_color = "0x7533c1ff" node_color = "0x7533c1ff"
def load(self, context, name, namespace, data): def load(self, context, name, namespace, data):
@ -109,7 +115,7 @@ class LoadGizmoInputProcess(api.Loader):
# get corresponding node # get corresponding node
GN = nuke.toNode(container['objectName']) GN = nuke.toNode(container['objectName'])
file = api.get_representation_path(representation).replace("\\", "/") file = get_representation_path(representation).replace("\\", "/")
name = container['name'] name = container['name']
version_data = version.get("data", {}) version_data = version.get("data", {})
vname = version.get("name", None) vname = version.get("name", None)

View file

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

View file

@ -1,8 +1,8 @@
from avalon import api
import nuke 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. This will run matchmove script to create track in script.
""" """

View file

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

View file

@ -1,5 +1,11 @@
import nuke import nuke
from avalon import api, style, 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.lib import get_avalon_knob_data
from openpype.hosts.nuke.api import ( from openpype.hosts.nuke.api import (
containerise, containerise,
@ -8,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""" """Copy the published file to be pasted at the desired location"""
representations = ["nk"] representations = ["nk"]
@ -17,7 +23,7 @@ class LinkAsGroup(api.Loader):
label = "Load Precomp" label = "Load Precomp"
order = 0 order = 0
icon = "file" icon = "file"
color = style.colors.alert color = "#cc0000"
def load(self, context, name, namespace, data): def load(self, context, name, namespace, data):
# for k, v in context.items(): # for k, v in context.items():
@ -108,7 +114,7 @@ class LinkAsGroup(api.Loader):
""" """
node = nuke.toNode(container['objectName']) node = nuke.toNode(container['objectName'])
root = api.get_representation_path(representation).replace("\\", "/") root = get_representation_path(representation).replace("\\", "/")
# Get start frame from version data # Get start frame from version data
version = io.find_one({ version = io.find_one({

View file

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

View file

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

View file

@ -195,11 +195,12 @@ class ExtractImage(openpype.api.Extractor):
#### Loader Plugin #### Loader Plugin
```python ```python
from avalon import api, photoshop from avalon import api, photoshop
from openpype.pipeline import load, get_representation_path
stub = photoshop.stub() stub = photoshop.stub()
class ImageLoader(api.Loader): class ImageLoader(load.LoaderPlugin):
"""Load images """Load images
Stores the imported asset in a container named after the asset. Stores the imported asset in a container named after the asset.
@ -227,7 +228,7 @@ class ImageLoader(api.Loader):
with photoshop.maintained_selection(): with photoshop.maintained_selection():
stub.replace_smart_object( stub.replace_smart_object(
layer, api.get_representation_path(representation) layer, get_representation_path(representation)
) )
stub.imprint( 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 Add --enable-blink-features=ShadowDOMV0,CustomElementsV0 when starting Chrome
then localhost:8078 (port set in `photoshop\extension\.debug`) 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 Or install CEF client from https://github.com/Adobe-CEP/CEP-Resources/tree/master/CEP_9.x
## Resources ## Resources

View file

@ -14,7 +14,7 @@ from openpype.api import Logger
from openpype.tools.utils import host_tools from openpype.tools.utils import host_tools
from avalon import api from avalon import api
from avalon.tools.webserver.app import WebServerTool from openpype.tools.adobe_webserver.app import WebServerTool
from .ws_stub import PhotoshopServerStub from .ws_stub import PhotoshopServerStub

View file

@ -6,7 +6,12 @@ import avalon.api
from avalon import pipeline, io from avalon import pipeline, io
from openpype.api import Logger from openpype.api import Logger
from openpype.pipeline import LegacyCreator from openpype.lib import register_event_callback
from openpype.pipeline import (
LegacyCreator,
register_loader_plugin_path,
deregister_loader_plugin_path,
)
import openpype.hosts.photoshop import openpype.hosts.photoshop
from . import lib from . import lib
@ -67,7 +72,7 @@ def install():
pyblish.api.register_host("photoshop") pyblish.api.register_host("photoshop")
pyblish.api.register_plugin_path(PUBLISH_PATH) 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(LegacyCreator, CREATE_PATH)
log.info(PUBLISH_PATH) log.info(PUBLISH_PATH)
@ -75,12 +80,12 @@ def install():
"instanceToggled", on_pyblish_instance_toggled "instanceToggled", on_pyblish_instance_toggled
) )
avalon.api.on("application.launched", on_application_launch) register_event_callback("application.launched", on_application_launch)
def uninstall(): def uninstall():
pyblish.api.deregister_plugin_path(PUBLISH_PATH) 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) avalon.api.deregister_plugin_path(LegacyCreator, CREATE_PATH)

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