cupuh com
sahabat-keyboard.web.id
Semarak 4 Tahun HN Community
Semarak 4 tahun HN Community
Semarak 4 Tahun HN Community Blender to OGRE Perl Script | welcome to shoping news | simple shoping

Blender to OGRE Perl Script

Bookmark and Share
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) {
print "$file\n";
system("cp $file $outputMat");
}

[Remark] Save the script as ogreXML.perl

[Terminal] perl ogreXML.perl /path to your xml files/ /output directory for meshes/ /output directory for material/

[Remark] Don't forget to remember that you need to put your mesh files and materials in special directories in OGRE.

baca juga artikel terkait dibawah ini

{ 0 komentar... Views All / Send Comment! }