Your Digital Media Has Never Looked So Good

 
_rossbower
Topic Author
Posts: 8
Joined: Wed Jun 15, 2016 11:37 am

Unable to set values on FieldInterpolator at runtime

Thu Jun 23, 2016 10:35 am

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?
 
EnTerr
** Valued Community Member **
Posts: 3834
Joined: Sun Jan 02, 2011 2:41 am

Re: Unable to set values on FieldInterpolator at runtime

Fri Jun 24, 2016 8:41 pm

Not enough info - give code example! I have not tried but should be as simple as:
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
Posts: 1
Joined: Fri Apr 26, 2019 9:45 am

Re: Unable to set values on FieldInterpolator at runtime

Fri Apr 26, 2019 10:08 am

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

 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

Who is online

Users browsing this forum: No registered users and 1 guest