paya.runtime.plugs.NurbsCurve#
- class NurbsCurve(*args, **kwargs)#
Inheritance
Geometry
Attribute
Attribute
PyNode
ProxyUnicode
- classmethod createArc(*points, directionVector=None, radius=1.0, toggleArc=False, sections=8, degree=3, guard=None)#
- Parameters
points (tuple, list,
Point
,Vector
) – two or three points, packed or unpackeddirectionVector/dv (None, tuple, list,
Vector
,Vector
) – on two-point arcs this defaults to [0, 0, 1] (Z) and defines the arc’s ‘normal’; on three point arcs it must be provided explicitly if ‘guard’ is requested, and it is used to jitter the input points to avoid Maya errorsradius/r (float,
Math1D
) – for two-point arcs only: the arc radius; defaults to 1.0toggleArc/tac (bool) – for two-point arcs only: draw the arc on the outside; defaults to False
sections/s (int,
Math1D
) – the number of arc sections; defaults to 8degree/d (int,
Math1D
) – the arc degree; defaults to 3guard (bool) – for three-point arcs only: prevent the arc from disappearing with an error when the input points are collinear; defaults to True if directionVector was provided, otherwise False.
- Returns
An output for a circular arc.
- Return type
- classmethod createLine(startPoint, endPoint, degree=None, numCVs=None)#
- Parameters
startPoint (tuple, list, str,
Math1D
) – the start point of the linestartPoint – the end point of the line
degree/d – the curve degree; if omitted, it is automatically derived from ‘numCVs’; if ‘numCVs’ is also omitted, defaults to 1
numCVs/cvs (int) – the number of CVs; if omitted, it is automatically derived from ‘degree’; if ‘degree’ is also omitted, defaults to 2
- Returns
A curve output for a straight line.
- Return type
- createShape(dispCV=True, **kwargs)#
Overloads
paya.runtime.plugs.Geometry.createShape()
to add the dispCV/dcv argument.- Parameters
dispCV/dcv (bool) – display CVs on the curve shape; defaults to
True
**kwargs – forwarded to
paya.runtime.plugs.Geometry.createShape()
- Returns
The generated shape.
- Return type
- _resolveNumberFractionsOrParams(numberFractionsOrParams, parametric=False, uniform=False)#
Utility method. Resolves the numberFractionsOrParams argument on distribution methods into a list of fractions or parameters.
If numberFractionsOrParams is a list, it will merely be conformed and passed back. Otherwise, the return will always be values, not plugs.
- Parameters
numberFractionsOrParams (
float
, [float
|Math1D
]) –one of:
a single integer value, specifying how many fraction or parameter values to return, or
a user list of fractions or parameters, which can be values or plugs
parametric/par (bool) – if numberFractionsOrParams is a number, generate parameters, not fractions; defaults to
False
uniform/uni (bool) – if generating parameters, distribute them by length, not parametric space; defaults to
False
- Returns
If ‘parametric’ is True, a list of parameters; otherwise, a list of fractions.
- Return type
- initNearestPointOnCurve(point, reuse=True)#
Initialises a
nearestPointOnCurve
node.
- numSpans()#
This is a static-only operation.
- Returns
The number of spans on this curve.
- Return type
- findExistingInfoNode()#
- Returns
The first
curveInfo
node connected to this curve, orNone
.- Return type
None
|paya.runtime.nodes.CurveInfo
- info(reuse=True, plug=False)#
- Parameters
- Returns
If plug is
True
, acurveInfo
node; otherwise, a dictionary with the following keys:'arcLength'
,'controlPoints'
,'knots'
- Return type
dict
|paya.runtime.nodes.CurveInfo
- length(plug=False)#
If plug is False, a temporary
curveInfo
node will be used instead ofmaya.OpenMaya.MFnNurbsCurve.length()
to ensure correct space management.This method will always use a :param bool plug/p: return a plug, not just a value; defaults
to
False
- getKnots(plug=False)#
- Parameters
plug/p – return the
knots
array of acurveInfo
node, not just a list of values; defaults toFalse
- Returns
[
int
] | [paya.runtime.plugs.Math1D
]
- motionPath(**config)#
Creates a
motionPath
node and connects it to this curve. All other configuration is performed via config.- Parameters
**config – a source: plug mapping to configure the node’s attributes; sources can be plugs or values
- Returns
The
motionPath
node.- Return type
- motionPathAtParam(param, **config)#
Creates a
motionPath
and hooks it up to the specified parameter. All other configuration is performed via **config*. Flags uValue and fractionMode will always be overriden.- Parameters
param – the parameter at which to create the
motionPath
node**config – a source: plug mapping to configure the node’s attributes; sources can be plugs or values
- Rtype param
float,
Math1D
- Returns
The
motionPath
node.- Return type
- motionPathAtFraction(fraction, **config)#
Creates a
motionPath
and hooks it up to the specified fraction. All other configuration is performed via **config*. Flags uValue and fractionMode will always be overriden.- Parameters
fraction – the fraction at which to create the
motionPath
node**config – a source: plug mapping to configure the node’s attributes; sources can be plugs or values
- Rtype fraction
float,
Math1D
- Returns
The
motionPath
node.- Return type
- infoAtParam(param, reuse=True, plug=None, turnOnPercentage=False)#
- Parameters
turnOnPercentage/top (bool) – per the namesake attribute on
pointOnCurveInfo
, interpret param a percentage ratio within parametric space (note that this is not the same asfractionMode
on motion paths; defaults toFalse
reuse/re (bool) – if plug is
True
, reuse any matchingpointOnCurveInfo
nodes; defaults toTrue
plug/p (bool) – force a dynamic output, or indicate that one or more of the arguments are plugs to skip checks; defaults to
None
- return a
pointOnCurveInfo
node rather than a dictonary of values; default is auto-configured based on arguments
- Returns
If plug is
True
, apointOnCurveInfo
node; otherwise, a dictionary with the followingk keys:'position'
,'tangent'
,'normalizedTangent'
,'normal'
,'normalizedNormal'
- Return type
- getControlVerts(plug=False)#
- getControlVert(cvIndex, plug=False)#
- pointAt(paramOrFraction, parametric=True, plug=None)#
Dispatches
pointAtParam()
ifparametric=True
, otherwisepointAtFraction()
.- Parameters
parametric/par (bool) – interpret paramOrFraction as a U parameter rather than a length fraction; defaults to
False
- pointAtParam(param, plug=None)#
- pointAtLength(length, plug=None)#
- pointAtFraction(fraction, plug=None)#
- nearestPoint(refPoint, plug=None)#
- distributePoints(numberFractionsOrParams, parametric=False, uniform=False, plug=None)#
- Parameters
numberFractionsOrParams –
one of:
a single integer value, specifying how many fraction or parameter values to return, or
a user list of fractions or parameters, which can be values or plugs
parametric/par (bool) – if numberFractionsOrParams is a number, generate parameters, not fractions; defaults to
False
uniform/uni (bool) – if generating parameters, distribute them by length, not parametric space; defaults to
False
plug/p (bool) – force a dynamic output, or indicate that one or more of the arguments are plugs to skip checks; defaults to
None
- Returns
A list of point values or plugs.
- Return type
- paramAtStart(plug=False)#
- paramAtEnd(plug=False)#
- knotDomain(plug=False)#
- paramAtPoint(point, plug=None)#
This is a ‘forgiving’ implementation, and uses the closest point.
- Alias
nearestParam
- Parameters
- Returns
The nearest parameter to the reference point.
- Return type
- paramAtFraction(fraction, plug=None)#
- paramAtLength(length, plug=None)#
- distributeParams(numberFractionsOrParams, parametric=False, uniform=False, plug=None)#
- Parameters
numberFractionsOrParams (
float
, [float
|Math1D
]) –one of:
a single integer value, specifying how many fraction or parameter values to return, or
a user list of fractions or parameters, which can be values or plugs
parametric/par (bool) – if numberFractionsOrParams is a number, generate parameters, not fractions; defaults to
False
uniform/uni (bool) – if generating parameters, distribute them by length, not parametric space; defaults to
False
plug/p (bool) – force a dynamic output, or indicate that one or more of the arguments are plugs to skip checks; defaults to
None
- Returns
A list of parameter plugs or values.
- Return type
- lengthAtFraction(fraction, plug=None)#
- lengthAtParam(param, plug=None, checkDomain=True)#
Differs from the PyMEl / API
findLengthFromParam()
in that it returns properly-spaced curve lengths.- Parameters
param (float,
Math1D
) – the parameter to inspectcheckDomain/cd (bool) – perform gating against the current curve knot domain to prevent sampling errors at the very start or end of the curve; defaults to
True
plug/p (bool) – force a dynamic output, or indicate that one or more of the arguments are plugs to skip checks; defaults to
None
- Returns
The curve length at the specified parameter.
- Return type
- lengthAtPoint(point, plug=None)#
This is a ‘forgiving’ implementation, and uses the closest point.
- distributeLengths(numberFractionsOrParams, parametric=False, uniform=False, plug=None)#
- Parameters
numberFractionsOrParams (
float
, [float
|Math1D
]) –one of:
a single integer value, specifying how many fraction or parameter values to return, or
a user list of fractions or parameters, which can be values or plugs
parametric/par (bool) – if numberFractionsOrParams is a number, generate parameters, not fractions; defaults to
False
uniform/uni (bool) – if generating parameters, distribute them by length, not parametric space; defaults to
False
plug/p (bool) – force a dynamic output, or indicate that one or more of the arguments are plugs to skip checks; defaults to
None
- Returns
A list of lengths.
- Return type
- fractionAtPoint(point, plug=None)#
This is a ‘forgiving’ implementation, and uses the closest point.
- Parameters
- Returns
The length fraction at the specified point.
- Return type
- fractionAtParam(param, plug=None)#
- fractionAtLength(length, plug=None)#
- distributeFractions(number)#
Convenience method. Equivalent to
floatRange(0, 1, number)
.
- normalAtParam(param, normalize=False, plug=None)#
- Parameters
- Returns
The sampled vector.
- Return type
- normalAtFraction(fraction, normalize=False, plug=None)#
- Parameters
- Returns
The sampled vector.
- Return type
- normalAtLength(length, normalize=False, plug=None)#
- Parameters
- Returns
The sampled vector.
- Return type
- normalAtPoint(point, normalize=False, plug=None)#
- Parameters
- Returns
The sampled vector.
- Return type
- tangentAtParam(param, normalize=False, plug=None)#
- Parameters
- Returns
The sampled vector.
- Return type
- tangentAtFraction(fraction, normalize=False, plug=None)#
- Parameters
- Returns
The sampled vector.
- Return type
- tangentAtLength(length, normalize=False, plug=None)#
- Parameters
- Returns
The sampled vector.
- Return type
- tangentAtPoint(point, normalize=False, plug=None)#
- Parameters
- Returns
The sampled vector.
- Return type
- distributeTangents(numberFractionsOrParams, plug=None, normalize=False, parametric=False, uniform=True)#
- Parameters
numberFractionsOrParams –
this should either be
A number of fractions or parameters to sample along the curve, or
An explicit list of fractions or parameters at which to construct the tangents
plug/p (bool) – return attribute outputs, not values; defaults to
False
normalize/nr (bool) – normalize the tangents; defaults to
False
parametric/par (bool) – interpret numberOrFractions as parameters, not fractions; defaults to
False
uniform/uni (bool) – if parametric is
True
, and numberFractionsOrParams is a number, initial parameters should be distributed by length, not parametric space; defaults toFalse
- Returns
A list of tangents.
- Return type
- upVectorAtParam(param, sampler=None, plug=None)#
- Parameters
param (
float
,Math1D
) – the parameter at which to sample the up vectorplug/p (bool) – force a dynamic output, or indicate that one or more of the arguments are plugs to skip checks; defaults to
None
sampler/sam (
str
,Network
,CurveUpVectorSampler
) – an up vector sampler to use; sampler can be created usingcreateUpVectorSampler()
; if this is omitted, then the last sampler created usingcreateUpVectorSampler(setAsDefault=True)
will be retrieved; defaults toNone
- Raises
RuntimeError – No default up vector sampler has been configured on this curve output.
- Returns
An up vector at the specified parameter. A default up vector sampler must have been configured on this curve using
createUpVectorSampler()
.- Return type
- upVectorAtFraction(fraction, plug=None, **kwargs)#
Converts fraction into a parameter and defers to
upVectorAtParam()
.- Parameters
plug/p (bool) – force a dynamic output, or indicate that one or more of the arguments are plugs to skip checks; defaults to
None
**kwargs – forwarded to
upVectorAtParam()
- upVectorAtLength(length, plug=None, **kwargs)#
Finds the parameter at the specified length and defers to
upVectorAtParam()
.- Parameters
plug/p (bool) – force a dynamic output, or indicate that one or more of the arguments are plugs to skip checks; defaults to
None
**kwargs – forwarded to
upVectorAtParam()
- upVectorAtPoint(point, plug=None, **kwargs)#
Finds the closest parameter to the specified point and defers to
upVectorAtParam()
.- Parameters
plug/p (bool) – force a dynamic output, or indicate that one or more of the arguments are plugs to skip checks; defaults to
None
**kwargs – forwarded to
upVectorAtParam()
- createUpVectorSampler(resolution=9, unwindSwitch=0, interpolation='Linear', aimCurve=None, closestPoint=True, upObject=None, upVector=None, parallelTransport=False, setAsDefault=True)#
Depending on options, returns one of the following up-vector samplers:
Not all options can be combined. If all options are omitted, an optimised curve normal sampler will be returned.
Use
sampleAtParam()
on the returned object to pull up vectors.- Parameters
upVector/upv (
None
,zip
,list
,tuple
,str
,Vector
,Vector
, [[float
|str
|Math1D
], [tuple
|list
,paya.runtime.data.Vector
,paya.runtime.plugs.Vector
]]) – this can be a single up vector, or zipped pairs of parameter: vector, indicating known up vectors at specific points; if a single up vector is provided then, if it’s combined with upObject, the vector is multiplied by the object’s world matrix (similar to ‘Object Rotation Up’ onmotionPath
nodes); otherwise, the vector is used on its own; if pairs are provided then they will be blended using parallel-transport or linearly (similar to IK spline twist); defaults toNone
upObject/uo (str,
Transform
) – if provided on its own, works as an aiming interest (similar to ‘Object Up’ mode onmotionPath
nodes); if combined with upVector, the object’s world matrix is used to multiply the up vector; defaults toNone
resolution/res (int) – if using parallel transport, the number of solutions to generate; higher values improve accuracy at the expense of interactivity; defaults to 9
unwindSwitch/uws (
int
,str
,Math1D
, [int
|str
|Math1D
]) –an integer value or plug, or a list of integer values or plugs (one per segment, i.e.
len(paramVectorKeys)-1
) specifying how to resolve angle- blending edge cases in per-segment parallel transport:0
(shortest, the default)1
(positive)2
(negative)
interpolation/i: –
defines how to interpolate values from param: vector pairs:
0
('None'
) (you wouldn’t normally want this)1
('Linear'
) (the default)2
('Smooth'
)3
('Spline'
)
parallelTransport/pt (bool) – use parallel-transport; defaults to False
aimCurve (str,
paya.runtime.nodes.NurbsCurve
,paya.runtime.nodes.Transform
,paya.runtime.plugs.NurbsCurve
) – an aim-curve from which to pull aiming interest points, similarly to the option oncurveWarp
nodes; defaults to NoneclosestPoint/cp (bool) – pull points from aimCurve by proximity rather than matched parameter; defaults to
True
setAsDefault/sad (bool) – make this the default fallback up vector source for other sampling operations; defaults to
True
- Raises
NotImplementedError – The requested options can’t be combined.
- Returns
The sampler system.
- Return type
- getUpVectorSamplers()#
- Returns
All
up vector samplers
created on this curve output.- Return type
- getDefaultUpVectorSampler()#
- Returns
The last
up vector sampler
that was created on this curve withsetAsDefault=True
.- Return type
- clearUpVectorSamplers()#
Removes all up vector samplers and their dependencies.
Warning
This will break any rigging that hangs off one or more of the samplers.
- matrixAtParam(param, primaryAxis, secondaryAxis, upVector=None, upObject=None, aimCurve=None, closestPoint=True, upVectorSampler=None, defaultToNormal=None, globalScale=None, squashStretch=False, plug=None)#
Note
Unlike
matrixAtFraction()
, which uses amotionPath
node, this builds off of apointOnCurveInfo
.- Parameters
param (float, str,
Math1D
) – the parameter at which to construct the matrixprimaryAxis (str) – the primary (aim) matrix axis, for example ‘-y’
secondaryAxis (str) – the secondary (up) matrix axis, for example ‘x’
upVector/upv (None, str, tuple, list,
Vector
,Vector
) – if provided on its own, used directly; if combined with upObject, multiplied by the object’s world matrix, similar to the ‘Object Rotation Up’ mode onmotion path
nodes; defaults toNone
upObject/uo (None, str,
Transform
) – similar tomotion path
nodes, if provided on its own, used as an aiming interest (‘Object Up’ mode); if combined with upVector, the up vector is multiplied by the object’s world matrix (‘Object Rotation Up’ mode); defaults toNone
aimCurve/aic (None, str,
paya.runtime.plugs.NurbsCurve
,paya.runtime.nodes.NurbsCurve
,Transform
) – a curve from which to pull aiming interests, similar to the option oncurveWarp
nodes; defaults toNone
closestPoint/cp (bool) – pull points from aimCurve by proximity, not matched parameters; defaults to
True
upVectorSampler/ups (None, str,
Network
,CurveUpVectorSampler
) – an up vector sampler created usingcreateUpVectorSampler()
; defaults toNone
defaultToNormal/dtn (bool) – when all other up vector options are exhausted, don’t fall back to any ‘default’ up vector sampler previously created using
createUpVectorSampler(setAsDefault=True)
; instead, use the curve normal (the curve normal will be used anyway if no default sampler is defined); defaults toFalse
globalScale/gs (None, float, str,
Math1D
) – a baseline scaling factor; note that scale will be normalized in all cases, so if this is value rather than a plug, it will have no practical effect; defaults toNone
squashStretch/ss (bool) – allow squashing and stretching of the primaryAxis on the output matrix; defaults to
False
plug/p (bool) – force a dynamic output, or indicate that one or more of the arguments are plugs to skip checks; defaults to
None
- Returns
A matrix at the specified position.
- Return type
- matrixAtFraction(fraction, primaryAxis, secondaryAxis, upVector=None, upObject=None, aimCurve=None, closestPoint=True, upVectorSampler=None, defaultToNormal=None, globalScale=None, squashStretch=False, plug=None)#
Note
Unlike
matrixAtParam()
, which uses apointOnCurveInfo <paya.runtime.nodes.PointOnCurveInfo
node, this builds off of amotionPath
.- Parameters
fraction (float, str,
Math1D
) – the fraction at which to construct the matrixprimaryAxis (str) – the primary (aim) matrix axis, for example ‘-y’
secondaryAxis (str) – the secondary (up) matrix axis, for example ‘x’
upVector/upv (None, str, tuple, list,
Vector
,Vector
) – if provided on its own, used directly; if combined with upObject, multiplied by the object’s world matrix, similar to the ‘Object Rotation Up’ mode onmotion path
nodes; defaults toNone
upObject/uo (None, str,
Transform
) – similar tomotion path
nodes, if provided on its own, used as an aiming interest (‘Object Up’ mode); if combined with upVector, the up vector is multiplied by the object’s world matrix (‘Object Rotation Up’ mode); defaults toNone
aimCurve/aic (None, str,
paya.runtime.plugs.NurbsCurve
,paya.runtime.nodes.NurbsCurve
,Transform
) – a curve from which to pull aiming interests, similar to the option oncurveWarp
nodes; defaults toNone
closestPoint/cp (bool) – pull points from aimCurve by proximity, not matched parameters; defaults to
True
upVectorSampler/ups (None, str,
Network
,CurveUpVectorSampler
) – an up vector sampler created usingcreateUpVectorSampler()
; defaults toNone
defaultToNormal/dtn (bool) – when all other up vector options are exhausted, don’t fall back to any ‘default’ up vector sampler previously created using
createUpVectorSampler(setAsDefault=True)
; instead, use the curve normal (the curve normal will be used anyway if no default sampler is defined); defaults toFalse
globalScale/gs (None, float, str,
Math1D
) – a baseline scaling factor; note that scale will be normalized in all cases, so if this is value rather than a plug, it will have no practical effect; defaults toNone
squashStretch/ss (bool) – allow squashing and stretching of the primaryAxis on the output matrix; defaults to
False
plug/p (bool) – force a dynamic output, or indicate that one or more of the arguments are plugs to skip checks; defaults to
None
- Returns
A matrix at the specified position.
- Return type
- matrixAtParamOrFraction(paramOrFraction, primaryAxis, secondaryAxis, parametric=True, plug=None, **kwargs)#
Dispatches
matrixAtParam()
ormatrixAtFraction()
. See either of those for full parameter information.- Parameters
paramOrFraction (float, str,
Math1D
) – the parameter or fraction at which to construct a matrixprimaryAxis (str) – the primary (aim) matrix axis, for example ‘-y’
secondaryAxis (str) – the secondary (up) matrix axis, for example ‘x’
parametric (bool) – interpret paramOrFraction as a U parameter rather than a length fraction; defaults to
True
plug/p (bool) – force a dynamic output, or indicate that one or more of the arguments are plugs to skip checks; defaults to
None
**kwargs – forwarded to
matrixAtParam()
or :meth:`matrixAtFraction
- Returns
A matrix at the specified position.
- Return type
- matrixAtPoint(point, primaryAxis, secondaryAxis, plug=None, **kwargs)#
Finds the closest parameter to point and dispatches
matrixAtParam()
. See that method for full parameter information.- Parameters
primaryAxis (str) – the primary (aim) matrix axis, for example ‘-y’
secondaryAxis (str) – the secondary (up) matrix axis, for example ‘x’
plug/p (bool) – force a dynamic output, or indicate that one or more of the arguments are plugs to skip checks; defaults to
None
**kwargs – forwarded to
matrixAtParam()
- Returns
A matrix at the specified position.
- Return type
- matrixAtLength(length, primaryAxis, secondaryAxis, plug=None, **kwargs)#
Finds the parameter at length and dispatches
matrixAtParam()
. See that method for full parameter information.- Parameters
length (tuple, list,
Point
,Vector
) – the partial length at which to construct the matrixprimaryAxis (str) – the primary (aim) matrix axis, for example ‘-y’
secondaryAxis (str) – the secondary (up) matrix axis, for example ‘x’
plug/p (bool) – force a dynamic output, or indicate that one or more of the arguments are plugs to skip checks; defaults to
None
**kwargs – forwarded to
matrixAtParam()
- Returns
A matrix at the specified position.
- Return type
- distributeMatrices(numberFractionsOrParams, primaryAxis, secondaryAxis, parametric=False, uniform=False, chain=False, upVector=None, upObject=None, aimCurve=None, closestPoint=True, upVectorSampler=None, defaultToNormal=None, globalScale=None, squashStretch=False, plug=None)#
- Parameters
numberFractionsOrParams –
this should either be
A number of fractions or parameters to generate along the curve, or
An explicit list of fractions or parameters at which to construct the matrices
primaryAxis (str) – the primary (aim) matrix axis, for example ‘-y’
secondaryAxis (str) – the secondary (up) matrix axis, for example ‘x’
parametric/par (bool) – interpret numberOrFractions as parameters, not fractions; defaults to
False
uniform/uni (bool) – if parametric is
True
, and numberFractionsOrParams is a number, initial parameters should be distributed by length, not parametric space; defaults toFalse
chain/cha (bool) – aim each matrix towards the next in the series, similar to chain joints; defaults to
False
upVector/upv (
None
,str
,tuple
,list
,Vector
,Vector
, [None
|str
|tuple
|list
|Vector
|Vector
]) –either
A single up vector, or
A list of up vectors (one per matrix)
If up vectors are provided on their own, they are used directly; if they are combined with ‘up objects’ (upObject), they are multiplied by the objects’ world matrices, similar to the ‘Object Rotation Up’ mode on
motion path
nodes; defaults toNone
upObject/uo (
None
,str
,Transform
) – this can be a single transform, or a list of transforms (one per sample point); if provided on its own, used as an aiming interest (similar to ‘Object Up’ mode onmotionPath
nodes); if combined with upVector, the vector will be multiplied with the object’s matrix (similar to ‘Object Rotation Up’); defaults toNone
aimCurve/aic (None, str,
paya.runtime.plugs.NurbsCurve
,paya.runtime.nodes.NurbsCurve
,Transform
) – a curve from which to pull aiming interests, similar to the option oncurveWarp
nodes; defaults toNone
closestPoint/cp (bool) – pull points from aimCurve by proximity, not matched parameters; defaults to
True
upVectorSampler/ups (None, str,
Network
,CurveUpVectorSampler
) – an up vector sampler created usingcreateUpVectorSampler()
; defaults toNone
defaultToNormal/dtn (bool) – when all other up vector options are exhausted, don’t fall back to any ‘default’ up vector sampler previously created using
createUpVectorSampler(setAsDefault=True)
; instead, use the curve normal (the curve normal will be used anyway if no default sampler is defined); defaults toFalse
globalScale/gs (None, float, str,
Math1D
) – a baseline scaling factor; note that scale will be normalized in all cases, so if this is value rather than a plug, it will have no practical effect; defaults toNone
squashStretch/ss (bool) – allow squashing and stretching of the primaryAxis on the output matrix; defaults to
False
plug/p (bool) – force a dynamic output, or indicate that one or more of the arguments are plugs to skip checks; defaults to
None
- Returns
A matrix at the specified position.
- Return type
- distributeJoints(numberFractionsOrParams, primaryAxis, secondaryAxis, parametric=False, uniform=False, upVector=None, upObject=None, aimCurve=None, closestPoint=True, upVectorSampler=None, defaultToNormal=None, globalScale=None, squashStretch=False, chain=False, displayLocalAxis=True, radius=1.0, rotateOrder='xyz', parent=None, freeze=True, decompose=True, plug=False)#
Distributes joints along this curve. Pass plug/p=True for live connections.
- Parameters
numberFractionsOrParams –
this should either be
A number of fractions or parameters to generate along the curve, or
An explicit list of fractions or parameters at which to construct the matrices
primaryAxis (str) – the primary (aim) matrix axis, for example ‘-y’
secondaryAxis (str) – the secondary (up) matrix axis, for example ‘x’
parametric/par (bool) – interpret numberOrFractions as parameters, not fractions; defaults to
False
uniform/uni (bool) – if parametric is
True
, and numberFractionsOrParams is a number, initial parameters should be distributed by length, not parametric space; defaults toFalse
upVector/upv (
None
,str
,tuple
,list
,Vector
,Vector
, [None
|str
|tuple
|list
|Vector
|Vector
]) –either
A single up vector, or
A list of up vectors (one per matrix)
If up vectors are provided on their own, they are used directly; if they are combined with ‘up objects’ (upObject), they are multiplied by the objects’ world matrices, similar to the ‘Object Rotation Up’ mode on
motion path
nodes; defaults toNone
upObject/uo (
None
,str
,Transform
) – this can be a single transform, or a list of transforms (one per sample point); if provided on its own, used as an aiming interest (similar to ‘Object Up’ mode onmotionPath
nodes); if combined with upVector, the vector will be multiplied with the object’s matrix (similar to ‘Object Rotation Up’); defaults toNone
aimCurve/aic (None, str,
paya.runtime.plugs.NurbsCurve
,paya.runtime.nodes.NurbsCurve
,Transform
) – a curve from which to pull aiming interests, similar to the option oncurveWarp
nodes; defaults toNone
closestPoint/cp (bool) – pull points from aimCurve by proximity, not matched parameters; defaults to
True
upVectorSampler/ups (None, str,
Network
,CurveUpVectorSampler
) – an up vector sampler created usingcreateUpVectorSampler()
; defaults toNone
defaultToNormal/dtn (bool) –
when all other up vector options are exhausted, don’t fall back to any ‘default’ up vector sampler previously created using :meth:`createUpVectorSampler(
setAsDefault=True) <createUpVectorSampler>`;
instead, use the curve normal (the curve normal will be used anyway if no default sampler is defined); defaults to
False
globalScale/gs (None, float, str,
Math1D
) – a baseline scaling factor; note that scale will be normalized in all cases, so if this is value rather than a plug, it will have no practical effect; defaults toNone
squashStretch/ss (bool) – allow squashing and stretching of the primaryAxis on the output matrix; defaults to
False
chain/cha (bool) – create the joints as a contiguous chain with aimed, rather than tangent-based, matrix orientation; defaults to
False
displayLocalAxis/dla (bool) – display the local matrix axes; defaults to
True
radius/rad (float) – the joint display radius; defaults to 1.0
rotateOrder/ro (
None
,str
,int
,Math1D
) – the rotate order for the joint; defaults to'xyz'
parent/p (None, str,
Transform
) – an optional destination parent for the jointsfreeze/fr (bool) – zero-out transformations (except translate) at the initial pose; defaults to
True
decompose/dec (bool) –
if
False
, connect tooffsetParentMatrix
instead of driving the joint’s SRT channels; note that, if freeze is requested, the initial matrixwill always be applied via decomposition and then frozen; defaults to
True
plug/p (bool) – drive the joints dynamically; defaults to
False
- Returns
The individual joints or a chain (if chain was requested).
- Return type
- toBezier(force=False)#
Converts this NURBS curve to a Bezier curve.
- Parameters
force/f (bool) – when this is
False
, this plug will be passed through as-is if it’s already a Bezier curve; defaults to False- Returns
The bezier curve.
- Return type
- toNurbs(force=False)#
Converts this Bezier curve to a NURBS curve.
- Parameters
force/f (bool) – when this is
False
, this plug will be passed through as-is if it’s already a Bezier curve; defaults to False- Returns
The NURBS curve.
- Return type
- bSpline(tolerance=0.001, keepRange=1)#
- Parameters
- Returns
The B-spline.
- Return type
- subCurve(minValue, maxValue, relative=False)#
Connects and configures a
subCurve
node and returns its output.- Alias
sub
- Parameters
- Returns
The sub-curve.
- Return type
- attach(*curves, blend=False, blendBias=0.5, parameter=0.1, blendKnotInsertion=False, reverse1=False, reverse2=False, multipleKnots=True)#
Note
If more than one curves are passed-in, the result may be different from calling
detach()
per pair, because theinputCurves
array will be used on the node.- Parameters
*curves (str,
NurbsCurve
) – one or more curves to attach to this oneblend (bool) – use blended attachments; defaults to False
blendBias/bb (float,
Math1D
) – ignored if more than two curves are involved; the bias for blended attachments; defaults to 0.5blendKnotInsertion (bool) – ignored if more than two curves are involved; add a blend knot; defaults to False
parameter/p (float) – ignored if more than two curves are involved or blendKnotInsertion is False; the parameter for the blend knot; defaults to 0.1
reverse1/rv1 (bool) – ignored if more than two curves are involved; reverse the first curve; defaults to False
reverse2/rv2 (bool) – ignored if more than two curves are involved; reverse the second curve; defaults to False
multipleKnots (bool) – keep multiple knots; defaults to True
- Returns
The combined curve.
- Return type
- detach(*parameters, select=None)#
Detaches this curve at the specified parameter(s).
- Parameters
*parameters (float,
Math1D
) – the parameter(s) at which to ‘cut’ the curveselect/sel – a subset of output indices to include in the return;
keep
attributes will configured accordingly
- Returns
- initExtendCurve(**config)#
Connects and configures an
extendCurve
node.- Parameters
**config – an unpacked mapping of attrName: attrSource for attribute configuration; sources can be values or plugs
- Returns
The
extendCurve
node.- Return type
ExtendCurve
- retract(length, atStart=None, atBothEnds=None)#
Retracts this curve.
- Parameters
- Returns
The modified curve.
- Return type
- setLength(targetLength, atStart=False, vector=None, linear=None, circular=None, extrapolate=None, multipleKnots=True)#
Uses gated retractions and extensions to force the length of this curve.
- Parameters
targetLength (float,
Math1D
) – the target lengthatStart/ats (bool) – anchor the curve at the end rather than the start; defaults to
False
vector (None, tuple, list,
Vector
,Vector
) – a vector along which to extend; this is recommended for spine setups where tangency should be more tightly controlled; if this is omitted, the linear / circular / extrapolate modes will be used insteadcircular/cir (bool) – ignored if vector was provided; use the ‘circular’ mode of the
extendCurve
node; defaults toFalse
linear/lin (bool) – ignored if vector was provided; use the ‘linear’ mode of the
extendCurve
node; defaults toFalse
extrapolate/ext (bool) – ignored if vector was provided; use the ‘extrapolate’ mode of the
extendCurve
node; defaults toTru``e
multipleKnots (bool) – keep multiple knots; defaults to
True
- Returns
- extendByLength(length, circular=None, linear=None, extrapolate=None, atStart=None, atEnd=None, multipleKnots=True)#
- Parameters
circular (bool) – use a circular extension; defaults to
False
linear (bool) – use a linear extension; defaults to
True
extrapolate (bool) – use an extrapolated extension; defaults to
False
atStart (bool) – extend at the start of the curve; defaults to
False
atEnd (bool) – extend at the start of the curve; defaults to
True
multipleKnots/mul (bool) – preserve multiple knots; defaults to
True
- Returns
This curve output, extended accordingly.
- Return type
- extendByVector(vector, atStart=False, useSegment=False, multipleKnots=True)#
- Parameters
- Returns
This curve output, extended along the specified vector.
- Return type
- extendByPoint(point, atStart=False, useSegment=False, multipleKnots=True)#
- Parameters
- Returns
This curve output, extended towards the specified point.
- Return type
- extend(atStart=None, atEnd=None, point=None, vector=None, length=None, multipleKnots=True, useSegment=False)#
- Parameters
length (
float
,Math1D
) – the length to add to the curve; defaults toNone
vector (
list
[float
],str
,Vector
,Vector
) – the vector along which to extend; defaults toNone
point (
list
[float
],str
,Vector
,Vector
) – the point towards which to extend; defaults toNone
atStart – extend at the start of the curve; defaults to
False
atEnd – extend at the start of the curve; defaults to
True
useSegment/seg (bool) – uses an attached line segment for the extension (vector / point only); defaults to
False
multipleKnots/mul (bool) – preserve multiple knots; defaults to
True
- Raises
One of:
More than one of vector, point or length were specified.
Both atStart and atEnd were specified when extending with point / vector.
None of vector, point or length were specified.
The useSegment option was requested when extending by curve.
- Returns
This curve output, extended accordingly.
- Return type
- squashStretch(squashy, stretchy, globalScale=None, vector=None)#
- Parameters
squashy (
str
,Math1D
) – the user attribute to control how squashy the output should bestretchy (
str
,Math1D
) – the user attribute to control how stretchy the output should beglobalScale/gs (
str
,Math1D
) – (recommended) an attribute to use as a normalizing factor for length calculations; defaults toNone
vector/v – (recommended) an extension vector to use when the curve is under-shot (e.g. an extracted animation control axis); defaults to
None
- Returns
This curve output with added squash-stretch effects.
- Return type
- rebuild(spans=None, degree=None, keepRange=1, endKnots=0, keepEndPoints=True, keepTangents=True, keepControlPoints=False, tolerance=0.01, rebuildType=0, matchCurve=None)#
Same signature as the API method. If any arguments are omitted, they are derived from the curve’s current state.
- Parameters
spans/s – the target number of spans; defaults to the current number of spans
degree/d (int, str,
Math1D
) – the target degree, one of 1, 2, 3, 5 or 7; defaults to the current degreekeepRange/kr (int, str,
Math1D
) –an integer or label for the enumerator on
rebuildCurve
, namely:0 (‘0 to 1’)
1 (‘Original’) (the default)
2 (‘0 to #spans’)
endKnots/end (int, str,
Math1D
) –an integer or label for the enumerator on
rebuildCurve
, namely:0 (‘Non Multiple end knots’)
1 (‘Multiple end knots’)
keepEndPoints/kep (bool, str,
Math1D
) – keep end points; defaults to TruekeepTangents/kt (bool, str,
Math1D
) – keep tangents; defaults to TruekeepControlPoints/kcp (bool, str,
Math1D
) – keep control points; defaults to Falsetolerance/tol (float, str,
Math1D
) – the rebuild tolerance; defaults to 0.01matchCurve/mc (str,
NurbsCurve
,NurbsCurve
,Transform
) – a curve shape or input for the ‘Match Knots’ mode; if provided, rebuildType will be overriden to 2; defaults to NonerebuildType/rt (int, str,
Math1D
) –an integer or label for the enumerator on
rebuildCurve
, namely:0 (‘Uniform’) (the default)
1 (‘Reduce Spans’)
2 (‘Match Knots’)
3 (‘Remove Multiple Knots’)
4 (‘Curvature’)
5 (‘End Conditions’)
6 (‘Clean’)
- Returns
The rebuilt curve.
- cvRebuild(numCVs, degree=None, endKnots='Multiple end knots', keepRange='Original', keepControlPoints=False, keepEndPoints=True, keepTangents=False)#
Rebuilds this curve to the specified number of CVs.
- Parameters
degree/d (int) – the degree to build to; defaults to this curve’s (current) degree if omitted
endKnots/end –
An enum index or label:
0: ‘Non Multiple end knots’
1: ‘Multiple end knots’ (the default)
An enum index or label:
0: ‘0 to 1’
1: ‘Original’ (the default)
2: ‘0 to #spans’
keepEndPoints/kep (bool) – keep end points; defaults to True
keepTangents/kt (bool) – keep tangents; defaults to False
- Returns
The rebuilt curve.
- Return type
- cageRebuild()#
- Returns
A linear curve with the same CVs as this one.
- Return type
- reverse()#
- Returns
The reversed curve.
- Return type
- blend(otherCurve, weight=0.5)#
Blends this curve output towards otherCurve via an
avgCurves
node. You may get unexpected results if the curves don’t match in terms of spans, degree etc.- Parameters
otherCurve (str,
NurbsCurve
) – the curve to blend towardsweight/w (float,
Math1D
) – the blend weight; the other curve will take over fully at 1.0; defaults to 0.5
- Returns
The blended curve.
- Return type
- insertKnot(*parameters, insertBetween=None)#
- Parameters
*parameters (
float
|Math1D
| [float
|Math1D
]) – the parameters at, or between, which to add knotsinsertBetween/ib (bool) – if this is specified, cuts won’t be performed at the specified parameters, but rather between them; this should be a scalar, or a list of scalars (one per internal segment, i.e.
len(parameters)-1
), specifying the number(s) of cuts; defaults toNone
- Returns
The edited curve.
- Return type