Skip to content

Commit

Permalink
Merge branch 'develop' into chore/limit_extract_active_view_for_autom…
Browse files Browse the repository at this point in the history
…atic_testing
  • Loading branch information
kalisp authored Sep 27, 2024
2 parents 6fdc4b7 + 29ab54c commit 3623ee8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 66 deletions.
8 changes: 2 additions & 6 deletions client/ayon_maya/plugins/create/create_layout.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from ayon_maya.api import plugin
from ayon_core.lib import BoolDef, EnumDef
from ayon_core.lib import BoolDef


class CreateLayout(plugin.MayaCreator):
Expand All @@ -17,9 +17,5 @@ def get_instance_attr_defs(self):
label="Group Loaded Assets",
tooltip="Enable this when you want to publish group of "
"loaded asset",
default=False),
EnumDef("layout_options",
items=["fbx", "abc"],
label="Export Layout Options",
default="fbx")
default=False)
]
19 changes: 0 additions & 19 deletions client/ayon_maya/plugins/publish/collect_layout_options.py

This file was deleted.

47 changes: 6 additions & 41 deletions client/ayon_maya/plugins/publish/extract_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ def convert_matrix_to_4x4_list(
class ExtractLayout(plugin.MayaExtractorPlugin):
"""Extract a layout."""

label = "Extract Layout(FBX)"
families = ["layout.fbx"]
label = "Extract Layout"
families = ["layout"]
project_container = "AVALON_CONTAINERS"

def process(self, instance):
Expand Down Expand Up @@ -82,11 +82,8 @@ def process(self, instance):
representation = get_representation_by_id(
project_name,
representation_id,
fields={"versionId", "context"}
fields={"versionId", "context", "name"}
)

self.log.debug(representation)

version_id = representation["versionId"]
# TODO use product entity to get product type rather than
# data in representation 'context'
Expand All @@ -100,7 +97,8 @@ def process(self, instance):
"instance_name": cmds.getAttr(
"{}.namespace".format(container)),
"representation": str(representation_id),
"version": str(version_id)
"version": str(version_id),
"extension": repre_context["ext"]
}

local_matrix = cmds.xform(asset, query=True, matrix=True)
Expand Down Expand Up @@ -158,7 +156,7 @@ def create_transformation_matrix(self, local_matrix, local_rotation):
return t_matrix

def convert_transformation_matrix(self, transform_mm: om.MMatrix, rotation: list) -> om.MMatrix:
"""Convert matrix to list of transformation matrix for Unreal Engine import.
"""Convert matrix to list of transformation matrix for Unreal Engine fbx asset import.
Args:
transform_mm (om.MMatrix): Local Matrix for the asset
Expand All @@ -180,36 +178,3 @@ def convert_transformation_matrix(self, transform_mm: om.MMatrix, rotation: list
convert_transform.setScale([convert_scale[0], convert_scale[2], convert_scale[1]], om.MSpace.kObject)

return convert_transform.asMatrix()


class ExtractLayoutAbc(ExtractLayout):
"""Extract a layout."""

label = "Extract Layout(Abc)"
families = ["layout.abc"]
project_container = "AVALON_CONTAINERS"

def convert_transformation_matrix(self, transform_mm: om.MMatrix, rotation: list) -> om.MMatrix:
"""Convert matrix to list of transformation matrix for Unreal Engine import.
Args:
transform_mm (om.MMatrix): Local Matrix for the asset
rotation (list): Rotations of the asset
Returns:
List[om.MMatrix]: List of transformation matrix of the asset
"""
# TODO: need to find the correct implementation of layout for alembic
convert_transform = om.MTransformationMatrix(transform_mm)

convert_translation = convert_transform.translation(om.MSpace.kWorld)
convert_translation = om.MVector(convert_translation.x, convert_translation.z, convert_translation.y)
convert_scale = convert_transform.scale(om.MSpace.kObject)
convert_transform.setTranslation(convert_translation, om.MSpace.kWorld)
converted_rotation = om.MEulerRotation(
math.radians(rotation[0]), math.radians(rotation[2]), math.radians(rotation[1])
)
convert_transform.setRotation(converted_rotation)
convert_transform.setScale([convert_scale[0], convert_scale[2], convert_scale[1]], om.MSpace.kObject)

return convert_transform.asMatrix()

0 comments on commit 3623ee8

Please sign in to comment.