So first of all there is existing animation format. Please check it:
Today @hkoehler asked about adding new icons for secondary skills added by mods. Currently for existing skills there is SECSKILL.def
that contain 3 frames (basic, advanced and expert) for each existing skill. His initial idea was to add frames into animation dynamically, but it’s seems very ugly and not practical because currently animation can only contain integer identifiers.
From what I see we efficiently have two options how to solve this while keep using CAnimation
and CAnimImage
for said icons. In both cases we need to allow text identifiers for “frames” and convert existing H3 DEF to decided format.
- First option is to just make every modder merge own frames into our newly converted
SECSKILL.json
just by usual JSON merge. I don’t like this very much because this would mean modders will have additional file to change and mess up. - Another option is to add option to CAnimation so instead of using pre-defined frames list it’s could be configured with path to directory with icons. Then UI will be able to request literally any file in that directory as frame:
iconSecondarySkill->setFrame("core:pathfinding", "advanced");
In the end CAnimation will just load image like /data/vcmi/icons/skills/core:pathfinding/advanced.png
. Of course it’s will be preloaded, but you get the point.
Or we might stop using CAnimation for any icons that contents might be modified by mods. Then we don’t need to mess with animation format and possibly this is sanest solution.