IrrEdit Example Scripts

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
Athlon_Jedi
Posts: 156
Joined: Wed Jul 21, 2004 4:29 am
Location: Mishawaka, In

IrrEdit Example Scripts

Post by Athlon_Jedi »

ok so no one has taken the time to post any of thier scripts for IrrEdit they use so what the heck heres the scripts i have written so far and tested .

a word of caution befor using these: As yet they only Apply The properties they are written for and DO NOT TOGGLE them so once you use them the resulting change is sort of perminite. once i have more time ill update them to Toggle the flags on and off but eh. not bad for a first look i dont guess.

these all add entrys into the tools menu list that applies the atributes under the appropriate name :)

ok to turn EMT_LIGHTING ON for the selecet mesh:

autostartLighting.nut

Code: Select all


function SetNodePropertyLighting()
{
local s = editorGetSelectedSceneNode();
local t = irrSetSceneNodeMaterialProperty(s, 0, "Lighting", "true");

if (s)
print(" Lighting Allplied");

else
print(" Lighting Failed");

editorUpdateAllWindows();
}

editorRegisterMenuEntry("SetNodePropertyLighting", "Apply Lighting");

this adds Apply Lighting to the tools menu and sets the material flag for EMT_LIGHTING to true and finaly prints "Lighting Applied " in the output window



autostartGuarardShading.nut

Code: Select all

function SetNodePropertyGouraudShading()

{
local s = editorGetSelectedSceneNode();
local t = irrSetSceneNodeMaterialProperty(s, 0, "GouraudShading", "true");


if (s)
print(" GouraudShading Enabled ");

else
print(" Property Not Applied ");

editorUpdateAllWindows();

}

editorRegisterMenuEntry("SetNodePropertyGouraudShading", "GouraudShading");


adds guarard shading and again prints to output window


autostartnormals.nut

Code: Select all


function SetNodePropertyNormals()

{
local s = editorGetSelectedSceneNode();
local t = irrSetSceneNodeMaterialProperty(s, 0, "NormalizeNormals", "true");


if (s)
print("Normals Normalized");

else
print("Nothing Changed");

editorUpdateAllWindows();
}

editorRegisterMenuEntry("SetNodePropertyNormals", "Normalize");

normalizes mesh normals

aurostartZbuffer.nut

Code: Select all


function SetNodePropertyZBuffer()

{
local s = editorGetSelectedSceneNode();
local t = irrSetSceneNodeMaterialProperty(s, 0, "ZBuffer", "true");


if (s)
print(" ZBuffer Enabled ");

else
print(" Property Not Applied ");

editorUpdateAllWindows();

}

editorRegisterMenuEntry("SetNodePropertyZBuffer", "ZBuffer");

by now it should be clear what the scripts do just by looking at the function declaration :)


autostart trilinearfilter.nut

Code: Select all


function SetNodePropertyTrilinearFilter()

{
local s = editorGetSelectedSceneNode();
local t = irrSetSceneNodeMaterialProperty(s, 0, "TrilinearFilter", "true");


if (s)
print(" Trilinear Filter Enabled ");

else
print(" Properties Not Applied");

editorUpdateAllWindows();
}

editorRegisterMenuEntry("SetNodePropertyTrilinearFilter", "Trilinear Filter");

autostartSN.nut

this one is a bit different , returns the scene node name in the output winow ( useful for GetSceneNodeFromName(); )

Code: Select all


function SelectedSceneNode()
{

      local s = editorGetSelectedSceneNode();

if (s)
print("Node Name ' " + irrGetSceneNodeProperty(s, "Name") + " ' " );

else
print("Pick One First Dummy");

}

editorRegisterMenuEntry("SelectedSceneNode", "Node Name");

autostartMC.nut ( returns material count for selected scene node)


Code: Select all


function MaterialCount()

{
local s = editorGetSelectedSceneNode();
local a = irrGetSceneNodeMaterialCount(s);

print("the scene node has " + a + " materials"); 

}

editorRegisterMenuEntry("MaterialCount", "Material Count");

i have a few more but they are still being tested and as you can see , its acculy not that diffcult to extend the editor, i derived these from looking at the script refrence and putting 2 and 2 together so if I can do it Anyone can lol

soon ill be prototyping and testing functions that add different meshes to the scene like say things like cars, trees, buildings ....and other static meshes , then all the level designer has to do is pop in the desired meshes and have the complete level lightmapped in one tool like Quake 3 GTKRadiant and halflifes Hammer editor and could be customized for each project and make level building with Irrlicht so much easyer : )

hope these end up being usful to some one even if as just a starting point for your own scripts :D
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Wow, maybe with this we can turn irrlicht into easy to use game creation studio, somehow...
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Hey, cool :) thanks for posting them here.
Athlon_Jedi
Posts: 156
Joined: Wed Jul 21, 2004 4:29 am
Location: Mishawaka, In

no problem

Post by Athlon_Jedi »

your welcome,

i havent really been able to contribute much so heres some little thing i can do :)

Thanks to Niko for an excellent engine and editing tool :)

EDIT : by the way , with the active scripting engine input window , it makes prototyping and testing scripts real easy and please keep everything non modal Niko, it makes using the editor even better with a multi monitor set up. any chance the main perspective window could be made non modal as well? lol ( lightwave 3d has spoiled me ) :P :P :D
Post Reply