20tab / UnrealEnginePython

Embed Python in Unreal Engine 4
MIT License
2.75k stars 746 forks source link

Accessing a UStruct Array. #765

Open Visherac opened 5 years ago

Visherac commented 5 years ago

We are having trouble accessing multiple axis information in the BlendParameters value in a AimOffsetBlendSpace UClass.

import unreal_engine as ue
from unreal_engine.classes import AimOffsetBlendSpaceFactoryNew
from unreal_engine.structs import BlendParameters

aim_offset_factory = AimOffsetBlendSpaceFactoryNew()
aim_offset_blendspace = aim_offset_factory.factory_create_new("some_unreal_path")
#set X axis
aim_offset_blendspace.BlendParameters = BlendParameter(DisplayName='XAxis', min=-180.0, max=180.0, GridNum=6)
#Set Y Axis
aim_offset_blendspace.BlendParameters[1] = BlendParameter(DisplayName='YAxis', min=-10.0, max=10.0, GridNum=4)

In the code above when trying to access the BlendParameters at index[1] we can't properly retrieve the information or set it. We don't know how to access the array properly in Python. Please help.

For reference In C++ in UBlendSpaceBase the UProperty supports indexing.

/** Blend Parameters for each axis. **/
UPROPERTY(EditAnywhere, Category = BlendParametersTest)
struct FBlendParameter BlendParameters[3];

We were unable to find a good example in the supplied examples folder to understand how to access this type of property correctly.

Thanks, Jason

tempaccountforissue commented 1 year ago

@Visherac Hey, I know it's been a couple of years since you posted this, but did you ever find a solution?