• Bugs
  • Mix and Match Attachment.GetRemappedClone() filterMode issue

  • Изменено
Related Discussions
...

Hey Spine team,

Thanks for an excellent product and runtime. You guys are really great.

This is just a small bug that I quickly fixed locally, but I thought you'd want to hear about it. I recently switched from bilinear filtering for my project assets to Point mode, and noticed when I used my Mix and Match code that the remapped clone sprite would be set to Bilinear filtering, which is the default mode for a Texture2D in Unity, I believe.

The offending code starts at a call to the Extension method in AttachmentTools.cs: GetRemappedClone. The PMA version of the function that is then called, ToAtlasRegionPMAClone, respects the textureFormat and mipmaps setting, but doesn't handle the filtermode. To fix this, I adjusted the code by adding the line shown below.

public static AtlasRegion ToAtlasRegionPMAClone (this Sprite s, Shader shader, TextureFormat textureFormat = SpineTextureFormat, bool mipmaps = UseMipMaps, Material materialPropertySource = null) {
         var material = new Material(shader);
         if (materialPropertySource != null) {
            material.CopyPropertiesFromMaterial(materialPropertySource);
            material.shaderKeywords = materialPropertySource.shaderKeywords;
         }

     var tex = s.ToTexture(textureFormat, mipmaps);
     tex.ApplyPMA(true);
     tex.filterMode = s.texture.filterMode; // added this line

I haven't updated my runtime in a few months so forgive me if this is already known/fixed. You may also prefer to set the filterMode inside the ToTexture extension method instead. Cheers!

14 дней спустя

A bugfix has just been committed. You can download the updated unitypackages here as usual:
Spine Unity Download

Thanks again for reporting!