4
$\begingroup$

I've been working on an add-on that manipulates text data called randomiser
https://github.com/BenSimonds/Randomiser

My problem is a bug I'm trying to resolve with getting the correct "current frame" for an object based on what's scene it's in. If the blend file only has one scene, or if the object only appears in the active scene this is trivial (context.scene.frame_current).

However if the object appears in another scene it gets more complex. ob.users_scene will return a list of scenes that the object appears in and I could maybe get the current frame from them, but if the object appears in multiple scenes then how can i decide which to pick frame_current from?

Or is this precisely why the script should only let you use a value keyed by the user and not directly use the current frame?

$\endgroup$
  • $\begingroup$ You might consider using "Animation Nodes" to achieve the type of effects available in Randomiser. With just a couple expression nodes, one can manipulate the strings in text objects, and use nodes to drive their contents in a very visual way. $\endgroup$ – David Jeske Jun 6 '16 at 22:05
5
$\begingroup$

There is no current frame property for objects, there's only a frame_current for every Scene. What "current frame" means to an object is not defined.

What you might want to do is to get the current frame of the active scene, there's only a single active scene per Blender window and it's what the user sees (are you using a frame change handler that changes Text.body based on frame_current?)

$\endgroup$
  • $\begingroup$ Yeah this is exactly what I'm doing currently. However someone raised the point that if for example you then added a scene animated this way to the sequence editor with and offset it with respect to it's own starting frame, then frame_current wouldn't give the same results as it did in the original scene. $\endgroup$ – BenSimonds Apr 16 '14 at 10:31
  • $\begingroup$ I'm thinking either I have to abandon using frame_current, or add a property to the script that tells the object which scene to get the current frame from. $\endgroup$ – BenSimonds Apr 16 '14 at 10:32
  • $\begingroup$ I see. You could try to detect the VSE and get the strip's scene and the "local" frame_current $\endgroup$ – CoDEmanX Apr 16 '14 at 11:13
  • $\begingroup$ My first attempts at that weren't very successful - the frame_current frame of a scene doesn't change as you scroll through it in the VSE - it remains a the value it was when that scene was last active. My conclusion is that frame_current isn't to be used directly for animating, as it's seems to be more a property of the scene as it is being viewed by the user. $\endgroup$ – BenSimonds Apr 16 '14 at 11:52
  • $\begingroup$ That's true. How about using frame_current of the sequencer scene and subtracting the linked sequence's frame_start? $\endgroup$ – CoDEmanX Apr 16 '14 at 12:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.