Reading The Spline User Data - How?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 27/06/2012 at 17:23, xxxxxxxx wrote:

    Hi, I am almost new to scripting in C4D, but not new to programming. I want to use the User Data Spline interface, and wonder how I can read out the values. I have added a null object to my project. To this object I added an xpresso tag. In the xpresso I added a Python operator.
    The Python operator has one user data value, with a Spline interface.

    Now - how do I read out the values from this interface? I guess C4D does the math behind the scenes for me? So that I can get the Y value for any given X value between 0 (min) and 1 (max).

    Any help much appreciated!

    -Ingvar
    Spline user data



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 27/06/2012 at 17:50, xxxxxxxx wrote:

    For simplicity, add your position controller and the Spline as Userdata on the xpresso tag.
    The nodes already have a SplineData input (I called "curve" in the example).

    Cheers
    Lennart



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 27/06/2012 at 18:28, xxxxxxxx wrote:

    Hej Lennart, tack söta bror!!!!
    Just great. Having searched for this several hours, you came up with the solution in minutes!
    As a matter of fact, I want to wrap everything in a Python script, and not use xpresso operators at all. So I use this code:
     
        foo = op[c4d.ID_USERDATA,1]
        somePosition = 0.6
        print int(foo.GetPoint(somePosition).y * 100)
     
    This gives me the percentage at position 0.6, where the spline user data scale is Max 1 on the X-axis and Max 1 on the Y axis. Precisely what I am after. The Spline User Data control is invaluable, and now I know how to use it Approve
    Thanks again for your help!
     
    -Ingvar


Log in to reply