Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Artist refactoring #1175

Merged
merged 69 commits into from
Sep 19, 2023
Merged

Artist refactoring #1175

merged 69 commits into from
Sep 19, 2023

Conversation

tomvanmele
Copy link
Member

The goal is to simplify working with artists and to make the use of colors more transparent...

What type of change is this?

  • Bug fix in a backwards-compatible manner.
  • New feature in a backwards-compatible manner.
  • Breaking change: bug fix or new feature that involve incompatible API changes.
  • Other (e.g. doc update, configuration, etc)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I added a line to the CHANGELOG.md file in the Unreleased section under the most fitting heading (e.g. Added, Changed, Removed).
  • I ran all tests on my computer and it's all green (i.e. invoke test).
  • I ran lint on my computer and there are no errors (i.e. invoke lint).
  • I added new functions/classes and made them available on a second-level import, e.g. compas.datastructures.Mesh.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary documentation (if appropriate)

@tomvanmele tomvanmele marked this pull request as ready for review September 14, 2023 21:14
Copy link
Member

@gonzalocasas gonzalocasas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a pretty large PR, so my review is rather superficial, but besides a bunch of minor comments, I don't see any big issues, LGTM!

Comment on lines +1 to +12
from compas.geometry import NurbsCurve
from compas.artists import Artist

Artist.clear()

curve = NurbsCurve.from_points([[0, 0, 0], [3, 3, 6], [6, -3, -3], [9, 0, 0]])

artist = Artist(curve)
artist.color = (0.0, 1.0, 0.0)
artist.draw()

Artist.redraw()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

artist.draw_vertices()
artist.draw_edges()
artist.draw_faces(color={face: Color.pink() for face in mesh.face_sample(size=17)})
#artist.draw_vertexnormals()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#artist.draw_vertexnormals()

delete?


point = Point(0, 0, 0)
artist = Artist(point)
# artist.color = (0.0, 1.0, 0.0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# artist.color = (0.0, 1.0, 0.0)

delete? or uncomment?

Comment on lines +11 to +19
# artist.color = (0.0, 1.0, 0.0)

# for i in range(11):
# artist.draw(
# color=Color.from_i(i / 10),
# point=[i, 0, 0],
# show_point=True
# )

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, delete or uncomment?

setup.py Show resolved Hide resolved
Comment on lines 273 to 275
# if not self._transformation:
# if hasattr(self._item, "transformation"):
# self._transformation = self._item.transformation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# if not self._transformation:
# if hasattr(self._item, "transformation"):
# self._transformation = self._item.transformation

delete?

src/compas/artists/descriptors/colordict.py Outdated Show resolved Hide resolved
from .color import Color


class ColorDict(Data):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it worth it to inherit from UserDict instead of implementing our own dict logic? Not a lot, but it would shave off a few lines of code that can be used directly from that class

@@ -282,7 +282,7 @@ def from_three_colors(cls, c1, c2, c3):
return cls(colors)

@classmethod
def from_rgb(cls):
def from_rgb(cls, n=256):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add n to the docstrings, please

src/compas_rhino/conversions/meshes.py Show resolved Hide resolved
@tomvanmele tomvanmele merged commit 4b50dcb into main Sep 19, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants