using spline graph user data in python for remap



  • On 05/05/2016 at 08:33, xxxxxxxx wrote:

    I'm trying to find different methods for remapping values in python, like the range mapper in xpresso.
    I'd like to make a python xpresso node which accepts "spline" user data for remapping data coming into its other inlets.

    I know if I'm using xpresso its seems pointless to do this since I can just make an xpresso range mapper node and plug my spline data into that, but I'd like to learn if its possible to it using python only, and see what different approaches there might be.

    At the moment it looks like I should use "c4d.utils.Smoothstep(a, b, x)", but I don't think its possible to define the curve?
    It says 
    The mapping is smoothed using an ease-in/ease-out curve.
    Parameters:|

    • a  (float) – The float value.
    • b  (float) – The float value.
    • x  (float) – The float value.

    ---|---
    Return type:|
    float

    Returns:|
    The smoothed value.

    _<_t_>_



  • On 06/05/2016 at 01:57, xxxxxxxx wrote:

    Hi,

    The Python function similar to the XPresso RangeMapper node is c4d.utils.RangeMap().
    The curve optional argument defines the spline to use and it accepts a SplineData object.

    Note RangeMap() currently gives wrong results when clamping the output value if clampval argument is True. This issue will be fixed soon.


Log in to reply