Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Move hiero client code #586

Merged
merged 13 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client/ayon_core/addon/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"clockify": VersionInfo(0, 2, 0),
"flame": VersionInfo(0, 2, 0),
"fusion": VersionInfo(0, 2, 0),
"hiero": VersionInfo(0, 2, 0),
"max": VersionInfo(0, 2, 0),
"photoshop": VersionInfo(0, 2, 0),
"traypublisher": VersionInfo(0, 2, 0),
Expand Down
10 changes: 0 additions & 10 deletions client/ayon_core/hosts/hiero/__init__.py

This file was deleted.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
exclude = [
"client/ayon_core/hosts/unreal/integration/*",
"client/ayon_core/hosts/aftereffects/api/extension/js/libs/*",
"client/ayon_core/hosts/hiero/api/startup/*",
"client/ayon_core/modules/deadline/repository/custom/plugins/CelAction/*",
"client/ayon_core/modules/deadline/repository/custom/plugins/HarmonyAYON/*",
"client/ayon_core/modules/click_wrap.py",
"client/ayon_core/scripts/slates/__init__.py"
"client/ayon_core/scripts/slates/__init__.py",
"server_addon/hiero/client/ayon_hiero/api/startup/*"
]

[tool.ruff.lint.per-file-ignores]
Expand Down
13 changes: 13 additions & 0 deletions server_addon/hiero/client/ayon_hiero/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from .version import __version__
from .addon import (
HIERO_ADDON_ROOT,
HieroAddon,
)


__all__ = (
"__version__",

"HIERO_ADDON_ROOT",
"HieroAddon",
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@
import platform
from ayon_core.addon import AYONAddon, IHostAddon

HIERO_ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
from .version import __version__

HIERO_ADDON_ROOT = os.path.dirname(os.path.abspath(__file__))


class HieroAddon(AYONAddon, IHostAddon):
name = "hiero"
version = __version__
host_name = "hiero"

def add_implementation_envs(self, env, _app):
# Add requirements to HIERO_PLUGIN_PATH
new_hiero_paths = [
os.path.join(HIERO_ROOT_DIR, "api", "startup")
os.path.join(HIERO_ADDON_ROOT, "api", "startup")
]
old_hiero_path = env.get("HIERO_PLUGIN_PATH") or ""
for path in old_hiero_path.split(os.pathsep):
Expand All @@ -36,7 +39,7 @@ def add_implementation_envs(self, env, _app):
python_path_parts = []
if python_path:
python_path_parts = python_path.split(os.pathsep)
vendor_path = os.path.join(HIERO_ROOT_DIR, "vendor")
vendor_path = os.path.join(HIERO_ADDON_ROOT, "vendor")
python_path_parts.insert(0, vendor_path)
env["PYTHONPATH"] = os.pathsep.join(python_path_parts)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,19 +453,19 @@ def get_track_openpype_data(track, container_name=None):
)


@deprecated("ayon_core.hosts.hiero.api.lib.get_trackitem_openpype_tag")
@deprecated("ayon_hiero.api.lib.get_trackitem_openpype_tag")
def get_track_item_pype_tag(track_item):
# backward compatibility alias
return get_trackitem_openpype_tag(track_item)


@deprecated("ayon_core.hosts.hiero.api.lib.set_trackitem_openpype_tag")
@deprecated("ayon_hiero.api.lib.set_trackitem_openpype_tag")
def set_track_item_pype_tag(track_item, data=None):
# backward compatibility alias
return set_trackitem_openpype_tag(track_item, data)


@deprecated("ayon_core.hosts.hiero.api.lib.get_trackitem_openpype_data")
@deprecated("ayon_hiero.api.lib.get_trackitem_openpype_data")
def get_track_item_pype_data(track_item):
# backward compatibility alias
return get_trackitem_openpype_data(track_item)
Expand Down Expand Up @@ -802,7 +802,7 @@ def eventHandler(self, event):
#
# '''
# import hiero.core
# from ayon_core.hosts.nuke.api.lib import (
# from ayon_nuke.api.lib import (
# BuildWorkfile,
# imprint
# )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import contextlib
from collections import OrderedDict

import hiero
from pyblish import api as pyblish

from ayon_core.lib import Logger
from ayon_core.pipeline import (
schema,
Expand All @@ -18,15 +20,14 @@
AYON_CONTAINER_ID,
)
from ayon_core.tools.utils import host_tools
from ayon_hiero import HIERO_ADDON_ROOT

from . import lib, menu, events
import hiero

log = Logger.get_logger(__name__)

# plugin paths
API_DIR = os.path.dirname(os.path.abspath(__file__))
HOST_DIR = os.path.dirname(API_DIR)
PLUGINS_DIR = os.path.join(HOST_DIR, "plugins")
PLUGINS_DIR = os.path.join(HIERO_ADDON_ROOT, "plugins")
PUBLISH_PATH = os.path.join(PLUGINS_DIR, "publish").replace("\\", "/")
LOAD_PATH = os.path.join(PLUGINS_DIR, "load").replace("\\", "/")
CREATE_PATH = os.path.join(PLUGINS_DIR, "create").replace("\\", "/")
Expand Down Expand Up @@ -308,9 +309,9 @@ def reload_config():
import importlib

for module in (
"ayon_core.hosts.hiero.lib",
"ayon_core.hosts.hiero.menu",
"ayon_core.hosts.hiero.tags"
"ayon_hiero.lib",
"ayon_hiero.menu",
"ayon_hiero.tags"
):
log.info("Reloading module: {}...".format(module))
try:
Expand All @@ -328,7 +329,7 @@ def on_pyblish_instance_toggled(instance, old_value, new_value):
log.info("instance toggle: {}, old_value: {}, new_value:{} ".format(
instance, old_value, new_value))

from ayon_core.hosts.hiero.api import (
from ayon_hiero.api import (
get_trackitem_openpype_tag,
set_publish_attribute
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,8 @@ def load(self):
log.debug("__ self.timeline_out: {}".format(self.timeline_out))

# check if slate is included
slate_on = "slate" in self.context["version"]["data"]["families"]
slate_on = "slate" in self.context["version"]["data"].get(
"families", [])
log.debug("__ slate_on: {}".format(slate_on))

# if slate is on then remove the slate frame from beginning
Expand Down Expand Up @@ -600,7 +601,7 @@ class Creator(LegacyCreator):

def __init__(self, *args, **kwargs):
super(Creator, self).__init__(*args, **kwargs)
import ayon_core.hosts.hiero.api as phiero
import ayon_hiero.api as phiero
self.presets = get_current_project_settings()[
"hiero"]["create"].get(self.__class__.__name__, {})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

# activate hiero from pype
from ayon_core.pipeline import install_host
import ayon_core.hosts.hiero.api as phiero
import ayon_hiero.api as phiero
install_host(phiero)

try:
__import__("ayon_core.hosts.hiero.api")
__import__("ayon_hiero.api")
__import__("pyblish")

except ImportError as e:
Expand All @@ -15,5 +15,5 @@

else:
# Setup integration
import ayon_core.hosts.hiero.api as phiero
import ayon_hiero.api as phiero
phiero.lib.setup()
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from hiero.core import util

import opentimelineio as otio
from ayon_core.hosts.hiero.api.otio import hiero_export
from ayon_hiero.api.otio import hiero_export

class OTIOExportTask(hiero.core.TaskBase):

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

FormLayout = QFormLayout # lint:ok

from ayon_core.hosts.hiero.api.otio import hiero_export
from ayon_hiero.api.otio import hiero_export

class OTIOExportUI(hiero.ui.TaskUIBase):
def __init__(self, preset):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import PySide2.QtWidgets as qw

from ayon_core.hosts.hiero.api.otio.hiero_import import load_otio
from ayon_hiero.api.otio.hiero_import import load_otio


class OTIOProjectSelect(qw.QDialog):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from copy import deepcopy
import ayon_core.hosts.hiero.api as phiero
# from ayon_core.hosts.hiero.api import plugin, lib
import ayon_hiero.api as phiero
# from ayon_hiero.api import plugin, lib
# reload(lib)
# reload(plugin)
# reload(phiero)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
VIDEO_EXTENSIONS,
IMAGE_EXTENSIONS
)
import ayon_core.hosts.hiero.api as phiero
import ayon_hiero.api as phiero


class LoadClip(phiero.SequenceLoader):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
load,
get_representation_path,
)
from ayon_core.hosts.hiero import api as phiero
from ayon_hiero import api as phiero
from ayon_core.lib import Logger


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class CollectClipEffects(pyblish.api.InstancePlugin):
order = pyblish.api.CollectorOrder - 0.078
label = "Collect Clip Effects Instances"
families = ["clip"]
settings_category = "hiero"

effect_categories = []

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# from ayon_core import plugins
import os
import json
import pyblish.api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from ayon_core.pipeline import AYON_INSTANCE_ID, AVALON_INSTANCE_ID
from ayon_core.pipeline.editorial import is_overlapping_otio_ranges

from ayon_core.hosts.hiero import api as phiero
from ayon_core.hosts.hiero.api.otio import hiero_export
from ayon_hiero import api as phiero
from ayon_hiero.api.otio import hiero_export

import hiero
# # developer reload modules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import hiero.ui

from ayon_core.hosts.hiero.api.otio import hiero_export
from ayon_hiero.api.otio import hiero_export


class PrecollectWorkfile(pyblish.api.ContextPlugin):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pyblish import api
import hiero
import math
from ayon_core.hosts.hiero.api.otio.hiero_export import create_otio_time_range
from ayon_hiero.api.otio.hiero_export import create_otio_time_range

class PrecollectRetime(api.InstancePlugin):
"""Calculate Retiming of selected track items."""
Expand Down
3 changes: 3 additions & 0 deletions server_addon/hiero/client/ayon_hiero/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
"""Package declaring AYON addon 'hiero' version."""
__version__ = "0.2.0"
8 changes: 7 additions & 1 deletion server_addon/hiero/package.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
name = "hiero"
title = "Hiero"
version = "0.1.3"
version = "0.2.0"
client_dir = "ayon_hiero"

ayon_required_addons = {
"core": ">0.3.2",
}
ayon_compatible_addons = {}
39 changes: 0 additions & 39 deletions server_addon/hiero/server/settings/publish_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@
)


class CollectInstanceVersionModel(BaseSettingsModel):
enabled: bool = SettingsField(
True,
title="Enabled"
)


class CollectClipEffectsDefModel(BaseSettingsModel):
_layout = "expanded"
name: str = SettingsField("", title="Name")
Expand All @@ -38,46 +31,14 @@ def validate_unique_outputs(cls, value):
return value


class ExtractReviewCutUpVideoModel(BaseSettingsModel):
enabled: bool = SettingsField(
True,
title="Enabled"
)
tags_addition: list[str] = SettingsField(
default_factory=list,
title="Additional tags"
)


class PublishPluginsModel(BaseSettingsModel):
CollectInstanceVersion: CollectInstanceVersionModel = SettingsField(
default_factory=CollectInstanceVersionModel,
title="Collect Instance Version"
)
CollectClipEffects: CollectClipEffectsModel = SettingsField(
default_factory=CollectClipEffectsModel,
title="Collect Clip Effects"
)
"""# TODO: enhance settings with host api:
Rename class name and plugin name
to match title (it makes more sense)
"""
ExtractReviewCutUpVideo: ExtractReviewCutUpVideoModel = SettingsField(
default_factory=ExtractReviewCutUpVideoModel,
title="Exctract Review Trim"
)


DEFAULT_PUBLISH_PLUGIN_SETTINGS = {
"CollectInstanceVersion": {
"enabled": False,
},
"ExtractReviewCutUpVideo": {
"enabled": True,
"tags_addition": [
"review"
]
},
"CollectClipEffectsModel": {
"effect_categories": []
}
Expand Down