DragonBones / DragonBonesCSharp

DragonBones C# Runtime
MIT License
537 stars 198 forks source link

Consider using UVs in JSON files #18

Open chriswaldron15 opened 7 years ago

chriswaldron15 commented 7 years ago

This is a suggestion rather than a major issue, however I spent the last few hours scratching my head over why Unity was showing my DragonBones animations incorrectly but was fine in the DragonBones application.

By default Unity imports textures at 2048x2048 (for desktop), however DragonBones has options to export to 4096x4096 and 8192x8192.

If I wanted to create a build for multiple platforms which might have texture restraints, or simply to improve performance on lower end machines, I might want to use a smaller texture and let Unity handle that when building for specific platforms.

As such I propose that when exporting the JSON files from DragonBones, texture UVs are used instead of absolute texture coordinates (e.g. x: 512, y:512 becomes x: 0.25, y: 0.25 on a 2048x2048 size image). This way even if the texture is scaled down, the texture coordinates still map correctly to the mesh.