[x3d-public] keyValue at first next for Sequencers [was: ScalarSequencer proto repo]

Andreas Plesch andreasplesch at gmail.com
Mon Nov 20 18:50:36 PST 2017


On Mon, Nov 20, 2017 at 7:27 PM, Andreas Plesch <andreasplesch at gmail.com> wrote:
> On Nov 20, 2017 10:24 AM, "doug sanden" <highaspirations at hotmail.com> wrote:
>
>> Did you follow the spec. in some way when you considered initializing
> the hidden index field to 0 ?
> No - I didn't see any hints in the specs.
> If I initialize to -1 then next gives me Child 0, or previous gives me Child
> n-1 in other words, nothing bad happens with -1, we could do it that way.
>
>
> I was not quite sure if I missed something in the spec.
>
> To me, it does seem less surprising in a scene which uses sequencers to
> start with the first keyValue for the first next input.
>
> Another question is if it should be possible to give the set_fraction field
> an initial value in order to control what the first next input produces ?
>
> <IntegerSequencer set_fraction='.5' key='0 0.5 1' keyValue='1 2 3'/>
>
> would produce value_changed=3 for first next.
>
> I think it should.
>
> Will give it a try with various browsers.

So I gave it a try with this scene:
https://glitch.com/edit/#!/x3d-sequencers-first?path=SequencerFirstNext.x3d:6:6
http://x3d-sequencers-first.glitch.me/SequencerFirstNext.x3d

It turns out not a single browser out of the tested
x3dom,x_ite,octaga,view3dscene and instantplayer would change its
behaviour for first next based on an initial set_fraction value.

So I suspect that I am missing something but my working assumption is
that no browser actually expects set_fraction to be initialized to a
value. After all,
http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/components/utils.html#X3DSequencerNode
does not define a default value, setting the expectation that the
fraction value can only be set dynamically with events.

This makes sense for interpolators since the only way to get a
value_changed event is to first input a set_fraction. But for
sequencers, next/previous also can output value_changed making an
initialization of set_fraction meaningful.

So I would propose a default value of NULL for set_fraction in which
case first next produces keyValue[0]. For other initial values of
set_fraction, first next produces the keyValue following the one which
corresponds to the index of fraction in the key array.

How does that sound ?

-Andreas

> ________________________________________
> From: Andreas Plesch <andreasplesch at gmail.com>
> Sent: November 19, 2017 2:09 PM
> To: doug sanden
> Cc: X3D Graphics public mailing list
> Subject: Re: [x3d-public] keyValue at first next for Sequencers [was:
> ScalarSequencer proto repo]
>
> Hi Doug,
>
> On Sun, Nov 19, 2017 at 11:58 AM, doug sanden
> <highaspirations at hotmail.com> wrote:
>> Thanks Andreas.
>> Implemented your suggestion of hidden index.
>> If I initialize the hidden index field to 0 during parsing > node
>> instancing, then I get CHILD 1 in your test scene, without further
>> tinkering.
>
> Yeah, some browser get keyValue[1] for first next, others get
> keyValue[0], depending on initialization.
>
> The spec. seems ambiguous. There are good arguments for either choice
> although I would prefer and expect to get keyValue[0] with first next.
> Did you follow the spec. in some way when you considered initializing
> the hidden index field to 0 ?
>
> Cheers,
> -Andreas
>
>> -Doug
>> ________________________________________
>> From: Andreas Plesch <andreasplesch at gmail.com>
>> Sent: November 19, 2017 9:23 AM
>> To: doug sanden
>> Cc: X3D Graphics public mailing list
>> Subject: Re: [x3d-public] keyValue at first next for Sequencers [was:
>> ScalarSequencer proto repo]
>>
>> On Sun, Nov 19, 2017 at 10:28 AM, doug sanden
>> <highaspirations at hotmail.com> wrote:
>>> Andreas,
>>> (sorry still haven't been able to sign up for x3d-public - please
>>> forward)
>>>
>>> {Boolean/Integer}Sequencer.next, .previous doesn't appear to be
>>> implemented in freewrl and I found this code comment:
>>>
>>> /* WHAT ARE NEXT AND PREVIOUS FIELDS FOR???? NOT MENTIONED IN SPEC (AT
>>> LEAST
>>> REVISION FOUND WHEN IMPLEMENTING */
>>> -Doug
>>>
>>> Doug hypothesis:
>>> H0:  rounds next=up, prev=down the last key fraction to closest key, to
>>> get an index, then next=increments/prev=decrements the index and sets the
>>> key and ouptuts keyvalue of that index in the key[index] and keyValue[index]
>>> arrays
>>
>> In x3dom, we just keep the index around which was used for the last
>> value_changed output event, and modulus increment/decrement it for
>> next/previous.
>>
>> see
>> https://github.com/x3dom/x3dom/blob/master/src/nodes/EventUtilities/X3DSequencerNode.js#L98
>>
>> To get an index from the key fraction, we just go through all keys to
>> find the corresponding interval. Perhaps proven interpolator code can
>> be reused for this.
>>
>> Hope this helps,
>>
>> -Andreas
>>
>> PS: Adding an experimental ScalarSequencer node may be almost trivial
>> once the IntegerSequencer node works.
>>
>> --
>> Andreas Plesch
>> Waltham, MA 02453
>
>
>
> --
> Andreas Plesch
> Waltham, MA 02453
>
>



-- 
Andreas Plesch
Waltham, MA 02453



More information about the x3d-public mailing list