Blender .x export problem solved (script inside)

A forum to store posts deemed exceptionally wise and useful
Post Reply
simply
Posts: 7
Joined: Mon Jun 26, 2006 9:49 am

Blender .x export problem solved (script inside)

Post by simply »

I took the modified .x file exporter script version from our user "necro_", played a little bit with it. First I got an error message (occured with new blender versions), solved. Another thing was the specular color issue (model shined very bright), I solved it, too.

You'll get my modified version from: http://www.computerkind.com/files/Direc ... rterMod.py

I think I'll continue to mod this script in the future, stay tuned.
wukc
Posts: 3
Joined: Mon Nov 27, 2006 12:09 pm

Post by wukc »

hi simply
i have tried your script, but got an error

Image

i follow the steps writed on the export dialogue:

1.create model
2.uv texture
3.make armature
4.object->armature make parent + the same loc,rot,size
5.create name group, set effect vertex
6.export

but...it show the error
did i make some mistake on somewhere?
please help ~~~ thanks!

here is my blend file and test program
http://myweb.hinet.net/home1/wukcsoft/irrlicht/pack.zip
simply
Posts: 7
Joined: Mon Jun 26, 2006 9:49 am

Post by simply »

Uh, I did not test the script with armatures.

I have no time to review my script in the next days, so try the one from rakar, perhaps it works: http://blenderartists.org/forum/showthread.php?t=73602
wukc
Posts: 3
Joined: Mon Nov 27, 2006 12:09 pm

Post by wukc »

it works !!
thanks a lot !!

but it is necessary to hack .x file:
http://irrlicht.sourceforge.net/phpBB2/ ... hp?p=95977
anyway, it works well.
simply
Posts: 7
Joined: Mon Jun 26, 2006 9:49 am

Post by simply »

It's better to "hack" the python script than to hack every .x file after every export.

Open "xFileExporter242.py" with the editor of your choice, go to line 1045. Replace the four lines 1045 to 1048 with the following code:

Code: Select all

			self.file.write("    1.0; 1.0; 1.0; 1.0;;\n")
			self.file.write("    0.0;\n")
			self.file.write("    0.0; 0.0; 0.0;;\n")
			self.file.write("    0.0; 0.0; 0.0;;\n")
It should work!
wukc
Posts: 3
Joined: Mon Nov 27, 2006 12:09 pm

Post by wukc »

oh~ it works too!
thanks again~

There are 2 place need to change except what you say.
(Commented are original code)
Line 1018~1020

Code: Select all

#					self.file.write("    %d;;\n" % (tex.index(face.image.name) + count))
#				else :
#					self.file.write("    %d;;\n" % (mater))
					self.file.write("    %d;\n" % (tex.index(face.image.name) + count))
				else :
					self.file.write("    %d;\n" % (mater))
Line 1034~1038

Code: Select all

			#self.file.write("    %f; %f; %f;" % (mat.R, mat.G, mat.B))
			#self.file.write("%s;;\n" % (mat.alpha))
			#self.file.write("    %f;\n" % (mat.spec))
			#self.file.write("    %f; %f; %f;;\n" % (mat.specR, mat.specG, mat.specB))
			#self.file.write("    0.0; 0.0; 0.0;;\n")
			self.file.write("    0.800000;0.800000;0.800000;1.000000;;\n")
			self.file.write("    0.000000;\n")
			self.file.write("    0.000000;0.000000;0.000000;;\n")
			self.file.write("    0.000000;0.000000;0.000000;;\n")
Line 1045~1048

Code: Select all

			#self.file.write("    1.0; 1.0; 1.0; 1.0;;\n")
			#self.file.write("    1.0;\n")
			#self.file.write("    1.0; 1.0; 1.0;;\n")
			#self.file.write("    0.0; 0.0; 0.0;;\n")
			self.file.write("    0.800000;0.800000;0.800000;1.000000;;\n")
			self.file.write("    0.000000;\n")
			self.file.write("    0.000000;0.000000;0.000000;;\n")
			self.file.write("    0.000000;0.000000;0.000000;;\n")
I didn't try to read code because i think it might use some functions in blender that i don't understand.
It amazed me that plugin looks like shell script, handle everything by programmer.
Writing plugin must be a hard work...
The code not incorrect, seems to contain some informtion.
I think irrlicht might process .x file itself instead of using Direct X built-in function.
So the rules to read .x file are different from the rules that Microsoft defined.
simply
Posts: 7
Joined: Mon Jun 26, 2006 9:49 am

Post by simply »

wukc wrote:So the rules to read .x file are different from the rules that Microsoft defined.
Sadly, this is right.
Post Reply