_rossbower
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2016
10:35 AM
Unable to set values on FieldInterpolator at runtime
I have a Vector2DFieldInterpolator node, and I want to set its keyValue field dynamically at runtime. However, when I try to set a value on keyValue, it fails. It just returns "false", with no error. I have tried setting the entire keyValue property to a new array, and I have also tried changing individual values by subscript. Both fail. Nothing in the documentation indicates these fields are read-only. What am I doing wrong?
2 REPLIES 2
EnTerr
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2016
08:41 PM
Re: Unable to set values on FieldInterpolator at runtime
Not enough info - give code example! I have not tried but should be as simple as:
Who is returning you false, .setField("keyValue", val)? If so, my bet would be your `val` is wrong type.
I noticed SG gives no error on wrong type... Roku tends to be like that, silent if deadly
v2dfi.keyValue = [ [318.0, 8.0], [656.0, 8.0], [318.0, 8.0] ]
Who is returning you false, .setField("keyValue", val)? If so, my bet would be your `val` is wrong type.
I noticed SG gives no error on wrong type... Roku tends to be like that, silent if deadly
ninglis
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2019
10:08 AM
Re: Unable to set values on FieldInterpolator at runtime
I know this might be a little late, but I came across this thread, and figured I would give an answer for others who might find it.
While I wasn't able to set the value with keyValue directly, I found if I created a new array, copied over/changed values, then set keyValue to my new array, it would work properly
While I wasn't able to set the value with keyValue directly, I found if I created a new array, copied over/changed values, then set keyValue to my new array, it would work properly
interp = anim.getChild(animIndex)
newKey = []
newKeyValue = []
for i = 0 to interp.key.Count() - 1
newKey.Push(interp.key[i])
newKeyValue.Push(interp.keyValue[i])
'alter values here if needed'
end for
interp.key = newKey
interp.keyValue = newKeyValue