Set Knot Value of RangeData, bug?



  • Hello, I am using a RangeData in my UserData. I am trying to set the value of a knot in the RangeData Gui but nothing is changing despite rs.SetSelectedKnot(knot) returning True.
    Is this a bug or am I doing something wrong? Thanks for any insight.
    (I'm using R19)

       rs = op[c4d.ID_USERDATA,1]   #get my rangeSlider
        
        
        v = op[c4d.ID_USERDATA,2]  #Get a Float
        rs.SetCurrentValue(v)
    
        print rs.GetCurrentValue()
        knot = rs.GetSelectedKnot()
        rs.SetKnotValue(knot, v)
        rs.SetSelectedKnot(knot)
        
    
        c4d.EventAdd()
    


  • Hi @gsmetzer I've moved your topic since it's related to Cinema 4D API itself.
    I also added tags to your post and mark the topic as a question. Don't worry but the next time try to setup your topic correctly, see Q&A New Functionality and How to Post Questions.

    Regarding your issue, rs = op[c4d.ID_USERDATA,1] #get my rangeSlider performs a copy of the RangeData to the rs variable. So you have to assign it back at the end of your code op[c4d.ID_USERDATA,1] = rs

    Cheers,
    Maxime.



  • Hi @gsmetzer I've moved your topic since it's related to Cinema 4D API itself.
    I also added tags to your post and mark the topic as a question. Don't worry but the next time try to setup your topic correctly, see Q&A New Functionality and How to Post Questions.

    Regarding your issue, rs = op[c4d.ID_USERDATA,1] #get my rangeSlider performs a copy of the RangeData to the rs variable. So you have to assign it back at the end of your code op[c4d.ID_USERDATA,1] = rs

    Cheers,
    Maxime.



  • Thank You,
    How embarrassing I forgot to write back to the UserData. (I shouldn't code late at night) Solved.