create3000 / titania

Titania X3D Editor
https://github.com/create3000/titania/wiki
GNU General Public License v3.0
39 stars 10 forks source link

non-default viewpoint orientation {0,0,0,0} not displayed or saved. #77

Closed splace closed 5 years ago

splace commented 5 years ago

not normally an issue, since angle zero, but i think it would be possible to set just the angle in a script, so the value of the default axis would make a difference.

create3000 commented 5 years ago

Under which circumstances does this happen? When I create a new Viewpoint by adding one from the Library or with the Node Editor the orientation is 0 0 1 0. Also tested JavaScript access to orientation field:

print (viewpoint .orientation)

Which prints the default value.

Also:

ecmascript:

function initialize ()
{
    var v = Browser .currentScene .createNode ("Viewpoint");

    print (v .orientation); // prints '0 0 1 0'
}

Works without problems.

splace commented 5 years ago

OK, seems only to be with downloaded content. (when i save locally and reload, the default value is correct.)

to reproduce, open this world...

http://www.x-3-x.net/vrml/archive/cache/www.barrdunge.com/avatars/tarzan.wrl

and expand the default values on the viewpoint.

screenshot from 2019-02-18 17-56-21

create3000 commented 5 years ago

In the file the orientation is specified as following:

DEF Camera01 Viewpoint {
position 0 -1 4
orientation 0 0 0 0
fieldOfView 0.6024
description "Camera01"
}

and this is what the Outline Editor displays.

splace commented 5 years ago

in which case the outline editor isn't displaying the non-default orientation when it should.

splace commented 5 years ago

i now see this isn't when the source is remote, it just looked that way because when you save locally from titania, it removes the orientation.

create3000 commented 5 years ago

There was another bug which was about that the rotations should not be normalized, that is if you specify, for instance a rotation like 1 0 0 0 that this rotation should not be normalized to 0 0 1 0. So the author can later changed the angle and the axis does not change. This also affects a rotation like 0 0 0 0.

create3000 commented 5 years ago

Link to previous bug (normalized rotation) https://github.com/create3000/titania/issues/54.

splace commented 5 years ago

yes, this does appear to have the same underlying cause as #54, (the textual values having 4-dimensions when the basic concept has only 3.) but, unlike #54, it is text editing issues, UI/file, and only applies to titania.

this specific case, Viewpoint.orientation {0,0,0,0} is a very narrow edge case, but it also happens for Transform.rotation, Transform.scaleoriention, SphereSensor.offset and for other rotation values. example: {1,1,0,0} and {0,0,0,1}

maybe the simplest thing, would be to automatically change rotation values to the textual representation of their normalised value as they are imported/edited, this way the displayed value always shows defaults/non-default correctly and saves them as they are shown. ideally this would trigger an undo and a warning?

the cases where the world builder relies on these un-normalised values, a bad idea and so very rare it seems reasonable to just say they are unsupported by titania for editing.

i looked for other cases where non-default values were hidden, but did not find any.