get position of play head from script?


#1

can we get the position of the play head in synfig? for example, if i scrub to frame 10 and run a script,can i get it synfig to return 10?is this stored in the file anyplace?


#2

Nop!

The (actual) plugins system “takes .sif file as first argument and should modify its contents in some way.–Doc:Plugins-> .

So, you can “only” play with the full animation content and not with a special frame/time of the content.

You can write a feature request about that idea to don"t loose it .
synfig.org/issues/thebuggenie/synfig


#3

You can retrieve the current time using a convert type. Take a real value from any layer and convert it to Linear type. Then modify the subparameter “Rate” and make it 1.0. That is one second per second. Make the offset subparameter to be zero. Then you have the original real parameter converted to exactly the current time of the time cursor in seconds.

Later you can use that value for any other purpose in your animation…
-G


#4

… yes … good trick :wink:
But, is it possible to retrieve that particular value a particular time from a script ???


#5

No with the current script feature because it works with the file itself, and the file doesn’t save the current time.
-G


#6

Doc:Plugins updated


#7

No, no, inside the file you have all the values for the parameters for all the times. What you cannot retrieve is the current time cursor position when the script is invoked, because it is not saved in the file. But you can know the value of a parameter or value node at a certain time, because the Animated Value Nodes are stored. Other problem is to know the interpolated value, which is not trivial for other thing rather than linear or constant interpolation.
-G


#8

Doc:Plugins re-updated


#9

Interesting. I notice you can get the value of way points, but can we do the same for keyframes? I am planing on making a pose copier/paster but for it to work i need to to change value in specific attributes only. Keyframes are good but problematic as they capture everything.


#10

Keyframes are stored in the sif file, so they can be reached through a python script. Keyframes don’t store any value, just the time where they are.
-G