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

feat(texture): support selecting textures #356

Merged
merged 13 commits into from
Mar 7, 2024

Conversation

mspivak-actionengine
Copy link
Collaborator

No description provided.

Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-356.d3nof3l3x2sso4.amplifyapp.com

@dsavinov-actionengine
Copy link

@belom88 please review

src/components/upload-panel/upload-panel.tsx Outdated Show resolved Hide resolved
src/redux/slices/pick-pane-slice.ts Outdated Show resolved Hide resolved
src/components/deck-gl-wrapper/deck-gl-wrapper.tsx Outdated Show resolved Hide resolved
src/components/deck-gl-wrapper/deck-gl-wrapper.tsx Outdated Show resolved Hide resolved
src/components/deck-gl-wrapper/deck-gl-wrapper.tsx Outdated Show resolved Hide resolved
src/components/deck-gl-wrapper/deck-gl-wrapper.tsx Outdated Show resolved Hide resolved
src/components/debug-panel/debug-panel.tsx Outdated Show resolved Hide resolved
src/components/pick-pane-panel/pick-pane-panel.tsx Outdated Show resolved Hide resolved
src/components/pick-pane-panel/pick-pane-panel.tsx Outdated Show resolved Hide resolved
src/redux/slices/pick-pane-slice.ts Outdated Show resolved Hide resolved
@mspivak-actionengine mspivak-actionengine marked this pull request as draft February 29, 2024 06:57
@mspivak-actionengine mspivak-actionengine marked this pull request as ready for review March 1, 2024 10:55
Copy link
Collaborator

@belom88 belom88 left a comment

Choose a reason for hiding this comment

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

It is unnecessary complexity with textures initialization and adding textures via uv-debug-texture-slice. The responsibilities of slices are clear:

  • icon-list-slice - manage lists;
  • uv-debug-texture-slice - load the texture when the url has changed.

How they should work together:

  • Init the list directly in icon-list-slice. It is OK that there will be "list of textures" in this slice initialized. It is not a generic component for a UI library. All add and remove list item logic should dispatch directly to this slice;
  • uv-debug-texture-slice doesn't know about multiple textures. It stores only a loaded ImageBitmap. Add url argument to fetchUVDebugTexture. Make sure that the texture is null during requests. Probably, need to track request status (idle, loading, succeded, failed);
  • We should have a useEffect in DeckglWrapper - it should dispatch fetchUVDebugTexture when selected texture has changed

src/components/bookmarks-panel/bookmarks-panel.tsx Outdated Show resolved Hide resolved
src/components/icon-list-panel/icon-list-panel.tsx Outdated Show resolved Hide resolved
src/components/debug-panel/debug-panel.tsx Outdated Show resolved Hide resolved
Copy link
Collaborator

@belom88 belom88 left a comment

Choose a reason for hiding this comment

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

image
  • Upload panel cause horizontal scroll
  • Custom texture doesn't work;
  • Add gaps between title and drag&drop area and between "Cancel" button and drag&drop area;
  • Add gaps between upload panel and parent debug panel

src/components/debug-panel/debug-panel.tsx Outdated Show resolved Hide resolved
src/components/debug-panel/debug-panel.tsx Outdated Show resolved Hide resolved
src/redux/slices/uv-debug-texture-slice.ts Outdated Show resolved Hide resolved
src/redux/slices/icon-list-slice.ts Outdated Show resolved Hide resolved
src/types.ts Show resolved Hide resolved
src/utils/bookmarks-utils.ts Show resolved Hide resolved
src/redux/slices/icon-list-slice.ts Show resolved Hide resolved
src/components/deck-gl-wrapper/deck-gl-wrapper.tsx Outdated Show resolved Hide resolved
src/components/icon-list-panel/icon-list-panel.tsx Outdated Show resolved Hide resolved
const uvDebugTexture = useAppSelector(selectUVDebugTexture(imageUrl));
const uvDebugTextureRef = useRef<ImageBitmap | null>(null);
uvDebugTextureRef.current = uvDebugTexture;
const [needTransitionToTileset, setNeedTransitionToTileset] = useState(false);

const [forceRefresh, setForceRefresh] = useState(false);
Copy link
Collaborator

Choose a reason for hiding this comment

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

forceRefresh is changed but never used

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

After the texture is replaced in the tileset (in useEffect) we change the variable forceRefresh in order to start re-rendering.

action: PayloadAction<{ imageUrl: string; image: ImageBitmap | null }>
action: PayloadAction<{
imageUrl: string;
image: ImageBitmap | null;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does it make sense to push null to image?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed null from the type.

@mspivak-actionengine mspivak-actionengine merged commit dbd3241 into master Mar 7, 2024
3 checks passed
@mspivak-actionengine mspivak-actionengine deleted the ms/select-texture branch March 7, 2024 15:36
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.

3 participants