From 2cb952cd878922cc8454257a41442bbe1a609035 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Soma=20R=C3=A1d=C3=B3czi?= Date: Tue, 14 May 2024 21:28:01 +0200 Subject: [PATCH] set property values --- cast.go | 7 ++++++- cast_test.go | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cast.go b/cast.go index 8dc0fc3..473240f 100644 --- a/cast.go +++ b/cast.go @@ -454,7 +454,12 @@ func (p *CastProperty[T]) GetValues() []T { return p.values } -// AddValues adds values to the property's values +// SetValues sets the values of the property +func (p *CastProperty[T]) SetValues(values ...T) { + p.values = values +} + +// AddValues adds values to the property func (p *CastProperty[T]) AddValues(values ...T) { p.values = append(p.values, values...) } diff --git a/cast_test.go b/cast_test.go index ab86fca..3aa1430 100644 --- a/cast_test.go +++ b/cast_test.go @@ -104,6 +104,12 @@ func TestCastFile(t *testing.T) { assertEqual(t, len(p.GetValues()), 1) assertEqual(t, p.GetValues()[0], "foo") + p.SetValues("bar", "baz") + values := p.GetValues() + assertEqual(t, len(values), 2) + assertEqual(t, values[0], "bar") + assertEqual(t, values[1], "baz") + prop2, err := CreateProperty(mesh, PropNamePosition, PropVector3, Vec3{ X: 1, Y: 2,