ParallelGraphics Forums
General
You are here: [Forums]::[General]

Registration 
Registration
Forgot your password?

Help 
Help
Support

Quick search 

Subscribe to newsletters 

Install Cortona VRML Client for FREE!
Outline 3D
Try RobinZone!
email:  password:
  General

Subject: Re: Dynamically change script node's url field
Sender: dan.vera@gmail.com 14.03.08 00:15

Thanks for the answer, I was expecting it I guess, however i don't know if i can expect (or hope for) Cortona to fix this.

Meantime, here is a work around for those who are interested:

(note: my goal was to enable dynamic update of a script code file without having to reload the scene)

The script node of which the code has to be changed dynamically is saved as a separate wrl file:
----------------------------------------------
DEF my_script Script {
eventIn SFFloat my_float
url ["c:/test.js"]
}
----------------------------------------------


the file called test.js located in c: contains the following code:
----------------------------------------------
javascript:
function my_float (val) {
print(val);
}
----------------------------------------------


the main test file contains:
----------------------------------------------
DEF test_tra Transform {}

DEF script Script {    
field SFNode test_tra USE test_tra
field SFNode script USE script

eventIn SFTime touched1
eventIn SFTime touched2
eventIn SFTime touched3
eventIn MFNode nodesLoaded

directOutput TRUE
url "javascript:

function touched1 () {
Browser.createVrmlFromURL(new
MFString('path_to_myscript.wrl'),
script, 'nodesLoaded');            
}

function touched2 () {
test = 10;    
}

function nodesLoaded (Mnod) {
Browser.deleteRoute(script, 'test',
test_tra.children[0], 'my_float');

test_tra.children[0]    = Mnod[0];
Browser.addRoute(script, 'test', Mnod[0], 'my_float');


}
"}    
--------------------------------------------------------------


this way it is possible to update/change the test.js file without having to reload the scene

Dan

 


Dynamically change script node's url field / dan.vera@gmail.com / 12.03.08 03:01
     Re: Dynamically change script node's url field / Uh / 13.03.08 23:03
         Re: Dynamically change script node's url field / dan.vera@gmail.com / 14.03.08 00:15

Messages in thread: 3


© 1998-2007 ParallelGraphics. All rights reserved. Terms of use.