Parse Stop Motion Texture Details from Filename
Crelam opened this issue · 2 comments
With the incorporation of the Stop Motion package as a core feature of Weakauras as of the Alpha, this is a great time to refine the feature for people who may be using it for the first time.
For that reason, I was thinking we could have some basic parameters pulled from the textures filename if present. For example:
Cool_Swirl.x8y8f60.tga
would set the default parameters of the stop motion aura to 8 rows, 8 columns, and 60 frames. This would alleviate the need to go out of game to look at the texture to count the rows, columns, and frames. It would be a boon to anyone that has a collection of these types of textures to use. It would also be a boon to anyone sharing a stop motion texture because it 'would just work' once you point the aura to the texture. It would also have the advantage of being able to tell that this texture is meant for a Stop Motion aura simply by looking at the filename.
Thank you for all that you do.
I'm not against such a feature, though someone would need to implement that. And I don't find it interesting enough for me to do that.
So PRs welcome.
As to the implementation, there are currently 2 classes of textures. The built-in textures, where the data is read from the built-in information, and user-provided textures where the user has to provide the data. The basic approach is to treat files that match a certain pattern in a analog way to the first case.
There are a few places which need to be modified for that:
a) In the actual region code:
In RegionTypes\stopmotion.lua the "modify" function applies the settings to a actual aura. The If (tdata) block handles the built-in types, the else block the user provided ones.
In the options:
b) createOptions creates the options to be displayed, and a few options contain this line:
hidden = function() return texture_data[data.foregroundTexture] end, which needs to consider the new case too.
c) modifyThumbnail works in a very similar way to the main code
All in all, it's not terrible difficult.