Switch RMB/MMB Maya Camera && Folder Choose dialog

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
Post Reply
TekniX
Posts: 24
Joined: Tue May 01, 2007 12:39 pm

Switch RMB/MMB Maya Camera && Folder Choose dialog

Post by TekniX »

Hey guys,

thought I'd share some code bits with you. All the merit goes to the Irrlicht developers, all I have made was adding a parameter to a function call and "slightly modifying" some functions based on the value of this parameter. Nothing fancy :)

FIRST OFF : These are DIRTY HACKS ( probably ;) )
I assume no liability for this stuff, I tested it with devcpp, the engine recompiles, apart from the usual warnings no problems , and the stuff works... MAKE BACKUPS of the files you replace..

If anyone is interested in seeing how it works I will explain it :)

1 - Switched Keys for maya camera -

Everyone who uses maya knows this issue ;) maya translate camera is on MMB and zoom camera is on RMB , Irrlicht Maya camera is reversed ... Zooming is MMB and Translating is RMB . Super anoying if youre using both things a lot ;) . If you want to have a Maya camera with the regular keys
download http://www.sandvfx.com/media/switchkeysmaya.rar this rar, unzip, copy all the C*.h C*.cpp files to your irrlicht source directory and the I*.h files to the irrlicht include directory, recompile irrlicht, copy new .dll .a .def files plus the modified include ( the I*.h ) to your project and your ready to go. Use like this :

Code: Select all

ICameraSceneNode* mCam = smgr->addCameraSceneNodeMaya(camRoot,0,300.0f,1500.0f,-1,true,true);
NOTE : another parameter has appeared, the last bool is Enable Switchkeys = true or false, so for regular maya cam ( irrlicht version use false )


2 - Choose folder Dialog -

Irrlicht does provide all the functionality to actually just choose a folder instead of a file. So I modified the code a little to use it ..
Download this http://www.sandvfx.com/media/folderchoose.rar .
Unpack. Copy I*.h to irrlicht engine include dir, copy C*.h && C*.cpp to irrlicht source directory, recompile irrlicht, copy the new .dll .a .def and I*.h include files to your project . Ready to go..
To use it :

Code: Select all

IGUIFileOpenDialog *d = guienv->addFileOpenDialog(L"FOPEN",true,0,-100,true);
NOTE: the new parameter of type bool after the id ! This tells the FileOpenDialog to be able to choose a folder... you can cath this event as follows :

Code: Select all

switch(event.GUIEvent.EventType)
	{
		case EGET_DIRECTORY_SELECTED: 
			// load the model file, selected in the file open dialog
			dialog =(IGUIFileOpenDialog*)event.GUIEvent.Caller;
			cout << "\n Folder chosen : " << dialog->getDirectoryName().c_str();
			break; 
when you press the ok button in the file choose dialog, youre going to receive the EGET_DIRECTORY_SELECTED and you can ask the dialog what folder it was by calling dialog->getDirectoryName() ( this is actually in the documentation so nothing I changed there ) .


Greetings TekniX
Post Reply