Merge pull request #3436 from pypeclub/feature/change_anatomy_imports

General: Use Anatomy after move to pipeline
This commit is contained in:
Jakub Trllo 2022-07-01 08:31:40 +02:00 committed by GitHub
commit 91e5f5aa27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 62 additions and 59 deletions

View file

@ -1,11 +1,10 @@
from openpype.api import Anatomy
from openpype.lib import (
PreLaunchHook,
EnvironmentPrepData,
prepare_app_environments,
prepare_context_environments
)
from openpype.pipeline import AvalonMongoDB
from openpype.pipeline import AvalonMongoDB, Anatomy
class GlobalHostDataHook(PreLaunchHook):

View file

@ -19,8 +19,9 @@ from openpype.client import (
get_last_versions,
get_representations,
)
from openpype.pipeline import legacy_io
from openpype.api import (Logger, Anatomy, get_anatomy_settings)
from openpype.settings import get_anatomy_settings
from openpype.pipeline import legacy_io, Anatomy
from openpype.api import Logger
from . import tags
try:

View file

@ -5,8 +5,7 @@ import husdoutputprocessors.base as base
import colorbleed.usdlib as usdlib
from openpype.client import get_asset_by_name
from openpype.api import Anatomy
from openpype.pipeline import legacy_io
from openpype.pipeline import legacy_io, Anatomy
class AvalonURIOutputProcessor(base.OutputProcessorBase):

View file

@ -9,8 +9,8 @@ from openpype.pipeline import (
LoaderPlugin,
get_representation_path,
AVALON_CONTAINER_ID,
Anatomy,
)
from openpype.api import Anatomy
from openpype.settings import get_project_settings
from .pipeline import containerise
from . import lib

View file

@ -20,21 +20,23 @@ from openpype.client import (
)
from openpype.api import (
Logger,
Anatomy,
BuildWorkfile,
get_version_from_path,
get_anatomy_settings,
get_workdir_data,
get_asset,
get_current_project_settings,
)
from openpype.tools.utils import host_tools
from openpype.lib.path_tools import HostDirmap
from openpype.settings import get_project_settings
from openpype.settings import (
get_project_settings,
get_anatomy_settings,
)
from openpype.modules import ModulesManager
from openpype.pipeline import (
discover_legacy_creator_plugins,
legacy_io,
Anatomy,
)
from . import gizmo_menu

View file

@ -10,8 +10,8 @@ from openpype.lib import (
from openpype.pipeline import (
registered_host,
legacy_io,
Anatomy,
)
from openpype.api import Anatomy
from openpype.hosts.tvpaint.api import lib, pipeline, plugin

View file

@ -2,7 +2,7 @@ import os
import unreal
from openpype.api import Anatomy
from openpype.pipeline import Anatomy
from openpype.hosts.unreal.api import pipeline

View file

@ -3,7 +3,7 @@ from pathlib import Path
import unreal
from openpype.api import Anatomy
from openpype.pipeline import Anatomy
from openpype.hosts.unreal.api import pipeline
import pyblish.api

View file

@ -20,10 +20,7 @@ from openpype.settings.constants import (
METADATA_KEYS,
M_DYNAMIC_KEY_LABEL
)
from . import (
PypeLogger,
Anatomy
)
from . import PypeLogger
from .profiles_filtering import filter_profiles
from .local_settings import get_openpype_username
from .avalon_context import (
@ -1305,7 +1302,7 @@ def get_app_environments_for_context(
dict: Environments for passed context and application.
"""
from openpype.pipeline import AvalonMongoDB
from openpype.pipeline import AvalonMongoDB, Anatomy
# Avalon database connection
dbcon = AvalonMongoDB()

View file

@ -14,7 +14,6 @@ from openpype.settings import (
get_project_settings,
get_system_settings
)
from .anatomy import Anatomy
from .profiles_filtering import filter_profiles
from .events import emit_event
from .path_templates import StringTemplate
@ -593,6 +592,7 @@ def get_workdir_with_workdir_data(
))
if not anatomy:
from openpype.pipeline import Anatomy
anatomy = Anatomy(project_name)
if not template_key:
@ -604,7 +604,10 @@ def get_workdir_with_workdir_data(
anatomy_filled = anatomy.format(workdir_data)
# Output is TemplateResult object which contain useful data
return anatomy_filled[template_key]["folder"]
path = anatomy_filled[template_key]["folder"]
if path:
path = os.path.normpath(path)
return path
def get_workdir(
@ -635,6 +638,7 @@ def get_workdir(
TemplateResult: Workdir path.
"""
if not anatomy:
from openpype.pipeline import Anatomy
anatomy = Anatomy(project_doc["name"])
workdir_data = get_workdir_data(
@ -747,6 +751,8 @@ def compute_session_changes(
@with_pipeline_io
def get_workdir_from_session(session=None, template_key=None):
from openpype.pipeline import Anatomy
if session is None:
session = legacy_io.Session
project_name = session["AVALON_PROJECT"]
@ -762,7 +768,10 @@ def get_workdir_from_session(session=None, template_key=None):
host_name,
project_name=project_name
)
return anatomy_filled[template_key]["folder"]
path = anatomy_filled[template_key]["folder"]
if path:
path = os.path.normpath(path)
return path
@with_pipeline_io
@ -853,6 +862,8 @@ def create_workfile_doc(asset_doc, task_name, filename, workdir, dbcon=None):
dbcon (AvalonMongoDB): Optionally enter avalon AvalonMongoDB object and
`legacy_io` is used if not entered.
"""
from openpype.pipeline import Anatomy
# Use legacy_io if dbcon is not entered
if not dbcon:
dbcon = legacy_io
@ -1673,6 +1684,7 @@ def _get_task_context_data_for_anatomy(
"""
if anatomy is None:
from openpype.pipeline import Anatomy
anatomy = Anatomy(project_doc["name"])
asset_name = asset_doc["name"]
@ -1741,6 +1753,7 @@ def get_custom_workfile_template_by_context(
"""
if anatomy is None:
from openpype.pipeline import Anatomy
anatomy = Anatomy(project_doc["name"])
# get project, asset, task anatomy context data

View file

@ -9,7 +9,6 @@ import platform
from openpype.client import get_project
from openpype.settings import get_project_settings
from .anatomy import Anatomy
from .profiles_filtering import filter_profiles
log = logging.getLogger(__name__)
@ -227,6 +226,7 @@ def fill_paths(path_list, anatomy):
def create_project_folders(basic_paths, project_name):
from openpype.pipeline import Anatomy
anatomy = Anatomy(project_name)
concat_paths = concatenate_splitted_paths(basic_paths, anatomy)

View file

@ -1045,7 +1045,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
get publish_path
Args:
anatomy (pype.lib.anatomy.Anatomy):
anatomy (openpype.pipeline.anatomy.Anatomy):
template_data (dict): pre-calculated collected data for process
asset (string): asset name
subset (string): subset name (actually group name of subset)

View file

@ -2,11 +2,11 @@ import re
import subprocess
from openpype.client import get_asset_by_id, get_asset_by_name
from openpype.settings import get_project_settings
from openpype.pipeline import Anatomy
from openpype_modules.ftrack.lib import BaseEvent
from openpype_modules.ftrack.lib.avalon_sync import CUST_ATTR_ID_KEY
from openpype.api import Anatomy, get_project_settings
class UserAssigmentEvent(BaseEvent):
"""

View file

@ -1,7 +1,7 @@
import os
import collections
import copy
from openpype.api import Anatomy
from openpype.pipeline import Anatomy
from openpype_modules.ftrack.lib import BaseAction, statics_icon

View file

@ -11,9 +11,8 @@ from openpype.client import (
get_versions,
get_representations
)
from openpype.api import Anatomy
from openpype.lib import StringTemplate, TemplateUnsolved
from openpype.pipeline import AvalonMongoDB
from openpype.pipeline import AvalonMongoDB, Anatomy
from openpype_modules.ftrack.lib import BaseAction, statics_icon

View file

@ -10,12 +10,13 @@ from openpype.client import (
get_versions,
get_representations
)
from openpype.api import Anatomy, config
from openpype.pipeline import Anatomy
from openpype_modules.ftrack.lib import BaseAction, statics_icon
from openpype_modules.ftrack.lib.avalon_sync import CUST_ATTR_ID_KEY
from openpype_modules.ftrack.lib.custom_attributes import (
query_custom_attributes
)
from openpype.lib import config
from openpype.lib.delivery import (
path_from_representation,
get_format_dict,

View file

@ -11,13 +11,13 @@ from openpype.client import (
get_project,
get_assets,
)
from openpype.api import get_project_settings
from openpype.settings import get_project_settings
from openpype.lib import (
get_workfile_template_key,
get_workdir_data,
Anatomy,
StringTemplate,
)
from openpype.pipeline import Anatomy
from openpype_modules.ftrack.lib import BaseAction, statics_icon
from openpype_modules.ftrack.lib.avalon_sync import create_chunks

View file

@ -11,10 +11,10 @@ from openpype.client import (
get_version_by_name,
get_representation_by_name
)
from openpype.api import Anatomy
from openpype.pipeline import (
get_representation_path,
AvalonMongoDB,
Anatomy,
)
from openpype_modules.ftrack.lib import BaseAction, statics_icon

View file

@ -14,8 +14,7 @@ from openpype.client import (
get_representations
)
from openpype_modules.ftrack.lib import BaseAction, statics_icon
from openpype.api import Anatomy
from openpype.pipeline import AvalonMongoDB
from openpype.pipeline import AvalonMongoDB, Anatomy
from openpype_modules.ftrack.lib.avalon_sync import CUST_ATTR_ID_KEY

View file

@ -4,10 +4,11 @@ import shutil
import threading
import time
from openpype.api import Logger, Anatomy
from openpype.api import Logger
from openpype.pipeline import Anatomy
from .abstract_provider import AbstractProvider
log = Logger().get_logger("SyncServer")
log = Logger.get_logger("SyncServer")
class LocalDriveHandler(AbstractProvider):

View file

@ -9,14 +9,12 @@ from collections import deque, defaultdict
from openpype.modules import OpenPypeModule
from openpype_interfaces import ITrayModule
from openpype.api import (
Anatomy,
from openpype.settings import (
get_project_settings,
get_system_settings,
get_local_site_id
)
from openpype.lib import PypeLogger
from openpype.pipeline import AvalonMongoDB
from openpype.lib import PypeLogger, get_local_site_id
from openpype.pipeline import AvalonMongoDB, Anatomy
from openpype.settings.lib import (
get_default_anatomy_settings,
get_anatomy_settings
@ -28,7 +26,7 @@ from .providers import lib
from .utils import time_function, SyncStatus, SiteAlreadyPresentError
log = PypeLogger().get_logger("SyncServer")
log = PypeLogger.get_logger("SyncServer")
class SyncServerModule(OpenPypeModule, ITrayModule):

View file

@ -14,11 +14,8 @@ from pyblish.lib import MessageHandler
import openpype
from openpype.modules import load_modules, ModulesManager
from openpype.settings import get_project_settings
from openpype.lib import (
Anatomy,
filter_pyblish_plugins,
)
from openpype.lib import filter_pyblish_plugins
from .anatomy import Anatomy
from . import (
legacy_io,
register_loader_plugin_path,

View file

@ -9,10 +9,10 @@ import numbers
import six
from bson.objectid import ObjectId
from openpype.lib import Anatomy
from openpype.pipeline import (
schema,
legacy_io,
Anatomy,
)
log = logging.getLogger(__name__)

View file

@ -9,9 +9,8 @@ import qargparse
from Qt import QtWidgets, QtCore
from openpype import style
from openpype.pipeline import load, AvalonMongoDB
from openpype.pipeline import load, AvalonMongoDB, Anatomy
from openpype.lib import StringTemplate
from openpype.api import Anatomy
class DeleteOldVersions(load.SubsetLoaderPlugin):

View file

@ -3,8 +3,8 @@ from collections import defaultdict
from Qt import QtWidgets, QtCore, QtGui
from openpype.pipeline import load, AvalonMongoDB
from openpype.api import Anatomy, config
from openpype.lib import config
from openpype.pipeline import load, AvalonMongoDB, Anatomy
from openpype import resources, style
from openpype.lib.delivery import (

View file

@ -4,11 +4,11 @@ Requires:
os.environ -> AVALON_PROJECT
Provides:
context -> anatomy (pype.api.Anatomy)
context -> anatomy (openpype.pipeline.anatomy.Anatomy)
"""
import os
from openpype.api import Anatomy
import pyblish.api
from openpype.pipeline import Anatomy
class CollectAnatomyObject(pyblish.api.ContextPlugin):

View file

@ -17,8 +17,7 @@ from openpype.client import (
get_thumbnail_id_from_source,
get_thumbnail,
)
from openpype.api import Anatomy
from openpype.pipeline import HeroVersionType
from openpype.pipeline import HeroVersionType, Anatomy
from openpype.pipeline.thumbnail import get_thumbnail_binary
from openpype.pipeline.load import (
discover_loader_plugins,

View file

@ -6,8 +6,7 @@ import speedcopy
from openpype.client import get_project, get_asset_by_name
from openpype.lib import Terminal
from openpype.api import Anatomy
from openpype.pipeline import legacy_io
from openpype.pipeline import legacy_io, Anatomy
t = Terminal()

View file

@ -11,7 +11,6 @@ from openpype.tools.utils import PlaceholderLineEdit
from openpype.tools.utils.delegates import PrettyTimeDelegate
from openpype.lib import (
emit_event,
Anatomy,
get_workfile_template_key,
create_workdir_extra_folders,
)
@ -22,6 +21,7 @@ from openpype.lib.avalon_context import (
from openpype.pipeline import (
registered_host,
legacy_io,
Anatomy,
)
from .model import (
WorkAreaFilesModel,