Better introjucer/jucer image integration


#1

Now that the Jucer has been swallowed, is there any way that the juce can detect images in the binary resources, rather than caching the image into the jucer component source?


#2

Totally possible, but too low a priority for me to look at in the near future. It’s the kind of feature I’ll add if I ever need it myself, or if someone contributes a mod to do it…


#3

Sorry if there are rules against res'ing old topics. Looked and couldn't find any.

If this feature is such a low priority, I'm hopeful that there are existing ways to do these things:

  • How do I make Xcode not choke on 5+ MB source files? It freezes up for a few seconds every time I switch to one of these files.
  • How do I generate reasonably sized diffs for these huge files to use in code reviews? Files that are 95+% binary data and 5-% source code aren't manageable at all with a lot of common tools.
  • How do I prevent images that are used by more than one component from bloating our codebase / binaries with duplicate data?
  • How do I do these things and continue to take advantage of the Introjucer's visual GUI editing?

Unfortunately, I'm expecting the answer to be that I can't do those things, which makes Introjucer-generated components really appalling for my team. So my next question, if I can't convince you to bump this up a bit on the priority list would be this:

How difficult do you think it would be for a seasoned engineer that's never even glanced at the Introjucer's source to add the ability for it to use binary resources? It sounds like a pretty trivial addition, and if that's anywhere near true, I'll probably take a shot at tackling it.


#4

Yeah, Xcode isn't too brilliant at handling large files, and all the stuff you're struggling with are good reasons for making it use the introjucer's binary data instead.

It wouldn't be difficult to change it, but it'd involve some wading through the old GUI editor code looking for the code that's involved, so the hard bit would really just be learning your way around how the introjucer works.


#5

Thanks. I'll take a look over the next few days then and maybe I'll get a pull request in.


#6

Thanks, but please don't send me an actual GIT pull request! Best thing is to just send me the files you've changed, and I'll review + edit them before committing it.


#7

Hmm... trying to upload a .txt attachment with this post gives me an error: "The file could not be uploaded."

Here are the changes I made:

https://github.com/ccbrown/JUCE/compare/julianstorer:master...ccbrown:binary-data-images

If you just want the raw files, here they are:

https://raw.githubusercontent.com/ccbrown/JUCE/binary-data-images/extras/Introjucer/Source/Project%20Saving/jucer_ResourceFile.h

  • Added a `getFile(index)` method.

https://raw.githubusercontent.com/ccbrown/JUCE/binary-data-images/extras/Introjucer/Source/ComponentEditor/paintelements/jucer_ImageResourceProperty.h

  • Added binary data images to the image selection drop-down. They're added as "BinaryData::imageName"

https://raw.githubusercontent.com/ccbrown/JUCE/binary-data-images/extras/Introjucer/Source/ComponentEditor/paintelements/jucer_PaintElementImage.h

  • When determining the image variable names, replace "::" with an underscore. So binary data images are named like so: "cachedImage_BinaryData_imageName"

https://raw.githubusercontent.com/ccbrown/JUCE/binary-data-images/extras/Introjucer/Source/ComponentEditor/paintelements/jucer_FillType.h

  • If the selected image resource name contains a "::", load it from the project's binary data.
  • Replace ":" with "#" when serializing image resource names.

Thanks for your time!


#8

Cool, thanks very much! I'll take a look at this asap!