Posts

Showing posts from January, 2010

Blender to OGRE Perl Script

Complex scenes hold lots of meshes (in xml format after you export to ogre meshes from blender). You need to convert it one by one. But I have written a script that converts all mesh.xml files into ogre meshes and save them to desired directories.

[Script]
#!/usr/bin/perl

$directoryName=$ARGV[0];
$outputMesh=$ARGV[1];
$outputMat=$ARGV[2];

print "Looking for: $directoryName\n";

chdir($directoryName) or die "Cant chdir to $directoryName !";

opendir(DIR, ".");
@xmlFiles = grep(/\.xml$/,readdir(DIR));
closedir(DIR);

foreach $file (@xmlFiles) {
print "$file\n";
system("OgreXMLConverter $file");
}

opendir(DIR, ".");
@meshFiles = grep(/\.mesh$/,readdir(DIR));
closedir(DIR);

printf "Meshes: $outputMesh\n";
printf "Materials: $outputMat\n";

foreach $file (@meshFiles) {
system("cp $file $outputMesh");
}

opendir(DIR, ".");
@material = grep(/\.material$/,readdir(DIR));
closedir(DIR);

foreach $file (@material) {
p…

Blender To Ogre

This is a small tutorial on how to use the Blender Exporter script to use your textured models created with Blender in Ogre. This document works with Ogre 1.06 and newer and Blender 2.49b. The procedure will be same on any Operating System because all programs used are cross-platform.
In Blender In Blender scale up your cube. Make wall, fort or anything. Select the cube, and press TAB to enter EDIT mode. Move your cursor to the upper boundary till you see a two sided arrow. Right click, left klick on Split Area and afterwards determine the size of the second window by another left click. Now select UV/ImageEditor mode in the second window. Image → Open and Load(MMB) any texture from your ogrenew/samples/media/material/texture directory. Within the 3d view Edit window, press UKEY and Select Cube Projection or anything that suits you. Unwrap (smart projections) is often the best option. Change the Select mode in the 3D view Edit window to FACE Select a single face in the EDIT windo…

Simple& Quick mysql commands

$ mysql --user=your-user-name --password=your-passwordmysql> show databases;mysql> use thedatabaseyouwantoselect;mysql> show tables;

How to get event numbers

$ ls /dev/input/by-id

OR
$ ls /dev/input/by-id -l
usb-045e_Microsoft_Natural_Keyboard_Pro-event-kbd
usb-Sony_Computer_Entertainment_Inc._SCE_USB_MOUSE-event-mouse
usb-Sony_Computer_Entertainment_Inc._SCE_USB_MOUSE-mouse
usb-THRUSTMASTER_2_in_1_DT-event-joystick

$ file /dev/input/by-id/usb-045e_Microsoft_Natural_Keyboard_Pro-event-kbd

/dev/input/by-id/usb-045e_Microsoft_Natural_Keyboard_Pro-event-kbd: symbolic
link to `../event1'