I am new to c++ programming but not to UE4. I thought I’d try to make a script that would take in a mesh, and separate it into vertices, triangles and UV Data and return it. I know that it’s hard to return to multiple values in a function without a structure, so the first problem is making a structure. I’m falling at the first hurdle, but I’m not giving up.
USTRUCT()
struct FMeshData{
UPROPERTY()
TArray<FVector>* vertices;
UPROPERTY()
TArray<int>* triangles;
UPROPERTY()
TArray<FVector2D>* uvData
// This is the constructor
FMeshData()
: vertices[(0, 0, 0), (0, 100, 0), (100, 0, 0), (100, 100, 0)],
triangles[0, 1, 2, 3, 2, 1, 0],
uvData[(0, 0), (0, 1), (1, 0), (1, 1)]
{}
// This is another constructor, but allows me to set the variables to a different value than the default.
FMeshData(TArray<FVector>* Vertices, TArray<int>* Triangles, TArray<FVector2D>* UvData)
: vertices(Vertices),
triangles(Triangles),
uvdata(Uvdata)
{}
}
To make the structure variable, I have included in the header file:
FMeshData meshData = {
};
No default variables as the constructor defaults should take their place initally.
The errors I’m getting are: