various problems... help needed

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Post Reply
saurabh
Posts: 0
Joined: Wed Jul 14, 2004 7:44 pm

various problems... help needed

Post by saurabh »

I want a camera to follow a moving object. I mean the camera should remain stationary but keep aiming an object, say, a car moving around in circles. I have linked a file to framechanged. I tried to use 'rot' variable of the camera object in that linked file, but I can't seem to figure out what the 3 angles are.

Another thing I want to know is if there is a way to change the file linked to frame change in a script. For eg. if I want one file to be run every frame change for the 1st 100 frames and then change the file for every subsequent frame (in the 1st file, i could change the linked file if the current frame is 100)

One more problem:- I can't figure out how to give a name to a mesh when creating it in a script.
Eg. NMesh.PutRaw(mesh, 'car', 1)
The name 'car' can't be used in a script linked to frame change to get the object :- Object.Get('car')
I have to use the default name mesh or mesh.001 etc. but I want to use my own name.

Some of these questions may have obvious answers, but please bear with me. The learning curve of Blender seems too high for me.

Thanx

joeri
Posts: 96
Joined: Fri Jan 10, 2003 6:41 pm
Contact:

Post by joeri »

I would use 1 script that checks for the frame. And execute function1 from start till 100 and function2 from frame 101 till end.

saurabh
Posts: 0
Joined: Wed Jul 14, 2004 7:44 pm

Post by saurabh »

Hey thanks... but I may actually need to run a sequence of events one after the other and not just 2. It might end up looking somewhat like this:-
if frame <= 100:
func1()
elif frame <= 200:
func2()
elif frame <= 300:
func3()
and so on.....

So I thought if I could just change the script to be called I might be able to do some things more easily. The idea of changing the script to be called seemed nice to me.

Anyway, this was just a minor thing. I still need to figure out how to use the rot variable of the camera object.

Also if anyone could suggest a way to use variables (in the script called on frame change) so the change made to the variable in one frame is remembered in the next frame. I could store the value in a file and read it every frame, but I want to know if there is a better way.

kitsu
Posts: 0
Joined: Sun Jun 06, 2004 8:08 am

Post by kitsu »

Check out the Blender.Registry module. It lets you store all kinds of things: lists dicts,strings, functions and even objects...

saurabh
Posts: 0
Joined: Wed Jul 14, 2004 7:44 pm

Post by saurabh »

hey thanks...
Does anyone know how to use the 'rot' variable in the camera object. What exactly are the 3 values?

Post Reply