You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PyTK's scale-up feature doesn't handle mod images loaded as IRawTextureData.
Background
With SMAPI 3.15, mods can load raw image data like helper.ModContent.Load<IRawTextureData>("assets/example.png"). That returns a model with this info:
/// <summary>The raw data for an image read from the filesystem.</summary>publicinterfaceIRawTextureData{/// <summary>The image width.</summary>intWidth{get;}/// <summary>The image height.</summary>intHeight{get;}/// <summary>The loaded image data.</summary>Color[]Data{get;}}
Creating a full Texture2D instance is expensive and involves GPU calls, so this optimizes cases where we only need the image data. In particular, Content Patcher 1.27 will migrate to that feature for all of its EditImage patches.
PyTK impact
For PyTK, that probably means adding a separate Harmony patch on ModContentManager.LoadRawImageData and scaling the raw data directly:
/// <summary>Load the raw image data from a file on disk.</summary>/// <param name="file">The file whose data to load.</param>/// <param name="forRawData">Whether the data is being loaded for an <see cref="IRawTextureData"/> (true) or <see cref="Texture2D"/> (false) instance.</param>privateIRawTextureDataLoadRawImageData(FileInfofile,boolforRawData);
Workaround
For players who want to use PyTK's scale up with SMAPI 3.15:
PyTK's scale-up feature doesn't handle mod images loaded as
IRawTextureData
.Background
With SMAPI 3.15, mods can load raw image data like
helper.ModContent.Load<IRawTextureData>("assets/example.png")
. That returns a model with this info:Creating a full
Texture2D
instance is expensive and involves GPU calls, so this optimizes cases where we only need the image data. In particular, Content Patcher 1.27 will migrate to that feature for all of itsEditImage
patches.PyTK impact
For PyTK, that probably means adding a separate Harmony patch on
ModContentManager.LoadRawImageData
and scaling the raw data directly:Workaround
For players who want to use PyTK's scale up with SMAPI 3.15:
smapi-internal/config.json
in a text editor (Notepad is fine).UseRawImageLoading
option to false.This may increase the performance impact, so you should only disable it if needed.
The text was updated successfully, but these errors were encountered: