use docstrings instead of hash comments

This commit is contained in:
David Rose 2006-05-12 23:04:52 +00:00
parent ae9d5a6f77
commit 2c049a474d

View File

@ -3,7 +3,7 @@ import types
class Rope(NodePath): class Rope(NodePath):
""" """
This class defines a Nurbs curve whose control vertices are This class defines a NURBS curve whose control vertices are
defined based on points relative to one or more nodes in space, so defined based on points relative to one or more nodes in space, so
that the "rope" will animate as the nodes move around. It uses that the "rope" will animate as the nodes move around. It uses
the C++ RopeNode class to achieve fancy rendering effects like the C++ RopeNode class to achieve fancy rendering effects like
@ -20,33 +20,34 @@ class Rope(NodePath):
self.name = name self.name = name
def setup(self, order, verts, knots = None): def setup(self, order, verts, knots = None):
# This must be called to define the shape of the curve """This must be called to define the shape of the curve
# initially, and may be called again as needed to adjust the initially, and may be called again as needed to adjust the
# curve's properties. curve's properties.
# order must be either 1, 2, 3, or 4, and is one more than the order must be either 1, 2, 3, or 4, and is one more than the
# degree of the curve; most NURBS curves are order 4. degree of the curve; most NURBS curves are order 4.
# verts is a list of (NodePath, point) tuples, defining the verts is a list of (NodePath, point) tuples, defining the
# control vertices of the curve. For each control vertex, the control vertices of the curve. For each control vertex, the
# NodePath may refer to an arbitrary node in the scene graph, NodePath may refer to an arbitrary node in the scene graph,
# indicating the point should be interpreted in the coordinate indicating the point should be interpreted in the coordinate
# space of that node (and it will automatically move when the space of that node (and it will automatically move when the
# node is moved), or it may be the empty NodePath or None to node is moved), or it may be the empty NodePath or None to
# indicate the point should be interpreted in the coordinate indicate the point should be interpreted in the coordinate
# space of the Rope itself. Each point value may be either a space of the Rope itself. Each point value may be either a
# 3-tuple or a 4-tuple (or a VBase3 or VBase4). If it is a 3-tuple or a 4-tuple (or a VBase3 or VBase4). If it is a
# 3-component vector, it represents a 3-d point in space; a 3-component vector, it represents a 3-d point in space; a
# 4-component vector represents a point in 4-d homogeneous 4-component vector represents a point in 4-d homogeneous
# space; that is to say, a 3-d point and an additional weight space; that is to say, a 3-d point and an additional weight
# factor (which should have been multiplied into the x y z factor (which should have been multiplied into the x y z
# components). components).
# knots is optional. If specified, it should be a list of knots is optional. If specified, it should be a list of
# floats, and should be of length len(verts) + order. If it floats, and should be of length len(verts) + order. If it
# is omitted, a default knot string is generated that consists is omitted, a default knot string is generated that consists
# of the first (order - 1) and last (order - 1) values the of the first (order - 1) and last (order - 1) values the
# same, and the intermediate values incrementing by 1. same, and the intermediate values incrementing by 1.
"""
self.order = order self.order = order
self.verts = verts self.verts = verts
@ -55,9 +56,9 @@ class Rope(NodePath):
self.recompute() self.recompute()
def recompute(self): def recompute(self):
# Recomputes the curve after its properties have changed. """Recomputes the curve after its properties have changed.
# Normally it is not necessary for the user to call this Normally it is not necessary for the user to call this
# directly. directly."""
if not self.showRope: if not self.showRope:
return return
@ -83,9 +84,9 @@ class Rope(NodePath):
self.ropeNode.resetBound(self) self.ropeNode.resetBound(self)
def getPoints(self, len): def getPoints(self, len):
# Returns a list of len points, evenly distributed in """Returns a list of len points, evenly distributed in
# parametric space on the rope, in the coordinate space of the parametric space on the rope, in the coordinate space of the
# Rope itself. Rope itself."""
result = self.curve.evaluate(self) result = self.curve.evaluate(self)
numPts = len numPts = len