Hi everybody,
I want to create a Script node from the string:
CString StringObjects::script = L"DEF SCRIPT \ Script {\ eventIn SFBool play \ field SFNode avatarTimer USE
AVATARTIMER
url [\"javascript: \
function play(value, time){\
avatarTimer.set_startTime = time -
1;\
}\" ]\
}";
with CreateNodeFromString function but it fails because of
"field SFNode avatarTimer USE AVATARTIMER".
Can somebody tell me what can I use instead "USE".
You can't do it that way. Try the following:
1) Set the initial value of SFNode field to NULL (in the string with VRML syntax).
2) Create a script node from the syntax.
3) Get "AVATARTIMER" INodeObject from Nodes collection by name.
4) Set the value of the avatarTimer field of the newborn node to INodeObject from 3)
5) Add script node to the scene graph (for example using Add method of the RootNodes collection)