UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
InterchangeSourceData.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "Misc/Paths.h"
7#include "Misc/SecureHash.h"
8#include "UObject/Object.h"
10
11#include "InterchangeSourceData.generated.h"
12
13/*
14 * Helper class to be able to read different source data
15 * File on disk
16 * HTTP URL (TODO)
17 * Memory buffer (TODO)
18 * Stream (TODO)
19 */
20
21UCLASS(BlueprintType, Blueprintable, MinimalAPI)
23{
25
26public:
28
30
31 UFUNCTION(BlueprintCallable, Category = "Interchange | Import Manager")
32 inline FString GetFilename() const
33 {
34 return Filename;
35 }
36
39 {
41 if(!FileContentHashCache.IsSet())
42 {
43 ComputeFileContentHashCache();
44 }
45 return FileContentHashCache;
46 }
47
48 UFUNCTION(BlueprintCallable, Category = "Interchange | Import Manager")
49 inline bool SetFilename(const FString& InFilename)
50 {
52 //Reset the cache
53 FileContentHashCache.Reset();
54 return true;
55 }
56
58 inline FString ToDisplayString() const
59 {
60 if (!Filename.IsEmpty())
61 {
62 bool bFileExist = FPaths::FileExists(Filename);
63 FString CleanFilename = FPaths::GetCleanFilename(Filename);
64 FString BasePath = FPaths::GetPath(Filename);
65 //limit the base path to 20 character do ellipsis in the middle
66 if (BasePath.Len() > 43)
67 {
68 FString RightPath = BasePath.Right(20);
69 FString LeftPath = BasePath.Left(20);
70 BasePath = LeftPath + TEXT("...") + RightPath;
71 }
72 FString DisplayString = BasePath + TEXT("/") + CleanFilename;
73 return DisplayString;
74 }
75 return FString();
76 }
77
78 UFUNCTION(BlueprintCallable, Category = "Interchange | Import Manager")
79 INTERCHANGECORE_API UObject* GetContextObjectByTag(const FString& Tag) const;
80
81 UFUNCTION(BlueprintCallable, Category = "Interchange | Import Manager")
82 INTERCHANGECORE_API void SetContextObjectByTag(const FString& Tag, UObject* Object) const;
83
84 UFUNCTION(BlueprintCallable, Category = "Interchange | Import Manager")
85 INTERCHANGECORE_API TArray<FString> GetAllContextObjectTags() const;
86
87 UFUNCTION(BlueprintCallable, Category = "Interchange | Import Manager")
88 INTERCHANGECORE_API void RemoveAllContextObjects() const;
89
91 void INTERCHANGECORE_API ComputeFileContentHashCache() const;
92
93 UPROPERTY()
94 FString Filename;
95
102 mutable TOptional<FMD5Hash> FileContentHashCache;
103
110 UPROPERTY()
111 mutable TMap<FString, TObjectPtr<UObject>> ContextObjectsByTag;
112};
#define TEXT(x)
Definition Platform.h:1272
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define TRACE_CPUPROFILER_EVENT_SCOPE(Name)
Definition CpuProfilerTrace.h:528
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UFUNCTION(...)
Definition ObjectMacros.h:745
#define UCLASS(...)
Definition ObjectMacros.h:776
static CORE_API bool FileExists(const FString &InPath)
Definition Paths.cpp:1149
static CORE_API FString GetCleanFilename(const FString &InPath)
Definition Paths.cpp:967
static CORE_API FString ConvertRelativePathToFull(const FString &InPath)
Definition Paths.cpp:1586
static CORE_API FString GetPath(const FString &InPath)
Definition Paths.cpp:1043
Definition Array.h:670
Definition UnrealString.h.inl:34
Definition InterchangeSourceData.h:23
FString ToDisplayString() const
Definition InterchangeSourceData.h:58
TOptional< FMD5Hash > GetFileContentHash() const
Definition InterchangeSourceData.h:38
Definition Object.h:95
Definition SecureHash.h:133
Definition ObjectPtr.h:488
Definition Optional.h:131