[X3D-Public] Any way to get 'this' proto instance inside itself?

Braden McDaniel braden at endoframe.com
Sun Oct 31 19:53:52 PDT 2010

On Sun, 2010-10-31 at 10:51 -0700, Dave A wrote:
> I may be missing something obvious, but please enlighten me:
> Is there a way to get a handle on 'this' proto's instance from within
> a script in that proto?

Not exactly...

> Ex:
> PROTO myproto [
>     inputOutput SFString s ""
> ]
> {
>     DEF pscript Script {
>     url [ "ecmascript:
>         function initialize()
>         {
>             Browser.addRoute ( somenode, 'somefield', I NEED TO ACCESS
>         }
> I'm using Contact FWIW. I can see that Contact has a lovely external
> 'get node by DEF name' feature, not available in internal script. I
> don't see any API which takes DEF name strings and creates routes.
> I'd really like to avoid having to crawl the scene graph looking for
> my instance by name (that name being a proto field set same as the DEF
> name for it).

You just need to IS 's' to some interface in the PROTO definition and
route to that.

Braden McDaniel <braden at endoframe.com>

More information about the X3D-Public mailing list