http://www.youtube.com/watch?
Wonderland
Tuesday, February 8, 2011
Solar System animation
Here is an animation created using the animation capability built into the scripting component. The animation is of a group of planets organized into a solar system. Note that one of the planets has a moon.
http://www.youtube.com/watch? v=BE7KhCUVft0
http://www.youtube.com/watch?
FlyCam animation
During the week I created an animation of a HUD camera attached to a bug model that flies around in an OWL world. The bug animation was created in Maya and contains the animations to do the movements as in the video.
Here is the url to the video:
Morris
Shape module copy script
In the process of doing the shape cell tutorial I wanted to rename the module so that there would be no overlap of names/files/etc. Rather than manually rename everything I created a script to create a new module from the shape module with everything renamed. Here it is. Hope the blog doesn't screw up the formatting too much! By the way, it is a *nix script.
Looks like the lines wrapped a bit so I separated them to clarify it a bit.
It is run from the shape cell directory as:
./constructor.h [path to this directory] [path to new module] [new module name] [path to image file to use]
For example I used:
./constructor.sh
/Users/morrisford/trunk-20100321/wonderland-modules/unstable/shape-tutorial-module /Users/morrisford/trunk-20100321/wonderland-modules/unstable/shapeMorris shapeMorris /Users/morrisford/images/apple.jpg
echo "Enter constructor"
echo "Shape path = $1"
echo "New module path = $2"
echo "New module name = $3"
echo "Image file name = $4"
mkdir $2
mkdir -p $2/src/classes/org/jdesktop/wonderland/modules/$3/client
mkdir -p $2/src/classes/org/jdesktop/wonderland/modules/$3/client/jme
mkdir -p $2/src/classes/org/jdesktop/wonderland/modules/$3/client/jme/cellrenderer
mkdir -p $2/src/classes/org/jdesktop/wonderland/modules/$3/common
mkdir -p $2/src/classes/org/jdesktop/wonderland/modules/$3/server
mkdir -p $2/lib
mkdir -p $2/nbproject/private
mkdir -p $2/art
cp $4 $2/art/.
sed -e s/shape/$3/g -e s/Shape/$3/g < $1/build.xml > $2/build.xml
sed -e s/shape/$3/g -e s/Shape/$3/g < $1/nbproject/project.xml > $2/nbproject/project.xml
cp $1/nbproject/nb.properties $2/nbproject/nb.properties
cp $1/nbproject/private/private.xml $2/nbproject/private/private.xml
sed -e s/shape/$3/g -e s/Shape/$3/g < $1/my.module.properties > $2/my.module.properties
sed -e s/com.jme.scene.shape/saveit/g -e s/shape/$3/g -e s/Shape/$3/g -e s/saveit/com.jme.scene.shape/g < $1/src/classes/org/jdesktop/wonderland/modules/shape/client/jme/cellrenderer/ShapeCellRenderer.java > $2/src/classes/org/jdesktop/wonderland/modules/$3/client/jme/cellrenderer/$3CellRenderer.java
sed -e s/shape/$3/g -e s/Shape/$3/g < $1/src/classes/org/jdesktop/wonderland/modules/shape/client/ShapeCell.java > $2/src/classes/org/jdesktop/wonderland/modules/$3/client/$3Cell.java
sed -e s/shape/$3/g -e s/Shape/$3/g -e s/MountainPicture.png/`basename $4`/g < $1/src/classes/org/jdesktop/wonderland/modules/shape/client/ShapeCellFactory.java > $2/src/classes/org/jdesktop/wonderland/modules/$3/client/$3CellFactory.java
sed -e s/shape/$3/g -e s/Shape/$3/g < $1/src/classes/org/jdesktop/wonderland/modules/shape/common/ShapeCellChangeMessage.java > $2/src/classes/org/jdesktop/wonderland/modules/$3/common/$3CellChangeMessage.java
sed -e s/shape/$3/g -e s/Shape/$3/g < $1/src/classes/org/jdesktop/wonderland/modules/shape/common/ShapeCellClientState.java > $2/src/classes/org/jdesktop/wonderland/modules/$3/common/$3CellClientState.java
sed -e s/shape/$3/g -e s/Shape/$3/g < $1/src/classes/org/jdesktop/wonderland/modules/shape/common/ShapeCellServerState.java > $2/src/classes/org/jdesktop/wonderland/modules/$3/common/$3CellServerState.java
sed -e s/shape/$3/g -e s/Shape/$3/g < $1/src/classes/org/jdesktop/wonderland/modules/shape/server/ShapeCellMO.java > $2/src/classes/org/jdesktop/wonderland/modules/$3/server/$3CellMO.java
sed -e s/shape/$3/g -e s/Shape/$3/g < $1/src/classes/org/jdesktop/wonderland/modules/shape/client/InfoContextMenuFactory.java > $2/src/classes/org/jdesktop/wonderland/modules/$3/client/InfoContextMenuFactory.java
Looks like the lines wrapped a bit so I separated them to clarify it a bit.
It is run from the shape cell directory as:
./constructor.h [path to this directory] [path to new module] [new module name] [path to image file to use]
For example I used:
./constructor.sh
/Users/morrisford/trunk-20100321/wonderland-modules/unstable/shape-tutorial-module /Users/morrisford/trunk-20100321/wonderland-modules/unstable/shapeMorris shapeMorris /Users/morrisford/images/apple.jpg
echo "Enter constructor"
echo "Shape path = $1"
echo "New module path = $2"
echo "New module name = $3"
echo "Image file name = $4"
mkdir $2
mkdir -p $2/src/classes/org/jdesktop/wonderland/modules/$3/client
mkdir -p $2/src/classes/org/jdesktop/wonderland/modules/$3/client/jme
mkdir -p $2/src/classes/org/jdesktop/wonderland/modules/$3/client/jme/cellrenderer
mkdir -p $2/src/classes/org/jdesktop/wonderland/modules/$3/common
mkdir -p $2/src/classes/org/jdesktop/wonderland/modules/$3/server
mkdir -p $2/lib
mkdir -p $2/nbproject/private
mkdir -p $2/art
cp $4 $2/art/.
sed -e s/shape/$3/g -e s/Shape/$3/g < $1/build.xml > $2/build.xml
sed -e s/shape/$3/g -e s/Shape/$3/g < $1/nbproject/project.xml > $2/nbproject/project.xml
cp $1/nbproject/nb.properties $2/nbproject/nb.properties
cp $1/nbproject/private/private.xml $2/nbproject/private/private.xml
sed -e s/shape/$3/g -e s/Shape/$3/g < $1/my.module.properties > $2/my.module.properties
sed -e s/com.jme.scene.shape/saveit/g -e s/shape/$3/g -e s/Shape/$3/g -e s/saveit/com.jme.scene.shape/g < $1/src/classes/org/jdesktop/wonderland/modules/shape/client/jme/cellrenderer/ShapeCellRenderer.java > $2/src/classes/org/jdesktop/wonderland/modules/$3/client/jme/cellrenderer/$3CellRenderer.java
sed -e s/shape/$3/g -e s/Shape/$3/g < $1/src/classes/org/jdesktop/wonderland/modules/shape/client/ShapeCell.java > $2/src/classes/org/jdesktop/wonderland/modules/$3/client/$3Cell.java
sed -e s/shape/$3/g -e s/Shape/$3/g -e s/MountainPicture.png/`basename $4`/g < $1/src/classes/org/jdesktop/wonderland/modules/shape/client/ShapeCellFactory.java > $2/src/classes/org/jdesktop/wonderland/modules/$3/client/$3CellFactory.java
sed -e s/shape/$3/g -e s/Shape/$3/g < $1/src/classes/org/jdesktop/wonderland/modules/shape/common/ShapeCellChangeMessage.java > $2/src/classes/org/jdesktop/wonderland/modules/$3/common/$3CellChangeMessage.java
sed -e s/shape/$3/g -e s/Shape/$3/g < $1/src/classes/org/jdesktop/wonderland/modules/shape/common/ShapeCellClientState.java > $2/src/classes/org/jdesktop/wonderland/modules/$3/common/$3CellClientState.java
sed -e s/shape/$3/g -e s/Shape/$3/g < $1/src/classes/org/jdesktop/wonderland/modules/shape/common/ShapeCellServerState.java > $2/src/classes/org/jdesktop/wonderland/modules/$3/common/$3CellServerState.java
sed -e s/shape/$3/g -e s/Shape/$3/g < $1/src/classes/org/jdesktop/wonderland/modules/shape/server/ShapeCellMO.java > $2/src/classes/org/jdesktop/wonderland/modules/$3/server/$3CellMO.java
sed -e s/shape/$3/g -e s/Shape/$3/g < $1/src/classes/org/jdesktop/wonderland/modules/shape/client/InfoContextMenuFactory.java > $2/src/classes/org/jdesktop/wonderland/modules/$3/client/InfoContextMenuFactory.java
Saturday, January 29, 2011
Blog post week #1 - P2PU OWL class
Finished the reading for week one and built the shape cell. I sorta cheated. I worked with the shape cell tutorial back when it was first written. I have included below a short 'tutorial' that I wrote a while back about the shape cell and adding a scripting command interface. Thought it might be interesting for anyone interested in scripting. I can't guarantee that everything matches up exactly with the current shape cell because there have been some minor changes. I have it in pdf format also.
Shape Cell Scripting Mod
This is an addition to Jordan's shape cell tutorial that enables scripting control of the shape change. The changes in this mini-tutorial could be applied to any type of cell in order to easily add automation. The changes are in only the cell.java and the cellMO.java code.
Functionally what is changed is that a scripting component is attached and a command stack mechanism is added that will allow the component to call the commands in the command stack by an arbitrary command name. The command stack for the shape cell only implements one command but the process of adding other commands is exactly the same. Then you will create a script that calls
MyClass.executeAction(“shapeChange”);
Shape Cell
Add the following imports:
import org.jdesktop.wonderland.modules.scriptingComponent.client.ScriptingActionClass;
import org.jdesktop.wonderland.modules.scriptingComponent.client.ScriptingComponent;
import org.jdesktop.wonderland.modules.scriptingComponent.client.ScriptingRunnable;
Add the following two lines lines in bold and italics near the top of the code in the location as below:
@UsesCellComponent private ContextMenuComponent contextComp = null;
private ContextMenuFactorySPI menuFactory = null;
@UsesCellComponent
private ScriptingComponent scriptingComponent;
public ShapeCell(CellID cellID, CellCache cellCache) {
Add the two following methods with the other methods in the file:
public void shapeChangeShape()
{
shapeType = (shapeType.equals("BOX") == true) ? "SPHERE" : "BOX";
renderer.updateShape();
ShapeCellChangeMessage msg = new ShapeCellChangeMessage(getCellID(), shapeType);
sendCellMessage(msg);
}
ScriptingRunnable shapeChangeShapeRun = new ScriptingRunnable()
{
@Override
public void run()
{
shapeChangeShape();
System.out.println("ScriptingActionClass - enter shapeChange");
}
};
Add the following four lines in bold and italics in the setStatus method in the spot as below:
contextComp.addContextMenuFactory(menuFactory);
ScriptingActionClass sac = new ScriptingActionClass();
sac.setName("Shape");
sac.insertCmdMap("shapeChange", shapeChangeShapeRun);
scriptingComponent.putActionObject(sac);
}
Shape Cell MO
Add the following import:
import org.jdesktop.wonderland.modules.scriptingComponent.server.ScriptingComponentMO;
Add the following line in the constructor as below. public ShapeCellMO()
{
addComponent(new ScriptingComponentMO(this), ScriptingComponentMO.class);
}
Scripting based cell creation
The scripting component allows for creation of cells under scripting control. Basically all that is required is to put into a script a command like:
MyClass.createCellInstance("org.jdesktop.wonderland.modules.shape.common.S hapeCellServerState", 3.0, 0.0, 3.0, "shape");
The parameters are the cell server state class name, x, y, z and the cell name to be used for this cell instance.
In order for this to work best I changed one line in the ShapeCellServerState.java to be like this:
private String textureURI = "wla://shape-tutorial-module/MountainPicture.png";
This change puts a default value for the textureURI. Creating a cell this way seems to require that all values be defaulted in the server state class.
Problems with Windows and the Scripting Editor
Hello All,
The Scripting Component for Open Wonderland (OWL) is one of the implementations for scripting that have been created by the OWL community. This implementation of scripting utilizes a scripting interface defined in JSR-223, Scripting for the Java Platform. This interface allows for the use of any scripting language that has a scripting engine that conforms to the JSR-223 specification, and there are a number of compliant scripting languages. For instance, usable languages include javascript, jython, jruby, sleep, php and java. This post will deal a bit with the problems involved with using java as a scripting language through the Scripting Component on Windows systems.
Ordinarily, java is not considered to be a scripting language but some helpful soul at Sun decided to create a JSR-223 compliant scripting engine to allow its usage. This was quite attractive to me when I was creating the UI for creating and managing scripts in OWL since I could use Netbeans to create a nice java program that I could then run as a script within the component. So, I happily sauntered along using my Mac to create and test the UI program while being completely oblivious to any difficulties with running a java script on Windows. Then people actually started trying to use the UI and I very rapidly was made aware of the fact that it wouldn't work on Windows. So, I cranked up my trusty old XP system and after a bit of poking I discovered that the problem was that javaws.exe, the program that implements the Web Start capability, was using the path to the JRE to run instead of the PATH to the JDK and when the scripting component was instructed to bring up the editor which is a java script, the javac.exe was nowhere to be found. The solution was to tell the javaws to use the JDK path but my fix turned out to be temporary since I was reconfiguring javaws itself. Then Nina (nnjones in the P2PU class) found that a reconfiguration of the browser would do a 'permanent' fix. Unfortunately, each person that wants to run the scripting editor on Windows has to resolve the problem on their system and also since the resolution has to do with the version of Windows and the browser used, there are lots of variations.
Here is the essence of the 'fix' that I just posted to a thread on the OWL forum about this problem:
thread -> http://groups.google.com/group/openwonderland/browse_thread/thread/3998957b6be51184
--------------------------------------------------------------------------------------------------
The Scripting Component for Open Wonderland (OWL) is one of the implementations for scripting that have been created by the OWL community. This implementation of scripting utilizes a scripting interface defined in JSR-223, Scripting for the Java Platform. This interface allows for the use of any scripting language that has a scripting engine that conforms to the JSR-223 specification, and there are a number of compliant scripting languages. For instance, usable languages include javascript, jython, jruby, sleep, php and java. This post will deal a bit with the problems involved with using java as a scripting language through the Scripting Component on Windows systems.
Ordinarily, java is not considered to be a scripting language but some helpful soul at Sun decided to create a JSR-223 compliant scripting engine to allow its usage. This was quite attractive to me when I was creating the UI for creating and managing scripts in OWL since I could use Netbeans to create a nice java program that I could then run as a script within the component. So, I happily sauntered along using my Mac to create and test the UI program while being completely oblivious to any difficulties with running a java script on Windows. Then people actually started trying to use the UI and I very rapidly was made aware of the fact that it wouldn't work on Windows. So, I cranked up my trusty old XP system and after a bit of poking I discovered that the problem was that javaws.exe, the program that implements the Web Start capability, was using the path to the JRE to run instead of the PATH to the JDK and when the scripting component was instructed to bring up the editor which is a java script, the javac.exe was nowhere to be found. The solution was to tell the javaws to use the JDK path but my fix turned out to be temporary since I was reconfiguring javaws itself. Then Nina (nnjones in the P2PU class) found that a reconfiguration of the browser would do a 'permanent' fix. Unfortunately, each person that wants to run the scripting editor on Windows has to resolve the problem on their system and also since the resolution has to do with the version of Windows and the browser used, there are lots of variations.
Here is the essence of the 'fix' that I just posted to a thread on the OWL forum about this problem:
thread -> http://groups.google.com/group/openwonderland/browse_thread/thread/3998957b6be51184
--------------------------------------------------------------------------------------------------
I have been working to try to resolve this problem with windows and the
scripting editor. I am using Vista so your results may vary.
scripting editor. I am using Vista so your results may vary.
I have got it working with Firefox and Internet Explorer.
1) Make sure that you have the JDK installed.
2) Make sure that your PATH environment variable does not have an entry for
the JRE and that it does have an entry for the JDK/bin directory.
3) In Firefox, go to Tools->Options->Applications tab. In the list of
Content Types, find the entry for JNLP File. Set the action for this item to
the javaws.exe that is in the JDK/bin directory. Save and exit. It should
now work.
4) In Internet Explorer, go to Tools->Internet Options->Programs->Set
Programs. Go to 'Associate a file type or protocol ...'. Find the line for
.jnlp file type and set the Current Default to the javaws.exe in the JDK/bin
directory. Save and exit. It should now work.
2) Make sure that your PATH environment variable does not have an entry for
the JRE and that it does have an entry for the JDK/bin directory.
3) In Firefox, go to Tools->Options->Applications tab. In the list of
Content Types, find the entry for JNLP File. Set the action for this item to
the javaws.exe that is in the JDK/bin directory. Save and exit. It should
now work.
4) In Internet Explorer, go to Tools->Internet Options->Programs->Set
Programs. Go to 'Associate a file type or protocol ...'. Find the line for
.jnlp file type and set the Current Default to the javaws.exe in the JDK/bin
directory. Save and exit. It should now work.
-------------------------------------------------------------------------------------------------------------------------
In addition, I wanted to say a few more things about the scripting editor and other possible ideas about its use:
1) It is not mandatory to use the editor for creation or maintenance of scripts. Everything that is done with the editor can be done manually. All the scripts are stored on the OWL server using the 'webdav' api. The files are all stored in the .wonderland-server/[version]/run/content directory area and can be accessed by anyone with sufficient permissions to edit files at the server.
2) The editor is a script that is run through the JSR-223 interface and as such could be replaced by another script written in any of the supported languages.
I think a discussion of all this during the P2PU would be in order.
Morris
Tuesday, January 25, 2011
Module creation from snapshot
A recent thread on the OWL forum discussed the creation of a module from a snapshot. The link to the forum thread is here https://mail.google.com/mail/?shva=1#inbox/12da95d3bc3bd7df
After taking one look at the document, I decided that doing that procedure more than once was not something I wanted to do. So, I created a framework of a module that contains a script for performing all the steps from the document. Now, a new 'world' for OWL can be created by inserting models and art into an empty world, taking a snapshot of the world and then running the script to create a new module that contains the world. Then, the next time that the server is restarted the new world will be available in the list of worlds in the 'Manage Worlds' section in the admin tool.
Morris
After taking one look at the document, I decided that doing that procedure more than once was not something I wanted to do. So, I created a framework of a module that contains a script for performing all the steps from the document. Now, a new 'world' for OWL can be created by inserting models and art into an empty world, taking a snapshot of the world and then running the script to create a new module that contains the world. Then, the next time that the server is restarted the new world will be available in the list of worlds in the 'Manage Worlds' section in the admin tool.
Morris
Friday, January 21, 2011
Start-Em-Up
This is my initial blog to get started with the Wonderland course. Here is my screenshot.
My background:
I have worked with computers for almost 50 years now. I started back in the days when Fortran had no number, as in Fortran V. I have worked with Java for 15 years or so, most of that time involved with database access programming. I have experience with many other computing environments and systems. I started with Wonderland a couple of years ago early in the version 04 days.
I look forward to participating in this class and learning a lot more about Wonderland.
I have worked with computers for almost 50 years now. I started back in the days when Fortran had no number, as in Fortran V. I have worked with Java for 15 years or so, most of that time involved with database access programming. I have experience with many other computing environments and systems. I started with Wonderland a couple of years ago early in the version 04 days.
I look forward to participating in this class and learning a lot more about Wonderland.
Subscribe to:
Posts (Atom)