<div dir="ltr">Hi Bastien! Thanks for those details, very useful!<div><br></div><div>Kind Regards</div><div><br>James</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jun 26, 2016 at 8:00 PM,  <span dir="ltr"><<a href="mailto:bf-python-request@blender.org" target="_blank">bf-python-request@blender.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Send Bf-python mailing list submissions to<br>
        <a href="mailto:bf-python@blender.org">bf-python@blender.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="https://lists.blender.org/mailman/listinfo/bf-python" rel="noreferrer" target="_blank">https://lists.blender.org/mailman/listinfo/bf-python</a><br>
or, via email, send a message with subject or body 'help' to<br>
        <a href="mailto:bf-python-request@blender.org">bf-python-request@blender.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:bf-python-owner@blender.org">bf-python-owner@blender.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of Bf-python digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
   1. Understanding blend file binary data (James Crowther)<br>
   2. Re: Understanding blend file binary data (Bastien Montagne)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Sat, 25 Jun 2016 21:55:09 +1000<br>
From: James Crowther <<a href="mailto:jamesharrycrowther@gmail.com">jamesharrycrowther@gmail.com</a>><br>
Subject: [Bf-python] Understanding blend file binary data<br>
To: <a href="mailto:bf-python@blender.org">bf-python@blender.org</a><br>
Message-ID:<br>
        <<a href="mailto:CAJOwpNsZo1zmhMkx_knOkbYwtKe6zone4OTQT8%2BJbt1vRdfgog@mail.gmail.com">CAJOwpNsZo1zmhMkx_knOkbYwtKe6zone4OTQT8+Jbt1vRdfgog@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hi there,<br>
             I have a need to understand why a blend file can be different<br>
on disk after saving it despite nothing actually changing in the actual<br>
scene data, by that I mean D.objects.<br>
<br>
>From a cursory look at the differences using a file diff viewer like beyond<br>
compare, I can tell that there are some metadata like the file name that<br>
are included in the file's binary, so this would of course change for some<br>
instances where you copy the file for example.<br>
However, the file name is only one part of the vast number of changes I can<br>
see.<br>
<br>
To reproduce simply open a blend file, save it. Then copy it. Open the copy<br>
and save it. Do a file diff on the original file and the copy and you will<br>
see many differences throughout the file.<br>
<br>
The use case I am working with here is I am distributing a file across many<br>
machines to render parts on each. I need to make sure the file is the same<br>
on each machine so I have some assurance that the file transfer works<br>
(whatever method the transport uses, LAN, USB stick etc) and that the<br>
machines all have the same data.<br>
Originally I was going to do this using something like CRC32 or MD5<br>
depending on speed and security needs, but since the file changes once it<br>
is saved, even if the file is not changed, this presents a problem since<br>
the data of the scene is the same, but the results of a CRC32 or MD5 will<br>
be different due to the effects of saving a file.<br>
<br>
Could someone educate me as to how to read the blend file format in such a<br>
way as to remove these differences? I'm more than happy to write a custom<br>
CRC routine so long as I can know which parts of the file contain the data<br>
and which are headers that are altered on a save.<br>
<br>
Thanks!<br>
<br>
James<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <a href="http://lists.blender.org/pipermail/bf-python/attachments/20160625/620fb8b6/attachment-0001.htm" rel="noreferrer" target="_blank">http://lists.blender.org/pipermail/bf-python/attachments/20160625/620fb8b6/attachment-0001.htm</a><br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Sat, 25 Jun 2016 15:35:53 +0200<br>
From: Bastien Montagne <<a href="mailto:montagne29@wanadoo.fr">montagne29@wanadoo.fr</a>><br>
Subject: Re: [Bf-python] Understanding blend file binary data<br>
To: <a href="mailto:bf-python@blender.org">bf-python@blender.org</a><br>
Message-ID: <<a href="mailto:3be9f46a-9c8c-cd16-e7ab-9b1ca092f155@wanadoo.fr">3be9f46a-9c8c-cd16-e7ab-9b1ca092f155@wanadoo.fr</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hi James,<br>
<br>
Think the main (if not the only) serious cause of those differences here<br>
are the fact that Blender uses memory addresses of its struct as<br>
'in-file uuid' in the .blend. So first thing to do for your usecase<br>
would be to ignore all and every pointers from DNA structs, since those<br>
will change every time.<br>
<br>
As for reading a .blend file, besides blender code itself, suggest you<br>
have a look at code in io_blend_utils folder in addons repository, not<br>
yet complete but should give you a good start. You may also want to have<br>
a look to blend2json.py script (in our blender-dev-tools git repository,<br>
<a href="https://developer.blender.org/diffusion/BDT/" rel="noreferrer" target="_blank">https://developer.blender.org/diffusion/BDT/</a>).<br>
<br>
Cheers,<br>
Bastien<br>
<br>
Le 25/06/2016 ? 13:55, James Crowther a ?crit :<br>
> Hi there,<br>
>              I have a need to understand why a blend file can be<br>
> different on disk after saving it despite nothing actually changing in<br>
> the actual scene data, by that I mean D.objects.<br>
><br>
> From a cursory look at the differences using a file diff viewer like<br>
> beyond compare, I can tell that there are some metadata like the file<br>
> name that are included in the file's binary, so this would of course<br>
> change for some instances where you copy the file for example.<br>
> However, the file name is only one part of the vast number of changes<br>
> I can see.<br>
><br>
> To reproduce simply open a blend file, save it. Then copy it. Open the<br>
> copy and save it. Do a file diff on the original file and the copy and<br>
> you will see many differences throughout the file.<br>
><br>
> The use case I am working with here is I am distributing a file across<br>
> many machines to render parts on each. I need to make sure the file is<br>
> the same on each machine so I have some assurance that the file<br>
> transfer works (whatever method the transport uses, LAN, USB stick<br>
> etc) and that the machines all have the same data.<br>
> Originally I was going to do this using something like CRC32 or MD5<br>
> depending on speed and security needs, but since the file changes once<br>
> it is saved, even if the file is not changed, this presents a problem<br>
> since the data of the scene is the same, but the results of a CRC32 or<br>
> MD5 will be different due to the effects of saving a file.<br>
><br>
> Could someone educate me as to how to read the blend file format in<br>
> such a way as to remove these differences? I'm more than happy to<br>
> write a custom CRC routine so long as I can know which parts of the<br>
> file contain the data and which are headers that are altered on a save.<br>
><br>
> Thanks!<br>
><br>
> James<br>
><br>
><br>
> _______________________________________________<br>
> Bf-python mailing list<br>
> <a href="mailto:Bf-python@blender.org">Bf-python@blender.org</a><br>
> <a href="https://lists.blender.org/mailman/listinfo/bf-python" rel="noreferrer" target="_blank">https://lists.blender.org/mailman/listinfo/bf-python</a><br>
<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <a href="http://lists.blender.org/pipermail/bf-python/attachments/20160625/89a17332/attachment-0001.htm" rel="noreferrer" target="_blank">http://lists.blender.org/pipermail/bf-python/attachments/20160625/89a17332/attachment-0001.htm</a><br>
<br>
------------------------------<br>
<br>
_______________________________________________<br>
Bf-python mailing list<br>
<a href="mailto:Bf-python@blender.org">Bf-python@blender.org</a><br>
<a href="https://lists.blender.org/mailman/listinfo/bf-python" rel="noreferrer" target="_blank">https://lists.blender.org/mailman/listinfo/bf-python</a><br>
<br>
<br>
End of Bf-python Digest, Vol 133, Issue 9<br>
*****************************************<br>
</blockquote></div><br></div>