Animate irrEdit lights

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
cemedias
Posts: 17
Joined: Mon Jun 11, 2007 9:58 pm

Animate irrEdit lights

Post by cemedias »

I made a level in irrEdit and I uploaded it into my game using loadScene() from the scene manager. Does irrEdit support exporting dynamic lights to .irr files, and if so, how do I animate the lights from my .irr level in my code? Does irrEdit support exporting animations to .irr scenes that can be loaded into the engine?
RuggJack93
Posts: 39
Joined: Mon Sep 06, 2010 5:09 pm
Location: Italy

Post by RuggJack93 »

Does irrEdit support exporting dynamic lights to .irr files?
Take a look at the tutorial 15.LoadIrrFile, you'll find all the answers about .irr files (or, at least, many of them).
Does irrEdit support exporting animations to .irr scenes that can be loaded into the engine?
From an .irr file you can load both animations from irrlicht animators and from animated meshes.

Basically in the .irr file is written the description of what's in the scene and the properties of every node in it (position,rotation,textures,materials,animators,node type, ecc..). So loadScene(); is another way to tell irrlicht what to put in the scene (in this case you only have to write in your code loadScene(), because all the other stuff is written in the file). Up to now, the only the normalmap material and the parallaxmap material can't be loaded(because irrEdit doesn't support those material types).
how do I animate the lights from my .irr level in my code?
Just add the flycircle animator from irredit, then the loadScene() function will load all your scene elements (included animators).
cemedias
Posts: 17
Joined: Mon Jun 11, 2007 9:58 pm

Post by cemedias »

Thank you for the reply.

I'm really confused.

Because that's what I did. I set the behavior on one of the lights in my scene on irrEdit to Fly in Circle, and it works in the editor and it's level tester, but when I load the scene into my game it only shows the level with static unmoving lights.

All that I am doing to load the scene is calling loadScene("level.irr"). Is there something else I am supposed to call to initialize the animations for the lights?


I apologize if I am asking something really simple. I have limited experience with irrlicht and am trying to learn as I go along with this project.
RuggJack93
Posts: 39
Joined: Mon Sep 06, 2010 5:09 pm
Location: Italy

Post by RuggJack93 »

That's strange :? ..
I've just made a simple scene with irrEdit 1.5 and loaded in irrlicht 1.7.1 without problems and also, the light animator had been loaded automatically and worked just fine.

Maybe there is something in your code that affects the animator or you've done something wrong in the editor.

What does the console say?
cemedias
Posts: 17
Joined: Mon Jun 11, 2007 9:58 pm

Post by cemedias »

Ok, apparently the problem is coming from how I am calling loadScene. The game starts with a simple GUI with two buttons, one to begin the game and the other to quit. In my onEvent, I have this code:

Code: Select all

case EGET_BUTTON_CLICKED:
switch(id)
{
case GUI_ID_PLAY_BUTTON:
{
	guienv->clear();
						
	loadScene("level.irr");
	game::setCamera();
				
	return true;
}

...
}
Would calling loadScene from onEvent prevent the animators from loading? I only made the GUI menu for the experience of learning how to do it. Is there a better way to load the scene and transition from the GUI menu to the actual game?
cemedias
Posts: 17
Joined: Mon Jun 11, 2007 9:58 pm

Post by cemedias »

Actually, I think I narrowed down the source of my problem. I decided to compare the text of my level.irr file with the example.irr file from example 15, and my file doesn't have any animators listed. For instance, the example.irr file has:

Code: Select all

<animators>
<attributes>
<string name="Type" value="flycircle"/>
...
</attributes>
</animators>
I did a text search in notepad in my level.irr file, and it couldn't even find the word "animators." I have my level.irr file open in CopperCube irrEdit and I can clearly see that my light is flying in a circle, so I know I put the animation in, it's just not exporting it with the rest of the scene.

I use CopperCube 2.0.1.

Any ideas?
RuggJack93
Posts: 39
Joined: Mon Sep 06, 2010 5:09 pm
Location: Italy

Post by RuggJack93 »

Ok, i've remade my test scene with coppercube 2.0.0 and seems that the problem is coppercube itself. Seems that it can't export correctly irrlicht animators.
I suggest you to edit your scenes with the old irrEdit 1.5. Besides, irrEdit has more material types (like sphere mapping,detail mapping,ecc..)

EDIT:I've found a solution if you want use coppercube.
after loading the scene try this:

Code: Select all

scene::ISceneNode* light = smgr->getSceneNodeFromName("YourLightSceneNodeNameInCoppercube");
	scene::ISceneNodeAnimator* anim = smgr->createFlyCircleAnimator("putHereTheLightDataFromCoppercube);
	light->addAnimator(anim);
	anim->drop();
cemedias
Posts: 17
Joined: Mon Jun 11, 2007 9:58 pm

Post by cemedias »

Thanks for the help ruggjack. I will try irrEdit 1.5 tonight. My only question is will irrEdit 1.5 work with irrlicht 1.7? The ambiera website says it is only compatible with irrlicht 1.5.

In regard to your edit, I tried manually creating my animator for the light but I figured that once I finish the prototype for my game and begin making levels with many dynamic lights and animations it would be a pain to hardcode every animator.

I will reply tonight and let you know how irrEdit 1.5 works for me.

Thanks again.
Brainsaw
Posts: 1177
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Post by Brainsaw »

IrrEdit 1.5 is compatible with Irrlicht 1.7 (I use it all the time and have created a ton of scenenode plugins for it), it just won't work with earlier versions of Irrlicht.
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Post Reply