Blend2Java - an announcement and a question


(iamamoocow) #1

I’ve just written a script for exporting Blender Models to Java3D source code (If anyone was interested) I’ve created a sf project; blend2java.sf.net (I haven’t uploaded it yet but)…

What I’m wanting to do, is have that Save File dialog popup though… FileSelector is the thing I want, but none of the API’s seem uptodate.

I can’t find a tute for it anywhere…

I’m also trying to get the colour information out of the model, buggered if I can figure that out. I’m sure programming wasn’t 'sposed to be this trial-and-error.

J.


(Schlops) #2

I’m also trying to get the colour information out of the model, buggered if I can figure that out.

Blender.Material.Get(‘YourMaterialNameHere’).R gives you the red-value of the material, GB accordingly.

I’m sure programming wasn’t 'sposed to be this trial-and-error.

dir() and doc are your friends:

import Blender

print dir(Blender.Material)
print "-----"
print Blender.Material.__doc__

or download Zr’s doc-borowser script: http://www.download.blender.pl/other/plugins/scripts/docstrings.zip

Sorry, can’t help you with your Fileselector-question.


(eeshlo) #3

There are plenty of scripts to learn from, shouldn’t be to hard to find what you’re looking for.

And as for the fileselector, this is only available in Blender versions from 2.10 upto 2.23, again, you can find this info in other scripts, even in the old API documentation on Blender.org, but just as an example:


import GUI

FSEL = GUI.FileSelector()

def FileSelect():
	FSEL.activate(callback)

def callback():
	print FSEL.filename

FileSelect()