paya.geoshapext#
Tools for adapting and copying functionality on geo plug classes over to their shape counterparts.
- makeDoc(sources, notes=None)#
- Parameters
sources ([
FunctionType
]) – the functions to inspect for docstrings, in order of preferencenotes – optional notes to prepend; defaults to
None
- Returns
The constructed docstring.
- Return type
- class copyToShape(**copyToShapeKwargs)#
Decorator-with-arguments. Use it on plug functions to signal that they should be copied over to the shape class. Any keyword arguments captured by
__init__()
are forwarded tocopyPlugFuncToShapeClassDict()
.Note that the shape classes won’t pick up these ‘sends’ unless they are themselves built, or rebuilt, using
ShapeExtensionMeta
.- __call__(f)#
Call self as a function.
- copyPlugFuncToShapeClassDict(plugFunc, dictKeys, className, shapeClassDict, editsHistory=False, worldSpaceOnly=False, bezierInterop=True, replace=False)#
Copies a plug function (method) to the dictionary of an under-construction shape class, with appropriate modifications.
- Parameters
plugFunc – the function (method) on the plug class
dictKeys ([
str
]) – all the dictionary keys under which the function appears (there may be several if ‘aliases’ are used)className (str) – the shared name of the shape and plug classes
shapeClassDict (dict) – the dictionary of the shape class being constructed
editsHistory/eh (bool) – indicates that the plug function should be wrapped to use the shape’s history input and return shapes; defaults to
False
worldSpaceOnly/wso (bool) – don’t add any worldSpace/ws keyword argument; always run the method on the shape’s world-space geo output; defaults to
False
bezierInterop/bio (bool) – ignored if editsHistory is
False
; consider NURBS and Bezier types to be interoperable (i.e. connect a NURBS output directly to a hero shape and vice versa, without swapping the shape)
- expandShapeClassDict(clsname, classDict)#
Expands the dictionary of an under-construction shape class with any methods in the namesake plugs class that have been decorated with
@copyToShape
.- Parameters
clsname (str) – the name of the shape class
classDict – the dictionary of the shape class
- class ShapeExtensionMeta(clsname, bases, dct)#
Inheritance
type
When this metaclass is assigned to, or used to rebuild, a template class for a geometry shape, it will look in the matching plug class for any methods decorated with
@copyToShape
and copy them over.