- ttermeer-reboundcg
- Posts: 19
- Joined:
- Contact:
UE5: How to write converters?
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
Re: UE5: How to write converters?
Hi,
Are you registering your converter? You can see how we do it in our DataBinding sample. We register them in the Game module's StartupModule function and unregister them in the ShutdownModule function.
Please, let us know if that helps.
Are you registering your converter? You can see how we do it in our DataBinding sample. We register them in the Game module's StartupModule function and unregister them in the ShutdownModule function.
Please, let us know if that helps.
- ttermeer-reboundcg
- Posts: 19
- Joined:
- Contact:
Re: UE5: How to write converters?
Thanks! This is what I was missing. It works now :)
Who is online
Users browsing this forum: No registered users and 2 guests