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

Refactor silhouette from add_mesh #1689

Merged

Conversation

MatthewFlamm
Copy link
Contributor

@MatthewFlamm MatthewFlamm commented Sep 23, 2021

Overview

add_mesh is a monster and the logic is very complex depending on combinations of input parameters. I think it is best if we can extract out as much logic as possible into separable pieces. Silhouette functionality is completely separate from all the other pieces. This PR separates out the silhouette functionality into it's own method, that can be called on it's own if desired. add_mesh calls this new method.

Details

My personal style preference would be to have the below for any functionality like this:

plotter.add_mesh(mesh)
plotter.add_silhouette(mesh)

This makes it more clear that we have two separate actors being added to the scene. I'm not sure if the current state has problems. If the mesh is updated, will the silhouette also update? In any case, separating out the logic is the first step.

TODO:

  • Docstring
  • Examples for docstring where new method is called directly
  • Test where new method is called directly

@codecov
Copy link

codecov bot commented Sep 23, 2021

Codecov Report

Merging #1689 (b380b44) into main (9d05d4d) will decrease coverage by 0.00%.
The diff coverage is 96.42%.

@@            Coverage Diff             @@
##             main    #1689      +/-   ##
==========================================
- Coverage   92.59%   92.59%   -0.01%     
==========================================
  Files          71       71              
  Lines       13864    13870       +6     
==========================================
+ Hits        12838    12843       +5     
- Misses       1026     1027       +1     

@MatthewFlamm MatthewFlamm marked this pull request as ready for review September 23, 2021 18:34
@akaszynski
Copy link
Member

Still failing due to:

WARNING: [numpydoc] Validation warnings while processing docstring for 'pyvista.Plotter.add_silhouette':
PR07: Parameter "mesh" has no description
RT01: No Returns section found

+100 for cleaning up add_mesh. I've done a little bit in #1685

Copy link
Member

@akaszynski akaszynski left a comment

Choose a reason for hiding this comment

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

Nice work! I made some minor changes to get the links to build correctly, but otherwise LGTM.

@akaszynski akaszynski merged commit b7ee961 into pyvista:main Sep 25, 2021
@tkoyama010 tkoyama010 added the enhancement Changes that enhance the library label Oct 13, 2021
@MatthewFlamm MatthewFlamm deleted the refactor-sillhouette-from-add_mesh branch November 24, 2021 18:10
@akaszynski akaszynski mentioned this pull request Jan 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Changes that enhance the library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants