Hiya, I’m trying to add a generic matrix type to blueprint by creating a UCLASS with the blueprinttypw specifier and providing properties like rows/columns along with some functions to operate on it.
I can create the reference variable in a blueprint, and make it instance editable, but it still needs to be constructed either as an hard asset or created in the blueprint (with a factory BP function i added to a BP function library). Interestingly, calling construct object from class gave back a null object. Create the object from a factory function was the only way to get it to work.
I’ve seen lots of posts in the answer hub about adding DefaultToInstanced and EditInlineNew to the class specifier but its not doing what I expect.
Is it even possible to be able to set default properties on a variable of this type on uclasses without constructed them?
I did try just wrapping it up in a USTRUCT which kinds of works as it allows me to set the properties (at this point, just two int for rows and columns). But I can’t do any post property initialization on the USTRUCT.
This post seems to suggest adding the extra class specifiers should do what the person and myself want, but so far I can’t seem to get it to work.
I appreciate any help on this matter
#pragma once
#include "CoreMinimal.h"
#include <Eigen/Dense>
#include "EigenMatrix.generated.h"
UCLASS(Blueprintable, DefaultToInstanced, editinlinenew)
class DOKIFLUIDDEVTOOLS_API UEigenMatrix : public UObject
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Player Variables")
int32 rows = 1;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Player Variables")
int32 columns = 1;
Eigen::MatrixXf matrix;
};