1
$\begingroup$

How can Blender automatically update a 3d model from a changing network file?

I have a networked drive that has a 3d model, let's say an ".obj" file, that is being worked on by either multiple people, computers, or programs. When a change in the filesystem is detected (someone made a change and saved it), IF there are no changes to the model since the last import for that model, I'd like blender to automatically reimport it. (A prompt would be nice too). Is this possible via a script or existing features now, and if so, how?

$\endgroup$
  • 3
    $\begingroup$ Doesn't sound to easy to me, i'm no expert, but how would the script know when the file was updated? and even if it can check, checking 24/7 might be intensive. $\endgroup$ – Luka ash Jun 24 '16 at 22:55
  • 1
    $\begingroup$ Are you sure you wrote what you mean? Don't you want to reload the networked file if there have been changes, and leave it alone if there have not? $\endgroup$ – brasshat Jun 25 '16 at 0:19
1
$\begingroup$

Based on what I have learned from my time as a software developer let's think this through...

Blender's base file to work with is the .blend file format. You can append from .blend files, you can also link to single objects in .blend files but you still have to reload your file to see the changes that were made in the library (which actually makes a lot of sense, when you think about it).

Blender does not use separate file formats for models or materials, everything is just in the .blend file (even textures, if you pack them).

.obj (and all the other formats) gets imported into Blender, which means they become part of the .blend file, while the original imported file is not relevant anymore. Furthermore non-Blender models mostly get imported as "group1", so even this theoretical link to the original file is gone.

IMHO this cannot be solved by scripting alone, there need to be a lot of changes to be made not only on Blender's native file format but also the application itself.

$\endgroup$
1
$\begingroup$

I do not claim to have expert level knowledge of the internal file structure of ~.blend files, but based on my initial observation, I do not see in the file anything that would seem to record a time stamp included in any of the parameters making up the internal description of any data item in a Blender scene. That is, I see nothing in the data block of a mesh or object that is any type of time stamp. Such an internal timestamp recorded as part of the data block would seem to be necessary in order to accomplish what you hope to be able to do, as it would be necessary to know the time stamp of the components to know whether compare the one element has been changed in a source file compared to a similar element in the target.

This lack of an internal timestamp on elements of a scene would also seem to preclude determining whether a Blender file that contains a single element is newer than some part of a different file by using the file timestamp of the second file, as there is nothing (except the time stamp of the original file) to compare it to.

It does not seem to me that it would be too difficult to maintain a list of data blocks and their sources, and use the file system time stamp to provide time stamps to compare, but I'm not sure this is possible within the current structure of Blender.

$\endgroup$
  • 1
    $\begingroup$ The fileformat doesn't offer up timestamp info, but the script could ask the OS, or keep track directly. If asking the OS for the last time the file changed isn't good enough (e.g. the file contains more than just our model), the script could still figure it out itself. The the script could 1) load the model, 2) pass the object through a "hash function" (e.g. dump its vertices, edges, faces though md5sum), 3) if current hash differs from previous hash, load in Blender, 4) store the current hash and go back to 1). Would probably want a sleep cycle of say, a minute between each poll. $\endgroup$ – ajwood Jul 25 '16 at 11:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.