You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Blueprint real number support. This change deprecates the use the of "float" and "double" types in Blueprints in favor of a new "real". By default, "real" is back by a double precision floating point number. However, it can be single precision if the number is a native float property or function parameter. This distinction won't be visible to the Blueprint user: in both instances, they'll be represented by "real" pin types. During deserialization, we'll automatically convert Blueprint pin types to use real/doubles, unless they're used to represent native code (including delegate signatures). One consequence of this change is that we need to perform implicit casts between single and double precision real numbers. During Blueprint compilation, the compiler will detect points in the graph for when either a widening or narrowing conversion needs to occur. Subsequently, the script bytecode will contain a new cast instruction that performs the conversion. This also works on container types, but each entry in the container will have to be converted. This can introduce unwanted overhead for large containers that are frequently passed between Blueprint and native code. The scope of this change affects Blueprints used by Gameplay, Animation, Control Rig, and UMG. #rb marc.audy (serialization changes) #jira UE-116484 #preflight 61f8bdd5a2514ba12ff7bdfc #ROBOMERGE-AUTHOR: dave.jones2 #ROBOMERGE-SOURCE: CL 18809077 in //UE5/Release-5.0/... via CL 18809455 via CL 18822548 #ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v908-18788545) [CL 18823569 by dave jones2 in ue5-main branch]
165 lines
3.9 KiB
C++
165 lines
3.9 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "UObject/ObjectMacros.h"
|
|
#include "UObject/Object.h"
|
|
#include "Misc/Guid.h"
|
|
#include "UObject/SoftObjectPtr.h"
|
|
#include "EdGraph/EdGraphPin.h"
|
|
#include "UObject/StructOnScope.h"
|
|
#include "EditorUndoClient.h"
|
|
#include "Kismet2/StructureEditorUtils.h"
|
|
#include "UserDefinedStructEditorData.generated.h"
|
|
|
|
class ITransactionObjectAnnotation;
|
|
|
|
USTRUCT()
|
|
struct FStructVariableDescription
|
|
{
|
|
GENERATED_USTRUCT_BODY()
|
|
|
|
UPROPERTY()
|
|
FName VarName;
|
|
|
|
UPROPERTY()
|
|
FGuid VarGuid;
|
|
|
|
UPROPERTY()
|
|
FString FriendlyName;
|
|
|
|
UPROPERTY()
|
|
FString DefaultValue;
|
|
|
|
// TYPE DATA
|
|
UPROPERTY()
|
|
FName Category;
|
|
|
|
UPROPERTY()
|
|
FName SubCategory;
|
|
|
|
UPROPERTY()
|
|
TSoftObjectPtr<UObject> SubCategoryObject;
|
|
|
|
UPROPERTY()
|
|
FEdGraphTerminalType PinValueType;
|
|
|
|
UPROPERTY()
|
|
EPinContainerType ContainerType;
|
|
|
|
// UE_DEPRECATED(4.17)
|
|
UPROPERTY()
|
|
uint8 bIsArray_DEPRECATED:1;
|
|
|
|
// UE_DEPRECATED(4.17)
|
|
UPROPERTY()
|
|
uint8 bIsSet_DEPRECATED:1;
|
|
|
|
// UE_DEPRECATED(4.17)
|
|
UPROPERTY()
|
|
uint8 bIsMap_DEPRECATED:1;
|
|
|
|
UPROPERTY(Transient)
|
|
uint8 bInvalidMember:1;
|
|
|
|
UPROPERTY()
|
|
uint8 bDontEditOnInstance:1;
|
|
|
|
UPROPERTY()
|
|
uint8 bEnableSaveGame : 1;
|
|
|
|
UPROPERTY()
|
|
uint8 bEnableMultiLineText:1;
|
|
|
|
UPROPERTY()
|
|
uint8 bEnable3dWidget:1;
|
|
|
|
// CurrentDefaultValue stores the actual default value, after the DefaultValue was changed, and before the struct was recompiled
|
|
UPROPERTY(NonTransactional)
|
|
FString CurrentDefaultValue;
|
|
|
|
UPROPERTY()
|
|
FString ToolTip;
|
|
|
|
UNREALED_API bool SetPinType(const struct FEdGraphPinType& VarType);
|
|
|
|
UNREALED_API FEdGraphPinType ToPinType() const;
|
|
|
|
// UE_DEPRECATED(4.17)
|
|
void PostSerialize(const FArchive& Ar);
|
|
|
|
FStructVariableDescription()
|
|
: ContainerType(EPinContainerType::None)
|
|
, bIsArray_DEPRECATED(false)
|
|
, bIsSet_DEPRECATED(false)
|
|
, bIsMap_DEPRECATED(false)
|
|
, bInvalidMember(false)
|
|
, bDontEditOnInstance(false)
|
|
, bEnableSaveGame(false)
|
|
, bEnableMultiLineText(false)
|
|
, bEnable3dWidget(false)
|
|
{ }
|
|
};
|
|
|
|
template<>
|
|
struct TStructOpsTypeTraits< FStructVariableDescription > : public TStructOpsTypeTraitsBase2< FStructVariableDescription >
|
|
{
|
|
enum
|
|
{
|
|
WithPostSerialize = true,
|
|
};
|
|
};
|
|
|
|
UCLASS()
|
|
class UNREALED_API UUserDefinedStructEditorData : public UObject, public FEditorUndoClient
|
|
{
|
|
GENERATED_UCLASS_BODY()
|
|
|
|
private:
|
|
// the property is used to generate an uniqe name id for member variable
|
|
UPROPERTY(NonTransactional)
|
|
uint32 UniqueNameId;
|
|
|
|
public:
|
|
UPROPERTY()
|
|
TArray<FStructVariableDescription> VariablesDescriptions;
|
|
|
|
UPROPERTY()
|
|
FString ToolTip;
|
|
|
|
public:
|
|
// UObject interface.
|
|
virtual TSharedPtr<ITransactionObjectAnnotation> FactoryTransactionAnnotation(const ETransactionAnnotationCreationMode InCreationMode) const override;
|
|
virtual void Serialize(FArchive& Ar) override;
|
|
virtual void PostEditUndo() override;
|
|
virtual void PostEditUndo(TSharedPtr<ITransactionObjectAnnotation> TransactionAnnotation) override;
|
|
virtual void PostLoadSubobjects(struct FObjectInstancingGraph* OuterInstanceGraph) override;
|
|
virtual void PreSave(FObjectPreSaveContext ObjectSaveContext) override;
|
|
// End of UObject interface.
|
|
|
|
// FEditorUndoClient interface
|
|
virtual void PostUndo(bool bSuccess) override;
|
|
virtual void PostRedo(bool bSuccess) override { PostUndo(bSuccess); }
|
|
// End of FEditorUndoClient interface.
|
|
|
|
|
|
uint32 GenerateUniqueNameIdForMemberVariable();
|
|
class UUserDefinedStruct* GetOwnerStruct() const;
|
|
|
|
const uint8* GetDefaultInstance() const;
|
|
void RecreateDefaultInstance(FString* OutLog = nullptr);
|
|
void ReinitializeDefaultInstance(FString* OutLog = nullptr);
|
|
void CleanDefaultInstance();
|
|
void RefreshValuesFromDefaultInstance();
|
|
|
|
private:
|
|
|
|
// Track the structure change that PostEditUndo undid to pass to FUserDefinedStructureCompilerUtils::CompileStruct
|
|
FStructureEditorUtils::EStructureEditorChangeInfo CachedStructureChange;
|
|
|
|
// Utility function for both PostEditUndo to route through
|
|
void ConsolidatedPostEditUndo(FStructureEditorUtils::EStructureEditorChangeInfo ActiveChange);
|
|
|
|
};
|