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

Implemented Texture Icons/Thumbnails #595

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

PrakarshPanwar
Copy link

@PrakarshPanwar PrakarshPanwar commented Nov 14, 2022

Describe the issue (if no issue has been made)

  • Currently Hazel has no Image Icons/Thumbnails in ContentBrowserPanel for Texture Files, it is represented by Standard File Icon
  • Same with SpriteRendererComponent in Properties Panel, there is only Texture drag/drop button and not an Image Button Icon

PR impact (Make sure to add closing keywords)

List of related issues/PRs this will solve:

  • Adds Textures as Image Icons in ContentBrowserPanel
  • Adds ImGui.ImageButton instead of ImGui.Button for Texture in SpriteRendererComponent in Properties Panel. To remove texture right-click on Image Button then click Remove Texture
Impact Issue/PR
Issues this solves None or #number(s)
Other PRs this solves None or #number(s)

Proposed fix (Make sure you've read on how to contribute to Hazel)

A short description of what this fix is and how it fixed the issue you described.

Additional context

  • Currently if Texture file was deleted or modified, we won't be able to erase it from std.unordered_map cache. Possible solution is to use filewatcher
  • Now for textures that take longer than 0.02 seconds to load completely on directory will result in black thumbnails

- Earlier textures were represented by Standard File Icon
- Now only .png will be presented as texture in Content Browser Panel
…operties panel

- Now on clicking on Entity will show texture in a button
- Also removed some previous methods and made default texture in SceneHierarchyPanel const
- Editor crashes when adding new textures in asset directory
- This issue is still open to some extent
- This can happen due to OpenGL unable to load multiple textures at once
- This issue will gone after switching to Vulkan
- Reason for this issue was that the texture didn't load fully on the directory which resulted in black textures
- Adding `std.this_thread.sleep_for` gave time for directory to load textures properly
- However for large assets that can take longer than 0.02s to load on directory this method will not work
# Conflicts:
#	Hazelnut/src/Panels/ContentBrowserPanel.cpp
- To do this right-click on Image Button in SpriteRendererComponent then click Remove Texture
- Now instead of taking `this` it only takes default texture
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.

1 participant