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

Fixed "readOnly" issue with GetMobileBillboardMaterial #2576

Merged
merged 1 commit into from
Feb 11, 2024

Conversation

KABoissonneault
Copy link
Collaborator

When using mods that provide lots of texture replacements and new textures, logs are filled with the message "Texture {name} is not readable."

image

The root of this is a change I made in 2021 in this PR: https://github.com/Interkarma/daggerfall-unity/pull/2160/files#diff-19063ddd0d72895174af2f1e16dd67e9c31329b6c2b66995d076184724e2991dR550

Crucially, for TextureReplacement.GetMobileBillboardMaterial, we read textures in three points:

  • LoadFromCacheOrImport, called when the billboard material is in cache, where readOnly was true
  • textureFile.Load, called when the archive is a DF classic, where readOnly was true
  • the TryImportTexture fallback, added by my above PR, called when the archive is outside DF classic, where readOnly was implicitly false

This issue therefore mostly hits mods like Daggerfall Enemy Expansion and Vanilla Enhanced and "DEX - DREAM patch", which provide textures for mobiles outside the classics. They generally don't need the mobile textures to be readable, but this new code path I added accidentally demanded it.

There is no reason for keeping this inconsistency, that was a mistake in my original PR from lack of understanding. There is no conceivable world where a mod relies on the mobile material being readable/writable only if it's a custom archive.

The fix is on line 628 and 634. The rest is either readability/documentation, or new overloads for mods to use.

…false" textures for modded archives outside the original 512. Added more TextureReplacement overloads to allow more readOnly=true for mods
@KABoissonneault KABoissonneault added this to the DFU 1.0.1 milestone Feb 6, 2024
@KABoissonneault KABoissonneault merged commit 5bde976 into Interkarma:master Feb 11, 2024
@KABoissonneault KABoissonneault deleted the fix/log-spam branch February 11, 2024 03:14
@KABoissonneault KABoissonneault mentioned this pull request Feb 13, 2024
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