[x3d-public] Behavior of X3D's DOM integration
Behr, Johannes
johannes.behr at igd.fraunhofer.de
Thu Apr 16 00:56:27 PDT 2015
> On 16 Apr 2015, at 09:25, Kristian Sons <kristian.sons at dfki.de> wrote:
>
> Hi,
>
> interesting discussion.
>
> I completely agree with Max and Leonard that the dangling references are the most "web-style" way with a behaviour that can also be found e.g. in SVG's use references. However, this behavior comes with a number of issues:
>
> * The using node becomes kind of a node of it's own (like a proxy node holding the reference). This is not X3D-style, where the DEF/USE statements are only considered during serialization and "the same node is inserted into the scene graph a second time"
> * The semantics of deleting and adding nodes in scenes with dangling references is then very different from the standard semantics. For instance, in X3D it's safe to remove any node without side-effects in other parts of the graph. Imagine five shapes sharing a material. You can now remove any shape without running at risk that other shape loose their material. In the case of dangling references, if you remove the shape that holds the DEF of the material, all remaining shapes will have a dangling reference. For the "dangling references" behaviour it would be essential to have a "<defs>" section that allows to split definition from occurrence (I remember some old VRML exporters doing this with a Switch node hiding it's children). BTW, in XML3D we have the dangling reference concept and shared nodes are typically defined in the <defs> section.
>
> Using Johannes approach, one would circumvent this. On the other hand this would result in some magic transforming the DOM at other places if the user deletes or adds a node. I would find this very counterintuitive.
For me DEF/USE is really just a serialisation construct to map the graph to a tree and therefore two pointer to the same node which should behaviour exactly the same. According to the spec the node is the same. Deep-copies are done with Proto-instances. Therefore this should work:
1) Create to shapes (A,B) which share the material
2) Delete one shape (A)
3) (B) should still work with the given material in the setup state
Best regards
Johannes
>
> Also Lenard is trying to define a behavior that works around some issues of the dangling reference (replacing a node without going into an invalid state). However, it introduces some magic as well. Kind of a hidden definition section that keeps references alive. I think if a Element.replaceChild would not lead to an error state, this would be sufficient.
>
> Best regards,
> Kristian
>
>
>
>
>
> I would fin it strange if the DOM transforms by magic if I delete a node.
>
>
> Am 15.04.2015 um 17:57 schrieb Behr, Johannes:
>> Hi,
>>
>> I still prefer 2. since for me DEF/USE is just a specific construct to serialise the graph in a file/xml-tree and the developer just removes one of those nodes in a live scene. For X3D nodes which are still in the setup state (= not in the DOM) this behaviour would be different. But this is the case for many X3D feature (e.g. assigning of non-expoesed fields)
>>
>> best regards
>> Johannes
>>
>>> On 15 Apr 2015, at 12:38, Kristian Sons<kristian.sons at dfki.de> wrote:
>>>
>>> Dear X3D community,
>>>
>>> although this is a question concerncing the X3DOM integration model, I post this quesion to the X3D mailing list, because I know that the consortium is really interested in adopting this integration model in a future version of X3D.
>>>
>>> I am be interested in the intended behavior when synchronization between the DOM representation and internal X3D scene graph is necessary. The X3DOM paper is not really explicit here.
>>>
>>> Let me use the simple DEF/USE example from x3dom.org as example:
>>> http://examples.x3dom.org/example/x3dom_defUse.xhtml
>>>
>>> The scene has to <Shape> nodes, one defining the Shape below Transform#bar, one that is reusing the Shape below Transform#bar.
>>>
>>> Now I remove the defining node (using jQuery syntax):
>>> $("Transform#bar Shape").remove();
>>>
>>> Now I have an invalid X3D scene in the DOM with a single <Shape> node pointing to a definition that does not exists. The currently included X3DOM implementation 1.6.2-dev produces an error, stops rendering (displaying both shapes) and gets inactive (I guess this is a bug) . Former versions would just render the "USE" node using the previous definition.
>>>
>>> What the intended behavior? I could think of three behaviors:
>>>
>>> 1. The USE node has a dangling reference. Consequently nothing is rendered at all (corresponds to a reinitialization of the scene state based on the new DOM representation)
>>> 2. The USE node becomes the DEF node (the DOM corresponds to removing the node via SAI and then serializing the scene)
>>> 3. The USE node is still rendering the referenced shape but the definition does not appear in the DOM (the run-time corresponds to removing the node via SAI, but the DOM representation differs)
>>>
>>> The first behavior seems the most logical variant for me.
>>>
>>> Any opinions on this?
>>>
>>> Thanks,
>>> Kristian
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> _______________________________________________________________________________
>>>
>>> Kristian Sons
>>> Deutsches Forschungszentrum für Künstliche Intelligenz GmbH, DFKI
>>> Agenten und Simulierte Realität
>>> Campus, Geb. D 3 2, Raum 0.77
>>> 66123 Saarbrücken, Germany
>>>
>>> Phone: +49 681 85775-3833
>>> Phone: +49 681 302-3833
>>> Fax: +49 681 85775–2235
>>>
>>> kristian.sons at dfki.de
>>> http://www.xml3d.org
>>>
>>>
>>> Geschäftsführung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster (Vorsitzender)
>>> Dr. Walter Olthoff
>>>
>>> Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
>>> Amtsgericht Kaiserslautern, HRB 2313
>>> _______________________________________________________________________________
>>>
>>> _______________________________________________
>>> x3d-public mailing list
>>> x3d-public at web3d.org
>>> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>> ---
>> Dr. Johannes Behr
>> Visual Computing System Technologies
>> Fraunhofer IGD
>> Fraunhoferstr. 5 | 64283 Darmstadt | Germany
>> Tel +49 6151 155-510 | Fax +49 6151 155-196
>> johannes.behr at igd.fraunhofer.de |www.igd.fraunhofer.de/vcst
>>
>
>
> --
> _______________________________________________________________________________
>
> Kristian Sons
> Deutsches Forschungszentrum für Künstliche Intelligenz GmbH, DFKI
> Agenten und Simulierte Realität
> Campus, Geb. D 3 2, Raum 0.77
> 66123 Saarbrücken, Germany
>
> Phone: +49 681 85775-3833
> Phone: +49 681 302-3833
> Fax: +49 681 85775–2235
> kristian.sons at dfki.de
> http://www.xml3d.org
>
> Geschäftsführung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster (Vorsitzender)
> Dr. Walter Olthoff
>
> Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
> Amtsgericht Kaiserslautern, HRB 2313
> _______________________________________________________________________________
>
---
Dr. Johannes Behr
Visual Computing System Technologies
Fraunhofer IGD
Fraunhoferstr. 5 | 64283 Darmstadt | Germany
Tel +49 6151 155-510 | Fax +49 6151 155-196
johannes.behr at igd.fraunhofer.de | www.igd.fraunhofer.de/vcst
More information about the x3d-public
mailing list