I wouldn't be surprised if visibility is forced to be stepped by Maya. 
Objects are either visible or not. If you want an object to fade from 
opaque to transparent, you would need to use a different approach.

On Tuesday, 25 June 2019 04:41:18 UTC+10, likage wrote:
>
> Hi everyone, I am trying to set some keyframes on the attributes 
> pythonically but noticed that only the "visibility" attribute is touched 
> upon, both the `inTagentType` and `outTagentType` are not factored into 
> account.
>
> Eg. in my code, I have sent them to be keyframed with linear tangents, but 
> for the visibility attribute, it comes out as stepped.
> Here is a snippet of my code:
>
> from maya import cmds
> loc = cmds.spaceLocator(name="test")
> loc_tx = "{0}.translateX".format(loc[0])
> loc_vis = "{0}.visibility".format(loc[0])
>
> # At Frame 1
> cmds.currentTime(1)
> cmds.setKeyframe(loc_tx, inTangentType="linear", outTangentType="linear")
> cmds.setKeyframe(loc_vis, inTangentType="linear", outTangentType="linear")
>
> # At Frame 10
> cmds.currentTime(10)
> cmds.setAttr(loc_tx, 10)
> cmds.setKeyframe(loc_tx, inTangentType="linear", outTangentType="linear")
> cmds.setAttr(loc_vis, 0)
> cmds.setKeyframe(loc_vis, inTangentType="linear", outTangentType="linear") 
> # This will still returns me in stepped tangent
>
> The only method that I can conform the visibility curve to use linear 
> tangent is to run the following line after the above code block:
> (it is almost the same code when I uses `setKeyframe`)
> cmds.keyTangent(loc_vis, edit=True, inTangentType='linear', 
> outTangentType='linear')
>
> Am I missing something in my code? Or how can I enforce it to use `linear` 
> as the in/outTangentType whenever I am setting a keyframe...
>
>

-- 
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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/a55bdb7c-ab4f-4318-b7bf-6c908cc1fb65%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to