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 Maya addon code #546

Merged
merged 6 commits into from
May 30, 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
3 changes: 2 additions & 1 deletion client/ayon_core/addon/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"max": VersionInfo(0, 2, 0),
"traypublisher": VersionInfo(0, 2, 0),
"tvpaint": VersionInfo(0, 2, 0),
"maya": VersionInfo(0, 2, 0),
"nuke": VersionInfo(0, 2, 0),
"substancepainter": VersionInfo(0, 2, 0),
}
Expand Down Expand Up @@ -1330,7 +1331,7 @@ def __init__(self, settings=None):
self.doubleclick_callback = None

def add_doubleclick_callback(self, addon, callback):
"""Register doubleclick callbacks on tray icon.
"""Register double-click callbacks on tray icon.

Currently, there is no way how to determine which is launched. Name of
callback can be defined with `doubleclick_callback` attribute.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
EnumDef,
is_in_tests,
)
from ayon_core.hosts.maya.api.lib_rendersettings import RenderSettings
from ayon_core.hosts.maya.api.lib import get_attr_in_layer
from ayon_maya.api.lib_rendersettings import RenderSettings
from ayon_maya.api.lib import get_attr_in_layer

from openpype_modules.deadline import abstract_submit_deadline
from openpype_modules.deadline.abstract_submit_deadline import DeadlineJobInfo
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ line-ending = "auto"
# Ignore words that are not in the dictionary.
ignore-words-list = "ayon,ynput,parms,parm,hda,developpement,ue"

# Ignore lines that contain this regex. This is hack for missing inline ignore.
# Remove with next codespell release (>2.2.6)
ignore-regex = ".*codespell:ignore.*"

skip = "./.*,./package/*,*/vendor/*,*/unreal/integration/*,*/aftereffects/api/extension/js/libs/*"
count = true
quiet-level = 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from maya import cmds # noqa

from ayon_core.hosts.maya.api.lib import evaluation
from ayon_maya.api.lib import evaluation

log = logging.getLogger(__name__)

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

Instead of using ExitStack from contextlib, use it from this module:

>>> from ayon_core.hosts.maya.api.exitstack import ExitStack
>>> from ayon_maya.api.exitstack import ExitStack

It will provide the appropriate ExitStack implementation for the current
running Python version.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from maya import cmds # noqa
import maya.mel as mel # noqa
from ayon_core.hosts.maya.api.lib import maintained_selection
from ayon_maya.api.lib import maintained_selection


class FBXExtractor:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"hbu": bool, # hashBufferURI
"ext": bool, # externalTextures
"ivt": int, # initialValuesTime
"acn": str, # animationClipName
"acn": str, # animationClipName # codespell:ignore acn
"ast": int, # animationClipStartTime
"aet": int, # animationClipEndTime
"afr": float, # animationClipFrameRate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from ayon_core.pipeline import CreatorError, get_current_project_name
from ayon_core.pipeline.context_tools import get_current_folder_entity
from ayon_core.hosts.maya.api.lib import reset_frame_range
from ayon_maya.api.lib import reset_frame_range


class RenderSettings(object):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
UniqueOverride
)

from ayon_core.hosts.maya.api.lib import get_attribute
from ayon_maya.api.lib import get_attribute

EXACT_MATCH = 0
PARENT_MATCH = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
)
from ayon_core.pipeline.workfile import BuildWorkfile
from ayon_core.tools.utils import host_tools
from ayon_core.hosts.maya.api import lib, lib_rendersettings
from ayon_maya.api import lib, lib_rendersettings
from .lib import get_main_window, IS_HEADLESS
from ..tools import show_look_assigner

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
is_workfile_locked,
is_workfile_lock_enabled
)
from ayon_core.hosts.maya import MAYA_ROOT_DIR
from ayon_core.hosts.maya.lib import create_workspace_mel
from ayon_maya import MAYA_ROOT_DIR
from ayon_maya.lib import create_workspace_mel

from . import menu, lib
from .workio import (
Expand All @@ -58,7 +58,7 @@
current_file
)

log = logging.getLogger("ayon_core.hosts.maya")
log = logging.getLogger("ayon_maya")

PLUGINS_DIR = os.path.join(MAYA_ROOT_DIR, "plugins")
PUBLISH_PATH = os.path.join(PLUGINS_DIR, "publish")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,41 @@
import os
from abc import ABCMeta

import ayon_api
import qargparse
import six
import ayon_api
from maya import cmds
from maya.app.renderSetup.model import renderSetup

from ayon_core.lib import BoolDef, Logger
from ayon_core.settings import get_project_settings
from ayon_core.pipeline import (
AYON_INSTANCE_ID,
AYON_CONTAINER_ID,
AVALON_INSTANCE_ID,
AVALON_CONTAINER_ID,
AVALON_INSTANCE_ID,
AYON_CONTAINER_ID,
AYON_INSTANCE_ID,
Anatomy,

AutoCreator,
CreatedInstance,
Creator as NewCreator,
AutoCreator,
HiddenCreator,

CreatorError,
HiddenCreator,
LegacyCreator,
LoaderPlugin,
get_representation_path,
get_current_project_name,
get_representation_path,
publish,
)
from ayon_core.pipeline.load import LoadError
from ayon_core.pipeline.create import get_product_name
from ayon_core.pipeline.load import LoadError
from ayon_core.settings import get_project_settings
from maya import cmds
from maya.app.renderSetup.model import renderSetup
from pyblish.api import ContextPlugin, InstancePlugin

from . import lib
from .lib import imprint, read
from .pipeline import containerise

log = Logger.get_logger()
SETTINGS_CATEGORY = "maya"


def _get_attr(node, attr, default=None):
Expand Down Expand Up @@ -652,7 +653,7 @@ def get_load_color_for_product_type(product_type, settings=None):

class Loader(LoaderPlugin):
hosts = ["maya"]

settings_category = SETTINGS_CATEGORY
load_settings = {} # defined in settings

@classmethod
Expand Down Expand Up @@ -807,10 +808,9 @@ def process_reference(self, context, name, namespace, options):
raise NotImplementedError("Must be implemented by subclass")

def update(self, container, context):
from ayon_maya.api.lib import get_container_members
from maya import cmds

from ayon_core.hosts.maya.api.lib import get_container_members

node = container["objectName"]

project_name = context["project"]["name"]
Expand Down Expand Up @@ -1025,3 +1025,30 @@ def _organize_containers(nodes, container):
AYON_CONTAINER_ID, AVALON_CONTAINER_ID
}:
cmds.sets(node, forceElement=container)


class MayaLoader(LoaderPlugin):
"""Base class for loader plugins."""

settings_category = SETTINGS_CATEGORY


class MayaInstancePlugin(InstancePlugin):
"""Base class for instance publish plugins."""

settings_category = SETTINGS_CATEGORY
hosts = ["maya"]


class MayaContextPlugin(ContextPlugin):
"""Base class for context publish plugins."""

settings_category = SETTINGS_CATEGORY
hosts = ["maya"]


class MayaExtractorPlugin(publish.Extractor):
"""Base class for extract plugins."""

settings_category = SETTINGS_CATEGORY
hosts = ["maya"]
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
get_representation_path,
get_current_project_name,
)
from ayon_core.hosts.maya.api.lib import (
from ayon_maya.api.lib import (
matrix_equals,
unique_namespace,
get_container_transforms,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from ayon_applications import PreLaunchHook, LaunchTypes
from ayon_core.hosts.maya.lib import create_workspace_mel
from ayon_maya.lib import create_workspace_mel


class PreCopyMel(PreLaunchHook):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import ayon_api

from ayon_core.pipeline.create.creator_plugins import ProductConvertorPlugin
from ayon_core.hosts.maya.api import plugin
from ayon_core.hosts.maya.api.lib import read
from ayon_maya.api import plugin
from ayon_maya.api.lib import read

from maya import cmds
from maya.app.renderSetup.model import renderSetup
Expand All @@ -12,7 +12,7 @@ class MayaLegacyConvertor(ProductConvertorPlugin,
plugin.MayaCreatorBase):
"""Find and convert any legacy products in the scene.

This Convertor will find all legacy products in the scene and will
This Converter will find all legacy products in the scene and will
transform them to the current system. Since the old products doesn't
retain any information about their original creators, the only mapping
we can do is based on their families.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from maya import cmds

from ayon_core.hosts.maya.api import lib, plugin
from ayon_maya.api import lib, plugin

from ayon_core.lib import (
BoolDef,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from maya import cmds

from ayon_core.hosts.maya.api import (
from ayon_maya.api import (
lib,
plugin
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ayon_core.hosts.maya.api import plugin
from ayon_maya.api import plugin


class CreateAssembly(plugin.MayaCreator):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ayon_core.hosts.maya.api import (
from ayon_maya.api import (
lib,
plugin
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ayon_core.hosts.maya.api import plugin
from ayon_maya.api import plugin
from ayon_core.lib import BoolDef


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ayon_core.hosts.maya.api import (
from ayon_maya.api import (
plugin,
lib
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ayon_core.hosts.maya.api import (
from ayon_maya.api import (
lib,
plugin
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ayon_core.hosts.maya.api import plugin, lib
from ayon_maya.api import plugin, lib
from ayon_core.lib import (
BoolDef,
EnumDef,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ayon_core.hosts.maya.api import plugin
from ayon_maya.api import plugin


class CreateMayaScene(plugin.MayaCreator):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ayon_core.hosts.maya.api import plugin
from ayon_maya.api import plugin
from ayon_core.lib import (
BoolDef,
TextDef
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
)
from maya import cmds # noqa: F401

from ayon_core.hosts.maya.api import plugin
from ayon_maya.api import plugin
from ayon_core.lib import BoolDef, EnumDef, TextDef
from ayon_core.pipeline import (
Creator,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ayon_core.hosts.maya.api import plugin
from ayon_maya.api import plugin
from ayon_core.lib import (
BoolDef,
EnumDef
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ayon_core.hosts.maya.api import plugin, lib
from ayon_maya.api import plugin, lib
from ayon_core.lib import (
BoolDef,
NumberDef,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ayon_core.hosts.maya.api import plugin, lib
from ayon_maya.api import plugin, lib
from ayon_core.lib import (
BoolDef,
NumberDef,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ayon_core.hosts.maya.api import plugin, lib
from ayon_maya.api import plugin, lib
from ayon_core.lib import (
BoolDef,
NumberDef,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ayon_core.hosts.maya.api import (
from ayon_maya.api import (
lib,
plugin
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Creator of Redshift proxy product types."""

from ayon_core.hosts.maya.api import plugin, lib
from ayon_maya.api import plugin, lib
from ayon_core.lib import BoolDef


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
"""Create ``Render`` instance in Maya."""

from ayon_core.hosts.maya.api import (
from ayon_maya.api import (
lib_rendersettings,
plugin
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from ayon_core.hosts.maya.api import plugin
from ayon_maya.api import plugin
from ayon_core.pipeline import CreatorError


Expand Down
Loading