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

Show offset planes in the scene, let user select them #4481

Merged
merged 36 commits into from
Nov 18, 2024

Conversation

franknoirot
Copy link
Collaborator

@franknoirot franknoirot commented Nov 13, 2024

Closes #4468.

Implements

  1. Updates wasm-lib's implementation of offset_plane_inner to also call an engine-side effect to show a visible gray plane in the scene, and return the whole plane instead of just PlaneData
  2. Updates start_sketch_on_inner's implementation to accept full Plane definitions in addition to PlaneData.
  3. Hooks the returned plane into the ArtifactGraph on the client side
  4. Hooks the new additional planes in the ArtifactGraph to be available for selection while attempting to sketch-on-face.
  5. Adds a new ArtifactGraph test for the planes' addition, and a new Playwright test for selecting these planes for sketching.

Gotchas

  1. Because we exclude plane type geometry from our default selection filter, these are not yet selectable on their own, so the user flow of "select plane -> start sketch" is not yet available.
  2. These planes are always visible, and because of our limited notion of transparency, this will likely make models that use offset planes much more visibly noisy until we have a feature tree (Add a feature tree representation to the "code" pane #4274) that allows toggling planes' visibility. I would support a request to make these planes hidden except for during sketch plane selection (the "Sketch no face" state) until we have the feature tree implemented, or hiding offset planes that have sketches on them?

Future improvements

  1. Selection behavior mentioned above
  2. Visibility toggling mentioned above
  3. Remove the engine-side scaling behavior of planes that these share with default planes

Demo

Screenshare.-.2024-11-13.1_24_12.PM-compressed.mp4

Copy link

qa-wolf bot commented Nov 13, 2024

QA Wolf here! As you write new code it's important that your test coverage is keeping up.
Click here to request test coverage for this PR!

Copy link

vercel bot commented Nov 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
modeling-app ✅ Ready (Inspect) Visit Preview Nov 18, 2024 8:56pm

src/lang/modifyAst.ts Outdated Show resolved Hide resolved
Comment on lines +252 to +254
if (cmd.type === 'make_plane' && range[1] !== 0) {
// If we're calling `make_plane` and the code range doesn't end at `0`
// it's not a default plane, but a custom one from the offsetPlane standard library function
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems pretty hacky. Can we add a flag when we create the default planes that indicate what they are?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree. I was going to say something that seems like a bit of a heuristic, which I'm not a fan of. The only reason why I didn't say anything is because I think this condition will be valid for a long time to come. Maybe add a comment on top that it's a heuristic?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh yeah I just remembered that we store the IDs of the default planes in the engine command manager! I can verify that the ID is none of those; would that be concrete enough?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah but that would bring a dependency into ArtifactGraph. It does kinda lead to the question: why aren't we storing the default planes in the ArtifactGraph?

Copy link
Collaborator

@jtran jtran Nov 18, 2024

Choose a reason for hiding this comment

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

Let's make an issue for this to remember to revisit later.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@nadr0
Copy link
Collaborator

nadr0 commented Nov 13, 2024

I ran the branch locally and tested out the new feature. It worked well locally. Left some comments in the code.

Copy link
Contributor

@lf94 lf94 left a comment

Choose a reason for hiding this comment

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

Looks good! Nothing glaring. All nits.

src/wasm-lib/kcl/src/std/sketch.rs Outdated Show resolved Hide resolved
src/lang/modifyAst.ts Outdated Show resolved Hide resolved
This avoids the autocompletion issue I was having.
Copy link

codecov bot commented Nov 18, 2024

Codecov Report

Attention: Patch coverage is 76.03306% with 29 lines in your changes missing coverage. Please review.

Project coverage is 86.05%. Comparing base (fbb7b08) to head (3d3f7db).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
src/wasm-lib/kcl/src/std/args.rs 36.84% 24 Missing ⚠️
src/wasm-lib/kcl/src/lsp/tests.rs 62.50% 3 Missing ⚠️
src/wasm-lib/kcl/src/std/planes.rs 95.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4481      +/-   ##
==========================================
- Coverage   86.05%   86.05%   -0.01%     
==========================================
  Files          80       80              
  Lines       28762    28860      +98     
==========================================
+ Hits        24751    24835      +84     
- Misses       4011     4025      +14     
Flag Coverage Δ
wasm-lib 86.05% <76.03%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@franknoirot franknoirot merged commit 24bc4fc into main Nov 18, 2024
32 of 33 checks passed
@franknoirot franknoirot deleted the franknoirot/4468/offset-planes-visible branch November 18, 2024 21:25
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.

Show offsetPlanes as selectable planes in the scene
5 participants