Discussion:
[Maya-Python] [maya] nurbsCurve node modifying its input curveDatas
f***@gmail.com
2018-11-04 02:31:46 UTC
Permalink
hi folks,

I noticed something I never saw before, so I'd like to know if I'm missing something :
in a nutshell, I got different results when I connect the outCurve datas from a node to a motionPath, and when I pass the same connection through a nurbsCurve before connecting it to a motionPath.
I'm sure an example would be much self-explanatory, so you can run this snippet to see what I mean

sks = [cmds.createNode('joint', ss=1) for _ in xrange(2)]
nurbs = cmds.nurbsPlane(ch=0, ax=[0,1,0], w=2, lr=4)[0]
crv = cmds.duplicateCurve(nurbs + '.u[0.5]', ch=1)[0]
curveIso = cmds.listConnections(crv + '.create', s=1, d=0)[0]
cmds.setKeyframe(sks[-1], v=-4, at='tz')
cmds.currentTime(10)
cmds.setKeyframe(sks[-1], v=-14, at='tz')
cmds.skinCluster(nurbs, sks, tsb=1)

# - first setup
mp = cmds.createNode('motionPath')
cmds.connectAttr(curveIso + '.outputCurve', mp + '.geometryPath')
cmds.setAttr(mp + '.uValue', .2)
loc = cmds.spaceLocator()[0]
cmds.connectAttr(mp + '.allCoordinates', loc + '.t')
cmds.setAttr(mp + '.fractionMode', True)
# - second setup
mp = cmds.createNode('motionPath')
cmds.connectAttr(crv + '.ws', mp + '.geometryPath')
cmds.setAttr(mp + '.uValue', .2)
loc = cmds.spaceLocator()[0]
cmds.connectAttr(mp + '.allCoordinates', loc + '.t')
cmds.setAttr(mp + '.fractionMode', True)


As you can see if you scroll the timeline, the 2 locators have a different behavior. However, the 2 setups are the same, except for a nurbsCurve (that I'd like to bypass)
So I suspect the nurbsCurve does another operation, but I don't know which one exactly and why. Any explanation about that ?
cheers
--
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/b3bfc780-fd8e-4942-83d7-e83b532a0da1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Neil Roche
2018-11-05 18:28:25 UTC
Permalink
Hi,

Because of a weird bug in Maya when you set parametric length on a motion
path you need to set the opposite;

cmds.setAttr(mp + '.fractionMode', True)

actually turns parametric off.

So you need to do

cmds.setAttr(mp + '.fractionMode', not True) or cmds.setAttr(mp +
'.fractionMode', False)

To get your code snippet to work.

Cheers,

Neil
--
*MILK <http://www.milk-vfx.com/>** VISUAL EFFECTS**
*

Threeways House,





40-44 Clipstone Street London, W1W 5DW

Tel: *+44 (0)20 3697 8448*

* *


This message is intended solely for the addressee and may contain
confidential and/or legally privileged information. Any use, disclosure or
reproduction without the sender’s explicit consent is unauthorized and may
be unlawful. If you have received this message in error, please notify Milk
VFX immediately and permanently delete it. Any views or opinions expressed
in this message are solely those of the author and do not necessarily
represent those of Milk VFX. 

By engaging in professional correspondence
with Milk VFX, we may store your contact information for future reference.
This is in line with Milk’s Privacy policy which can be found here.
<http://www.milk-vfx.com/wp-content/uploads/2018/05/Milk-VFX-Privacy-Policy-May-2018.pdf> 
Milk Visual Effects is a registered limited company: 0844 1256. The
registered company address is Threeways House, 40-44 Clipstone Street,
London, W1W 5DW.
--
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/5b55c741-13aa-4343-8428-edc190e17698%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
f***@gmail.com
2018-11-05 18:35:05 UTC
Permalink
Hi,
Because of a weird bug in Maya when you set parametric length on a motion path you need to set the opposite; 
cmds.setAttr(mp + '.fractionMode', True)  
actually turns parametric off.
So you need to do  
cmds.setAttr(mp + '.fractionMode', not True)  or cmds.setAttr(mp + '.fractionMode',  False) 
To get your code snippet to work.
Cheers,
Neil
Hi Neil,
thanks for the answer. Indeed, as you flagged, parametric attribute is the 'GUI' name, and fractionMode is the core name, parametric==not fractionMode.
In my example, I explicitely set the fractionMode to True, on purpose, because this is the behavior I need (i.e. not parametric).
But my thoughts are more about "what happens in a nurbsCurve node, to change the output of my curveIso ?"

In other words, I would expect to have the same result in curveFromSurfaceIso.outputSurface and in nurbsCurve.worldSpace. I don't.
Any idea of what the nurbsCurve is implicitely doing to my curveFromSurfaceIso.outputSurface ?
--
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/e228d2fe-180a-4655-8d20-0bb01d8a70ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Neil Roche
2018-11-06 14:57:49 UTC
Permalink
I would guess that the curveFromSurfaceIso node will work like a parametric
curve irrespective of whether parametric is set on or off as you have the
min and max U values at 0 and 1 and it has no concept of where to draw any
cvs inbetween. Once you have created the curve by connecting the
outputCurve to the curve.create attribute you now have a curve with 4 cvs
so with parametric off it will function as expected and the locator will
move as the cvs are stretched apart from each other, differently to the
motion path with the curveFromSurfaceIso input. That's my guess anyway.
Post by Neil Roche
Hi,
Because of a weird bug in Maya when you set parametric length on a
motion path you need to set the opposite;
Post by Neil Roche
cmds.setAttr(mp + '.fractionMode', True)
actually turns parametric off.
So you need to do
cmds.setAttr(mp + '.fractionMode', not True) or cmds.setAttr(mp +
'.fractionMode', False)
Post by Neil Roche
To get your code snippet to work.
Cheers,
Neil
Hi Neil,
thanks for the answer. Indeed, as you flagged, parametric attribute is the
'GUI' name, and fractionMode is the core name, parametric==not
fractionMode.
In my example, I explicitely set the fractionMode to True, on purpose,
because this is the behavior I need (i.e. not parametric).
But my thoughts are more about "what happens in a nurbsCurve node, to
change the output of my curveIso ?"
In other words, I would expect to have the same result in
curveFromSurfaceIso.outputSurface and in nurbsCurve.worldSpace. I don't.
Any idea of what the nurbsCurve is implicitely doing to my
curveFromSurfaceIso.outputSurface ?
--
*MILK <http://www.milk-vfx.com/>** VISUAL EFFECTS**
*

Threeways House,





40-44 Clipstone Street London, W1W 5DW

Tel: *+44 (0)20 3697 8448*

* *


This message is intended solely for the addressee and may contain
confidential and/or legally privileged information. Any use, disclosure or
reproduction without the sender’s explicit consent is unauthorized and may
be unlawful. If you have received this message in error, please notify Milk
VFX immediately and permanently delete it. Any views or opinions expressed
in this message are solely those of the author and do not necessarily
represent those of Milk VFX. 

By engaging in professional correspondence
with Milk VFX, we may store your contact information for future reference.
This is in line with Milk’s Privacy policy which can be found here.
<http://www.milk-vfx.com/wp-content/uploads/2018/05/Milk-VFX-Privacy-Policy-May-2018.pdf> 
Milk Visual Effects is a registered limited company: 0844 1256. The
registered company address is Threeways House, 40-44 Clipstone Street,
London, W1W 5DW.
--
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/11250e47-7def-4dc6-ab5a-cabebf79c748%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
f***@gmail.com
2018-11-06 23:53:09 UTC
Permalink
I would guess that the curveFromSurfaceIso node will work like a parametric curve irrespective of whether parametric is set on or off as you have the min and max U values at 0 and 1 and it has no concept of where to draw any cvs inbetween.  Once you have created the curve by connecting the outputCurve to the curve.create attribute you now have a curve with 4 cvs so with parametric off it will function as expected and the locator will move as the cvs are stretched apart from each other, differently to the motion path with the curveFromSurfaceIso input. That's my guess anyway.
Hi,
Because of a weird bug in Maya when you set parametric length on a motion path you need to set the opposite; 
cmds.setAttr(mp + '.fractionMode', True)  
actually turns parametric off.
So you need to do  
cmds.setAttr(mp + '.fractionMode', not True)  or cmds.setAttr(mp + '.fractionMode',  False) 
To get your code snippet to work.
Cheers,
Neil
Hi Neil,
thanks for the answer. Indeed, as you flagged, parametric attribute is the 'GUI' name, and fractionMode is the core name, parametric==not fractionMode.
In my example, I explicitely set the fractionMode to True, on purpose, because this is the behavior I need (i.e. not parametric).
But my thoughts are more about "what happens in a nurbsCurve node, to change the output of my curveIso ?"
In other words, I would expect to have the same result in curveFromSurfaceIso.outputSurface and in nurbsCurve.worldSpace. I don't.
Any idea of what the nurbsCurve is implicitely doing to my curveFromSurfaceIso.outputSurface ?
Interesting. that's the best guess I came up with so far too ! A bit like some datas not being computed, maybe for optimisation purpose, unless they are explicitely required, which happens when we plug the nurbsCurve.
off topic, this situation reminds me a bit of Young's interference experiment (https://en.wikipedia.org/wiki/Young%27s_interference_experiment) where the signal is both a wave and a particle until we force it to choose one ^^ here, the data is can be different things, depending on what we plug after ^^
--
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/0eff12d7-c4a6-4ffc-ba8d-0dceaadca56f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...