View Issue Details

IDProjectCategoryView StatusLast Update
0001951NoesisGUIUnrealpublic2021-03-31 05:19
ReporterTadinuAssigned Tohcpizzi 
PrioritynormalSeveritymajorReproducibilityalways
Status assignedResolutionopen 
Product Version3.0.11 
Target Version3.0.12Fixed in Version 
Summary0001951: XAML assets not recognized as placed in Plugin's Content
DescriptionIn various places of NoesisGUI plugin sources, `/Game/` prefix is hardcoded, meaning the asset is presumed to reside under the Content folder of Project, however it does not work for ones in Plugin's Contents, notably these ones:
https://github.com/Noesis/UE4Plugin/blob/master/Source/NoesisEditor/Private/NoesisXamlFactory.cpp#L341
https://github.com/Noesis/UE4Plugin/blob/master/Source/NoesisRuntime/Private/NoesisResourceProvider.cpp#L34
https://github.com/Noesis/UE4Plugin/blob/master/Source/NoesisRuntime/Private/NoesisResourceProvider.cpp#L63
https://github.com/Noesis/UE4Plugin/blob/master/Source/NoesisRuntime/Private/NoesisResourceProvider.cpp#L79

(1) I would recommend the argument being passed into `LoadXAML()` function be just the xaml asset name, and by using AssetRegistry, a `FAssetData` could be fetched based on that name as the key. Then that `FAssetData` could be converted to `UObject*`, in our case as `UNoesisXaml*` as noted here:
https://docs.unrealengine.com/en-US/ProgrammingAndScripting/ProgrammingWithCPP/Assets/Registry/#convertingfassetdatatouobject*

That operation actually also invokes `LoadObject()` under the hood.
https://github.com/EpicGames/UnrealEngine/blob/master/Engine/Source/Runtime/CoreUObject/Public/AssetRegistry/AssetData.h#L248

That way, we would not have to preprocess the path with `/Game/`, regardless of where the asset resides, either in Project's Content or Plugin's Content folder.
Besides, it would be great if you could make the loading asynchronous as recommended here in case we have numerous xaml asset widgets:
https://docs.unrealengine.com/en-US/ProgrammingAndScripting/ProgrammingWithCPP/Assets/AsyncLoading/index.html

(2) Otherwise, it looks like in here:
https://github.com/Noesis/UE4Plugin/blob/master/Source/NoesisRuntime/Private/NoesisXaml.cpp#L13
We could pass the UE asset path as it is directly like these:
Noesis::GUI::LoadXaml(TCHARToNsString(*(GetPackage()->GetPathName())).Str());
Noesis::GUI::LoadComponent(Component, TCHARToNsString(*(GetPackage()->GetPathName())).Str());

If so, that path could be forwarded to FNoesisXamlProvider::LoadXaml() and fed well to `LoadObject`, without having to use AssetRegistry I guess.
TagsNo tags attached.
PlatformLinux

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2021-03-26 15:29 Tadinu New Issue
2021-03-26 15:29 Tadinu Status new => assigned
2021-03-26 15:29 Tadinu Assigned To => hcpizzi
2021-03-26 15:36 jsantos Target Version => 3.0.12
2021-03-28 08:50 Tadinu Description Updated View Revisions
2021-03-31 05:18 Tadinu Description Updated View Revisions
2021-03-31 05:19 Tadinu Description Updated View Revisions