Populating a PointCollection from Blueprint in Unreal Engine
Posted: 10 Jun 2023, 06:04
How would I go about doing this in Unreal Engine? I'd like to set-up a {Binding Points} for a PolyBezierSegment. List (TArray) of Vector2D exposed in the View (UNoesisInstance) doesn't work for this binding.
I attempted to resolve this by creating a converter from a list of points into a point collection and failed.
XAML:
CPP:
This yielded me a:
But this lead to a crash with no useful log message.
My guess is that I'm doing something wrong.
Ideally, I'd like to be able to expose a point collection directly, but a workaround like a converter would help me a ton as well.
Thank you.
I attempted to resolve this by creating a converter from a list of points into a point collection and failed.
XAML:
Code: Select all
<UserControl.Resources>
<local:PointsConverter x:Key="PointsConverter"/>
...
<Canvas>
<Path Stroke="Black" StrokeThickness="10">
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<PathFigureCollection>
<PathFigure StartPoint="100,80">
<PathFigure.Segments>
<PathSegmentCollection>
<PolyBezierSegment Points="{Binding PolyPoints, Converter={StaticResource PointsConverter}}">
...
Code: Select all
bool TryConvert(Noesis::ArrayRef<Noesis::BaseComponent*> values, const Noesis::Type*, Noesis::BaseComponent*,
Noesis::Ptr<Noesis::BaseComponent>& result) override
{
// NS_ASSERT(values.Size() == 3);
Noesis::PointCollection PointCollection;
for(uint32_t i = 0; i < values.Size(); i++)
{
PointCollection.Add( Noesis::Boxing::Unbox<Noesis::Point>(values[i]));
}
result = PointCollection;
return true;
}
NS_IMPLEMENT_INLINE_REFLECTION_(PointsConverter, BaseMultiValueConverter,
"Converters.PointsConverter");
I attempted it in another way:LogNoesis: Warning: /Game;component/NoesisGUI/GameMap.xaml(40,72): Cannot set value for 'Binding.Converter', invalid value type 'AstrokillerNoesis.PointsConverter' for property type 'IValueConverter'
Code: Select all
<PolyBezierSegment>
<MultiBinding Converter="{StaticResource PointsConverter}">
<Binding Path="PolyPoints" />
</MultiBinding>
</PolyBezierSegment>My guess is that I'm doing something wrong.
Ideally, I'd like to be able to expose a point collection directly, but a workaround like a converter would help me a ton as well.
Thank you.