I don't understand how to access the "bone_tree" structure.

class unreal.Skeleton(outer=None, name=‘None’)
Editor Properties: (see get_editor_property/set_editor_property)

  • bone_tree (Array(BoneNode)): [Read-Only] Bone Tree: Skeleton bone tree - each contains name and parent index*

I got the structure from the above python API, but the output result is access to memory.
How can I output bone names and indexes to the UE log?


import unreal

# Load the skeleton asset
skeleton = unreal.EditorAssetLibrary.load_asset('/Game/MyStuff/mesh/test/test_Skeleton')

if skeleton:
    # Get the bone_tree property
    bone_tree = skeleton.get_editor_property("bone_tree")

    # If bone_tree is a list or array, loop through each element (likely a BoneNode)
    for bone_node in bone_tree:
        # Output information about the BoneNode in text form
        # Assuming bone_node has a property like 'bone_name', access it and print it
        if hasattr(bone_node, 'bone_name'):
            print(f"Bone Name: {bone_node.bone_name}")
        else:
            # If no 'bone_name' property, just print the bone_node itself
            print(bone_node)
#excute result

<Struct 'BoneNode' (0x0000060479A00960) {}>
<Struct 'BoneNode' (0x0000060479A052A0) {}>
<Struct 'BoneNode' (0x0000060479A04DA0) {}>
<Struct 'BoneNode' (0x0000060479A096C0) {}>
<Struct 'BoneNode' (0x0000060479A04380) {}>
<Struct 'BoneNode' (0x0000060479A08240) {}>
<Struct 'BoneNode' (0x0000060479A0CFE0) {}>
<Struct 'BoneNode' (0x0000060479A028E0) {}>
<Struct 'BoneNode' (0x0000060479A00F20) {}>
<Struct 'BoneNode' (0x0000060479A0F320) {}>
<Struct 'BoneNode' (0x0000060479A06620) {}>
<Struct 'BoneNode' (0x0000060479A092C0) {}>
<Struct 'BoneNode' (0x0000060479A010E0) {}>
<Struct 'BoneNode' (0x0000060479A07D80) {}>
<Struct 'BoneNode' (0x0000060479A04940) {}>
<Struct 'BoneNode' (0x0000060479A0A1C0) {}>
<Struct 'BoneNode' (0x0000060479A0CF00) {}>
<Struct 'BoneNode' (0x0000060479A01C20) {}>
<Struct 'BoneNode' (0x0000060479A0FB20) {}>
<Struct 'BoneNode' (0x0000060479A0D3C0) {}>
<Struct 'BoneNode' (0x0000060479A06A40) {}>
<Struct 'BoneNode' (0x0000060479A0DE60) {}>
<Struct 'BoneNode' (0x0000060479A06FA0) {}>
<Struct 'BoneNode' (0x0000060479A05760) {}>
<Struct 'BoneNode' (0x0000060479A0C080) {}>
<Struct 'BoneNode' (0x0000060479A005A0) {}>
<Struct 'BoneNode' (0x0000060479A0E4C0) {}>
<Struct 'BoneNode' (0x0000060479A01580) {}>
<Struct 'BoneNode' (0x0000060479A05EA0) {}>
<Struct 'BoneNode' (0x0000060479A00C20) {}>
<Struct 'BoneNode' (0x0000060479A09920) {}>
<Struct 'BoneNode' (0x0000060479A095A0) {}>
<Struct 'BoneNode' (0x0000060479A00DE0) {}>
<Struct 'BoneNode' (0x0000060479A01560) {}>
<Struct 'BoneNode' (0x0000060479A0A860) {}>