thanks Alok,

I found the issue late last night, turns out on one of the test scenes the
tangents had been broken, manually modified, then set locked, so the
setAngle was indeed getting the data wrong. As you said if the tangents are
unlocked, then the setAngle, then the tangents set locked as required
things start to behave.

cheers

Mark


On 17 May 2017 at 01:04, Alok Gandhi <[email protected]> wrote:

> Can you be more specific with the type of change? Is it the slope of the
> tangents, their length or something else that changes?
>
> I think setAngle()
> <http://docs.autodesk.com/MAYAUL/2014/ENU/Maya-API-Documentation/index.html?url=cpp_ref/class_m_fn_anim_curve.html,topicNumber=cpp_ref_class_m_fn_anim_curve_html641584cb-4f0f-4b53-803e-37ea10e47aa7,hash=a20d6cce1dc61007a7f098ff6647dd0b1>
> method may be the cause of this.
>
> Note that if this method is called on a locked tangent (which they are by
>> default), the corresponding out- or in-tangent will be modified as well
>> (i.e., they will both be set to fixed). To prevent this from occurring, you
>> must first unlock the tangent, make your modifications and then restore the
>> lock setting for the tangent afterwards.
>
>
> I think in your case if the order of setAngle would change the slope of
> the tangents if you do this operation without unlocking the tangent. Try
> setting the angles after unlocking the tangents and then lock them again.
>
> On Wed, May 17, 2017 at 2:15 AM, Mark Jackson <[email protected]> wrote:
>
>>
>> I'm wondering if anybody could shed a light on issues I'm having with
>> setting up animCurves through the API, or more specifically the key
>> Tangents.
>>
>> Basically I've moving our animFormat into API and have pretty much got
>> everything running but one of the regression tests is failing. It seems
>> like the order in which you set the MFnAnimCurve tangent vars affects the
>> resulting curve and how the tangents are built
>>
>> I'm running the following for key in keys on an MFnAnimCurve to try and
>> rebuild the tangents as per the original ....
>>
>>
>> crvFnc.setTangentsLocked(kindex, lockedTangents)
>>
>> if weightedTans:
>>     # only settable if the curve has weighted tangents
>>     crvFnc.setWeight(kindex, iw, 1)
>>     crvFnc.setWeight(kindex, ow, 0)
>>     crvFnc.setWeightsLocked(kindex, wl)
>>
>> crvFnc.setAngle(kindex, OpenMaya.MAngle(math.radians(inAngle)), 1)
>> crvFnc.setAngle(kindex, OpenMaya.MAngle(math.radians(outAngle)), 0)
>>
>> crvFnc.setInTangentType(kindex, AC_TANGENT_TYPES[inTangentType])
>> crvFnc.setOutTangentType(kindex, AC_TANGENT_TYPES[outTangentType])
>>
>>
>> .... but it seems like the order I set this data changes the results and
>> I'll be damned if I can get a sequence that loads everything back as
>> intended, even though the saved data is all correct
>>
>> Can anybody shed any light on this?
>>
>> cheers
>>
>> Mark
>>
>>
>> -------------------------------------
>> Mark Jackson
>> CEO / Technical Director
>> red9consultancy.com
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Python Programming for Autodesk Maya" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/python_inside_maya/CAGQH2FG0gm3oUP5uJTTg4Pu1W4E_Ro2bM2K2
>> %2BoL6vZUr5KdQng%40mail.gmail.com
>> <https://groups.google.com/d/msgid/python_inside_maya/CAGQH2FG0gm3oUP5uJTTg4Pu1W4E_Ro2bM2K2%2BoL6vZUr5KdQng%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/ms
> gid/python_inside_maya/CAPaTLMStr%3DSsLoD1DoJ8zYfwRQ_EiyAofw
> 3MUD%3DO6V2fAbiAKw%40mail.gmail.com
> <https://groups.google.com/d/msgid/python_inside_maya/CAPaTLMStr%3DSsLoD1DoJ8zYfwRQ_EiyAofw3MUD%3DO6V2fAbiAKw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
-------------------------------------
Mark Jackson
CEO / Technical Director
red9consultancy.com

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAGQH2FH-pH0rzF3nREY-zbkpZjmPVdVP9NdtU2hifSUmko20dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to