Live Reloading & Relocating Of Libraries

So, finally got something that seems to be kind of working in id-remap branch (see also the associated design task), and hence made some test builds available (updated 2016/01/16, see log below).

WARNING: Those builds are highly experimental, do not use them in production, nor on any file you want to keep valid! No corruption is expected – but you know, we do experimental builds for a good reason, issues are never expected. ;)

That said, let’s see a bit what id-remap is about. It’s a spin-off from Asset project, which requires ability to hot-reload libraries in Blender. This lead to hot-remapping of ID datablocks inside Blender, that is, the ability to totally replace all references to a given datablock (e.g. a material) by another one of the same type (and expected to be compatible!).

In theory this was rather simple, we already had tools to loop over ID usages in our code, but to use them in that case we need a totally valid and consistent handling of referencing and dereferencing IDs. I won’t go into dirty details here, but our master branch was far from that state. Some issues were fixed directly in master, but most implied some more involved changes that will likely rather end up in the 2.8 project.

All in all, code in id-remap should now allow for several cool features:

  • Possibility to remap an ID, that is, replace all usages of a given datablock by another (compatible) one. So e.g. you can replace all usages of a given material by another. Or all usages of a low-res mesh by its high-res version, etc.
  • Possibility to live-reload libraries.
  • Possibility to live-relocate libraries (i.e. select a new one to replace an existing or missing one).
  • Possibility to really, easily and properly delete a datablock in Blender (without having to save and reload .blend file).
  • etc.

The four first points above have been implemented in id-remap, and I’ve tested successfully library reloading with some rather heavy and complex files from Gooseberry, but now I need some real-life testing!

blender_outliner_lib_reload

To reload or relocate a library in those experimental builds, just go to the Outliner, select the Blender File view, right-click on the library you want to refresh, and select the desired option (if you want to relocate, a filebrowser will open to select new lib .blend).

If everything goes smooth (yeah I know, it won’t), you should see nothing, aside from linked objects being updated. Please report any issue to the bug tracker, as usual, stating clearly in title it’s about id-remap. :)

Updates Log

This lists changes/updates/fixes of each new testbuild:

  • 2015/11/30 build:
    • Updated against master f798c791cda, id-remap 1da2edfb257e.
    • Fixes bug when reloading and linked object is selected (reported by zeauro over IRC, thanks).
  • 2015/12/07 build:
    • Updated against master de0672436bf1, id-remap 8bbfd2729a2.
    • Adding proper deletion of IDs and whole libraries (from Outliner).
  • 2016/01/16 build:
    • Updated against master 9137a4401440d, id-remap 6eec8eaa57ff.
    • Fixed some crashes.
    • Fixed bad behavior of some new rmb menu options in outliner (not ‘taking’ the right item below cursor).
This Summer’s Sculpt Mode Refactor
Geometry Nodes Workshop: October 2024
New Brush Thumbnails
Blender 4.3 Beta is here!

17 comments
  1. Good and long awaited feature. Thanks. What about Replacing library by another file by this method?

    • Thanks. Replacing library by another file is actually already possible (use ‘relocate’ option in RMB menu of outliner).

      I have to make an updated testbuild too, have fixed some issues since early december…

      • No, it is not working (for me). For example, I create a link to the group in the some blend file (Group_Ferms). When I do relocate, it does not ask for a select group, the current connection remains, and below it there is some link to the new file.

        • Please make a bug report on the tracker (make it clear it’s not about master), with needed files to reproduce the issue. :)

  2. i really love blender and i hope that you update the game engine by adding a cube map and more good light system at least like unity + good 2D filter’s script i wish i could help in developing this

  3. looks like filepath integration in the outliner ?.
    it would be nice if the outliner supported some easy dragging re-grouping instead of ctrl+p

    i don’t see the complexity nor the milestones that have been passed here, but i say that as an outsider, not knowing the internal code. Apparently you reached something, and I’m still wondering what is the huge problem solved here?, that couldn’t have been part of blender 2.6. But codewise apparently something has been reached here, a blog posts here doesn’t happen often. So i should congratulate you.

    I don’t understand it but Blender got better again :)

  4. Could be nice if it worked for linked characters with proxy rig..
    Auto search and relocate multiple missing libraries option would be great

    • It’s supposed to work with proxies as well as with ‘pure’ linked data (though proxies are a bit sensible on this aspect, being kind of mixing local and lib data together in a same datablock).

      Batch-relocating and such is for sure great feature to have, but that’s kinda second goals, once we are sure the basics work OK we can go adding fancy stuff based on it. ;)

      • Batch-relocating is secondary goal indeed, but for scene with a lot assets is useful :)
        And i tried to relocate character before posting, didn’t worked for me (it just linked another one)
        Just wanted to inform, it must have feature in my opinion.
        For simple assets worked great.

        That feature is very anticipated, I’m very appreciate work you guys do!

  5. Will in future the ability to edit the linked object directly in the file where it is linked and save the change to original file?

    • This is not planned afaik, and I don’t think we’d like to do that, it’s kind of breaking the principle of libraries.

      What can be done (even with current master) is a small script or piece of code that would open a new instance of Blender with relevant library file opened to edit a lib datablock.

  6. I have many models that all use linked materials in a master ‘Materials.blend’ file. If I use Ctrl+C to copy an object from one model and Ctrl+V to paste it into another model the pasted object loses its linked material and instead appears as Material.001. Will the work described above fix this issue, and so avoid a lengthy re-linking process every time I paste an object?

    • Not aware of the details of copy/paste off hands, but this sounds more like a design decision of this tool (to make a local copy of linked data instead of keeping linking info). This may be needed, or on the countrary changeable, but it does not really fits int the scope of the id-remap branch.

      That branch, however, could make it possible to easily write a small script that would automatically remap copied materials usages to correct linked one.

  7. …replace all usages of a given material by another…

    Suppose I’ve imported the same mesh twice:
    first, via Collada, with an armature that I want, but materials that I don’t want;
    second, via TeleBlender ( https://sites.google.com/site/mcasualsdazscripts4/mcjteleblender3 ),
    with Cycles materials that I want, but no armature.

    Will the id-remap allow me to transfer all the materials from the second mesh
    to the first, in one simple command?

In order to prevent spam, comments are closed 7 days after the post is published.
Feel free to continue the conversation on the forums.