[x3d-public] ProtoBody completeness in nested Protos

Andreas Plesch andreasplesch at gmail.com
Mon Apr 25 08:20:21 PDT 2022


On Mon, Apr 25, 2022 at 12:43 AM Brutzman, Donald (Don) (CIV)
<brutzman at nps.edu> wrote:

> Actually please look a little more closely at that (admittedly tricky)
> example.

Thanks, looking closely is when I noticed that the CircleFishLod
ProtoBody is not completely defined within itself.

> * CircleFish is an ExternProto, separately defined in another file
> * CircleFishLod is a ProtoDeclare defined in that first file,
> CircleFishLodPrototype.x3d
> * CircleFishLod ProtoBody contains two ProtoInstance copies of CircleFish

Yes, but the CircleFishLod ProtoBody does not contain the CircleFish
ExternProtoDeclare (referencing the CircleFish ExternProto) which the
two copies of CircleFish use. So the ProtoBody is incomplete.

> * CircleFishLod ProtoDeclare is then followed by a CircleFishLod
> ProtoInstance (again  in CircleFishLodPrototype.x3d)
> So I would expect an X3D Browser to
>
> a. load ExternProtoDeclare      CircleFish

At this point the ProtoDeclaration is only registered under its name,
in the outer scene Execution Context. The protos array of the
Execution Context stores it :
https://www.web3d.org/documents/specifications/19777-1/V3.3/Part1/functions.html#t-ExecutionContextProperties.

> b. build ProtoDeclare                CircleFishLod
> c. create inner ProtoInstance  CircleFish for use

This ProtoInstance creation will look for the CircleFish
ProtoDeclaration, in the CircleFishLod Execution Context which is
separate from the scene execution context/name scope. But it is only
registered in the outer scene Context.

> d. create outer ProtoInstance CircleFishLod

In the example (not necessarily in the Proto x3d).

> Order of steps might vary a bit, but those are the dependencies.  Good luck
> sir.

Well, thanks for listing the specific steps which helped illuminate
that there is a deeper issue with assuming that the outer scene
Execution Context should apply also to the Proto Execution Context. I
do not think this is the case. Or is it ?

This scrutiny confirms to me that there is likely an oversight in the
CircleFishLod example. The example only happens to work in some
browsers which are more accepting of mixing Execution Contexts. The
example can be easily fixed by moving the ExternProtoDeclare inside
the ProtoBody, similar to other examples of nested Prototypes. In fact
all other examples of nested prototypes I could find do this.

Happy to be convinced otherwise,

Andreas

> Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA    +1.831.656.2149
> X3D graphics, virtual worlds, Navy robotics https://
> faculty.nps.edu/brutzman
>
> -----Original Message-----
> From: x3d-public <x3d-public-bounces at web3d.org> On Behalf Of Andreas Plesch
> Sent: Sunday, April 24, 2022 9:08 PM
> To: X3D Graphics public mailing list <x3d-public at web3d.org>
> Subject: [x3d-public] ProtoBody completeness in nested Protos
>
> ProtoDeclarations may use ProtoInstances of other Protos inside their
> ProtoBody definitions.
>
> For example, the CircleFishLod proto here:
>
> https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fx3dgraphic
> s.com%2Fexamples%2FX3dForWebAuthors%2FKelpForestExhibit%2FCircleFishLodProto
> typeIndex.html&data=05%7C01%7Cbrutzman%40nps.edu%7C0b4a867ba9874e371f9b0
> 8da267152fa%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637864565880708349%
> 7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwi
> LCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=upr4eckI8axT7MO5fAUvAWfyBzUJfhTwqcp
> BuH7tZjc%3D&reserved=0
>
> uses ProtoInstances of the CircleFish proto.
>
> A more extreme case of nesting is:
>
> https://www.web3d.org/x3d/content/examples/ConformanceNist/Miscellaneous/PRO
> TO/fivedeepnestingIndex.html
>
> where Proto1 uses ProtoInstance of Proto2 inside its ProtoBody. Proto2
> itself uses a ProtoInstance of Proto3 inside its ProtoBody. And so on to
> five levels deep.
>
> The second example with the deep nesting currently works with x3dom but the
> seemingly simpler CircleFishLod proto does not.
>
> The reason is that x3dom expects the complete definition of a proto to be
> contained in its ProtoBody. However, The CircleFishLod proto only contains
> the CircleFish ProtoInstances in the body but not the associated CircleFish
> ProtoDeclaration which for some reason occurs outside the CircleFishLod
> ProtoBody (and outside the CircleFishLod ProtoDeclaration).
>
> Expecting the ProtoBody to be complete and self-contained seems rather
> natural. Is x3dom too strict in this regard, or is there an oversight in the
> example ? There is not much guidance in the spec., if any.
>
> Thanks, Andreas
>
> --
> Andreas Plesch
> Waltham, MA 02453
>
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org



-- 
Andreas Plesch
Waltham, MA 02453



More information about the x3d-public mailing list