panda3d.core.RopeNode

class RopeNode

Bases: PandaNode

This class draws a visible representation of the NURBS curve stored in its NurbsCurveEvaluator. It automatically recomputes the curve every frame.

This is not related to NurbsCurve, CubicCurveseg or any of the ParametricCurve-derived objects in this module. It is a completely parallel implementation of NURBS curves, and will probably eventually replace the whole ParametricCurve class hierarchy.

Inheritance diagram

Inheritance diagram of RopeNode

__init__(name: str) → None
setCurve(curve: NurbsCurveEvaluator) → None

Sets the particular curve represented by the RopeNode.

getCurve() → NurbsCurveEvaluator

Returns the curve represented by the RopeNode.

Return type

NurbsCurveEvaluator

setRenderMode(render_mode: RenderMode) → None

Specifies the method used to render the rope. The simplest is RM_thread, which just draws a one-pixel line segment.

getRenderMode() → RenderMode

Returns the method used to render the rope. See setRenderMode().

Return type

RenderMode

setUvMode(uv_mode: UVMode) → None

Specifies the algorithm to use to generate UV’s for the rope.

getUvMode() → UVMode

Returns the algorithm to use to generate UV’s for the rope.

Return type

UVMode

setUvDirection(u_dominant: bool) → None

Specify true to vary the U coordinate down the length of the rope, or false to vary the V coordinate.

getUvDirection() → bool

Returns true if the rope runs down the U coordinate of the texture, or false if it runs down the V coordinate.

setUvScale(scale: float) → None

Specifies an additional scaling factor to apply to generated UV’s along the rope. This scale factor is applied in whichever direction is along the rope, as specified by setUvDirection().

getUvScale() → float

Returns the scaling factor to apply to generated UV’s for the rope.

setNormalMode(normal_mode: NormalMode) → None

Specifies the kind of normals to generate for the rope. This is only applicable when the RenderMode is set to RM_tube; in the other render modes, normals are never generated.

getNormalMode() → NormalMode

Returns the kind of normals to generate for the rope. This is only applicable when the RenderMode is set to RM_tube.

Return type

NormalMode

setTubeUp(tube_up: LVector3) → None

Specifies a normal vector, generally perpendicular to the main axis of the starting point of the curve, that controls the “top” of the curve, when RenderMode is RM_tube. This is used to orient the vertices that make up the tube. If this vector is too nearly parallel with the starting direction of the curve, there may be a tendency for the whole tube to gimble-lock around its primary axis.

getTubeUp() → LVector3

Returns the normal vector used to control the “top” of the curve, when RenderMode is RM_tube. See setTubeUp().

Return type

LVector3

setUseVertexColor(flag: bool) → None

Sets the “use vertex color” flag. When this is true, the R, G, B, A vertex color is assumed to be stored as the dimensions n + 0, n + 1, n + 2, n + 3, respectively, of the extended vertex values, where n is the value returned by getVertexColorDimension(). Use NurbsCurveEvaluator.setExtendedVertex() to set these values.

getUseVertexColor() → bool

Returns the “use vertex color” flag. See setUseVertexColor().

static getVertexColorDimension() → int

Returns the numeric extended dimension in which the color components should be found. See NurbsCurveEvaluator.setExtendedVertex().

The color components will be expected at (n, n + 1, n + 2, n + 3).

setNumSubdiv(num_subdiv: int) → None

Specifies the number of subdivisions per cubic segment (that is, per unique knot value) to draw in a fixed uniform tesselation of the curve.

getNumSubdiv() → int

Returns the number of subdivisions per cubic segment to draw. See setNumSubdiv().

setNumSlices(num_slices: int) → None

Specifies the number of radial subdivisions to make if RenderMode is RM_tube. It is ignored in the other render modes.

Increasing this number increases the roundness of a cross-section of the tube. The minimum value for a dimensional tube is 3; setting it to 2 will get you a thin piece of tape (which is similar to RM_billboard, except it won’t rotate to face the camera).

getNumSlices() → int

Returns the number of radial subdivisions to make if RenderMode is RM_tube. It is ignored in the other render modes. See setNumSlices().

setUseVertexThickness(flag: bool) → None

Sets the “use vertex thickness” flag. When this is true, the vertex thickness is assumed to be stored as the dimension getVertexThicknessDimension(), of the extended vertex values. Use NurbsCurveEvaluator.setExtendedVertex() to set these values.

In this mode, the overall thickness is also applied as a scale to the vertex thickness. Not all render modes support vertex thickness.

getUseVertexThickness() → bool

Returns the “use vertex thickness” flag. See setUseVertexThickness().

static getVertexThicknessDimension() → int

Returns the numeric extended dimension in which the thickness component should be found. See NurbsCurveEvaluator.setExtendedVertex().

setThickness(thickness: float) → None

Specifies the thickness of the rope, in pixels or in spatial units, depending on the render mode. See setRenderMode().

The thickness may also be specified on a per-vertex basis. See setUseVertexThickness().

getThickness() → float

Returns the thickness of the rope. See setThickness().

setMatrix(matrix: LMatrix4) → None

Specifies an optional matrix which is used to transform each control vertex after it has been transformed into the RopeNode’s coordinate space, but before the polygon vertices are generated.

clearMatrix() → None

Resets the node’s matrix to identity. See setMatrix().

hasMatrix() → bool

Returns true if the node has a matrix set, false otherwise. See setMatrix().

getMatrix() → LMatrix4

Returns the optional matrix which is used to transform each control vertex after it has been transformed into the RopeNode’s coordinate space, but before the polygon vertices are generated.

Return type

LMatrix4

resetBound(rel_to: NodePath) → None

Recomputes the bounding volume. This is normally called automatically, but it must occasionally be called explicitly when the curve has changed properties outside of this node’s knowledge.

static getClassType() → TypeHandle
Return type

TypeHandle

property curve
Getter

Returns the curve represented by the RopeNode.

Setter

Sets the particular curve represented by the RopeNode.

Return type

NurbsCurveEvaluator

property render_mode
Getter

Returns the method used to render the rope. See setRenderMode().

Setter

Specifies the method used to render the rope. The simplest is RM_thread, which just draws a one-pixel line segment.

Return type

RenderMode

property uv_mode
Getter

Returns the algorithm to use to generate UV’s for the rope.

Setter

Specifies the algorithm to use to generate UV’s for the rope.

Return type

UVMode

property uv_direction
Getter

Returns true if the rope runs down the U coordinate of the texture, or false if it runs down the V coordinate.

Setter

Specify true to vary the U coordinate down the length of the rope, or false to vary the V coordinate.

Return type

bool

property uv_scale
Getter

Returns the scaling factor to apply to generated UV’s for the rope.

Setter

Specifies an additional scaling factor to apply to generated UV’s along the rope. This scale factor is applied in whichever direction is along the rope, as specified by setUvDirection().

Return type

float

property normal_mode
Getter

Returns the kind of normals to generate for the rope. This is only applicable when the RenderMode is set to RM_tube.

Setter

Specifies the kind of normals to generate for the rope. This is only applicable when the RenderMode is set to RM_tube; in the other render modes, normals are never generated.

Return type

NormalMode

property tube_up
Getter

Returns the normal vector used to control the “top” of the curve, when RenderMode is RM_tube. See setTubeUp().

Setter

Specifies a normal vector, generally perpendicular to the main axis of the starting point of the curve, that controls the “top” of the curve, when RenderMode is RM_tube. This is used to orient the vertices that make up the tube. If this vector is too nearly parallel with the starting direction of the curve, there may be a tendency for the whole tube to gimble-lock around its primary axis.

Return type

LVector3

property use_vertex_color
Getter

Returns the “use vertex color” flag. See setUseVertexColor().

Setter

Sets the “use vertex color” flag. When this is true, the R, G, B, A vertex color is assumed to be stored as the dimensions n + 0, n + 1, n + 2, n + 3, respectively, of the extended vertex values, where n is the value returned by getVertexColorDimension(). Use NurbsCurveEvaluator.setExtendedVertex() to set these values.

Return type

bool

property vertex_color_dimension

Returns the numeric extended dimension in which the color components should be found. See NurbsCurveEvaluator.setExtendedVertex().

The color components will be expected at (n, n + 1, n + 2, n + 3).

Return type

int

property num_subdiv
Getter

Returns the number of subdivisions per cubic segment to draw. See setNumSubdiv().

Setter

Specifies the number of subdivisions per cubic segment (that is, per unique knot value) to draw in a fixed uniform tesselation of the curve.

Return type

int

property num_slices
Getter

Returns the number of radial subdivisions to make if RenderMode is RM_tube. It is ignored in the other render modes. See setNumSlices().

Setter

Specifies the number of radial subdivisions to make if RenderMode is RM_tube. It is ignored in the other render modes.

Increasing this number increases the roundness of a cross-section of the tube. The minimum value for a dimensional tube is 3; setting it to 2 will get you a thin piece of tape (which is similar to RM_billboard, except it won’t rotate to face the camera).

Return type

int

property use_vertex_thickness
Getter

Returns the “use vertex thickness” flag. See setUseVertexThickness().

Setter

Sets the “use vertex thickness” flag. When this is true, the vertex thickness is assumed to be stored as the dimension getVertexThicknessDimension(), of the extended vertex values. Use NurbsCurveEvaluator.setExtendedVertex() to set these values.

In this mode, the overall thickness is also applied as a scale to the vertex thickness. Not all render modes support vertex thickness.

Return type

bool

property vertex_thickness_dimension

Returns the numeric extended dimension in which the thickness component should be found. See NurbsCurveEvaluator.setExtendedVertex().

Return type

int

property thickness
Getter

Returns the thickness of the rope. See setThickness().

Setter

Specifies the thickness of the rope, in pixels or in spatial units, depending on the render mode. See setRenderMode().

The thickness may also be specified on a per-vertex basis. See setUseVertexThickness().

Return type

float

property matrix
Getter

Returns the optional matrix which is used to transform each control vertex after it has been transformed into the RopeNode’s coordinate space, but before the polygon vertices are generated.

Setter

Specifies an optional matrix which is used to transform each control vertex after it has been transformed into the RopeNode’s coordinate space, but before the polygon vertices are generated.

Return type

LMatrix4

enum RenderMode
enumerator RM_thread = 0

Render the rope as a one-pixel thread using a linestrip.

enumerator RM_tape = 1

Render the rope as a triangle strip oriented to be perpendicular to the tube_up vector.

enumerator RM_billboard = 2

Render the rope as a triangle strip oriented to be perpendicular to the view vector.

enumerator RM_tube = 3

Render the rope as a hollow tube extruded along its length.

enum UVMode
enumerator UV_none = 0

Don’t generate UV’s along the curve.

enumerator UV_parametric = 1

Generate UV’s based on the parametric coordinates along the curve.

enumerator UV_distance = 2

Generate UV’s in proportion to spatial distance along the curve, by using the distance function to compute the length of each segment.

enumerator UV_distance2 = 3

As above, but don’t bother to take the square root of each segment. The distance is then in proportion to the sum-of-squares of the segments along the rope. If the segments are similar in length, this approximates the proportion of UV_distance while avoiding hundreds of square root operations.

enum NormalMode
enumerator NM_none = 0

Don’t generate normals.

enumerator NM_vertex = 1

Generate vertex (smooth-shaded) normals.