ayon-core/pype/plugins/unreal/create/create_layout.py
Simone Barbieri 9d737c2e63 Implemented layout asset in Unreal
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.
2020-08-11 10:42:41 +01:00

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)