need your help for my diploma thesis, blender visuals

greatings to all I’m new here

First this is a really great forum here…
It helped me a lot, for geeting into blender.

I’m study new media in switzerland in an art university. Our teachers learned us a bit blender and python. But our blender teacher left :-((((
Now I’m on my diploma thesis and I want to implement a big part of it with blender.

Ok lets go…

Here first some sentences about my work:
I want to try to visualize your own metabolism. For this task I track the consumption with a barcode reader. This part I do with the TINI plattform and java and an Matrixorbital LCD display, this part works more or less…
Finally you a get a small gadget wich you can put on your fridge.

The TINI device connects to my xmlsocket server (python, twisted framework) and the db for the consumption.

Each person is representet as an agent in a blender world.
Know I have many visualisations taks that I have and without your help I can’t get it to work in 10 days…

what works in blender:
first it was really a pain to get good python support into blender under linux. Because I wanted to you use the GameEngine I use Blender 2.25 under gentoo-linux. I needed to compile python 2.01 new and modify same source so that pyhton compiles dynmaic modules, that blender can load.
But it worked. Now I can use pyxml, twisted and all the staff thats out for python 2.01 … great!
I can connect from blender to my xmlsocket server and get some data so that my test object in blender jumps high when it gets a lot of lipids and jumps not so high if there are less lipids in the product. It looks funny.
But I must pick up allways my data from the xmlsocket server with a key sensor… because it to slow to connect foreach frame to my xmlsocket server on the other maschine.

Now here my questions:

  1. GamEngine General:
    1.1 Is it not possible to have a python script that executes once and runs the whole time in blender?
    1.2 It seems to me that the python scripts that are attached to the object excute each frame, is it like that? What about the modules that you load, are they loaded each frame again?
    1.3 if 1.1 not works, what are the alternatives? I found this thread in this forum here this is solved by pipes. What about a local xml-rpc or soap server on the same maschine would this be fast enough? Has anybody test this?
    1.4 Is it not possible to have large python scripts, because the execution time is to long? Not really large, but the blender gamelogic python scripts if found for the gameEngine are all short.
    1.5 can I “import blender” in a gameEngine script?

  2. my visual questions:
    2.1 How can I manipulate the z value from each vertex on a mesh (territory plane)? Is it possible? Has anybody a python example for this?
    2.2 Can I interpolate from different animations (agent emotions)?
    2.3 Can I resize an entire object with python scripting?

so… any help is greatly appreciated!
sorry for this long post…

the good thing is I must document all the stuff I do with blender, so I think this project can help many people that want to do something with blender and python

greetings alexPixel

ps: my english is not perfect

If you want to have a script run continuously, you gotta use threads, they can be annoying, cause they crash blender if you don’t close the thread before blender is quit, but they work.

Scripts can be long, but remember it runs as often as you want it to. With a 0 in the pulse settings on an always sensor, they run basically every frame, so if very very long, that could slow it down.

Still, it has to run ALL python scripts every frame, and it waits for all python to execute before displaying, so whether you split a script up over multiple objects/scripts or have one big one, I don’t think there should be much difference in speed.

I have never run any tests to see how much python actually slows stuff down, but from just what I’ve experienced it seems pretty darn fast.

You can use the dir command to discover all the commands for a mesh.
Here are some to get you started, do a search on these functions and you should turn up more.
object = controller.getOwner()
mesh = object.getMesh()
numofvertexes = mesh.getNumVerts(0)
vert = mesh.getVertex(0,0) #First is material number, 0 second is vertex index
vert.setColor([r,g,b,a]) #I think, Im not so sure on this one

Thats all I can remember by memory, look it up to make sure, and use lots of print dir() commands:)

Good luck, sounds like a good project.

thank you for your post… I think it will help me a lot! I will post some results in a few days…