script generated instances

This is a discussion on script generated instances within the vrml forums in Programming Languages category; i don't seem to be able to instanciate a proto in a script, i think it really should work but, Cortona says 'unrecognised node' and Contact says nothing but the result is NULL, can anyone see whats wrong or is it browser problems. BTW im trying to have a script place some objects into a world, the script has the logic of how to arrange them but doesn't know what, or how many, objects are being added. example; ( replacing 'myproto{}' with the text inside the proto definition causes this to work) #VRML V2.0 utf8 PROTO myproto []{ Shape {geometry ...

Go Back   Application Development Forum > Programming Languages > vrml

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 06-09-2008, 10:15 AM
simon
Guest
 
Default script generated instances

i don't seem to be able to instanciate a proto in a script, i think it
really should work but, Cortona says 'unrecognised node' and Contact
says nothing but the result is NULL, can anyone see whats wrong or is
it browser problems.

BTW im trying to have a script place some objects into a world, the
script has the logic of how to arrange them but doesn't know what, or
how many, objects are being added.


example;
( replacing 'myproto{}' with the text inside the proto definition
causes this to work)

#VRML V2.0 utf8
PROTO myproto []{
Shape {geometry Box {}}
}

DEF scrpt Script {
eventOut MFNode out
url [ "javascript:
function initialize(){
out=new MFNode(new SFNode('myproto{}'));
}"
]
}

DEF trans Transform {}
ROUTE scrpt.out TO trans.addChildren
Reply With Quote
  #2  
Old 06-09-2008, 12:22 PM
Uh
Guest
 
Default Re: script generated instances

On Jun 9, 6:15*pm, simon <simon.pl...@googlemail.com> wrote:
> i don't seem to be able to instanciate a proto in a script, i think it
> really should work but, Cortona says 'unrecognised node' and Contact
> says nothing but the result is NULL, can anyone see whats wrong or is
> it browser problems.
>
> BTW im trying to have a script place some objects into a world, the
> script has the logic of how to arrange them but doesn't know what, or
> how many, objects are being added.
>
> example;
> ( replacing 'myproto{}' with the text inside the proto definition
> causes this to work)
>
> #VRML V2.0 utf8
> PROTO myproto []{
> * * * * * * *Shape {geometry * *Box * * {}}
>
> }
>
> DEF scrpt Script {
> * * * * eventOut MFNode out
> * * * * url [ *"javascript:
> * * * * * * * * function initialize(){
> * * * * * * * * * * * *out=new MFNode(new SFNode('myproto{}'));
> * * * * * * * * }"
> * * * * *]
>
> }
>
> DEF * * trans Transform {}
> ROUTE scrpt.out TO trans.addChildren


That works:
#VRML V2.0 utf8

DEF scrpt Script {
eventOut MFNode out
url [ "javascript:
function initialize(){
out=Browser.createVrmlFromString('PROTO myproto []{Shape
{geometry Box{}}} myproto{}');
}"
]
}

DEF trans Transform {}
ROUTE scrpt.out TO trans.addChildren
Reply With Quote
  #3  
Old 06-09-2008, 02:48 PM
simon
Guest
 
Default Re: script generated instances

> > BTW im trying to have a script place some objects into a world, the
> > script has the logic of how to arrange them but doesn't know what, or
> > how many, objects are being added.


so the node can't be defined in the script.
Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 04:14 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.