Previous Thread  Next Thread

chat icon Readable format....

mhpark68

Posted: Fri Nov 22, 2002 8:47 am
Joined: 22 Nov 2002
Posts: 3
Hi,

I'm a totally beginner to Blender. Embarassed Please help me....

Is there any way to export a Blender file in any readable format ?
I'd like to know what the Blender file looks like....


Thanks in advance....
Reply with quote


Jamesk

Posted: Fri Nov 22, 2002 10:05 am
Joined: 14 Oct 2002
Posts: 239
Just recently we've been told that the fileformat is essentially a form of memorydump, and there is currently no way to turn it into a more understandable format. Your best bet is to use a python script to dump the internals to a fairly readable ASCII-file using eeshlo's BF2PY script, which you can get here: http://mysite.iptic.com/eeshlo/BF2PY.zip

Since it depends on the Python API of Blender, you cannot expect to get all the info - only classes supported by the API. I'm pretty sure that it will not work on Blender 2.25, but it will most certainly do with 2.23. [please someone correct me if I'm wrong here]

Good luck!
Reply with quote


luke

Posted: Thu Jan 02, 2003 7:24 pm
Joined: 16 Oct 2002
Posts: 1
blasc is a perl script that does exactly wot ur asking:
i was looking for a similar thing today.
http://www.hillfamily.net/ritchie/blasc/

Very Happy
Reply with quote


eeshlo

Posted: Fri Jan 03, 2003 8:05 am
Joined: 06 Nov 2002
Posts: 130
Jamesk wrote:
Just recently we've been told that the fileformat is essentially a form of memorydump, and there is currently no way to turn it into a more understandable format. Your best bet is to use a python script to dump the internals to a fairly readable ASCII-file using eeshlo's BF2PY script, which you can get here: http://mysite.iptic.com/eeshlo/BF2PY.zip

Since it depends on the Python API of Blender, you cannot expect to get all the info - only classes supported by the API. I'm pretty sure that it will not work on Blender 2.25, but it will most certainly do with 2.23. [please someone correct me if I'm wrong here]


A rather late answer, but just incase anyone still reads this...

The blendfile converter is an independent python module, so it will work with any python/blenderversion.
You can use it without blender, it just converts the blendfile data to python classes, so you can get the data in the same way as you would get data from current blender python API datablocks.
As an example, this is the included simple example file to print out some information about textures that are used by materials, something you cannot do with the current Blender python API:

Code:

# BFReader simple example script to print information about a material

import Blender
from BFREAD import *

# Analyse the last loaded or saved blendfile
filename = Blender.Get('filename')

# read it in
bf = BFReader(filename)

# get the data, we are not interested in the raw output here
bf.getData(['Material', 'MTex', 'Tex', 'Image'])

# and convert to python...
FBlenderM = bf.convert2Python()
print "Raw Data was converted to %d class instances" % len(FBlenderM.Clist)

# Print out some info about all materials found in the file, like Material texture & image names
for mt in FBlenderM.getMaterial():
   print "\n",mt
   print "Material %s uses %d textures\n" % (mt.id.name, len(mt.mtex))
   for mtex in mt.mtex:
      if mtex:
         texture = mtex.tex
         print "Texture name: ", texture.id.name
         image = texture.ima
         if image:
            print "Texture uses image:"
            print "Image name: ", image.id.name
            print "Image path: ", image.name
         else:
            print "No image"
         print

print "That's it..."


For comparison, this is is what you get when do a dir(material) on a a material as returned from blender:

Code:

['B', 'G', 'R', '_object', 'alpha', 'amb', 'assignIpo', 'clrIpo', 'emit', 'haloS
ize', 'hard', 'ipo', 'mirB', 'mirG', 'mirR', 'mode', 'ref', 'spec', 'specB', 'sp
ecG', 'specR', 'specTransp']


Some of these are of course functions, so the actual data is a bit sparse at the moment. But this is what you get from the blendfile reader:

Code:

[Material MAMaterial.001]
['add', 'address', 'alpha', 'amb', 'ambb', 'ambg', 'ambr', 'ang', 'b', 'colormod
el', 'dynamode', 'emit', 'fh', 'fhdist', 'flareboost', 'flarec', 'flaresize', 'f
riction', 'g', 'har', 'hasize', 'id', 'ipo', 'kfac', 'lay', 'linec', 'mapto', 'm
irb', 'mirg', 'mirr', 'mode', 'mode2', 'mtex', 'name', 'pad', 'pad1', 'pr_back',
 'pr_lamp', 'pr_type', 'r', 'ref', 'reflect', 'ren', 'rgbsel', 'ringc', 'scriptl
ink', 'seed1', 'seed2', 'septex', 'spec', 'specb', 'specg', 'specr', 'spectra',
'starc', 'subsize', 'texact', 'texco', 'xyfrict', 'zoffs']


So pretty much all the data, I don't think anything is missing(?).

And as another example, the actual data from a Bone class, something also not accesible using the current python API:

Code:

[Bone IK_foot.L]
address  =  0x00e1c13c
childbase  =  [ListBase 0s000578c4]
defmat  =  [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0
.0, 0.0, 0.0, 1.0]]
dist  =  1.0
dloc  =  [0.0, 0.0, 0.0]
dquat  =  [0.0, 0.0, 0.0, 0.0]
dsize  =  [0.0, 0.0, 0.0]
flag  =  32
head  =  [2.1754440000000002, -4.9990230000000002, -1.405597]
id  =  None
irestmat  =  [[0.25883499999999998, 0.86133599999999999, -0.43715399999999999, 0
.0], [-0.86133599999999999, 0.00099299999999999996, -0.50803399999999999, 0.0],
[-0.43715399999999999, 0.50803399999999999, 0.74215699999999996, 0.0], [-5.48338
50000000002, -1.1547369999999999, -0.54549499999999995, 1.0]]
loc  =  [0.0, 0.0, 0.0]
name  =  IK_foot.L
next  =  None
obmat  =  [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.
0, 0.0, 0.0, 1.0]]
parent  =  None
parmat  =  [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0
.0, 0.0, 0.0, 1.0]]
posemat  =  [[0.25883499999999998, -0.86133599999999999, -0.43715399999999999, 0
.0], [0.86133599999999999, 0.00099299999999999996, 0.50803399999999999, 0.0], [-
0.43715399999999999, -0.50803399999999999, 0.74215699999999996, 0.0], [2.1754440
000000002, -4.9990230000000002, -1.405597, 1.0]]
prev  =  [Bone Toes.L]
quat  =  [1.0, 0.0, 0.0, 0.0]
roll  =  0.0
size  =  [1.0, 1.0, 1.0]
tail  =  [3.5645259999999999, -4.9974220000000003, -0.586287]
weight  =  1.0


Well, maybe someone will find a use for it, except me, no one else has ever used it sofar as far as I know. Of course it could (and should) all be simpler to get this data, but I'm sure that is only a matter of time before that is possible with an improved python API, or other options maybe.
Reply with quote


mmabob

Posted: Wed Mar 12, 2003 1:03 am
Joined: 04 Dec 2002
Posts: 8
eeshlo,

That BF2PY sounds like just the utility I need for a project I am working on. Could you please tell me where I can download it. The links on this page don't seem to be working.
Reply with quote


 
Jump to:  
Powered by phpBB © 2001, 2005 phpBB Group