1

I'm mostly working on my own with Blender. I create a blend file and use it to render and save an image. Then I fiddle some more, render another image hopefully save the Blender file and then repeat. I try to keep the same version and file names for images and blend files but I often get out of sync. What I need to be able to do is browse all the image versions and reliably find the blend file that produced it.

This seems like I could use a version control system such as git, making a commit after each render.

Is there an image browser that can view images in different commits or a git viewer that can show images?

Or is there a better way to do this?

elfnor
  • 469
  • 1
  • 5
  • 14
  • Git isn't very good at dealing with binary or non-human readable files. – Tim Biegeleisen May 25 '15 at 08:20
  • On the contrary. Compared to the revision control systems that preceded it, git has no trouble storing and retrieving binary files. The problem is that there is no commonly agreed upon definition of what a diff between two images should mean. But that's hardly git's fault. – Roland Smith May 25 '15 at 12:39

2 Answers2

1

While git keeps the information of all versions around, it doesn't keep all versions in the working tree simultantously.

And its interface is meant to show differences between revisions. The problem is that unlike text files, there is no good and common definition about what a "diff" between two images should mean. You could try and devise a textconv option for jpg files. But I wonder if that would be useful.

If you want to be able to see different version side-by-side, you should probably use some kind of numbering scheme and a script to help you with that. Suppose you have a blender file named foo.blend that you are working on. This is your working copy. You should write a script that does two things;

  • Copy foo.blend to e.g. foo-027.blend, if the last existing version in the same directory is foo-026.blend, unless there is no difference between foo.blend and foo-026.blend.
  • Render foo-027.blend to e.g. foo-027.jpg using blender in batch rendering mode.

Call this script whenever you want to save a certain version. You also might want to make previous revisions read-only.

Python would be a good candidate to write this script in, since blender supports Python scripting. You might even be able to call it from a menu or shortcut.

Roland Smith
  • 42,427
  • 3
  • 64
  • 94
  • This is the approach I'm now looking at. There's already an add-on that auto saves after each render. I'll add saving the blend file to that, probabaly using pack libraries to include all external linked files. That should enable the image versions to be browsed in a folder and the packed blend to be unzipped and opened to be recreate the image when needed. – elfnor May 25 '15 at 20:56
  • Done - a Blender add-on can be found here on [github-blender_auto_save_on_render](https://github.com/elfnor/blender_auto_save_on_render) for anyone interested. Packing external files is left to the user for simplicity. – elfnor May 29 '15 at 05:07
0

With enough storage space Git is okay with binary files. But Git doesn't store files in their native form; instead they are packed in "blobs" of unreadable format. So you will have to checkout older versions to have them in your disposal.

You can have a separate directory to "retrieve" files from older revisions. Say, you've got a repo in your workspace directory.

cd path/to/my/workspace/directory
git --work-tree=/path/to/another/directory checkout <revision> <filenames separated by spaces>

Or from the another/directory:

cd path/to/another/directory
git --git-dir=/path/to/my/workspace/directory checkout <revision> 

Now your workspace directory stays untouched, while another/directory has the older version. You can now compare and do whatever you want.

Of course, you can just checkout to older revision in the same directory:

git checkout <revision>
# and come back then:
git checkout master 

This answer is inspired with:
git pull while not in a git directory
How do I reconnect my project to my existing GitHub repository

Community
  • 1
  • 1
Nick Volynkin
  • 14,023
  • 6
  • 43
  • 67