I know that I have seen this somewhere in the API, but now, I cannot find it…
I am looking for the command to use for having a script move the current frame to, say, frame 55. I am doing some animation, and I need to run a certain set of commands when the currently visible frame is exactly 55… But I lost the command…
´Please, anyone help me find it…
Yup, that looks like it! But how do I access that? I tried Scene.Render.RenderData.currentFrame(insertnumberhere) as well as other permutations of the module hierachy, but I keep getting python errors…:mad:
EDIT: Scratch that, got it through scn.getRenderingContext… But now the real problem is presenting itself: Apparently, the command is completely useless! While it does leave the animation at the given frame, any and all other commands seem to be carried out as if the current frame remains frame 1! I am trying to write a script that reads the matrix of an object at a specific frame, but it keeps returning ONLY the matrix as it looks at frame 1… If I manually set the frame to 55 or 80 or whatever and run the script, it gives the right matrix, but this pretty much defeats the entire purpose of the script!
So my question has mutated into "how do I make my script return the matrix of object ObjX at frame 55, and not at frame 1 as Blender clearly wants to…?
<returns to brood over Blender API and yell broken sentences and curses at the heavens…>
Could you post the script snippet you are using to access the matrix?
The (I think) relevant parts are:
sc=Scene.GetCurrent()
ob1=Object.Get(‘OB_A’)
ob2=Object.Get(‘OB_B’)
sc.getRenderingContext().currentFrame(55)
sc.update()
ob1.setMatrix(ob2.getMatrix(‘worldspace’))
It doesn’t return an error or anything, it just keeps returning the ob2 matrix as it looks in frame 1, and not frame 55. Also, very weird, if I put in a Blender.Redraw() after the sc.update(), I get an error “int argument expected”. An int in Redraw()?? Am I losing my marbles here?:eek:
Oh yeah, and if I put in a print sc.getRenderingContext().currentFrame(), it seems to return the right frame number… Dont know what the h… is getting chewed up in this thing, but I sure did something wrong…
Odd. I tried it in 2.43 and SVN version yet it worked as expected. Here’s my test .blend http://bebraw.googlepages.com/mtest.blend . Could you upload yours? It might be some tiny thing I am not doing similarly causing the issue. It could even be a bug.
Yeah, I’m pretty sure it’s just a small screwup, but the effects are frustrating (“14 hours to find a misplaced zero”, a motto I live by:S). It’s part of a REALLY big script, some of it not mine to share, but I’ll try extracting the essentials later for you to examine.
I’ll download your file later (I’m not at my own computer now), but can you tell me if your ‘ob2’ is moving around, and whether you have tried it with parenting/constraints involved? As I said, it’s a big script, and I am looking at any possible explanation.
I am using version 2.44, btw. I hope it’s not a ‘bad upgrade’ thingie…
EDIT: I did a dryrun with nothing but the bit of code above, and for some reason, it worked. I tried adding some constraints and parenting, and it still worked. It seems the flaw is not in the code itself, but in the code/setting surrounding it. I’ll be chasing the reason, and will write whatever I find out!
EDIT2: Okay, officially the weirdest coding experience in my 20+ years of programming (am I that old?)… For some reason, I tried simply writing the currentFrame() line twice. Two completely identical lines. And now it works! Apparently, my Blender installation is going by the ‘dogs and small children’ philosophy of making me repeat myself before it obeys… This s*** freaks me out sometimes
Nice that you got it work.
Thanks for the help (and moral support :))