fixing 1.2.1 n00b issues (fmod, samples, blender, etc...)

This is my try to collect in 1 topic all the panda3d issues that I got as a baby-panda user as I till today, hoping to help and decrease a little the starting curve to other noobs like me, loosing time just to sqeeze little annoying bug pests.
Before to start, let’s assume that I got a fresh panda 1.2.1 onto a linux Fedora Core 4 w/ KDE desktop, patched and shining.

So let’s start to installation

here there are really no issues, cos the good Yosh Jelon have rpm’ed a smooth install pack - just remember to uninstall any former Panda you got in your box.

The story is that from my first beginning I wasn’t able to hear even a buzz from panda3d because of a stupid thing that i bet lots of noobs have found before:


audio(error): Fmod initialization failure

After a couple of headaches i’ve found why: KDE sound system is a little funny! So open the control center,select sound&multimedia->sound system and… disable it! As easy as it sounds, all things will goes smooth as ever before. And you’ll hear sounds either!

Premise1: these lines have been inspired by this really helpful zerovir’s post: discourse.panda3d.org/viewtopic.php?t=866
Premise2: Blender is a great piece of free software that everybody have to see to believe how good is and that is THE CHOICE to model 3D things in a free environment as linux.
But even here the life is not ‘stright on the line’ so, be advised of as follows:

  • texturing: assigning UV textures be careful to don’t pack 'em and fill the IM: box with the RELATIVE PATH (relative to the object location) you gave to the texture image name, as is: suppose you have your model in ./models and the texture image ‘wood.jpg’ in ./models/textures - in blender you will have to edit the IM: box IM:textures/wood.jpg - be warned though that it will fits just 15 chars!
    Then, in theory, you have just to export your scene with file/export/directx but, at this time (blender v.2.41), the X exporter is far from perfect so you have to download a better one here: projects.blender.org/projects/directxexporter/
    As you are guessing, the pain is not yet gone cause there are a couple of issues to get rid of, but luckily I’ve done a python script that will soothe 'em: just tell to this script where are located your X models and it will take charge of convert 'em to eggs and bams automatically fixing silently what have to be fixed. Here it is:

#!/usr/bin/env python
"""
This piece of cake will convert all blender .x exported models into eggs and bams but only if are NEWER THAN the bams (if found)
and will also do axis adaptation to suit panda tastes, different from the blender throughput.
"""
__author__ = "fabius"
__version__ = "$Revision: 0.0 $"
__date__ = "$Date: 2006/04/29 $"
__copyright__ = "Fabius@2006"
__license__ = "TINCS (ThisIsNotClosedSource)"

import sys,os,re,stat

def convert_all_xs(starting_point):
	filelistX=[os.path.join(starting_point,v) for v in os.listdir(starting_point) if re.search("\.x$",v)]

	for xfile in filelistX:
		convert=False
		try:
			eggfile=re.sub("\.x$", ".egg", xfile)
			bamfile=re.sub("\.x$", ".bam", xfile)
			xt=os.stat(xfile)[stat.ST_MTIME]
			bamt=os.stat(bamfile)[stat.ST_MTIME]
			if xt > bamt:
				convert=True
				print "<<< %s is fresh, lez convert it!" % (os.path.basename(xfile))
			else:
				print "<<< %s is old so rest in peace..." % (os.path.basename(xfile))
		except:
			convert=True

		if convert:
			#print "<<< %s conversion is on the way..." % (os.path.basename(xfile))
			try:
				r=os.system("x2egg -pd %s -TR -90,0,0 -o %s %s" % (starting_point,eggfile,xfile))
				if r:
					print "<<< something went bad with x2egg so no convertion for '%s'" % (os.path.basename(xfile))
				else:
					#print ">>> an egg is done!"
					r=os.system("egg2bam -pd %s -o %s %s" % (starting_point,bamfile,eggfile))
					#print ">>> and so a bam!"
			finally:
				pass

	print "<<< all done, i quit."

#====================================================================================
#
if __name__ == "__main__":
	# argv[1] :: the folder where models (.xs and .bams) are located ('./' is assumed)
	try:
		modelsfolder=sys.argv[1]
	except:
		modelsfolder="./"

	modelsfolder=os.path.abspath(modelsfolder)

	convert_all_xs(modelsfolder)

PS: looks like recent blender exporters thinks that dotted meshes , bones and object names is not a good thing, so it will normalize 'em cleaning the dots off (i.e: cube.001 -> cube001) - keep it in mind when you’ll make reference to them in your scripts.