I’m currently playing around with ofxhGui.
One gripe is that when building the example app, one has to copy the data/fonts directory from the addon folder to the example folder. This should not be necessary, imho, if the fonts already come with the addon, so I try to fix it.
If I have the following situation/folder structure, everything works as expected:
(fonts are allocated with gui->setup(“fonts/DIN.otf”, 9)
Now, according to ofxaddons.com, assets in addons should be in /bin/data/ (which makes sense to me), so I fix this oversight, and remove the duplicated font files from the example, to arrive at:
ofxhGui/bin/data/fonts/DIN.otf
Now I get errors in the example app that it can’t find the font:
Question: Why does this not work? Why is the addon data folder not seen by the example app?
I’m on Eclipse in Ubuntu, with a makefile-based project, and the font files are visible in the eclipse tree.
I don’t know that this functionality was ever built in or not, but it would be nice if the makefile could just copy everything from ofxWhatever/bin to myAppThatUsesOfxWhatever/bin. My addon, ofxVolumetrics encounters this problem for loading the shader.vert/frag files. I usually just make symlinks to the files from my app’s data folder, but its a bit clunky.
Secound thought: if not in the makefile, maybe this functionality could be built into createProjects.py?
why should the assets be copied at all, this leads to needless redundancy? If we have to build this function into OF, I’d vote that
a) there would be a global OF asset folder for stuff included in the release (try search for *.ttf in the repo to see how much is there in duplicate/triplicate and more).
and b) an asset folder in the respective addon’s folder where addons can put assets used by them.
The thing which is not clear to me is how we get OF to “index” addons only when they are included, but I presume this would work via addons.make.
Does that make sense?
edit: OK on further thought, having “global” data folders has negative implications on the portability of compiled applications. still, it would be great if there were some automatic mechanism to transfer needed assets.
I agree that copying is redundant, but I also think adding more search paths would be bad/inconsistent/confusing when it comes time to package and ship a product built on oF. What if instead of copying, a build script would make symbolic links? This way if the addon maintainer updates something in the repo, it automatically gets updated in your projects. If you wanted to keep an old version you could still manually copy the file and the script would leave it alone if it already existed.
Another somewhat unrelated idea is to have a config.make for for addons which can specify their own compiler and linker flags to link with system libraries.