UE5: How to write converters?
Posted: 29 Jul 2024, 18:11
I am trying to write converters for UE5 but I am having a hard time finding examples.
So far Noesis is unable to find my class and I have no idea why
here what I wrote so far
And it is called like this in the XAML:
In the logs it says it unable to find the class:
Any help is appreciated.
So far Noesis is unable to find my class and I have no idea why
here what I wrote so far
Code: Select all
#pragma once
#include "CoreMinimal.h"
#include <NsCore/Noesis.h>
#include <NsGui/BaseValueConverter.h>
class StringToUpper final : public Noesis::BaseValueConverter
{
public:
bool TryConvert(Noesis::BaseComponent* value, const Noesis::Type* targetType,
Noesis::BaseComponent* parameter, Noesis::Ptr<Noesis::BaseComponent>& result) override;
NS_DECLARE_REFLECTION(StringToUpper, Noesis::BaseValueConverter)
};Code: Select all
#include "StringToUpper.h"
using namespace Noesis;
////////////////////////////////////////////////////////////////////////////////////////////////////
bool StringToUpper::TryConvert(BaseComponent* value, const Type* targetType,
BaseComponent* parameter, Noesis::Ptr<BaseComponent>& result)
{
UE_LOG(LogTemp, Warning, TEXT("StringToUpper::TryConvert"));
return false;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
NS_BEGIN_COLD_REGION
NS_IMPLEMENT_REFLECTION_(StringToUpper, "BB2UE5.StringToUpper")Code: Select all
<UserControl
...
xmlns:local="clr-namespace:BB2UE5"
...
/>
<UserControl.Resources>
<ResourceDictionary>
<local:StringToUpper x:Key="StringToUpper" />
</ResourceDictionary>
</UserControl.Resources>
Code: Select all
LogNoesis: Warning: Unknown element type 'local:StringToUpper' (BB2UE5.StringToUpper)
LogNoesis: Warning: StaticResource 'StringToUpper' not found