Marcus Ottosson
2018-08-14 13:28:58 UTC
Hi all,
TLDR; In Maya 2015-2018, getAttr returns stale value when used in
conjunction with an ikHandle
Iâve ventured into the depths of querying attributes at an arbitrary time..
# Examplefrom maya import cmds
cmds.getAttr("myNode.translateX", time=5)
And it has worked well so far, except for when IK is involved.
from maya import cmds
# Build Scene# o o# \ /# \ /# o#
cmds.file(new=True, force=True)
a = cmds.joint(name="Root")
cmds.move(0, 0, 20)
cmds.joint()
cmds.move(0, 0, 0)
b = cmds.joint()
cmds.move(0, 10, -20)
handle, eff = cmds.ikHandle(
solver="ikRPsolver",
startJoint=a,
endEffector=b,
)
assert cmds.getAttr(a + ".rx") == 0.0assert cmds.getAttr(a + ".rx",
time=1) == 0.0 # Cycle warning!
Suddenly, Maya throws a cycle warning. Why is that?
Furthermore, the value returned isnât right anymore.
# Move handle
cmds.move(0, 15, -10, "|ikHandle1")
assert round(cmds.getAttr(a + ".rx"), 0) == -14.0assert cmds.getAttr(a
+ ".rx", time=1) == 0.0 # Bad value, no warning..
Where I should see -14.0 I get the previous value, 0.0. Why is that?
And so the story goes, until..
# Move root
cmds.move(0, 0, 21, a)
assert round(cmds.getAttr(a + ".rx"), 0) == -14.0assert
round(cmds.getAttr(a + ".rx", time=1), 0) == -14.0 # Correct
Viola, all values are correct. Why is that?? :O
This happens consistently across all versions of Maya, except 2015 doesnât
throw a Cycle Warning.
Anyone stumbled upon this before?
TLDR; In Maya 2015-2018, getAttr returns stale value when used in
conjunction with an ikHandle
Iâve ventured into the depths of querying attributes at an arbitrary time..
# Examplefrom maya import cmds
cmds.getAttr("myNode.translateX", time=5)
And it has worked well so far, except for when IK is involved.
from maya import cmds
# Build Scene# o o# \ /# \ /# o#
cmds.file(new=True, force=True)
a = cmds.joint(name="Root")
cmds.move(0, 0, 20)
cmds.joint()
cmds.move(0, 0, 0)
b = cmds.joint()
cmds.move(0, 10, -20)
handle, eff = cmds.ikHandle(
solver="ikRPsolver",
startJoint=a,
endEffector=b,
)
assert cmds.getAttr(a + ".rx") == 0.0assert cmds.getAttr(a + ".rx",
time=1) == 0.0 # Cycle warning!
Suddenly, Maya throws a cycle warning. Why is that?
Furthermore, the value returned isnât right anymore.
# Move handle
cmds.move(0, 15, -10, "|ikHandle1")
assert round(cmds.getAttr(a + ".rx"), 0) == -14.0assert cmds.getAttr(a
+ ".rx", time=1) == 0.0 # Bad value, no warning..
Where I should see -14.0 I get the previous value, 0.0. Why is that?
And so the story goes, until..
# Move root
cmds.move(0, 0, 21, a)
assert round(cmds.getAttr(a + ".rx"), 0) == -14.0assert
round(cmds.getAttr(a + ".rx", time=1), 0) == -14.0 # Correct
Viola, all values are correct. Why is that?? :O
This happens consistently across all versions of Maya, except 2015 doesnât
throw a Cycle Warning.
Anyone stumbled upon this before?
--
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+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODV_eKp2%3DJ3AdUufuDfBe2qojSWFjNpT9gJO1A6e9OLhg%40mail.gmail.com.
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 python_inside_maya+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODV_eKp2%3DJ3AdUufuDfBe2qojSWFjNpT9gJO1A6e9OLhg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.