Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Struct values returning garbage when accessed from Python #632

Copy link
Copy link
@mrpropellers

Description

@mrpropellers
Issue body actions

Using tagged release for commit 56a6f30 built from source, UE 4.18, and Python 3.4 on Windows 10. I have a USTRUCT which is a member of a UCLASS defined like so:

USTRUCT(BlueprintType)
struct FCartPoint
{
GENERATED_STRUCT_BODY()

UPROPERTY(BlueprintReadonly)
int x;

UPROPERTY(BlueprintReadonly)
int y;
// + some constructors/accessors etc.
}

UCLASS()
class PROJECT_API APointHolder : public AActor
{
GENERATED_BODY()
protected:
FCartPoint MyPoint;

public:
UFUNCTION(BlueprintCallable)
FCartPoint GetPoint() const {
  UE_LOG(LogTemp, Log, TEXT("Point: (%d, %d)"), MyPoint.x, MyPoint.y)
  return MyPoint;
}
}

In Python doing this:

p = actor.GetPoint()
ue.log("p by members: (%d, %d) -- p by get_field: (%d, %d)" % (p.x, p.y, p.get_field('x'), p.get_field('y')))

When ran, the log output from GetPoint prints the values I've assigned, but all the values printed from python appear to just be random blocks of memory typecast to int, and p.x != p.get_field('x') - they appear to be pointing at different locations as the values it spits out are unrelated.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.