[Bf-committers] How to handle simple files (images, videos, sounds, fonts...) as Assets?

Bastien Montagne montagne29 at wanadoo.fr
Sat Jul 2 17:13:45 CEST 2016

Hey guys & girls,

One of my most recent work in asset-engine branch has been to try to 
introduce mere non-blend files as assets (pictures, sounds, etc.), but 
am facing some serious issues/questions there…

I think it's pretty obvious why we need some kind of asset handling for 
those files - even current Cloud addon in blender only gives access to 
texture files, not texture datablocks.

I can imagine two ways of implementing this in Blender currently:
I) Adding a new 'type' of library (called virtual library so far), which 
has an empty path, and is only there to materialize related datablocks 
as 'lib' ones, and store asset engine references.
II) Adding some extra, asset engine reference type of data to datablocks 
which are based on those files (Image, Text, MovieClip, Sound, etc.).

Option I), which I started to implement in asset-engine branch, is 
rather easy to add - as long as we accept to keep the datablocks 
behaving as 'really' linked ones, that is, to keep them non-editable and 
consider them as mere linked data (with some trick in read/write code to 
actually write datablock itself, and not the usual 'ID' one we use for 
linked data). But I do think we’d want those datablocks to be editable, 
and there comes the problem. Basically, we use `id->lib` as simple test 
everywhere in Blender to detect libblocks, and apply to them specific 
rules (like being non-editable etc.). Having 'virtual' libraries related 
to 'real' datablocks would mean changing this check all over Blender 
codebase, which I'm not totally fan of.

Option II) would mean we kind of put some asset handling code outside of 
pure generic ID/Library area, would be a second, parallel asset handling 
code. Find this even worse solution.

But in both cases, am afraid we end up with some even more complicated 
library handling - and it’s already not the simplest and sanest part of 
Blender… So would love to get your feelings, ideas and advices!


More information about the Bf-committers mailing list