Script to convert single png to icon.dat?

Hi friends,

I search for a way or an existing script to create the icon dat files from a single png file for my custom Blender build.

Background: the usual icons have all scripts to create the icons from a svg sheet or from a blend file. I know how everything works, i add and update icons regulary to my custom build. But i find these methods super cumbersome and highly restrictive. Especially the need to model the tool shelf icons in 3D when you can do the same in a 2D software much faster and more convenient and more accurate. For example, Blender has no pixel grid, which requires a bit trial and error here and there. I might want to model icons, but i might also decide to do it in pure 2D instead. This should be the choice of the artist. And navigating in the blender_icons.svg is a pure pain. Using Inkscape anyways.

The newest change to the icons_update script to support Inkscape 1 also makes me trouble. Inkscape 1 does a few things different from 0.9x. For example, the default order is now from up left to down right. In 0.9x it was from down left to up right.

All in all, i would be happy to bypass all these restrictions and scripts and additional software altogether, and create my icon dat files from single png files instead. One by one. No trouble with scripts anymore. No trouble with changed software anymore. One file, one easy solution.

So i started to hunt down the rabbit hole to catch the script where the magic happens. Where for example the created png sheet is sliced to single images, and these single images are converted to dat then. I found the script set in source\blender\datatoc. But now i am stuck. Too much connections since it is of course part of the svg pipeline.

Where does the real magic happen here? Can it be isolated at all? Is there maybe in an older datatoc version of Blender a script set available to do what i want already? Or a method to create the dat files without any script?

And is it even possible to bypass the svg and blend pipeline? There is for example the CmakeLists.txt in source\blender\editors\datafiles. And under Linux i see a png file created. Means the icons seems to be recreated there.

I am happy about any help and hint :slight_smile:

Kind regards

1 Like