Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Overriding a viewpoints eulerRotation by Fieldaccess doesn't Refresh values.

Anonymous

Overriding a viewpoints eulerRotation by Fieldaccess doesn't Refresh values.

Anonymous
Not applicable

 

Hello,

 

a viewpoints eulerRotation override does not refresh.

 

vp_node.fields().setVec3f("eulerRotation", angles[0],angles[1],angles[2])

selectViewPoint(vp_name)

 

The values are overridden when I open the Nodeeditor, but even if I manually select the viewpoint, the view doesn't change.

Doing the same with "translation", works

 

overriding the matrix doesn't work either.

 

I'm using 2017.2. Is that a bug or do I have to trigger something?

 

Thank you for any help

0 Likes
Reply
Accepted solutions (2)
698 Views
5 Replies
Replies (5)

sinje_thiedemann
Autodesk
Autodesk
Accepted solution

Hi,

 

for changing the transformation of a transform node (which a viewpoint is) I'd suggest using the functions from vrNodeUtils, in this case setTransformNodeRotation:

 

setTransformNodeRotation (vp_node, angles[0],angles[1],angles[2])

 

Best regards

Sinje

michael_nikelsky
Autodesk
Autodesk
Accepted solution

A quick explanation on this: The euler and quaternion rotation values must be in sync. This is not the case if you set them by vrFieldAccess and it can be tricky to try this on your own.



Michael Nikelsky
Sr. Principal Engineer

Anonymous
Not applicable

oh that was ways easier as expected. Thank you very much.

 

I guess I should prevent modifying node fields/properties through field access as often as possible. Its however strange that my approach worked for the translation part, but not for the angles. Just out of curiosity, does this mean, field access is only a very raw tool to modify data but without any mechanism to force an update on that specific field? How can I force updates then? Is this possible through Field access, or does it highly depend on the mechanism behind and differs from field to field. Such errors are actually very hard to debug, if you change fields, the numbers are changed, you even activate that object, but the result is still different.  It took me some time to actually identify the problem. 

Another question, Is there something like autocomplete/intellisense planned for VRed?  

 

 

0 Likes

Anonymous
Not applicable

thank you, that answered some questions...

0 Likes

michael_nikelsky
Autodesk
Autodesk

Yes, vrFieldAccess is as low level as it gets. It allows you to change any values of a fieldContainer but it also makes you responsible for the values to make sense. There are some sanity checks on some values but in this case the transformation is valid, it just doesn´t match the quaternion (that´s why it works for translations, those are just simple values that don´t have any dependencies). It would probably have worked if you had modified the quaternion since this is the value used for calculating the matrix (euler are basically nothing more but an artist friendly representation of a rotation but for the actual math quaternions are far superior since the don´t suffer from things like gimbal lock and it is also possible to interpolate between two rotations without doing something weird like euler often do).

In general, I would avoid the FieldAccess as long as there are other functions that can do the job.

 

There are currently no plans to have something like intellisense. I would recommend to use a third party editor and write your code as a script plugin.



Michael Nikelsky
Sr. Principal Engineer