nukescripts.snap3d

Package nukescripts :: Module snap3d |
[hide private]
[frames] | no frames]

# Module snap3d

source code

Classes | [hide private]
| VertexInfo
| VertexSelection

Functions | [hide private]
translateThisNodeToPoints() | source code
translateRotateThisNodeToPoints() | source code
translateRotateScaleThisNodeToPoints() | source code
translateToPoints(nodeToSnap) Translate the specified node to the average position of the current vertex selection in the active viewer. | source code
translateRotateToPoints(nodeToSnap) Translate the specified node to the average position of the current vertex selection in the active viewer and rotate to the orientation of the (mean squares) best fit plane for the selection. | source code
translateRotateScaleToPoints(nodeToSnap) Translate the specified node to the average position of the current vertex selection in the active viewer, rotate to the orientation of the (mean squares) best fit plane for the selection and scale to the extents of the selection. | source code
translateSelectionToPoints(nodeToSnap, vertexSelection) | source code
translateRotateSelectionToPoints(nodeToSnap, vertexSelection) | source code
translateRotateScaleSelectionToPoints(nodeToSnap, vertexSelection) | source code
verifyVertexSelection(vertexSelection, minLen) | source code
verifyNodeToSnap(nodeToSnap, knobList) | source code
verifyNodeOrder(node, knobName, orderName) | source code
transpose(m) | source code
translateToPointsVerified(nodeToSnap, vertexSelection) | source code
scaleToPointsVerified(nodeToScale, vertexSelection) | source code
rotateToPointsVerified(nodeToSnap, vertexSelection) | source code
translateRotateToPointsVerified(nodeToSnap, vertexSelection) | source code
translateRotateScaleToPointsVerified(nodeToSnap, vertexSelection) | source code
calcRotationVector(vertexSelection, norm) | source code
calcAveragePosition(vertexSelection) Calculate the average position of all points. | source code
calcBounds(vertexSelection) | source code
planeRotation(tri, norm=None) Calculate the rotations around the X, Y and Z axes that will align a plane perpendicular to the Z axis with the given triangle. | source code
averageNormal(vertexSelection) averageNormal(selectionThreshold -> _nukemath.Vector3 Return a _nukemath.Vector3 which is the average of the normals of all selected points | source code
_nukemath.Vector3 |
anySelectedPoint(selectionThreshold=0.5) Return a selected point from the active viewer or the first viewer with a selection. | source code
iterator |
selectedPoints(selectionThreshold=0.5) Return an iterator which yields the position of every point currently selected in the Viewer in turn. | source code
getSelection(selectionThreshold=0.5) | source code
iterator |
selectedVertexInfos(selectionThreshold=0.5) Return an iterator which yields a tuple of the index and position of each point currently selected in the Viewer in turn. | source code
VertexInfo |
anySelectedVertexInfo(selectionThreshold=0.5) Returns a single VertexInfo for a selected point. | source code
iterator |
allNodes() Return an iterator which yields all nodes in the current script. | source code
allNodesWithGeoSelectKnob() | source code
cameraProjectionMatrix(cameraNode) Calculate the projection matrix for the camera based on its knob values. | source code
list of nuke.math.Vector2 |
projectPoints(camera=None, points=None) Project the given 3D point through the camera to get 2D pixel coordinates. | source code
nuke.math.Vector2 |
projectPoint(camera=None, point=None) Project the given 3D point through the camera to get 2D pixel coordinates. | source code
iterator yielding nuke.math.Vector2 |
projectSelectedPoints(cameraName='Camera1') Using the specified camera, project all of the selected points into 2D pixel coordinates and return their locations. | source code
None |
addSnapFunc(label, func) Add a new snapping function to the list. | source code
None |
callSnapFunc(nodeToSnap=None) Call the snapping function on a node. | source code

Variables | [hide private]
| snapFuncs = ``[``]``
| __package__ = ``'``nukescripts``'``

Function Details | [hide private]

### translateToPoints(nodeToSnap) | source code
Translate the specified node to the average position of the current vertex selection in the active viewer. The nodeToSnap must contain a 'translate' knob and the transform order must be 'SRT'. Parameters: `nodeToSnap` (nuke.Node) - Node to translate

### translateRotateToPoints(nodeToSnap) | source code
Translate the specified node to the average position of the current vertex selection in the active viewer and rotate to the orientation of the (mean squares) best fit plane for the selection. The nodeToSnap must contain 'translate' and 'rotate' knobs, the transform order must be 'SRT' and the rotation order must be 'ZXY'. Parameters: `nodeToSnap` (nuke.Node) - Node to translate and rotate

### translateRotateScaleToPoints(nodeToSnap) | source code
Translate the specified node to the average position of the current vertex selection in the active viewer, rotate to the orientation of the (mean squares) best fit plane for the selection and scale to the extents of the selection. The nodeToSnap must contain 'translate', 'rotate' and 'scale' knobs, the transform order must be 'SRT' and the rotation order must be 'ZXY'. Parameters: `nodeToSnap` (nuke.Node) - Node to translate, rotate and scale

### calcAveragePosition(vertexSelection) | source code
Calculate the average position of all points. Parameters: `points` - An iterable sequence of _nukemath.Vector3 objects. Returns: A _nukemath.Vector3 containing the average of all the points.

### planeRotation(tri, norm=None) | source code
Calculate the rotations around the X, Y and Z axes that will align a plane perpendicular to the Z axis with the given triangle. Parameters: `tri` - A list or tuple of 3 _nukemath.Vector3 objects. The 3 points must describe the plane (i.e. they must not be collinear). Returns: A _nukemath.Vector3 object where the x coordinate is the angle of rotation around the x axis and so on. Raises: `ValueError` - if the three points are collinear.

### anySelectedPoint(selectionThreshold=0.5) | source code
Return a selected point from the active viewer or the first viewer with a selection. The selectionThreshold parameter is used when working with a soft selection. Only points with a selection level >= the selection threshold will be returned by this function. Returns: _nukemath.Vector3

### selectedPoints(selectionThreshold=0.5) | source code
Return an iterator which yields the position of every point currently selected in the Viewer in turn. The selectionThreshold parameter is used when working with a soft selection. Only points with a selection level >= the selection threshold will be returned by this function. Returns: iterator

### selectedVertexInfos(selectionThreshold=0.5) | source code
Return an iterator which yields a tuple of the index and position of each point currently selected in the Viewer in turn. The selectionThreshold parameter is used when working with a soft selection. Only points with a selection level >= the selection threshold will be returned by this function. Returns: iterator

### anySelectedVertexInfo(selectionThreshold=0.5) | source code
Returns a single VertexInfo for a selected point. If more than one point is selected, one of them will be chosen arbitrarily. The selectionThreshold parameter is used when working with a soft selection. Only points with a selection level >= the selection threshold will be returned by this function. Returns: VertexInfo

### allNodes() | source code
Return an iterator which yields all nodes in the current script. This includes nodes inside groups. They will be returned in top-down, depth-first order. Returns: iterator

### projectPoints(camera=None, points=None) | source code
Project the given 3D point through the camera to get 2D pixel coordinates. Parameters: `camera` - The Camera node or name of the Camera node to use for projecting the point. `points` - A list or tuple of either nuke.math.Vector3 or of list/tuples of three float values representing the 3D points. Returns: list of nuke.math.Vector2 Raises: `ValueError` - If camera or point is invalid.

### projectPoint(camera=None, point=None) | source code
Project the given 3D point through the camera to get 2D pixel coordinates. Parameters: `camera` - The Camera node or name of the Camera node to use for projecting the point. `point` - A nuke.math.Vector3 or of list/tuple of three float values representing the 3D point. Returns: nuke.math.Vector2 Raises: `ValueError` - If camera or point is invalid.

### projectSelectedPoints(cameraName='Camera1') | source code
Using the specified camera, project all of the selected points into 2D pixel coordinates and return their locations. Parameters: `cameraName` - Optional name of the Camera node to use for projecting the points. If omitted, will look for a node called Camera1. Returns: iterator yielding nuke.math.Vector2

### addSnapFunc(label, func) | source code
Add a new snapping function to the list. The label parameter is the text that will appear in (eg.) an Enumeration_Knob for the function. It cannot be the same as any existing snap function label (if it is, the function will abort without changing anything). The func parameter is the snapping function. It must be a callable object taking a single parameter: the node to perform the snapping on. Returns: None

### callSnapFunc(nodeToSnap=None) | source code
Call the snapping function on a node. The nodeToSnap parameter is optional. If it's not specified, or is None, we use the result of nuke.thisNode() instead. The node must have an Enumeration_Knob called "snapFunc" which selects the snapping function to call. Returns: None