Community
When creating the key it is created fractionally, is it possible to change the code so that it does not add it in a fractional frame? I can't think of a way to do it.
import maya.cmds as mc
def insertKeyPercentage(percentage = 50):
key1 = mc.currentTime(q = True)
key2 = mc.findKeyframe(t = (key1,key1), w = "next")
p = ((key2-key1)/100)*percentage
newKey = mc.setKeyframe(i = True, t = (key1 +p))
insertKeyPercentage(percentage = 50)
Solved! Go to Solution.
Solved by Kahylan. Go to Solution.
Hi!
You just need to add the round() function to the final result of you newkey time value:
newKey = mc.setKeyframe(i = True, t = (round(key1 +p)))
I hope it helps!
Can't find what you're looking for? Ask the community or share your knowledge.