Skip to content

Commit

Permalink
Merge branch 'develop' into enhancement/fusion_launch_with_menu
Browse files Browse the repository at this point in the history
  • Loading branch information
BigRoy authored Mar 27, 2024
2 parents cb6f4dd + 15890de commit 6689b9b
Show file tree
Hide file tree
Showing 74 changed files with 2,399 additions and 498 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/pr_linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: 📇 Code Linting

on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]

workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number}}
cancel-in-progress: true

permissions:
contents: read
pull-requests: write

jobs:
linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ dump.sql

# Poetry
########
.poetry/
.python-version
.editorconfig
.pre-commit-config.yaml
Expand Down
6 changes: 3 additions & 3 deletions .hound.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
flake8:
enabled: true
config_file: setup.cfg
flake8:
enabled: true
config_file: setup.cfg
33 changes: 24 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: no-commit-to-branch
args: [ '--pattern', '^(?!((release|enhancement|feature|bugfix|documentation|tests|local|chore)\/[a-zA-Z0-9\-_]+)$).*' ]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: no-commit-to-branch
args: [ '--pattern', '^(?!((release|enhancement|feature|bugfix|documentation|tests|local|chore)\/[a-zA-Z0-9\-_]+)$).*' ]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
additional_dependencies:
- tomli

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.3.3
hooks:
# Run the linter.
- id: ruff
# Run the formatter.
# - id: ruff-format
24 changes: 18 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

AYON Core addon
========
AYON Core Addon
===============

AYON core provides the base building blocks for all other AYON addons and integrations and is responsible for discovery and initialization of other addons.
AYON core provides the base building blocks for all other AYON addons and integrations and is responsible for discovery and initialization of other addons.

- Some of its key functions include:
- It is used as the main command line handler in [ayon-launcher](https://github.com/ynput/ayon-launcher) application.
Expand All @@ -13,8 +13,20 @@ AYON core provides the base building blocks for all other AYON addons and integr
- Defines pipeline API used by other integrations
- Provides all graphical tools for artists
- Defines AYON QT styling
- A bunch more things
- A bunch more things

Together with [ayon-launcher](https://github.com/ynput/ayon-launcher) , they form the base of AYON pipeline and is one of few compulsory addons for AYON pipeline to be useful in a meaningful way.
Together with [ayon-launcher](https://github.com/ynput/ayon-launcher) , they form the base of AYON pipeline and is one of few compulsory addons for AYON pipeline to be useful in a meaningful way.

AYON-core is a successor to OpenPype repository (minus all the addons) and still in the process of cleaning up of all references. Please bear with us during this transitional phase.
AYON-core is a successor to [OpenPype repository](https://github.com/ynput/OpenPype) (minus all the addons) and still in the process of cleaning up of all references. Please bear with us during this transitional phase.

Development and testing notes
-----------------------------
There is `pyproject.toml` file in the root of the repository. This file is used to define the development environment and is used by `poetry` to create a virtual environment.
This virtual environment is used to run tests and to develop the code, to help with
linting and formatting. Dependencies defined here are not used in actual addon
deployment - for that you need to edit `./client/pyproject.toml` file. That file
will be then processed [ayon-dependencies-tool](https://github.com/ynput/ayon-dependencies-tool)
to create dependency package.

Right now, this file needs to by synced with dependencies manually, but in the future
we plan to automate process of development environment creation.
58 changes: 0 additions & 58 deletions client/ayon_core/hooks/pre_non_python_host_launch.py

This file was deleted.

8 changes: 7 additions & 1 deletion client/ayon_core/hosts/aftereffects/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
from .addon import AfterEffectsAddon
from .addon import (
AFTEREFFECTS_ADDON_ROOT,
AfterEffectsAddon,
get_launch_script_path,
)


__all__ = (
"AFTEREFFECTS_ADDON_ROOT",
"AfterEffectsAddon",
"get_launch_script_path",
)
17 changes: 17 additions & 0 deletions client/ayon_core/hosts/aftereffects/addon.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import os

from ayon_core.addon import AYONAddon, IHostAddon

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


class AfterEffectsAddon(AYONAddon, IHostAddon):
name = "aftereffects"
Expand All @@ -17,3 +21,16 @@ def add_implementation_envs(self, env, _app):

def get_workfile_extensions(self):
return [".aep"]

def get_launch_hook_paths(self, app):
if app.host_name != self.host_name:
return []
return [
os.path.join(AFTEREFFECTS_ADDON_ROOT, "hooks")
]


def get_launch_script_path():
return os.path.join(
AFTEREFFECTS_ADDON_ROOT, "api", "launch_script.py"
)
1 change: 0 additions & 1 deletion client/ayon_core/hosts/aftereffects/api/launch_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import functools
import traceback


from wsrpc_aiohttp import (
WebSocketRoute,
WebSocketAsync
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Script wraps launch mechanism of non python host implementations.
"""Script wraps launch mechanism of AfterEffects implementations.
Arguments passed to the script are passed to launch function in host
implementation. In all cases requires host app executable and may contain
Expand All @@ -8,6 +8,8 @@
import os
import sys

from ayon_core.hosts.aftereffects.api.launch_logic import main as host_main

# Get current file to locate start point of sys.argv
CURRENT_FILE = os.path.abspath(__file__)

Expand Down Expand Up @@ -79,26 +81,9 @@ def main(argv):
if after_script_idx is not None:
launch_args = sys_args[after_script_idx:]

host_name = os.environ["AYON_HOST_NAME"].lower()
if host_name == "photoshop":
# TODO refactor launch logic according to AE
from ayon_core.hosts.photoshop.api.lib import main
elif host_name == "aftereffects":
from ayon_core.hosts.aftereffects.api.launch_logic import main
elif host_name == "harmony":
from ayon_core.hosts.harmony.api.lib import main
else:
title = "Unknown host name"
message = (
"BUG: Environment variable AYON_HOST_NAME contains unknown"
" host name \"{}\""
).format(host_name)
show_error_messagebox(title, message)
return

if launch_args:
# Launch host implementation
main(*launch_args)
host_main(*launch_args)
else:
# Show message box
on_invalid_args(after_script_idx is None)
Expand Down
91 changes: 91 additions & 0 deletions client/ayon_core/hosts/aftereffects/hooks/pre_launch_args.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import os
import platform
import subprocess

from ayon_core.lib import (
get_ayon_launcher_args,
is_using_ayon_console,
)
from ayon_core.lib.applications import (
PreLaunchHook,
LaunchTypes,
)
from ayon_core.hosts.aftereffects import get_launch_script_path


def get_launch_kwargs(kwargs):
"""Explicit setting of kwargs for Popen for AfterEffects.
Expected behavior
- ayon_console opens window with logs
- ayon has stdout/stderr available for capturing
Args:
kwargs (Union[dict, None]): Current kwargs or None.
"""
if kwargs is None:
kwargs = {}

if platform.system().lower() != "windows":
return kwargs

if is_using_ayon_console():
kwargs.update({
"creationflags": subprocess.CREATE_NEW_CONSOLE
})
else:
kwargs.update({
"creationflags": subprocess.CREATE_NO_WINDOW,
"stdout": subprocess.DEVNULL,
"stderr": subprocess.DEVNULL
})
return kwargs


class AEPrelaunchHook(PreLaunchHook):
"""Launch arguments preparation.
Hook add python executable and script path to AE implementation before
AE executable and add last workfile path to launch arguments.
Existence of last workfile is checked. If workfile does not exists tries
to copy templated workfile from predefined path.
"""
app_groups = {"aftereffects"}

order = 20
launch_types = {LaunchTypes.local}

def execute(self):
# Pop executable
executable_path = self.launch_context.launch_args.pop(0)

# Pop rest of launch arguments - There should not be other arguments!
remainders = []
while self.launch_context.launch_args:
remainders.append(self.launch_context.launch_args.pop(0))

script_path = get_launch_script_path()

new_launch_args = get_ayon_launcher_args(
"run", script_path, executable_path
)
# Add workfile path if exists
workfile_path = self.data["last_workfile_path"]
if (
self.data.get("start_last_workfile")
and workfile_path
and os.path.exists(workfile_path)
):
new_launch_args.append(workfile_path)

# Append as whole list as these arguments should not be separated
self.launch_context.launch_args.append(new_launch_args)

if remainders:
self.launch_context.launch_args.extend(remainders)

self.launch_context.kwargs = get_launch_kwargs(
self.launch_context.kwargs
)
6 changes: 4 additions & 2 deletions client/ayon_core/hosts/harmony/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from .addon import (
HARMONY_HOST_DIR,
HARMONY_ADDON_ROOT,
HarmonyAddon,
get_launch_script_path,
)


__all__ = (
"HARMONY_HOST_DIR",
"HARMONY_ADDON_ROOT",
"HarmonyAddon",
"get_launch_script_path",
)
Loading

0 comments on commit 6689b9b

Please sign in to comment.