Files
samford-valley-home/unreal/SamfordHomestead/Content/Python/fix_tap_connection.py

8 lines
983 B
Python

import unreal as u,json
from pathlib import Path
ROOT=Path(__file__).resolve().parents[3];L=u.EditorAssetLibrary;A=u.get_editor_subsystem(u.EditorActorSubsystem);actors=A.get_all_level_actors()
name='Kitchen mixer - connected copper riser'
if not any(a.get_actor_label()==name for a in actors):
a=A.spawn_actor_from_class(u.StaticMeshActor,u.Vector(-432,274,227.1));a.set_actor_label(name);a.static_mesh_component.set_static_mesh(L.load_asset('/Engine/BasicShapes/Cylinder.Cylinder'));a.set_actor_scale3d(u.Vector(.028,.028,.408));m=next(p for p in L.list_assets('/Game/Homestead/Materials') if 'Copper_cookware' in p);a.static_mesh_component.set_material(0,L.load_asset(m));a.static_mesh_component.set_collision_profile_name('NoCollision')
u.get_editor_subsystem(u.LevelEditorSubsystem).save_current_level();(ROOT/'unreal-tap-check.json').write_text(json.dumps({'connected_riser_added':True,'position_cm':[-432,274,227.1],'height_cm':40.8},indent=2));u.SystemLibrary.quit_editor()