Editor progress week 14 - some more scripting

Last week I worked just a bit more on irrEdit, the Irrlicht Editor and improved various small details. I also added some more scripting functions and the possibility to insert menus and toolbar items into the editor via scripts, to make it extendable. I wrote documentation for the scripting interface which was the most difficult part :) Please take a look at it, are you missing something? It's not everything, but it should be possible to do pretty much with this already: modify everything of scene nodes and materials. Animators are still missing.
The cool thing about this is that those scripts are really useful, and not only a toy. Example:

So what's so cool about that screen shot? IrrEdit currently is not able to show the scene in wire frame mode. And the development version on the shot isn't either. So to test out the scripting stuff, I added a script which added a button enhancing the editor to toggle the wire frame mode. It looks like this:
WireframeModeOn <- false;

// toggles wirframe mode for one node and its children
function toggleWireframeForNode(node)
{
local materialCount = irrGetSceneNodeMaterialCount(node);

for (local i=0; i<materialCount; ++i)
irrSetSceneNodeMaterialProperty(node, i, "Wireframe",
::WireframeModeOn);

local childCount = irrGetSceneNodeChildCount(node);

for (local i=0; i<childCount; ++i)
toggleWireframeForNode(irrGetChildSceneNode(node, i));
}

// toggles wireframe mode for all nodes
function toggleWireframeForAllSceneNodes()
{
::WireframeModeOn = !::WireframeModeOn;

toggleWireframeForNode(irrGetRootSceneNode());
editorUpdateAllWindows();
}

Also cool: It was easier to write that script in 2 minutes than it would have taken to code it really in C++ into the editor. I hope that other people will use this scripting too and will contribute their stuff to make the editor better. :) Going to release that thing soon.

twelve comments, already:

When we can download the next version?
Lonerunner () - 17 07 06 - 19:58

wow, that’s cool stuff!
keep up the good work :)
bakkdoor () (link) - 17 07 06 - 19:59

“This example creates a new cube without default settings”
Guess you meant “with default settings”, right?
matt - 17 07 06 - 21:12

You have to love scripting.
SkaCahToa - 17 07 06 - 23:03

That’s pretty damn cool, Niko! As I understand you are unwilling to open the source code to the editor (note: I’m not complaining here!) – I was wondering if you would be willing to create an example project for integrating Irrlicht into wxWindows/wxWidgets.

Also, I am curious as to whether this will work in Linux (given the cross-platform capability of the underlying GUI library & Irrlicht). The method Acki(?) uses for embedding Irrlilcht in wxWindows is limited to the M$ Windows platform. Which is all well and good, but if I am limited to Microsoft platforms – I’ll stick with Borland C++ Builder. If, however, you have got this working on Linux as well – this would mean a switch to wxWidgets for me!
—EK
Eternl Knight () - 18 07 06 - 02:46

when the IrrEdit and irrlicht is mature? i has wait for it too long long time.
from long long time ago,i … ...
true-hearted watcher - 18 07 06 - 12:04

i hope this does get open-sourced soon, I really want to see if physics properties and sound source scene nodes could be added! :-)
buhatkj - 18 07 06 - 17:11

@matt: nope, its not a typo. If you want default settings, use editorAddSceneNode. :)
niko - 18 07 06 - 17:41

Bah. Why not use Python or Ruby for scripting?
But anyway. Great work.

Regards,
Armin
Armin Ronacher () (link) - 18 07 06 - 21:13

great stuff, niko!
lug - 19 07 06 - 07:06

While I too would have preferred embedding Python (and am in the process of embedding Stackless Python in my project), I think that Niko shoudl use whatever scripting language he feels comfortable with. While I’m not familiar with Ruby, Python does have it’s “gotchas” that throw some people off.

Given that Niko has coded Irrlicht & IrrEdit in C++, a language using similar syntax & semantics makes sense as far as I can tell. Hell, the only reason I am using Stackless Python is to shortcut the use of tasklets in my simulation.
—EK
Eternl Knight () - 19 07 06 - 13:55

Wow this is GREAT! If a powerful plug-in system is available to developers then we could see a very fast and realiable way to create games with irrlicht, just imagine irrEdit being able to work with soe physics engine.

Niko you’ll gotta add GUI designing soon :P
Trunks14 () - 20 07 06 - 05:16


Name:  
Remember personal info?
yes
no
Email (optional):
URL (optional):
Enter "layered" (antispam):
Comment:Emoticons / Textile

  ( Register your username / Log in )

Notify: Yes, send me email when someone replies.  

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.
Note: If you type in your email adress above, it will be visible to other visitors, although it will be hidden for bots using javaScript.