Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

3.0/feature/pype refactor start #169

Merged
merged 13 commits into from
Jun 1, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion pype/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from pyblish import api as pyblish
from avalon import api as avalon
from .api import config, Anatomy
from .lib import filter_pyblish_plugins
from pypeapp import config, Anatomy


import logging
Expand Down
17 changes: 14 additions & 3 deletions pype/api.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
from .plugin import (
from pypeapp import (
Logger,
Anatomy,
project_overrides_dir_path,
config,
execute
)

from .plugin import (
Extractor,

ValidatePipelineOrder,
Expand All @@ -16,8 +23,6 @@
RepairContextAction
)

from pypeapp import Logger

from .lib import (
version_up,
get_asset,
Expand All @@ -33,6 +38,12 @@
from .lib import _subprocess as subprocess

__all__ = [
"Logger",
"Anatomy",
"project_overrides_dir_path",
"config",
"execute",

# plugin classes
"Extractor",
# ordering
Expand Down
6 changes: 3 additions & 3 deletions pype/hooks/premiere/prelaunch.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os
import traceback
from pype.lib import PypeHook
from pypeapp import Logger
from pype.premiere import lib as prlib
from pype.api import Logger
from pype.hosts.premiere import lib as prlib


class PremierePrelaunch(PypeHook):
Expand All @@ -27,7 +27,7 @@ def execute(self, *args, env: dict = None) -> bool:
env = os.environ

try:
__import__("pype.premiere")
__import__("pype.hosts.premiere")
__import__("pyblish")

except ImportError as e:
Expand Down
4 changes: 2 additions & 2 deletions pype/hooks/unreal/unreal_prelaunch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import os

from pype.lib import PypeHook
from pype.unreal import lib as unreal_lib
from pypeapp import Logger
from pype.hosts.unreal import lib as unreal_lib
from pype.api import Logger

log = logging.getLogger(__name__)

Expand Down
File renamed without changes.
4 changes: 1 addition & 3 deletions pype/blender/__init__.py → pype/hosts/blender/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
from avalon import api as avalon
from pyblish import api as pyblish

PARENT_DIR = os.path.dirname(__file__)
PACKAGE_DIR = os.path.dirname(PARENT_DIR)
PLUGINS_DIR = os.path.join(PACKAGE_DIR, "plugins")
from pype import PLUGINS_DIR

PUBLISH_PATH = os.path.join(PLUGINS_DIR, "blender", "publish")
LOAD_PATH = os.path.join(PLUGINS_DIR, "blender", "load")
Expand Down
2 changes: 1 addition & 1 deletion pype/blender/action.py → pype/hosts/blender/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pyblish.api

from ..action import get_errored_instances_from_context
from ...action import get_errored_instances_from_context


class SelectInvalidAction(pyblish.api.Action):
Expand Down
File renamed without changes.
6 changes: 1 addition & 5 deletions pype/fusion/__init__.py → pype/hosts/fusion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

from avalon import api as avalon
from pyblish import api as pyblish


PARENT_DIR = os.path.dirname(__file__)
PACKAGE_DIR = os.path.dirname(PARENT_DIR)
PLUGINS_DIR = os.path.join(PACKAGE_DIR, "plugins")
from pype import PLUGINS_DIR

PUBLISH_PATH = os.path.join(PLUGINS_DIR, "fusion", "publish")
LOAD_PATH = os.path.join(PLUGINS_DIR, "fusion", "load")
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import avalon.fusion

# Config imports
import pype.lib pype
import pype.fusion.lib as fusion_lib
import pype.lib as pype
import pype.hosts.fusion.lib as fusion_lib

log = logging.getLogger("Update Slap Comp")

Expand Down
File renamed without changes.
10 changes: 3 additions & 7 deletions pype/houdini/__init__.py → pype/hosts/houdini/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,16 @@
from avalon import api as avalon
from avalon.houdini import pipeline as houdini

from pype.houdini import lib
from pype.hosts.houdini import lib

from pype.lib import any_outdated


PARENT_DIR = os.path.dirname(__file__)
PACKAGE_DIR = os.path.dirname(PARENT_DIR)
PLUGINS_DIR = os.path.join(PACKAGE_DIR, "plugins")
from pype import PLUGINS_DIR

PUBLISH_PATH = os.path.join(PLUGINS_DIR, "houdini", "publish")
LOAD_PATH = os.path.join(PLUGINS_DIR, "houdini", "load")
CREATE_PATH = os.path.join(PLUGINS_DIR, "houdini", "create")

log = logging.getLogger("pype.houdini")
log = logging.getLogger("pype.hosts.houdini")


def install():
Expand Down
2 changes: 1 addition & 1 deletion pype/houdini/lib.py → pype/hosts/houdini/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def validate_fps():

if current_fps != fps:

from ..widgets import popup
from ...widgets import popup

# Find main window
parent = hou.ui.mainQtWindow()
Expand Down
28 changes: 12 additions & 16 deletions pype/maya/__init__.py → pype/hosts/maya/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,13 @@
from avalon.tools import workfiles
from pyblish import api as pyblish

from ..lib import (
any_outdated
)
from ...lib import any_outdated
from pype import PLUGINS_DIR

from . import menu
from . import lib

log = logging.getLogger("pype.maya")

PARENT_DIR = os.path.dirname(__file__)
PACKAGE_DIR = os.path.dirname(PARENT_DIR)
PLUGINS_DIR = os.path.join(PACKAGE_DIR, "plugins")
log = logging.getLogger("pype.hosts.maya")

PUBLISH_PATH = os.path.join(PLUGINS_DIR, "maya", "publish")
LOAD_PATH = os.path.join(PLUGINS_DIR, "maya", "load")
Expand All @@ -30,7 +26,7 @@ def install():
pyblish.register_plugin_path(PUBLISH_PATH)
avalon.register_plugin_path(avalon.Loader, LOAD_PATH)
avalon.register_plugin_path(avalon.Creator, CREATE_PATH)

log.info(PUBLISH_PATH)
menu.install()

log.info("Installing callbacks ... ")
Expand Down Expand Up @@ -153,14 +149,14 @@ def on_open(_):
"""On scene open let's assume the containers have changed."""

from avalon.vendor.Qt import QtWidgets
from ..widgets import popup
from ...widgets import popup

cmds.evalDeferred(
"from pype.maya import lib;lib.remove_render_layer_observer()")
"from pype.hosts.maya import lib;lib.remove_render_layer_observer()")
cmds.evalDeferred(
"from pype.maya import lib;lib.add_render_layer_observer()")
"from pype.hosts.maya import lib;lib.add_render_layer_observer()")
cmds.evalDeferred(
"from pype.maya import lib;lib.add_render_layer_change_observer()")
"from pype.hosts.maya import lib;lib.add_render_layer_change_observer()")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (81 > 79 characters)

# # Update current task for the current scene
# update_task_from_path(cmds.file(query=True, sceneName=True))

Expand Down Expand Up @@ -200,11 +196,11 @@ def on_new(_):
avalon.logger.info("Running callback on new..")
with maya.suspended_refresh():
cmds.evalDeferred(
"from pype.maya import lib;lib.remove_render_layer_observer()")
"from pype.hosts.maya import lib;lib.remove_render_layer_observer()")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (81 > 79 characters)

cmds.evalDeferred(
"from pype.maya import lib;lib.add_render_layer_observer()")
"from pype.hosts.maya import lib;lib.add_render_layer_observer()")
cmds.evalDeferred(
"from pype.maya import lib;lib.add_render_layer_change_observer()")
"from pype.hosts.maya import lib;lib.add_render_layer_change_observer()")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (85 > 79 characters)

lib.set_context_settings()


Expand Down
4 changes: 2 additions & 2 deletions pype/maya/action.py → pype/hosts/maya/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pyblish.api


from ..action import get_errored_instances_from_context
from ...action import get_errored_instances_from_context


class GenerateUUIDsOnInvalidAction(pyblish.api.Action):
Expand Down Expand Up @@ -72,7 +72,7 @@ def _update_id_attribute(self, instance, nodes):
nodes (list): all nodes to regenerate ids on
"""

import pype.maya.lib as lib
from pype.hosts.maya import lib
import avalon.io as io

asset = instance.data['asset']
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions pype/maya/lib.py → pype/hosts/maya/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1899,7 +1899,7 @@ def validate_fps():
if current_fps != fps:

from avalon.vendor.Qt import QtWidgets
from ..widgets import popup
from ...widgets import popup

# Find maya main window
top_level_widgets = {w.objectName(): w for w in
Expand Down Expand Up @@ -2622,7 +2622,7 @@ def update_content_on_context_change():

def show_message(title, msg):
from avalon.vendor.Qt import QtWidgets
from ..widgets import message_window
from ...widgets import message_window

# Find maya main window
top_level_widgets = {w.objectName(): w for w in
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion pype/maya/menu.py → pype/hosts/maya/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from avalon.vendor.Qt import QtWidgets, QtGui
from avalon.maya import pipeline
from ..lib import BuildWorkfile
from ...lib import BuildWorkfile
import maya.cmds as cmds

self = sys.modules[__name__]
Expand Down
File renamed without changes.
19 changes: 8 additions & 11 deletions pype/nuke/__init__.py → pype/hosts/nuke/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
from avalon import api as avalon
from avalon.tools import workfiles
from pyblish import api as pyblish
from pype.nuke import menu
from pypeapp import Logger
from pype.hosts.nuke import menu
from pype.api import Logger
from pype import PLUGINS_DIR
from . import lib


Expand All @@ -18,10 +19,6 @@

AVALON_CONFIG = os.getenv("AVALON_CONFIG", "pype")

PARENT_DIR = os.path.dirname(__file__)
PACKAGE_DIR = os.path.dirname(PARENT_DIR)
PLUGINS_DIR = os.path.join(PACKAGE_DIR, "plugins")

PUBLISH_PATH = os.path.join(PLUGINS_DIR, "nuke", "publish")
LOAD_PATH = os.path.join(PLUGINS_DIR, "nuke", "load")
CREATE_PATH = os.path.join(PLUGINS_DIR, "nuke", "create")
Expand All @@ -44,11 +41,11 @@ def reload_config():

for module in (
"{}.api".format(AVALON_CONFIG),
"{}.nuke.actions".format(AVALON_CONFIG),
"{}.nuke.presets".format(AVALON_CONFIG),
"{}.nuke.menu".format(AVALON_CONFIG),
"{}.nuke.plugin".format(AVALON_CONFIG),
"{}.nuke.lib".format(AVALON_CONFIG),
"{}.hosts.nuke.actions".format(AVALON_CONFIG),
"{}.hosts.nuke.presets".format(AVALON_CONFIG),
"{}.hosts.nuke.menu".format(AVALON_CONFIG),
"{}.hosts.nuke.plugin".format(AVALON_CONFIG),
"{}.hosts.nuke.lib".format(AVALON_CONFIG),
):
log.info("Reloading module: {}...".format(module))

Expand Down
2 changes: 1 addition & 1 deletion pype/nuke/actions.py → pype/hosts/nuke/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
select_nodes
)

from ..action import get_errored_instances_from_context
from ...action import get_errored_instances_from_context


class SelectInvalidAction(pyblish.api.Action):
Expand Down
3 changes: 1 addition & 2 deletions pype/nuke/lib.py → pype/hosts/nuke/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@

from .utils import set_context_favorites

from pypeapp import Logger
log = Logger().get_logger(__name__, "nuke")
log = pype.Logger().get_logger(__name__, "nuke")

self = sys.modules[__name__]
self._project = None
Expand Down
4 changes: 2 additions & 2 deletions pype/nuke/menu.py → pype/hosts/nuke/menu.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import nuke
from avalon.api import Session

from pype.nuke import lib
from pypeapp import Logger
from pype.hosts.nuke import lib
from pype.api import Logger

log = Logger().get_logger(__name__, "nuke")

Expand Down
3 changes: 1 addition & 2 deletions pype/nuke/plugin.py → pype/hosts/nuke/plugin.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import re
import avalon.api
import avalon.nuke
from pype import api as pype
from pypeapp import config
from pype.api import config

class PypeCreator(avalon.nuke.pipeline.Creator):
"""Pype Nuke Creator class wrapper
Expand Down
5 changes: 2 additions & 3 deletions pype/nuke/presets.py → pype/hosts/nuke/presets.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from pype import api as pype
from pypeapp import Anatomy, config
from pype.api import Anatomy, config, Logger
import nuke

log = pype.Logger().get_logger(__name__, "nuke")
log = Logger().get_logger(__name__, "nuke")


def get_anatomy(**kwarg):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import os
from pypeapp import Logger
from pype.api import Logger
from avalon import api as avalon
from pyblish import api as pyblish
from pype import PLUGINS_DIR

from .workio import (
open_file,
Expand Down Expand Up @@ -37,10 +38,6 @@
AVALON_CONFIG = os.getenv("AVALON_CONFIG", "pype")

# plugin root path
PARENT_DIR = os.path.dirname(__file__)
PACKAGE_DIR = os.path.dirname(PARENT_DIR)
PLUGINS_DIR = os.path.join(PACKAGE_DIR, "plugins")

PUBLISH_PATH = os.path.join(PLUGINS_DIR, "nukestudio", "publish")
LOAD_PATH = os.path.join(PLUGINS_DIR, "nukestudio", "load")
CREATE_PATH = os.path.join(PLUGINS_DIR, "nukestudio", "create")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
import hiero.core.events
from pypeapp import Logger
from pype.api import Logger
from .lib import sync_avalon_data_to_workfile, launch_workfiles_app
from .tags import add_tags_from_presets

Expand Down
Loading