Skip to content

Instantly share code, notes, and snippets.

@nafeesb

nafeesb/ue-python.md

Last active Aug 11, 2019
Embed
What would you like to do?
Unreal engine python snippets

Preamble

import unreal_engine as ue
from unreal_engine.classes import PoseableMeshComponent, SkeletalMesh, Skeleton, SkeletalMeshComponent
from unreal_engine import FTransform, FVector, FRotator, FQuat, FSoftSkinVertex

Access object from editor

actor = ue.editor_get_selected_actors()[0]
mesh = actor.get_component_by_type(SkeletalMeshComponent)

Object Info

# Name
obj.get_name()

Getting the skeleton

# Get the SkeletalMeshComponent
meshcomp = self.uobject.get_component_by_type(SkeletalMeshComponent)
print(meshcomp)
# <unreal_engine.UObject 'Mesh' (0x000001723054C100) UClass 'SkeletalMeshComponent' (refcnt: 5)>

# Get the SkeletalMesh
skelmesh = meshcomp.SkeletalMesh
print(skelmesh)
# <unreal_engine.UObject 'mica_rtdev_rig_v39' (0x000001721879B900) UClass 'SkeletalMesh' (refcnt: 6)>

# Get the Skeleton
skel = skelmesh.Skeleton
print(skel)
# <unreal_engine.UObject 'micah_rtmd_rig_v58_Skeleton' (0x000001720AD10F00) UClass 'Skeleton' (refcnt: 4)>
print(skel.skeleton_bones_get_num())
357

Direct class access

mesh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment