Use new import source of Extractor

This commit is contained in:
Jakub Trllo 2022-09-01 12:11:07 +02:00
parent a515e58196
commit b61688828e
27 changed files with 76 additions and 76 deletions

View file

@ -1,12 +1,12 @@
import os
import openpype.api
from maya import cmds
from openpype.pipeline import publish
from openpype.hosts.maya.api.lib import maintained_selection
class ExtractAssStandin(openpype.api.Extractor):
class ExtractAssStandin(publish.Extractor):
"""Extract the content of the instance to a ass file
Things to pay attention to:

View file

@ -1,14 +1,13 @@
import os
import json
import os
import openpype.api
from openpype.pipeline import publish
from openpype.hosts.maya.api.lib import extract_alembic
from maya import cmds
class ExtractAssembly(openpype.api.Extractor):
class ExtractAssembly(publish.Extractor):
"""Produce an alembic of just point positions and normals.
Positions and normals are preserved, but nothing more,

View file

@ -3,17 +3,17 @@ import contextlib
from maya import cmds
import openpype.api
from openpype.pipeline import publish
from openpype.hosts.maya.api.lib import maintained_selection
class ExtractAssProxy(openpype.api.Extractor):
class ExtractAssProxy(publish.Extractor):
"""Extract proxy model as Maya Ascii to use as arnold standin
"""
order = openpype.api.Extractor.order + 0.2
order = publish.Extractor.order + 0.2
label = "Ass Proxy (Maya ASCII)"
hosts = ["maya"]
families = ["ass"]

View file

@ -2,11 +2,11 @@ import os
from maya import cmds
import openpype.api
from openpype.pipeline import publish
from openpype.hosts.maya.api import lib
class ExtractCameraAlembic(openpype.api.Extractor):
class ExtractCameraAlembic(publish.Extractor):
"""Extract a Camera as Alembic.
The cameras gets baked to world space by default. Only when the instance's

View file

@ -5,7 +5,7 @@ import itertools
from maya import cmds
import openpype.api
from openpype.pipeline import publish
from openpype.hosts.maya.api import lib
@ -78,7 +78,7 @@ def unlock(plug):
cmds.disconnectAttr(source, destination)
class ExtractCameraMayaScene(openpype.api.Extractor):
class ExtractCameraMayaScene(publish.Extractor):
"""Extract a Camera as Maya Scene.
This will create a duplicate of the camera that will be baked *with*

View file

@ -4,13 +4,13 @@ import os
from maya import cmds # noqa
import maya.mel as mel # noqa
import pyblish.api
import openpype.api
from openpype.hosts.maya.api.lib import maintained_selection
from openpype.pipeline import publish
from openpype.hosts.maya.api.lib import maintained_selection
from openpype.hosts.maya.api import fbx
class ExtractFBX(openpype.api.Extractor):
class ExtractFBX(publish.Extractor):
"""Extract FBX from Maya.
This extracts reproducible FBX exports ignoring any of the

View file

@ -5,13 +5,11 @@ import json
from maya import cmds
from maya.api import OpenMaya as om
from bson.objectid import ObjectId
from openpype.pipeline import legacy_io
import openpype.api
from openpype.client import get_representation_by_id
from openpype.pipeline import legacy_io, publish
class ExtractLayout(openpype.api.Extractor):
class ExtractLayout(publish.Extractor):
"""Extract a layout."""
label = "Extract Layout"
@ -30,6 +28,8 @@ class ExtractLayout(openpype.api.Extractor):
instance.data["representations"] = []
json_data = []
# TODO representation queries can be refactored to be faster
project_name = legacy_io.active_project()
for asset in cmds.sets(str(instance), query=True):
# Find the container
@ -43,11 +43,11 @@ class ExtractLayout(openpype.api.Extractor):
representation_id = cmds.getAttr(f"{container}.representation")
representation = legacy_io.find_one(
{
"type": "representation",
"_id": ObjectId(representation_id)
}, projection={"parent": True, "context.family": True})
representation = get_representation_by_id(
project_name,
representation_id,
fields=["parent", "context.family"]
)
self.log.info(representation)
@ -102,9 +102,10 @@ class ExtractLayout(openpype.api.Extractor):
for i in range(0, len(t_matrix_list), row_length):
t_matrix.append(t_matrix_list[i:i + row_length])
json_element["transform_matrix"] = []
for row in t_matrix:
json_element["transform_matrix"].append(list(row))
json_element["transform_matrix"] = [
list(row)
for row in t_matrix
]
basis_list = [
1, 0, 0, 0,

View file

@ -13,8 +13,8 @@ from maya import cmds # noqa
import pyblish.api
import openpype.api
from openpype.pipeline import legacy_io
from openpype.lib import source_hash
from openpype.pipeline import legacy_io, publish
from openpype.hosts.maya.api import lib
# Modes for transfer
@ -161,7 +161,7 @@ def no_workspace_dir():
os.rmdir(fake_workspace_dir)
class ExtractLook(openpype.api.Extractor):
class ExtractLook(publish.Extractor):
"""Extract Look (Maya Scene + JSON)
Only extracts the sets (shadingEngines and alike) alongside a .json file
@ -505,7 +505,7 @@ class ExtractLook(openpype.api.Extractor):
args = []
if do_maketx:
args.append("maketx")
texture_hash = openpype.api.source_hash(filepath, *args)
texture_hash = source_hash(filepath, *args)
# If source has been published before with the same settings,
# then don't reprocess but hardlink from the original

View file

@ -4,12 +4,11 @@ import os
from maya import cmds
import openpype.api
from openpype.hosts.maya.api.lib import maintained_selection
from openpype.pipeline import AVALON_CONTAINER_ID
from openpype.pipeline import AVALON_CONTAINER_ID, publish
class ExtractMayaSceneRaw(openpype.api.Extractor):
class ExtractMayaSceneRaw(publish.Extractor):
"""Extract as Maya Scene (raw).
This will preserve all references, construction history, etc.

View file

@ -4,11 +4,11 @@ import os
from maya import cmds
import openpype.api
from openpype.pipeline import publish
from openpype.hosts.maya.api import lib
class ExtractModel(openpype.api.Extractor):
class ExtractModel(publish.Extractor):
"""Extract as Model (Maya Scene).
Only extracts contents based on the original "setMembers" data to ensure

View file

@ -2,11 +2,11 @@ import os
from maya import cmds
import openpype.api
from openpype.pipeline import publish
from openpype.hosts.maya.api.lib import maintained_selection
class ExtractMultiverseLook(openpype.api.Extractor):
class ExtractMultiverseLook(publish.Extractor):
"""Extractor for Multiverse USD look data.
This will extract:

View file

@ -3,11 +3,11 @@ import six
from maya import cmds
import openpype.api
from openpype.pipeline import publish
from openpype.hosts.maya.api.lib import maintained_selection
class ExtractMultiverseUsd(openpype.api.Extractor):
class ExtractMultiverseUsd(publish.Extractor):
"""Extractor for Multiverse USD Asset data.
This will extract settings for a Multiverse Write Asset operation:

View file

@ -2,11 +2,11 @@ import os
from maya import cmds
import openpype.api
from openpype.pipeline import publish
from openpype.hosts.maya.api.lib import maintained_selection
class ExtractMultiverseUsdComposition(openpype.api.Extractor):
class ExtractMultiverseUsdComposition(publish.Extractor):
"""Extractor of Multiverse USD Composition data.
This will extract settings for a Multiverse Write Composition operation:

View file

@ -1,12 +1,12 @@
import os
import openpype.api
from openpype.pipeline import publish
from openpype.hosts.maya.api.lib import maintained_selection
from maya import cmds
class ExtractMultiverseUsdOverride(openpype.api.Extractor):
class ExtractMultiverseUsdOverride(publish.Extractor):
"""Extractor for Multiverse USD Override data.
This will extract settings for a Multiverse Write Override operation:

View file

@ -1,18 +1,16 @@
import os
import glob
import contextlib
import clique
import capture
from openpype.pipeline import publish
from openpype.hosts.maya.api import lib
import openpype.api
from maya import cmds
import pymel.core as pm
class ExtractPlayblast(openpype.api.Extractor):
class ExtractPlayblast(publish.Extractor):
"""Extract viewport playblast.
Takes review camera and creates review Quicktime video based on viewport

View file

@ -2,7 +2,7 @@ import os
from maya import cmds
import openpype.api
from openpype.pipeline import publish
from openpype.hosts.maya.api.lib import (
extract_alembic,
suspended_refresh,
@ -11,7 +11,7 @@ from openpype.hosts.maya.api.lib import (
)
class ExtractAlembic(openpype.api.Extractor):
class ExtractAlembic(publish.Extractor):
"""Produce an alembic of just point positions and normals.
Positions and normals, uvs, creases are preserved, but nothing more,

View file

@ -4,11 +4,11 @@ import os
from maya import cmds
import openpype.api
from openpype.pipeline import publish
from openpype.hosts.maya.api.lib import maintained_selection
class ExtractRedshiftProxy(openpype.api.Extractor):
class ExtractRedshiftProxy(publish.Extractor):
"""Extract the content of the instance to a redshift proxy file."""
label = "Redshift Proxy (.rs)"

View file

@ -1,10 +1,11 @@
import json
import os
import openpype.api
import json
import maya.app.renderSetup.model.renderSetup as renderSetup
from openpype.pipeline import publish
class ExtractRenderSetup(openpype.api.Extractor):
class ExtractRenderSetup(publish.Extractor):
"""
Produce renderSetup template file

View file

@ -4,11 +4,11 @@ import os
from maya import cmds
import openpype.api
from openpype.pipeline import publish
from openpype.hosts.maya.api.lib import maintained_selection
class ExtractRig(openpype.api.Extractor):
class ExtractRig(publish.Extractor):
"""Extract rig as Maya Scene."""
label = "Extract Rig (Maya Scene)"

View file

@ -3,14 +3,14 @@ import glob
import capture
from openpype.pipeline import publish
from openpype.hosts.maya.api import lib
import openpype.api
from maya import cmds
import pymel.core as pm
class ExtractThumbnail(openpype.api.Extractor):
class ExtractThumbnail(publish.Extractor):
"""Extract viewport thumbnail.
Takes review camera and creates a thumbnail based on viewport

View file

@ -6,7 +6,8 @@ from contextlib import contextmanager
from maya import cmds # noqa
import pyblish.api
import openpype.api
from openpype.pipeline import publish
from openpype.hosts.maya.api import fbx
@ -20,7 +21,7 @@ def renamed(original_name, renamed_name):
cmds.rename(renamed_name, original_name)
class ExtractUnrealSkeletalMesh(openpype.api.Extractor):
class ExtractUnrealSkeletalMesh(publish.Extractor):
"""Extract Unreal Skeletal Mesh as FBX from Maya. """
order = pyblish.api.ExtractorOrder - 0.1

View file

@ -5,7 +5,8 @@ import os
from maya import cmds # noqa
import pyblish.api
import openpype.api
from openpype.pipeline import publish
from openpype.hosts.maya.api.lib import (
parent_nodes,
maintained_selection
@ -13,7 +14,7 @@ from openpype.hosts.maya.api.lib import (
from openpype.hosts.maya.api import fbx
class ExtractUnrealStaticMesh(openpype.api.Extractor):
class ExtractUnrealStaticMesh(publish.Extractor):
"""Extract Unreal Static Mesh as FBX from Maya. """
order = pyblish.api.ExtractorOrder - 0.1

View file

@ -2,11 +2,11 @@ import os
from maya import cmds
import openpype.api
from openpype.pipeline import publish
from openpype.hosts.maya.api.lib import maintained_selection
class ExtractVRayProxy(openpype.api.Extractor):
class ExtractVRayProxy(publish.Extractor):
"""Extract the content of the instance to a vrmesh file
Things to pay attention to:

View file

@ -3,14 +3,14 @@
import os
import re
import openpype.api
from openpype.pipeline import publish
from openpype.hosts.maya.api.render_setup_tools import export_in_rs_layer
from openpype.hosts.maya.api.lib import maintained_selection
from maya import cmds
class ExtractVrayscene(openpype.api.Extractor):
class ExtractVrayscene(publish.Extractor):
"""Extractor for vrscene."""
label = "VRay Scene (.vrscene)"

View file

@ -2,14 +2,14 @@ import os
from maya import cmds
import openpype.api
from openpype.pipeline import publish
from openpype.hosts.maya.api.lib import (
suspended_refresh,
maintained_selection
)
class ExtractXgenCache(openpype.api.Extractor):
class ExtractXgenCache(publish.Extractor):
"""Produce an alembic of just xgen interactive groom
"""

View file

@ -3,10 +3,10 @@ import json
from maya import cmds
import openpype.api
from openpype.pipeline import publish
class ExtractYetiCache(openpype.api.Extractor):
class ExtractYetiCache(publish.Extractor):
"""Producing Yeti cache files using scene time range.
This will extract Yeti cache file sequence and fur settings.

View file

@ -7,7 +7,7 @@ import contextlib
from maya import cmds
import openpype.api
from openpype.pipeline import publish
from openpype.hosts.maya.api import lib
@ -90,7 +90,7 @@ def yetigraph_attribute_values(assumed_destination, resources):
pass
class ExtractYetiRig(openpype.api.Extractor):
class ExtractYetiRig(publish.Extractor):
"""Extract the Yeti rig to a Maya Scene and write the Yeti rig data."""
label = "Extract Yeti Rig"