[x3d-public] Fw: ProtoInstance USE without name

Don Brutzman brutzman at nps.edu
Sun Nov 29 11:05:27 PST 2020


Sorry to miss the whole email party... hope you landed where we landed before.  There was a bunch of mail about this, perhaps a year ago, searchable in mail archives.

For X3D XML encoding:

* X3D Tooltips: ProtoInstance
   https://www.web3d.org/x3d/tooltips/X3dTooltips.html#ProtoInstance

* https://www.web3d.org/x3d/tooltips/X3dTooltips.html#ProtoInstance.name

"Warning: name must be specified unless this ProtoInstance is a USE node."

The name field is omitted as part of USE declarations since it is duplicative (i.e. already defined in original ProtoInstance DEF) and also in order to avoid possibility of mismatched name between DEF and USE.

Perhaps more words should be added to the tooltip warning? Will think about it.

Only a few tools can enforce this in validation, since ProtoInstance declaration with @name field and optional DEF is also legitimate.

This is a requirement that will get checked int the X3D XML Encoding document when we revise it next year.


On 11/29/2020 10:38 AM, Christoph Valentin wrote:
> 
> Great. This fits perfectly to the fact that I started to develop my scenes for BS, Octaga and Instant those times.
> 
> -- 
> Diese Nachricht wurde von meinem Android Mobiltelefon mit GMX Mail gesendet.
> Am 29.11.20, 19:24 schrieb Andreas Plesch <andreasplesch at gmail.com>:
> 
>     Some results of testing browsers:
> 
>     freeWrl: A and B works, C does not
>     InstantPlayer: A and C renders, B does not, warning: "obligatory name is missing"; no sound in any on my system
>     view3dscene: A, B and C work, no warnings in any.
>     Octaga: A,B and C work, no warnings in any.
> 
>     In addition, I replaced "Script" with "Group" in C, with the same results in all browsers. This indicates that some browsers essentially ignore the Node type in a xml encoded USE node, following the VRML style of USE.
> 
>     [ So, in the XML encoding, we could have had a <USE name="DEFname" /> construct which may have been discussed but was decided against, perhaps for reasons of validation. ]
> 
>     Only InstantPlayer requires the name attribute in a USE ProtoInstance, indicating a gap in the xml specification. While requiring the name attribute would be cleaner, in my view, it would break backward compatibility. Therefore explicitly USE without name for ProtoInstances makes the most sense to me. This would make InstantPlayer a little non-compliant.
> 
>     Cheers, -Andreas
> 
> 
> 
>     On Sun, Nov 29, 2020 at 10:00 AM Christoph Valentin <christoph.valentin at gmx.at <mailto:christoph.valentin at gmx.at>> wrote:
> 
>         The archive has been updated.
>         . Removed the unused prototype
>           two additional editorial corrections
>         to be crystal clear: the optimum would be to have a clear X3D standard and to remove the workaround forever.
>         @all: do other users have similar experiences with ProtoInstances, DEF and USE? I am not the only user of X3D, am I?
>         kr
>         *Gesendet:* Sonntag, 29. November 2020 um 15:39 Uhr
>         *Von:* "Christoph Valentin" <christoph.valentin at gmx.at <mailto:christoph.valentin at gmx.at>>
>         *An:* "Andreas Plesch" <andreasplesch at gmail.com <mailto:andreasplesch at gmail.com>>
>         *Cc:* "X3D Graphics public mailing list" <x3d-public at web3d.org <mailto:x3d-public at web3d.org>>
>         *Betreff:* Re: [x3d-public] ProtoInstance USE without name
>         Hi Andreas,
> 
>         The MoosTrigger can be deleted. I forgot it there, sorry (it would be used for MU capability). I will correct asap.
> 
>         The only theory I have is that the external behaviour of scripts and protos regarding the event cascade is very similar. Both have fields that can be arbitrarily defined. So a reference to a script can hold a reference to a ProtoInstance.
> 
>         Sorry I am not a Browser developer, but I am a (potential) user of X3D, dont know so much about X3D internals. It could even be an intention of the standard.
> 
>         kr
> 
>         -- 
>         Diese Nachricht wurde von meinem Android Mobiltelefon mit GMX Mail gesendet.
>         Am 29.11.20, 15:24 schrieb Andreas Plesch <andreasplesch at gmail.com <mailto:andreasplesch at gmail.com>>:
> 
>             Hi Christoph,
>             The Pig proto is using a "Moostrigger" proto. Should the Mosstrigger proto be included in the archive, or can it be ignored, eg. commented out ?
>             I am struggling to understand how Version C, the Script workaround, could work:
>             <!-- the second pig , version C - ProtoInstance WITHOUT name -->
>                      <Transform translation='3 0 0' rotation='0 1 0 -1.57'>
>                          <Script USE="ThePig"/>
>                      </Transform>
>             and the ThePig DEF is:
>             <ProtoInstance DEF="ThePig" name='Pig'/>
>             So the ThePig DEF is not a Script node. ( And the Pig proto is of Group type. ). It seems like it is just a coincidence that it works with BSContact. Perhaps BSContact somehow treats all ProtoInstances as Scripts ?
>             Do  you have a theory why the workaround actually works with some browsers ?
>             Thanks, Andreas
>             On Sat, Nov 28, 2020 at 3:46 PM Andreas Plesch <andreasplesch at gmail.com <mailto:andreasplesch at gmail.com>> wrote:
> 
>                 Thanks, I will take a look.
>                 ---on the phone---
>                 On Sat, Nov 28, 2020, 9:17 AM Christoph Valentin <christoph.valentin at gmx.at <mailto:christoph.valentin at gmx.at>> wrote:
> 
>                     Hi Andreas,
>                     I felt free to provide an example scene in three flavors.
>                     The prototype renders a little pig that says "Eatme!", when you touch it (in remembrance of Douglas Adams)
>                     Version A: <ProtoInstance USE="xxx" name="yyy"/>    WITH name attribute - standards compliant
>                     Version B: <ProtoInstance USE="xxx"/>  WITHOUT name attribute
>                     Version C: <Script USE="xxx"/>  WORKAROUND - works for all browsers
>                     I tested with BS Contact --- he can cope with all three versions.
>                     Download the .zip file at https://lc-soc-lc.at/experimental/ProtoInstanceWithUSE/ <https://lc-soc-lc.at/experimental/ProtoInstanceWithUSE/>     I provide it by a GPLv3.
>                     Feed Back welcome. You may take it and give it to your benchmark tests, if you like.
>                     Kind regards,
>                     Christoph
>                     *Gesendet:* Dienstag, 24. November 2020 um 00:30 Uhr
>                     *Von:* "Andreas Plesch" <andreasplesch at gmail.com <mailto:andreasplesch at gmail.com>>
>                     *An:* "Christoph Valentin" <christoph.valentin at gmx.at <mailto:christoph.valentin at gmx.at>>
>                     *Cc:* "X3D Graphics public mailing list" <x3d-public at web3d.org <mailto:x3d-public at web3d.org>>
>                     *Betreff:* Re: [x3d-public] ProtoInstance USE without name
>                     Hi Christoph,
>                     thanks, interesting. Perhaps it will be useful to try a USE ProtoInstance in a very simple scene, in multiple browsers.
>                     -Andreas
>                     On Mon, Nov 23, 2020 at 1:01 PM Christoph Valentin <christoph.valentin at gmx.at <mailto:christoph.valentin at gmx.at>> wrote:
> 
>                         Hi
>                         This bug is common to many X3D players (even classical non-WebGL X3D players).
>                         I was used to use following workaround, which worked for all relevant players:
>                         If I want to USE a DEFd ProtoInstance, I will actually instantiate a <Script> node with USE.
>                         KR,
>                         Christoph
>                         *Gesendet:* Montag, 23. November 2020 um 00:00 Uhr
>                         *Von:* "Andreas Plesch" <andreasplesch at gmail.com <mailto:andreasplesch at gmail.com>>
>                         *An:* "X3D Graphics public mailing list" <x3d-public at web3d.org <mailto:x3d-public at web3d.org>>
>                         *Betreff:* [x3d-public] ProtoInstance USE without name
>                         Looking at why the old Prototypes for HAnim did not work properly for x3dom, I found that the xml examples typically have a ProtoInstance statement with a USE attribute but without the corresponding name attribute defining the actual node type. However, x3dom expects a name attribute with every ProtoInstance statement, even USE ones, to be able to insert the appropriate node.
>                         The xml spec  at
>                         https://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/concepts.html#ProtoInstanceAndFieldValueStatement <https://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/concepts.html#ProtoInstanceAndFieldValueStatement>
>                         does not address USE of ProtoInstances but all examples always have a name attribute.
>                         Also, in my quite extensive testing of Protos, I did not come across other examples of ProtoInstance elements without a name attribute.
>                         To be fair, the name attribute is not strictly necessary for USE ProtoInstances since the type of the inserted node can be determined from the referenced DEF node. But having the name attribute makes ProtoInstance elements more similar to regular nodes. So I think not requiring the name attribute for USE ProtoInstances should be explicitly allowed in the xml spec., but still be encouraged.
>                         I do not think the xml spec. would be otherwise affected by V.4 ?
>                         Best, Andreas


all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman



More information about the x3d-public mailing list