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

fix point cloud bugs #4401

Merged
merged 10 commits into from
May 21, 2024
Merged

fix point cloud bugs #4401

merged 10 commits into from
May 21, 2024

Conversation

sashankaryal
Copy link
Contributor

@sashankaryal sashankaryal commented May 20, 2024

What changes are proposed in this pull request?

  1. Add grid configurator
    grid

  2. Fix rgb shader not responding to point size change

  3. Center points geometry

  4. Use points.clone() to do a shallow copy so that point clouds with same URL are treated as different copies in the scene graph

How is this patch tested? If it is not, please explain why.

Manual testing

Summary by CodeRabbit

  • New Features

    • Introduced GridConfigurator component for enhanced grid settings customization.
    • Added new grid settings with various configurable parameters.
  • Improvements

    • Updated PopoutSectionTitle component styling for better alignment and spacing.
    • Converted ActionPopOver component to use forwardRef for improved ref forwarding.
    • Enhanced Gizmos component with dynamic grid settings.
  • Bug Fixes

    • Replaced useMemo with useEffect in Pcd component for better point cloud data handling.
  • Performance

    • Increased maximum value for pointSize in point cloud material controls from 20 to 50.
  • Chores

    • Updated Docker build script to exclude unnecessary directories and build the screenshot Docker image.

@sashankaryal sashankaryal self-assigned this May 20, 2024
Copy link
Contributor

coderabbitai bot commented May 20, 2024

Important

Review Skipped

Review was skipped due to path filters

Files ignored due to path filters (2)
  • e2e-pw/src/oss/specs/3d/fo3d-pcd-stl.spec.ts-snapshots/scene-chromium-darwin.png is excluded by !**/*.png, !**/*.png
  • e2e-pw/src/oss/specs/3d/fo3d-pcd-stl.spec.ts-snapshots/scene-chromium-linux.png is excluded by !**/*.png, !**/*.png

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The recent updates introduce significant enhancements to the looker-3d package, including new grid configuration options, updated component styling, and improved state management. Additionally, the PopoutSectionTitle component's styling was refined, and Docker image building scripts were optimized. These changes collectively improve the user interface, usability, and maintainability of the codebase.

Changes

File Path Change Summary
app/packages/components/src/components/PopoutSectionTitle/PopoutSectionTitle.tsx Added flexbox styling for better alignment and spacing in the PopoutSectionTitle component.
app/packages/looker-3d/src/action-bar/ToggleGridHelper.tsx Introduced a GridConfigurator component and updated ToggleGridHelper with new state management and UI elements.
app/packages/looker-3d/src/action-bar/shared.tsx Converted ActionPopOver to use forwardRef for better ref forwarding.
app/packages/looker-3d/src/action-bar/style.module.css Added new CSS classes for grid configuration styling.
app/packages/looker-3d/src/fo3d/Gizmos.tsx Updated grid-related calculations and state management using Recoil atoms.
app/packages/looker-3d/src/fo3d/point-cloud/Pcd.tsx Replaced useMemo with useEffect for point cloud data handling.
app/packages/looker-3d/src/hooks/use-pcd-material-controls.ts Increased the maximum pointSize value from 20 to 50.
app/packages/looker-3d/src/state.ts Added new Recoil atoms for grid settings.
e2e-pw/scripts/generate-screenshots-docker-image/build-docker-image.sh Updated script to exclude additional directories and added a Docker image build step.

In the realm of code, where changes dance,
New features bloom, enhancing chance.
With grids and styles, and Docker's might,
The future of apps shines ever bright.
Flex and atoms, all in line,
A rabbit's joy in every sign. 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@sashankaryal sashankaryal requested review from ritch and a team May 20, 2024 20:34
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits Files that changed from the base of the PR and between d1b48f2 and 53a8f82.
Files selected for processing (9)
  • app/packages/components/src/components/PopoutSectionTitle/PopoutSectionTitle.tsx (1 hunks)
  • app/packages/looker-3d/src/action-bar/ToggleGridHelper.tsx (1 hunks)
  • app/packages/looker-3d/src/action-bar/shared.tsx (1 hunks)
  • app/packages/looker-3d/src/action-bar/style.module.css (1 hunks)
  • app/packages/looker-3d/src/fo3d/Gizmos.tsx (3 hunks)
  • app/packages/looker-3d/src/fo3d/point-cloud/Pcd.tsx (2 hunks)
  • app/packages/looker-3d/src/fo3d/point-cloud/use-pcd-material.tsx (1 hunks)
  • app/packages/looker-3d/src/hooks/use-pcd-material-controls.ts (1 hunks)
  • app/packages/looker-3d/src/state.ts (1 hunks)
Files skipped from review due to trivial changes (1)
  • app/packages/components/src/components/PopoutSectionTitle/PopoutSectionTitle.tsx
Additional Context Used
Path-based Instructions (7)
app/packages/looker-3d/src/action-bar/shared.tsx (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

app/packages/looker-3d/src/fo3d/point-cloud/Pcd.tsx (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

app/packages/looker-3d/src/hooks/use-pcd-material-controls.ts (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

app/packages/looker-3d/src/state.ts (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

app/packages/looker-3d/src/fo3d/Gizmos.tsx (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

app/packages/looker-3d/src/fo3d/point-cloud/use-pcd-material.tsx (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

app/packages/looker-3d/src/action-bar/ToggleGridHelper.tsx (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

Learnings (1)
app/packages/looker-3d/src/fo3d/Gizmos.tsx (1)
User: sashankaryal
PR: voxel51/fiftyone#4310
File: app/packages/looker-3d/src/fo3d/Gizmos.tsx:110-0
Timestamp: 2024-04-25T21:03:45.341Z
Learning: The grid rendering logic in `Gizmos.tsx` is part of an external component and not directly modifiable within the project's codebase.
Additional comments not posted (8)
app/packages/looker-3d/src/action-bar/shared.tsx (1)

2-15: Ref forwarding implementation in ActionPopOver looks good and follows React best practices.

app/packages/looker-3d/src/action-bar/style.module.css (1)

38-64: CSS changes for grid configuration UI are consistent and well-structured.

app/packages/looker-3d/src/fo3d/point-cloud/Pcd.tsx (1)

35-47: Implementation of point cloud data manipulation using useEffect and useMemo is appropriate. Verify the dependencies to ensure there are no unnecessary re-renders.

Verification successful

The dependencies for useEffect and useMemo in Pcd.tsx appear to be correctly specified. The useMemo hook depends on points_, and the useEffect hook depends on points, which aligns with the expected usage to avoid unnecessary re-renders.

  • useMemo dependency: [points_]
  • useEffect dependency: [points]
Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the dependencies of useEffect and useMemo in Pcd.tsx to ensure optimal performance.

# Test: Search for the useEffect and useMemo usage. Expect: Correct dependencies specified.
rg --type typescript $'useEffect|useMemo' app/packages/looker-3d/src/fo3d/point-cloud/Pcd.tsx

Length of output: 129



Script:

#!/bin/bash
# Description: Verify the dependencies of useEffect and useMemo in Pcd.tsx to ensure optimal performance.

# Test: Search for the useEffect and useMemo usage. Expect: Correct dependencies specified.
rg --type tsx $'useEffect|useMemo' app/packages/looker-3d/src/fo3d/point-cloud/Pcd.tsx

Length of output: 115



Script:

#!/bin/bash
# Description: Verify the dependencies of useEffect and useMemo in Pcd.tsx to ensure optimal performance.

# Test: Search for the useEffect and useMemo usage. Expect: Correct dependencies specified.
rg 'useEffect|useMemo' app/packages/looker-3d/src/fo3d/point-cloud/Pcd.tsx

Length of output: 239

app/packages/looker-3d/src/hooks/use-pcd-material-controls.ts (1)

37-37: Increase of maximum point size to 50 is a useful enhancement for flexibility in visualizations. Consider verifying the performance impact on different devices.

app/packages/looker-3d/src/state.ts (1)

60-96: Introduction of new atoms for grid settings enhances state management capabilities. Ensure consistent usage across components.

app/packages/looker-3d/src/fo3d/Gizmos.tsx (1)

109-137: Use of new grid-related atoms for dynamic grid calculations is appropriate. Verify the correctness of these calculations to ensure accurate grid rendering.

Verification successful

The grid-related atoms (gridCellSizeAtom, gridSectionSizeAtom, gridSizeAtom, isGridInfinitelyLargeAtom, shouldGridFadeAtom) are correctly defined in app/packages/looker-3d/src/state.ts and are appropriately used in Gizmos.tsx. This ensures accurate grid calculations and rendering.

  • gridCellSizeAtom is defined as a number atom.
  • gridSectionSizeAtom is defined as a number atom.
  • isGridInfinitelyLargeAtom is defined as a boolean atom.
  • gridSizeAtom is defined as a number atom.
  • shouldGridFadeAtom is defined as a boolean atom.

These definitions align with their usage in Gizmos.tsx.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the correctness of grid calculations in Gizmos.tsx to ensure accurate grid rendering.

# Test: Check the grid rendering logic. Expect: Accurate grid calculations and rendering.
rg --type typescript $'gridCellSizeAtom|gridSectionSizeAtom|gridSizeAtom|isGridInfinitelyLargeAtom|shouldGridFadeAtom' app/packages/looker-3d/src/fo3d/Gizmos.tsx

Length of output: 197



Script:

#!/bin/bash
# Description: Verify the correctness of grid calculations in Gizmos.tsx to ensure accurate grid rendering.

# Test: Check the grid rendering logic. Expect: Accurate grid calculations and rendering.
rg --type ts 'gridCellSizeAtom|gridSectionSizeAtom|gridSizeAtom|isGridInfinitelyLargeAtom|shouldGridFadeAtom' app/packages/looker-3d/src/fo3d/Gizmos.tsx

Length of output: 557



Script:

#!/bin/bash
# Description: Verify the definitions of grid-related atoms to ensure accurate grid rendering.

# Test: Check the definitions of grid-related atoms. Expect: Correct definitions and usage.
rg 'const gridCellSizeAtom|const gridSectionSizeAtom|const gridSizeAtom|const isGridInfinitelyLargeAtom|const shouldGridFadeAtom' --glob '*.ts' --glob '*.tsx'

Length of output: 587

app/packages/looker-3d/src/fo3d/point-cloud/use-pcd-material.tsx (1)

112-112: Addition of key prop to <RgbShader> optimizes re-renders and enhances functionality. Ensure the key is correctly generated.

app/packages/looker-3d/src/action-bar/ToggleGridHelper.tsx (1)

20-112: Introduction of GridConfigurator and updates to ToggleGridHelper enhance the grid configuration UI. Consider verifying the usability of these components.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Review Details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits Files that changed from the base of the PR and between 53a8f82 and a8cc14d.
Files selected for processing (1)
  • app/packages/looker-3d/src/action-bar/ToggleGridHelper.tsx (1 hunks)
Additional Context Used
Path-based Instructions (1)
app/packages/looker-3d/src/action-bar/ToggleGridHelper.tsx (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

Additional comments not posted (1)
app/packages/looker-3d/src/action-bar/ToggleGridHelper.tsx (1)

41-108: Validate the accessibility of the GridConfigurator UI.

Ensure that all interactive elements in the GridConfigurator are accessible, including proper labeling and keyboard navigability. This is important for compliance with accessibility standards and providing a good user experience for all users.

followCamera
fadeStrength={shouldFade ? 1 : 0}
followCamera={shouldFade}
fadeFrom={0.5}
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a lot more configurable than blender... lol

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah... 😅
We expose "fading", "infinite / non-infinite", "cell size", "section size", and "grid size" if non-infinite.

ritch
ritch previously approved these changes May 20, 2024
Copy link

codecov bot commented May 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (release/v0.24.0@d1b48f2). Learn more about missing BASE report.

Current head 53a8f82 differs from pull request most recent head 9d8cad7

Please upload reports for the commit 9d8cad7 to get more accurate results.

Additional details and impacted files
@@                Coverage Diff                 @@
##             release/v0.24.0    #4401   +/-   ##
==================================================
  Coverage                   ?   99.27%           
==================================================
  Files                      ?       47           
  Lines                      ?    16155           
  Branches                   ?        0           
==================================================
  Hits                       ?    16038           
  Misses                     ?      117           
  Partials                   ?        0           
Flag Coverage Δ
python 99.27% <ø> (?)

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.

@sashankaryal sashankaryal requested a review from ritch May 20, 2024 21:21
ritch
ritch previously approved these changes May 20, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Review Details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits Files that changed from the base of the PR and between a8cc14d and 9ce414f.
Files ignored due to path filters (3)
  • e2e-pw/src/oss/specs/3d/fo3d-pcd-stl.spec.ts-snapshots/orthographic-projection-grid-cuboids-chromium-darwin.png is excluded by !**/*.png, !**/*.png
  • e2e-pw/src/oss/specs/3d/fo3d-pcd-stl.spec.ts-snapshots/scene-chromium-darwin.png is excluded by !**/*.png, !**/*.png
  • e2e-pw/src/oss/specs/3d/fo3d-pcd-stl.spec.ts-snapshots/scene-chromium-linux.png is excluded by !**/*.png, !**/*.png
Files selected for processing (4)
  • app/packages/looker-3d/src/fo3d/Gizmos.tsx (3 hunks)
  • app/packages/looker-3d/src/fo3d/point-cloud/Pcd.tsx (2 hunks)
  • app/packages/looker-3d/src/hooks/use-pcd-material-controls.ts (1 hunks)
  • e2e-pw/scripts/generate-screenshots-docker-image/build-docker-image.sh (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • app/packages/looker-3d/src/fo3d/Gizmos.tsx
  • app/packages/looker-3d/src/hooks/use-pcd-material-controls.ts
Additional Context Used
ShellCheck (1)
e2e-pw/scripts/generate-screenshots-docker-image/build-docker-image.sh (1)

[info] 24-24: Use ./glob or -- glob so names with dashes won't become options.

Path-based Instructions (1)
app/packages/looker-3d/src/fo3d/point-cloud/Pcd.tsx (1)

Pattern **/*.{ts,tsx}: Review the Typescript and React code for conformity with best practices in React, Recoil, Graphql, and Typescript. Highlight any deviations.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits Files that changed from the base of the PR and between 9ce414f and a3b727f.
Files selected for processing (1)
  • app/packages/looker-3d/src/fo3d/point-cloud/Pcd.tsx (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/packages/looker-3d/src/fo3d/point-cloud/Pcd.tsx

@sashankaryal sashankaryal requested a review from ritch May 21, 2024 00:23
@sashankaryal sashankaryal merged commit e925518 into release/v0.24.0 May 21, 2024
14 checks passed
@sashankaryal sashankaryal deleted the fix/pcd-bugs branch May 21, 2024 01:16
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