Open Fixer-007 opened 8 years ago
I wanted to make an animated crosshair. Can you guess what happened?
Yeah, didn't work...
Right, the problem is that in MC almost any texture can be animated, but MT doesn't automatically animate anything as the code to detect animated tiles just isn't present in MT. Basically every texture needs to be de-tiled, except for ... the ones we know can be animated.
Is it so that the animation only work, where the corresponding block is build like this? https://forum.minetest.net/viewtopic.php?id=6767
tiles = {{name="xxx_animated.png", animation={type="vertical_frames", aspect_w=32, aspect_h=32, length=8}}},
@ensonic yes, that's correct.
So ideally minetest would need some mechanism to allow texture packs to enable the animation part dynamically. Can't think of a clean way to achieve this though :/
textures with animation can not only be detected because of their aspect ration, but also by the presence of a $texture.png.mcmeta file in json format, e.g.
{
"animation": {
"frametime":4,
"frames": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12
]
}
}
or
{
"animation": {
"frames": [
{
"index": 0,
"time": 11
},
{
"index": 1,
"time": 7
},
...
{
"index": 0,
"time": 13
}
]
}
}
Unfortunately (as we can see) the format can vary. If we're okay to add a dependency to jq (which is commonly available), we can extract the number of frames like this:
# v1
cat items/bucket_water.png.mcmeta | jq '.animation.frames | max_by(.)'
# v2
cat blocks/tallgrass.png.mcmeta | jq '.animation.frames | max_by(.index) | .index'
Seems we can select the type by grepping for "index":
.
That remaining main issue seems that we need a list of which textures in minetest support animations right now. Any idea?
After texture fix #4016 you will need to improve your mcresconvert a bit for cases like were minetest is not using animation (like animated diamond ore/iron ore in John Smith modded pack), that means 32x1044 px file or so should be truncated to just 32x32. This issue appears only on rare packs, like on this popular one: http://mods.curse.com/texture-packs/minecraft/223328-john-smith-legacy-modded. Example of animated iron ore texture, when #4016 is applied: https://i.imgur.com/5On8J7i.png