← All ideas
  • Published 5 Apr 2019

Outliner Improvement: Export Object to New .blend File and link

Sometimes when I work, I'm kind of messy and I produce multiple assets in a single file. Usually, it's better to split a file up into multiple assets and link them in, so many artists can work together without having to keep re-linking files. When working in a group, it's not an option to keep multiple assets in a single .blend file (unless, of course, they belong to a set). So I propose an easy way of moving objects to their own .blend and linking them in: simply select the objects in the outliner, right click, and choose "Export Selected and Link."

RCS_idea_0.png

98%

Development Status: Open

Upvote 48 Downvote 1
Josephbburg
5 Apr 2019

9 Comments

awesomedata

This idea is actually really great. :)

Definitely a "Quality-of-Life" improvement for messy artists like me!

2
import bpy 
import os

A = bpy.context.object
S = bpy.context.selected_objects

blendname = bpy.path.basename(bpy.data.filepath)[:-6]
master = os.path.dirname(bpy.data.filepath)
masterlink = master+ "\\" + blendname + ".blend Links\\"
linkpath = masterlink + A.name+".blend"+"\\Object\\"+A.name 
linkpath = linkpath[:3] + "\\" + linkpath[3:] 
bpy.context.window_manager["LinkStore"]=linkpath


bpy.ops.object.select_all(action='INVERT')
I = bpy.context.selected_objects
for ob in I:
    ob.hide_viewport=True
for ob in S:
    ob.select_set(state=True)

try:
    os.mkdir(masterlink)
except:
    print('directory already created')
bpy.ops.wm.save_as_mainfile(copy=True, filepath=masterlink + A.name+".blend")

bpy.ops.object.delete(use_global=False)
for ob in I:
    ob.hide_viewport=False

bpy.ops.wm.link(filename=bpy.context.window_manager["LinkStore"], link=True)
1

im coding it right now

1
Josephbburg Author

Also be sure to check out Selective Save/Export and leave some feedback. This is the post that gave me the idea.

1
andreasng

i cannot understand why blender hasnt got an "export selected" as blend...

tilapiatsu

Hi, I've released an free addon to Export as Blend file :

github.com/Tilapiatsu/blender-export_as_blend/releases/tag/1.0.0

It is not integrated from the outliner, and there is no option to relink after export, but it could be on the future releases

DB3D

this could be done easely by code i think, guys learn coding ! its an entire part of blender !

Josephbburg Author

* @dodododorian * I use Python a lot myself, but this is a feature proposal. There's a whole lot more to learn than code- the existing codebase, for one, is huge. Then there's the whole building process, Git, the patch process... it's not something I have time for right now. I do intend to in the future! But it's not a small task.

2