Reimport Scene -> Auto Proxy update.

Hi All.

These past months have been great following B development. I look especially forward to the DebGraph + 2.7 work planned!
I work professionally in a big architecture company of Denmark. We work with many products in a big chain. I would love to include Blender in this chain as it is a very versatile product. I would especially like to include it in the rendering/compositing/animation part to start with, as we are using a BIM work flow for the modelling part.

In line with that subject I have been trying to work out a work flow that I have come to conclude is not possible in Blender right now. I would like to hear from some of the more Techy Blender Heroes if this work flow can be done already / might me possible with new debgraph refactor / might be considered in the planning etc.
Here I go:

  • I have a scene from i.e. Autodesk Revit, Autocas or Sketchup etc.

  • The scene is exported through a common fileformat where each object has its own ID block.

  • I import it into blender and would begin to edit the boring standard geometry/materials etc from the other programs to make everything nice for rendering.

  • Then the project has been edited (i.e. objects moved) by my colleagues in one of the other programs and a new file is exported.

  • Now I can just about start over because changing my blender file to match the new object locations for hundreds of objects is to time consuming.

In simple terms:
1: I would like to import an object to blender and be able to specify a proxy object for this object (possible now).
2: I would like to reimport the scene and keep the proxy object/materials etc. for the objects with the same ID that has a proxy object. New objects could just be imported as they are.

Is this by any way possible now? Or is it something that is possible in the new system?
Other thoughts?

If I have not made myself clear or if anything needs elaboration don hesitate to ask.
Thanks for the insights!

EDIT: I have also heard rumor of a general update to the asset management of Blender. This might cover my work flow in question?

I’m not sure if the scope of the current asset manager project includes imported data… and I don’t know if the deps graph is going to have anything to do with this… again, because it deals with importing external (non-blender) data. There may be beneficial side-effects from those projects, but I don’t think you’ll see any direct benefit.

That said, it’s possible that a solution to your problem could be done with a Python add-on (perhaps wrapping the importer add-on). In fact, the more I think about it, the more sure of it I am.

I thought of the debgraph because Brecht referred to it in one of the bug reports handling reimporting of objects with proxies, but honestly I dont know how far the debgraph handles.

Anyway an addon solution could be great although I thought i had to go deeper.
I asked the author of the new collada import addon if it could be done specifically for materials but afterwards I realized it could be used more generally.
In BIM workflow objects are often only references by very simple geometry. Too simple to render, but you cant substitute it with highly detailed geometry because thats not necessarily very efficient BIM programs. So an addon that could assign proxies automatically upon reimport would be awesome.

Maybe I will have a look at the import code, yet I have only limited experience with addon authoring for Blender.

The more I think about it, the more I’d like to extend my Edit Linked Library add-on to support imported data. I’m pretty sure it can be done. Might have to make a small change to the ImportHelper python object (so imported objects are tagged with the path of the source object)… but that’s not a huge thing.

Maybe add an option to the importer along the lines of ‘exclude existing objects’ that does a name-based (or ID tagged) lookup and just skips importing those objects?

It seems like what is needed is a way to “Update” the imported data without destroying the work you’ve already done. The issue I see with some kind of proxy system is that there may be thousands of objects that you would have to manually re-import each time. The best solution for this case I think of is to have a special command that looks at the data in the scene and the data in the import file and runs a comparison that looks for differences in object geometry and transforms and then only updates those those items leaving the materials and lighting and any other added objects intact.

Actually this is quite useful for all kinds of other things. I’ve often thought of an object importer that stays on the object in a modifier. Whenever the external object is changed you can just hit the update button and it simply updates the verts and transforms. The modifier simply uses the importers that are built into Blender. You could have checkboxes for what to update and what to leave the way it is. But that’s just for single objects. I don’t know what you would put in the scene to handle the updating of an entire scene? Maybe a new type of object that it just an empty with some data on it?

Oh and ejnaren, it’s “Depsgraph” not Debsgraph. :wink: It’s sort for “dependency graph”. It’s a mechanism for tracking what needs to be updated when you change something in the scene. A faster depsgraph makes working in Blender faster. Esspecially on large scenes and it speeds up things like animating hierarchies and animation playback… In theory at least. I think eventually the devs are also hoping to have a system that can handle a node based system like softimage ICE or Houdini.

I feel your pain with having to update imported data. I work in the tradeshow industry and there are often many many revisions that need to be re-rendered. I’ve been pretty much rebuilding all of my blend files whenever there is a significant change. Any addon that would smooth that process would be wonderful.

Indeed, this is also quite common in the commercial animation industry too. A lot of times clients are still making changes to characters even in the last few days of production. Or at least well into point where we are already animating. It’s the nature of the beast.

I just had a thought… You know the attribute transfer GSOC project that’s being done right now? Well, what if, you use that to transfer all the attributes specified from the old model to the new one while doing the scene update? That’s all theoretical of course.

As a comparison, it might help to look at how Maya handles it. Referencing (equivalent to linking) can be used on other file types besides project files, ex obj/fbx/collada. (of course you can use it for regular maya project files too). When the file is loaded, it reads all properties/data from the source file. If you make any change to it (different material, change the color, rotate it, scale it, change pose, whatever), the changed properties are recorded in a special datablock associated with the reference. When the reference is refreshed, any changed properties will keep the changed values recorded in the reference log. Anything not recorded as changed is re-read from the source file.

So, let’s say you reference a model, and fix the materials (the default ones the importer assigned suck), and you’ve moved and scaled it into position. Suddenly, you hear from the client. They’ve got a new version for you with several new pieces and other pieces changed. No problem. Overwrite your old file with the updated one, refresh the reference in Maya, and you’re done. The new piece is there already in the proper position.

It’s a similar functionality that Blender gives you with proxies, except rather than just working on a rigged object from another .blend, you can use it with pretty much any objects in any file types, and edit whatever you want on them. The equivalent in Blender would be the ability to A) link any file type, not just .blend files, and B) proxy any datablock that can be made local. Honestly, I’d still prefer per-property granularity rather than per-block. For example, being able to proxy an object block still doesn’t allow you to set constraints and transform locally while reading the modifier stack from the source file.

@Fweeb sounds like you are already way ahead of me coding wise if you already do importing. And the relinking addon would be an obvious candidate. It is already very cool.

It sounds like there are two solutions being discussed:
A: Simple solution of skipping reimporting objects with same id. This solution resolves redoing all the objects again and again, but will not update anything if the object has changed, moved etc…
B: Keeping a data block describing the initial imported state of the object and comparing it upon reimport to see if the user has updated anything and skipping each of those properties. Or maybe an option to choose which properties can be reimported anyway? Overwriting the changes…

If it should work like a proxy system the object should be fully imported each time (or at least the oath to the object) but then have a “stand in” in form of the proxy object.

@J_the_Ninja You are right that it would be way cool if it was a solution that could handle different file types. It seems more complicated though unless the solution was more generic and checked which properties blender support on import and only keep track of these. I dont know. Would it be possible to make a single addon that checks every import no matter which file type is being imported? Or is each importer a seperate script?

@indy_logic yeh I actually new the name and some of the functionality… its the third time I make that mistake now… :smiley: Ill never learn thanks for the reminder though… this time i have to remember…

One possible way to do it would be to create an importer addon that calls other importer addons to read in the actual file, then starts tracking the changed properties objects that script creates. Not sure how easy it would be to figure out which blocks got spawned by this action though. The other hard part with this is the actual change tracking. Blender can tell you if an object has been modified, but I’m not sure it will tell you what was changed. The addon might have to compare for that itself.

This thread bubbled up after the BA2.0 upgrade.
I’m working on something like this for rhino.
It has a function to make a hash key for an object and it’s properties. So if two objects have same hash they are the same.
Does blender have such a function?
Otherwise I could make one in python but I fear it would be very slow for larger scenes…

I haven’t seen something similar in blender,
Maybe you can start by comparing simple informations like vertex count, to skip quickly meshs that are different, then go on with the hash generation. md5 hash are made to be fast even with a large amount of data.

Very good idea.