mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 21:32:15 +01:00
This layout is made to work with Blender. The layout exports a json file with the reference to the blend files in ftrack that generated the fbx that has been imported in Unreal. In Blender, when the layout is loaded, pype will load the assets from the blend files and set the transform from the layout.
42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
from unreal import EditorLevelLibrary as ell
|
|
from pype.hosts.unreal.plugin import Creator
|
|
from avalon.unreal import (
|
|
instantiate,
|
|
)
|
|
|
|
|
|
class CreateLayout(Creator):
|
|
"""Layout output for character rigs"""
|
|
|
|
name = "layoutMain"
|
|
label = "Layout"
|
|
family = "layout"
|
|
icon = "cubes"
|
|
|
|
root = "/Game"
|
|
suffix = "_INS"
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
super(CreateLayout, self).__init__(*args, **kwargs)
|
|
|
|
def process(self):
|
|
data = self.data
|
|
|
|
name = data["subset"]
|
|
|
|
selection = []
|
|
# if (self.options or {}).get("useSelection"):
|
|
# sel_objects = unreal.EditorUtilityLibrary.get_selected_assets()
|
|
# selection = [a.get_path_name() for a in sel_objects]
|
|
|
|
data["level"] = ell.get_editor_world().get_path_name()
|
|
|
|
data["members"] = []
|
|
|
|
if (self.options or {}).get("useSelection"):
|
|
# Set as members the selected actors
|
|
for actor in ell.get_selected_level_actors():
|
|
data["members"].append("{}.{}".format(
|
|
actor.get_outer().get_name(), actor.get_name()))
|
|
|
|
instantiate(self.root, name, data, selection, self.suffix)
|