From cce46b5edb772fe37b5edfd9b963e5da2d3de4b9 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 15 Dec 2022 20:23:55 +0100 Subject: [PATCH] motiontrail: Set `start_color` and `end_color` in `add_vertex()` --- direct/src/motiontrail/MotionTrail.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/direct/src/motiontrail/MotionTrail.py b/direct/src/motiontrail/MotionTrail.py index cdc1c4c9cc..ab5f2d30e3 100644 --- a/direct/src/motiontrail/MotionTrail.py +++ b/direct/src/motiontrail/MotionTrail.py @@ -246,7 +246,8 @@ class MotionTrail(NodePath, DirectObject): return Task.cont - def add_vertex(self, vertex_id, vertex_function=None, context=None): + def add_vertex(self, vertex_id, vertex_function=None, context=None, *, + start_color=(1.0, 1.0, 1.0, 1.0), end_color=(0.0, 0.0, 0.0, 1.0)): """This must be called repeatedly to define the polygon that forms the cross-section of the generated motion trail geometry. The first argument is a user-defined vertex identifier, the second is a function @@ -266,6 +267,8 @@ class MotionTrail(NodePath, DirectObject): motion_trail_vertex.vertex = Vec4(vertex_id) else: motion_trail_vertex = MotionTrailVertex(vertex_id, vertex_function, context) + motion_trail_vertex.start_color = Vec4(start_color) + motion_trail_vertex.end_color = Vec4(end_color) total_vertices = len(self.vertex_list) self.vertex_list[total_vertices : total_vertices] = [motion_trail_vertex]