I need to get the maximum of an animated value to get its ratio (current/maximum). How can i get it? In driver edditor, the max function gives a maximum of 2 functions, or can clamp the value as I know. It doesn't really matter which way I would do it (python code/driver editor or something else).

  • 1
    $\begingroup$ You need to find out the maximum yourself, or play the animation once and use the script to make the measurement of the maximum and store it in some way accessible by drivers (like by positioning an empty on height equal to the maximum). $\endgroup$ Dec 9, 2023 at 20:16
  • $\begingroup$ So there is no way to get information from a key or information about a value at a particular time in blender, really? $\endgroup$
    – Dmitriy
    Dec 10, 2023 at 0:29
  • $\begingroup$ Depends what kind of information. Let's say you have a simulation and you want to get the maximum x coordinate of an object throughout the animation. You need to evaluate the entire simulation first. If you simply animate a value, you need to evaluate the f-curve controlling it, which is basically bezier, and finding the highest point of bezier is not trivial mathematically, so it's done by subdividing and sampling it (it is not computationally expensive if you don't do a lot of this), and you would use Python for that. $\endgroup$ Dec 10, 2023 at 10:13
  • $\begingroup$ Well my specific example - I made a node that creates a ruler and shows the length in selected units. But in order to animate this ruler correctly, I need to know what the final length will be (i.e. the second key) to calculate the "life factor" and use it in various mathematical operations. Now the node works through a "crutch" - the user needs to manually enter the maximum length in a separate line. I want to get rid of this and have the node get information about the maximum length automatically. $\endgroup$
    – Dmitriy
    Dec 10, 2023 at 12:08


You must log in to answer this question.

Browse other questions tagged .