6
$\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
  • 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, 2016 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, 2016 at 0:19
  • $\begingroup$ You can check this linker on your responsibility. gumroad.com/l/VdfWk I didn't check it. $\endgroup$ Feb 27, 2021 at 0:38

4 Answers 4

5
$\begingroup$

Old question I know, but I've written an addon for 2.9 which, in combination with a networked filesystem and assuming the model is in .blend format, should be able to achieve this:

https://github.com/gandalf3/auto-reload-linked-libraries/releases

The basic usage would be something like:

  1. Put the shared file on the networked filesystem
  2. Install and enable the addon
  3. Link the desired datablocks from the shared file
  4. Make changes to the shared file; changes should appear in blender more or less instantly.

That said it's not perfect (I just threw it together to work well enough for my purposes, but if you run into issues I wouldn't mind trying to improve it), and there's no prompt before reloading.

$\endgroup$
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
  • 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, 2016 at 11:44
0
$\begingroup$

Actually, this is possible as I've searched for the same purpose; it is as follows: (Note: This is possible only when importing a .blender file)

  1. Click File Menu
  2. Select Link...
  3. Select your file and click Link

You can't edit the imported (or actually "linked") file within your importing project. You have to edit it by opening the original file.

$\endgroup$
2
  • 2
    $\begingroup$ The user specifically asks for an OBJ file, not a blend. Also if the blend file is updated you have to manually reload $\endgroup$ Feb 27, 2021 at 0:24
  • $\begingroup$ Maybe you're right, but he asked a general question and given an example of .obj format. For .blend it doesn't need a reload, up to my knowledge:) $\endgroup$ Feb 27, 2021 at 0:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .