Repository navigation
Store texture as relative path reference instead of copying into project - #33
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Previously, selecting a texture in the editor would copy it into the project directory. The
.emberfile then stored only the bare filename, requiring the texture to live alongside the.emberfile at runtime. This made it impossible to reference textures in other directories (e.g., a shared spritesheet used by both particle effects and Tiled maps) without maintaining duplicate copies.Textures are now referenced by a path relative to the
.emberfile and are never copied. A spritesheet atContent\maps\spritesheet.pngcan be referenced fromContent\particles\effect.emberas..\maps\spritesheet.pngwith no duplication.Related Issues/Tickets
Changes Made
CopyToandIsRelativeTofromEditorContext. Texture files are no longer copied into the project directory on import.AddTexturenow generates the path of the selected file relative to the project directory viaGetRelativePathand uses that as both the cache key and the value stored inTexture2D.Name. This is what the serializer writes to theNameattribute in the.emberXML, and what it resolves back on load.LoadTextureis now private and takes an absolute path for loading and a relative path for naming. The cache is keyed by relative path, so textures from different directories that share a filename are treated as distinct entries and never conflict.ParticleEffectViewhas been removed entirely. With path keyed caching, filename conflicts between files in different directories cannot occur, and selecting the same file twice simply hits the cache.PropertyTable.TexturePropertynow displays only the filename viaPath.GetFileName, keeping the label short. The full relative path is shown in a dimmed line below the image preview in the hover tooltip for reference when needed.Checklist