You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
The SubobjectDataSubsystem is how users can manipulate a given object within Blueprints or Python scripting. Given a Uobject instance in a level or a UBlueprint asset, you can use GatherSubobjectData to get get an array of handles that you can use to manipulate that subobject. This is what the new SubobjectEditor (Previously the SCS editor) will be using instead of having all its logic within slate code. #rb marc.audy #jira UE-64131 #preflight 6082ce4f8de3a60001cf6af8 #preflight 6082d84a92d7e700019f53e0 [CL 16104548 by ben hoffman in ue5-main branch]
64 lines
1.7 KiB
C++
64 lines
1.7 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Templates/SharedPointer.h"
|
|
#include "SubobjectDataHandle.generated.h"
|
|
|
|
struct FSubobjectData;
|
|
|
|
/**
|
|
* A subobject handle is a globally unique identifier for subobjects
|
|
* Upon construction, the handle will be invalid. It is the responsibility
|
|
* of the owning FSubobjectData to set the DataPtr once the subobject
|
|
* data has validated that it has a good context.
|
|
*/
|
|
USTRUCT(BlueprintType)
|
|
struct SUBOBJECTDATAINTERFACE_API FSubobjectDataHandle
|
|
{
|
|
friend struct FSubobjectData;
|
|
friend class USubobjectDataSubsystem;
|
|
|
|
GENERATED_USTRUCT_BODY();
|
|
|
|
explicit FSubobjectDataHandle()
|
|
: DataPtr(nullptr)
|
|
{}
|
|
|
|
~FSubobjectDataHandle()
|
|
{
|
|
DataPtr = nullptr;
|
|
}
|
|
|
|
/**
|
|
* True if the Handle is valid (i.e. not INDEX_NONE). This is true once GenerateNewHandle is called
|
|
*
|
|
* @return bool True if this handle is valid
|
|
*/
|
|
inline bool IsValid() const { return DataPtr != nullptr; }
|
|
|
|
bool operator==(const FSubobjectDataHandle& Other) const
|
|
{
|
|
return DataPtr.Get() == Other.DataPtr.Get();
|
|
}
|
|
|
|
bool operator!=(const FSubobjectDataHandle& Other) const
|
|
{
|
|
return DataPtr != Other.DataPtr;
|
|
}
|
|
|
|
/** Returns a pointer to the subobject data that this is a handle for */
|
|
inline TSharedPtr<FSubobjectData> GetSharedDataPtr() const { return DataPtr; }
|
|
inline FSubobjectData* GetData() const { return DataPtr.IsValid() ? DataPtr.Get() : nullptr; }
|
|
|
|
/**
|
|
* A static representation of an invalid handle. Mostly used as a return
|
|
* value for functions that need to return a handle but have the risk of being invalid.
|
|
*/
|
|
static const FSubobjectDataHandle InvalidHandle;
|
|
|
|
private:
|
|
/** Pointer to the actual subobject data that this handle represents */
|
|
TSharedPtr<FSubobjectData> DataPtr;
|
|
}; |