vrml-java-generated vrml 
Author Message
 vrml-java-generated vrml

Hi

My question is to anybody who dealt with generated vrml code.

So,
if I have a base vrml file, to which I add more vrml code from a java
applet using the createVrmlfromString method (EAI), how can I set up
communication (e.g. route events) between the two types of vrml code,
base and dynamically added? Any idea?

Thank you

Szilard



Fri, 26 Apr 2002 03:00:00 GMT  
 vrml-java-generated vrml

Quote:

> Hi

> My question is to anybody who dealt with generated VRML code.

> So,
> if I have a base vrml file, to which I add more vrml code from a java
> applet using the createVrmlfromString method (EAI), how can I set up
> communication (e.g. route events) between the two types of vrml code,
> base and dynamically added? Any idea?

> Thank you

> Szilard

well,...
You can generate VRML code which look like "DEF mytrans Transform {...}"
and then you can route events with the addRoute() function.

have fun
KP



Fri, 26 Apr 2002 03:00:00 GMT  
 vrml-java-generated vrml
Hi

Quote:
> well,...
> You can generate VRML code which look like "DEF mytrans Transform {...}"
> and then you can route events with the addRoute() function.

Did you test this ?
i tried to do something like that some time ago using cosmo player and it
did'nt work...
What i am doing now is to add the nodes inside a Group and then accessing
them by getting an EventOut from the children_changed field.

Bye



Fri, 26 Apr 2002 03:00:00 GMT  
 vrml-java-generated vrml

Quote:

> Hi

> > well,...
> > You can generate VRML code which look like "DEF mytrans Transform {...}"
> > and then you can route events with the addRoute() function.

> Did you test this ?
> i tried to do something like that some time ago using cosmo player and it
> did'nt work...
> What i am doing now is to add the nodes inside a Group and then accessing
> them by getting an EventOut from the children_changed field.

> Bye

addRoute() works until you are using events from nodes DEF-ed in the
same generated code, not from the base file. At least that is what I
see.
The second approach looks promising, I shell try it. Thank you!

Szilard

PS: if anybody else got some good tips, I'll be glad to hear it! :)



Sat, 27 Apr 2002 03:00:00 GMT  
 vrml-java-generated vrml

Quote:

> Hi

> My question is to anybody who dealt with generated VRML code.

> So,
> if I have a base vrml file, to which I add more vrml code from a java
> applet using the createVrmlfromString method (EAI), how can I set up
> communication (e.g. route events) between the two types of vrml code,
> base and dynamically added? Any idea?

> Thank you

> Szilard

Everything is turned out to be so simple, and I wasted a whole day with
it! (Well, not exactly, there were two monday talks also :)

So, here it is:

To use createVrmlFromString, you use a Node[] variable, in which you
store the created vrml code, something like this

Node[] someVrmlCode = (Browser)
my_browser.createVrmlFromString(someString);

Now you calculate the serial number of the node whom's events do you
want to access (for example the 5th, or simple the first if you add just
one node) and get the right type of event with

eventInSFRotation someEvent = eventInSFRotation
someVrmlCode[5].getEventIn(someEventString);

You can use eventIn-s or eventOut-s with different type of
events(rotation, float, node, etc.) and you have access to the generated
code from Javatm (and from javatm you can link it with the base file).

Szilard



Sat, 27 Apr 2002 03:00:00 GMT  
 vrml-java-generated vrml

Quote:

>> So,
>> if I have a base vrml file, to which I add more vrml code from a java
>> applet using the createVrmlfromString method (EAI), how can I set up
>> communication (e.g. route events) between the two types of vrml code,

You can use the addRoute method from Browser class.
Btw, Cosmo Player's EAI implementation for createVrmlFromString() has
a known bug that causes your system to throw an Illegal operation (at times.)

Personally, I use createVrmlFromUrl instead.

---
yong bing



Sun, 28 Apr 2002 03:00:00 GMT  
 vrml-java-generated vrml
If you like, you can wrap your VRML in a PROTO node:
      PROTO my_node [
         eventIn MFNode addChildren
         exposedField SFColor color1
      ] {
         -- your VRML here --
      }
      my_node {}

(createVrmlFromString() on this)

And then anything you want to talk to in your world, hook it up to a field
or event of the
PROTO node.

Your java can then just talk to your interface fields and events, without
depending on
the underlying structure of your VRML.  (I.e., you don't have to know inside
java that
the 5th node is a Box, etc.)  This lets you update your VRML code without
needing to
change around your java interface code (I.e., you could add a node before
the Box,
making it the 6th node now, without breaking your java code).  This is
really useful
if you are reading a file in java, and using createVrmlFromString() on the
file contents.
You can edit your file the way you like without having to rebuild your java
each time
you make a change.  Cool stuff!

Don Ginn

Quote:

> Now you calculate the serial number of the node whom's events do you
> want to access (for example the 5th, or simple the first if you add just
> one node) and get the right type of event with

> eventInSFRotation someEvent = eventInSFRotation
> someVrmlCode[5].getEventIn(someEventString);



Tue, 30 Apr 2002 03:00:00 GMT  
 vrml-java-generated vrml



Quote:
> If you like, you can wrap your VRML in a PROTO node:
>       PROTO my_node [
>          eventIn MFNode addChildren
>          exposedField SFColor color1
>       ] {
>          -- your VRML here --
>       }
>       my_node {}

> (createVrmlFromString() on this)

> And then anything you want to talk to in your world, hook it up to a field
> or event of the
> PROTO node.

> Your java can then just talk to your interface fields and events, without
> depending on
> the underlying structure of your VRML.  (I.e., you don't have to know
inside
> java that
> the 5th node is a Box, etc.)  This lets you update your VRML code without
> needing to
> change around your java interface code (I.e., you could add a node before
> the Box,
> making it the 6th node now, without breaking your java code).  This is
> really useful
> if you are reading a file in java, and using createVrmlFromString() on the
> file contents.
> You can edit your file the way you like without having to rebuild your
java
> each time
> you make a change.  Cool stuff!

> Don Ginn


> > Now you calculate the serial number of the node whom's events do you
> > want to access (for example the 5th, or simple the first if you add just
> > one node) and get the right type of event with

> > eventInSFRotation someEvent = eventInSFRotation
> > someVrmlCode[5].getEventIn(someEventString);

As both of you know Vrml AND Java, why don't you dive into java3d ??
The development "environment" for such pluginless Web3d is at:
www.shout3d.com

sibyl



Thu, 02 May 2002 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. from near VRML to REAL VRML : My first EAI / Java / VRML Humanoid Avatar

2. VRML generated from JAVA, not JAVA script?

3. VRML in Java vs Java in VRML

4. Java library for generating VRML??

5. Java generated VRML

6. VRML/java scripting example and vrml.* packages

7. Two VRML worlds (VRML+Java)

8. EAI version of VRML 2.0 Tic-Tac-Toe game (VRML + Java)

9. JAVA + VRML (VRML libraries)

10. IE6 +VRML + javascript in VRML trouble (was: problem using javascript window.open in VRML)

11. Java in frame can't get instance of Java EAI + VRML in another frame

12. help: js generated vrml

 

 
Powered by phpBB® Forum Software