Skip to content

Commit

Permalink
fix: SetColors expects an System.Array, loop instead
Browse files Browse the repository at this point in the history
  • Loading branch information
tetov committed Aug 7, 2024
1 parent 82af17e commit 5b007fd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

* Replaced use of `Rhino.Geometry.VertexColors.SetColors` with a for loop and `SetColor` in `compas_ghpyton` since the former requires a `System.Array`.
* Changed the `__str__` of `compas.geometry.Frame`, `compas.geometry.Plane`, `compas.geometry.Polygon`, `compas.geometry.Polyhedron`, `compas.geometry.Quaternion` to use a limited number of decimals (determined by `Tolerance.PRECISION`). Note: `__repr__` will instead maintain full precision.
* Changed the `__str__` of `compas.geometry.Pointcloud` to print total number of points instead of the long list of points. Note: `__repr__` will still print all the points with full precision.
* Fixed bug in `Pointcloud.from_box()`.
Expand Down
6 changes: 4 additions & 2 deletions src/compas_ghpython/drawing.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,10 @@ def draw_mesh(vertices, faces, color=None, vertex_normals=None, texture_coordina

if color:
count = len(mesh.Vertices)
colors = [rs.coercecolor(color) for i in range(count)]
mesh.VertexColors.SetColors(colors)
color = rs.CreateColor(color)

for i in range(count):
mesh.VertexColors.SetColor(i, color.R, color.G, color.B)

return mesh

Expand Down

0 comments on commit 5b007fd

Please sign in to comment.