[x3d-public] cobweb DOM integration

Andreas Plesch andreasplesch at gmail.com
Thu Oct 13 12:28:16 PDT 2016


Version 0.4 of cobweb_dom.js is now available. It adds support for
accessing inlined scenes, allows for multiple scenes on a single web page,
and has better (good?) support for adding non-root nodes. Also all examples
are updated to use this release and the newest cobweb.js .

I want to look into Routes and Interpolators next.

One related question is if and how to relay events from x3d to the dom
(never back, I think). One idea is to generalize how sensor events are
triggering custom dom events named after the field name and with an event
value payload.

This could mean to attach fieldcallbacks to all [in,out] and [out] fields
of most(all?) nodes which then dispatch the custom dom events. In turn, in
the dom, event listeners can be added to any node by user code, and react
to the out events. I am concerned that a lot of custom dom events would be
zipping around.

What might be other concerns ?

This x3dom example triggered this idea:

view-source:
http://doc.x3dom.org/tutorials/animationInteraction/onoutputchange/example.html

With interpolators the goal would be to able to listen to a value_changed
dom event and then do something with it.

Are there strange scenarios where reacting to an field_changed (out) event
outside of the x3d event cascade may cause (perhaps catastrophic) trouble ?

-Andreas

On Sun, Oct 9, 2016 at 10:35 PM, Andreas Plesch <andreasplesch at gmail.com>
wrote:

> Hi,
>
> following up on adding support for sensors in inlines, I also added
> support for sensor which were added to an initial scene:
>
> https://andreasplesch.github.io/cobweb_dom/tests/cobweb_d3.xhtml
>
> The toggle box sensor adds and removes a TouchSensor to the last box
> added, and then adds an event handler to change the color of the box when
> 'touched'.
>
> This also required support for adding nodes which are ChildNodes of
> grouping nodes, and not root nodes.
>
> Now, in addition to ChildNodes I would like to add other nodes which are
> not root nodes, eg. field values of parent nodes. This requires determining
> which field of a parent node should be set, and I am looking for a good
> strategy to make this determination.
>
> If there is containerField attribute, one can just use its value as the
> field name of the parent node to be set.
>
> Otherwise, use the node name as the field name ? Works for Material and
> many other nodes but does not work for Box, for example.
> It is probably possible to make a big map of which nodes can be values of
> which fields. Is there such an explicit map (other than implicit in the XML
> schema) ?
> Using this map, it would be possible to look up he field(s) a node can be
> the value of and then check and set the appropriate parent's field, if any.
>
> What are other strategies for determining the field in a container node
> which should (most likely) be set given just the identity of a new node and
> its containing (parent) node ?
>
> Any ideas or feedback welcome,
>
> -Andreas
>
>
>
>
> On Sun, Oct 9, 2016 at 7:22 PM, Andreas Plesch <andreasplesch at gmail.com>
> wrote:
>
>> Hi list, Holger,
>>
>> I worked on reproducing this x3dom inline example:
>>
>> http://examples.x3dom.org/example/x3dom_inlineReflection.xhtml
>>
>> with cobweb_dom:
>>
>> https://andreasplesch.github.io/cobweb_dom/tests/inline_refl
>> ection/cobwebdom_inlineReflection.xhtml
>>
>> This required adding support for multiple scenes on a single web page,
>> and adding support for relaying sensor events to dom events from within
>> inlines.
>> Also, there is now a x3dload Event dispatched to signal when all inlines
>> are loaded into the dom. This is necessary for user code to know when it is
>> possible to access inlined elements.
>>
>> The main difference between x3dom and cobweb user code is still that
>> listeners need to be added with addEventListener rather than using a
>> onevent attribute and that actual TouchSensor nodes are required.
>>
>> I think this completes work on dom integration of inline. Next I want to
>> look into better support of adding non-root nodes.
>>
>> -Andreas
>>
>> --
>> Andreas Plesch
>> 39 Barbara Rd.
>> Waltham, MA 02453
>>
>
>
>
> --
> Andreas Plesch
> 39 Barbara Rd.
> Waltham, MA 02453
>



-- 
Andreas Plesch
39 Barbara Rd.
Waltham, MA 02453
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20161013/fbb6b04d/attachment.html>


More information about the x3d-public mailing list