[realXtend] How to add our own function to Tundra2?

2011-11-30 Thread Zhao Boxuan
Hi everyone,

I just downloaded the Tundra2.1.3 and its source code. I am planning
to develop some motion planning demos on Tundra2. However, the
documentation seems outdated and there is no instructions for how to
edit the .txml file to make a new scene(add some CAD models) or add
some new callback function(like mousemove callback or keyboard
callback). The only thing now I can do is use the default demo.

Could anyone tell me how can I start?

Besides, I have some python script. I see there is a project called
PythonScriptModule, so it seems like I can import my python script.
Could anyone give me a short instruction to deal with that, or
somewhere I can get help?

Thank you!

-- 
http://groups.google.com/group/realxtend
http://www.realxtend.org


Re: [realXtend] How to add our own function to Tundra2?

2011-11-30 Thread Toni Alatalo
On Nov 30, 2011, at 9:05 PM, Zhao Boxuan wrote:
> I just downloaded the Tundra2.1.3 and its source code. I am planning
> to develop some motion planning demos on Tundra2. However, the
> documentation seems outdated and there is no instructions for how to
> edit the .txml file to make a new scene(add some CAD models) or add

We usually make scenes, at least any more complex ones and when doing new 
polygon modelling, in a modelling app like Blender or 3ds max or Maya or such.

>From those you can export in the dotscene (.scene) format which is sometimes 
>used with Ogre, and which Tundra can import directly.

The new blender exporter (blender2ogre) can also do txml, and has a nice live 
preview system.

If you just make a simple scene with existing meshes, you can just drag & drop 
those from filesystem to the tundra 3d window, to add them to your scene. With 
shift-e you get the entity-component editing window open, and that also enables 
the simple 3d manipulation gui.

TXML is not usually edited by hand, but Tundra with the scene structure & 
entity component editors, + the 3d manipulation tools, is the editor.

> some new callback function(like mousemove callback or keyboard
> callback). The only thing now I can do is use the default demo.

The example scenes / applications are in the 'scenes' directory in release 
(bin/scenes/ in the source repo). Many of those have callbacks. 

The documentation of the core input api InputContext object, which has signals 
KeyEventReceived and MouseEventReceived, is at 
http://www.realxtend.org/doxygen/class_input_context.html#a0656a7bd87ae184eacaf1759169dbe05

Many applications, for example the simple reference / default avatar thing, 
uses entity actions for input .. e.g. 
https://github.com/realXtend/naali/blob/tundra2/bin/scenes/Avatar/simpleavatar.js#L431
 .. but that may not be necessary for you if you don't need to send your 
commands over the network to server.

> Could anyone tell me how can I start?

The interactive Python console, bundled in the SDK release, is one way to 
explore the api .. put test functions to key handling etc.

And JS with the automatic reloading is really nice -- just make a js file and 
e.g. that to a EC_Script in your scene (almost all of the example scenes do 
this), or to your plugins.xml to load at startup .. 

The default free camera js is loaded by 
https://github.com/realXtend/naali/blob/tundra2/bin/jsmodules/startup/cameraapplication.js
 from jsmodules/startup/ folder. the actual free cam script is also a nice 
example, with mouse and keyboard handling 
https://github.com/realXtend/naali/blob/tundra2/bin/jsmodules/camera/freelookcamera.js
 

You can also just do this to run a script: Tundra.exe --file 
/my/project/myscript.js .. to run that code at startup, and e.g. start 
listening to the mouse etc.

> Besides, I have some python script. I see there is a project called
> PythonScriptModule, so it seems like I can import my python script.
> Could anyone give me a short instruction to deal with that, or
> somewhere I can get help?

Python plugins can also be put to plugins.xml for loading -- there are a few 
ones ported to tundra2 now in the repo (the irc relay and the websocket server 
i think). 

There are also some unit tests written in Python which perhaps give the feel of 
the api nicely: 
https://github.com/realXtend/naali/blob/tundra2/bin/pyplugins/lib/apitests.py

So there's some pointers, please ask more to not get blocked. We are working 
towards next release, porting demos and updating docs etc also, but are happy 
to help here in the meantime too. And on #realxtend-dev on freenode irc.

Cheers,
~Toni

-- 
http://groups.google.com/group/realxtend
http://www.realxtend.org