-
Notifications
You must be signed in to change notification settings - Fork 0
Brush
Represents a brush defined by a list of faces. A brush is a convex polyhedron defined by the intersection of half-spaces.
Attribute | Type | Description | Note |
---|---|---|---|
id |
int |
The unique identifier for the brush | |
faces |
list[Face] |
The faces that compose the brush | |
face_counter |
int |
Counter for assigning unique IDs to faces | |
_vertices |
list[Point] |
Cached list of vertices for the brush | To get value use vertices property instead |
_origin |
Optional[Point] |
Cached centroid of the brush | To get value use origin property instead |
Constructor method for the
Brush
class.
b = Brush()
# faces = [face1, face2, face3, face4...]
b = Brush(faces)
Add face(es) to the brush.
# Add faces individually
b.add_face(face1)
b.add_face(face2)
# Add all faces at once
b.add_face(face1, face2)
Return the origin of the bounding box enclosing the brush.
bbox_center = b.bounding_box_origin()
Return the origin (centroid) of the brush.
brush_origin = b.centroid()
Create a deep copy of the brush.
b_copy = b.copy()
Check if any brush face has a specific texture.
if b.has_texture('AAATRIGGER', exact=True)
# ...
Move the brush by specified offsets.
b.move_by(10,10,10)
Move the brush to a specific coordinate.
b.move_to(256,256,0, centroid=True, bbox=False)
Replace a texture on faces that have the specified texture.
b.replace_texture('black', 'null')
Rotate the brush around the X-axis.
b.rotate_x(45)
Rotate the brush around the Y-axis.
b.rotate_y(45)
Rotate the brush around the Z-axis.
b.rotate_z(45)
Rotate the brush around the XYZ axes.
b.rotate_xyz(45,45,45)
Rotate the brush around a specified axis.
b.rotate_around_axis(45, Vector3(1,1,1))
Set a new texture for all faces in the brush.
b.set_texture('null')
Return the vertices of the brush.
Return a string representation of the brush.
Return an iterator over the faces of the brush.
for face in b:
# ...
Get a list of vertices of the brush.
brush_verts = b.vertices
Get the origin (centroid) of the brush.
brush_origin = b.origin
Get a list of edges of the brush.
brush_edges = b.edges