Home Technical Talk

MaxScript - Spline Knot - Reset Tangents

greentooth
Offline / Send Message
marks greentooth
I'm trying to access this function via maxscript, but I can't find it documented anywhere at all :( and the quad menu is a dead end. Anybody used this before, or know where I should start looking?

resettangents.jpg

Replies

  • miauu
    Options
    Offline / Send Message
    miauu polycounter lvl 14
    Watch [ame="http://www.youtube.com/watch?v=auloqB-0bBo"]this video[/ame]

    This is the code:
    (
        curObj = selection[1]
        if classOf curObj == splineShape or classof curObj == Line then
        (
            --    get the indexes of selected knots
            selKnot = getKnotSelection $ 1
            if selKnot.count != 0 then
            (
                --    get knot type
                knotType = for k in selKnot collect (getKnotType $  1 k)
                if selKnot != undefined do
                (    
                    for i in selKnot do setKnotType $ 1 i #smooth
                    updateshape $
                )
                --    set the knot type
                for k=1 to knotType.count do setKnotType $ 1 selKnot[k] knotType[k]
                updateshape $
            )
            else
                messagebox "Select some knots!" title:"miauu Script Error!!!"
        )
        else
            messagebox "Select only one spline!" title:"miauu Script Error!!!"
    )
    
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    miauu: you could add this link from polycount in the description of the YT video.
  • miauu
    Options
    Offline / Send Message
    miauu polycounter lvl 14
    renderhjs, the link is added to the description.
    marks,is the code work for you or not? Now I see that the script can be optimized -there is no need for second check of selKnot.
  • marks
    Options
    Offline / Send Message
    marks greentooth
    Funnily enough thats exactly what our TA suggested trying, convert knot type to smooth and then back to bezier. I'll need to hack up the code to plug it into another function but it looks like it should work fine, thanks for the help - much appreciated.
Sign In or Register to comment.