Coming up against the same thing I wrote some scripts many moons ago, with the idea of making it an addon. Only got this far, I've updated to handle clips.
Run this script in the blend file with bg images set up. It adds a set of properties onto the images mirroring the background image settings, & also the name of the screen the 3D view is in. (Doesn't discern for multi 3d views in same screen).
import bpy
context = bpy.context
text = bpy.data.texts.get("BGImages.py")
if text is None:
text = bpy.data.texts.new("BGImages.py")
text.clear()
spaces = [space for screen in bpy.data.screens
for a in screen.areas if a.type == 'VIEW_3D'
for space in a.spaces if space.type == 'VIEW_3D' if len(space.background_images)]
for s in spaces:
text.write("#Screen: %s\n" % s.id_data.name)
for i in s.background_images:
text.write("#%s\n" % ("-"*72))
for p in i.bl_rna.properties.keys():
if p in ['rna_type', 'image_user', 'clip_user']:
continue
val = getattr(i, p)
text.write("i.%s = " % p)
text.write("%s\n" % repr(val))
if not val:
continue
if i.source == 'IMAGE':
i.image["screen"] = s.id_data.name
if type(val).__name__ in ["bool", "str", "float", "int"]:
i.image[p] = val
else:
i.clip["screen"] = s.id_data.name
if type(val).__name__ in ["bool", "str", "float", "int"]:
i.clip[p] = val
It creates a text file named BGImages.py, ( ultimately making this a script to link / append then run and import, was the idea 8^)
#Screen: Scripting
#------------------------------------------------------------------------
i.source = 'IMAGE'
i.image = bpy.data.images['getting_started.blend2.png']
i.clip = None
i.offset_x = 0.0
i.offset_y = 0.0
i.size = 10.0
i.rotation = 0.0
i.use_flip_x = False
i.use_flip_y = False
i.opacity = 0.5
i.view_axis = 'ALL'
i.show_expanded = True
i.use_camera_clip = True
i.show_background_image = True
i.show_on_foreground = False
i.draw_depth = 'BACK'
i.frame_method = 'STRETCH'
Now in your new file if you link / append the bg images & run this script
import bpy
images = [i for i in bpy.data.images if "screen" in i.keys()]
clips = [i for i in bpy.data.movieclips if "screen" in i.keys()]
dic = {}
images.extend(clips)
for i in images:
l = dic.setdefault(i["screen"], [])
l.append(i)
def gonk(self, context):
space = context.area.spaces.active
for i in dic.setdefault(context.screen.name, []):
print(i.name)
bi = space.background_images.new()
if i["source"] == 'IMAGE':
bi.image = i
else:
bi.clip = i
for k in i.keys():
if k in ["screen", "image", "clip"]:
continue
setattr(bi, k, i[k])
def bgimages(self, context):
layout = self.layout
screen = context.screen
l = dic.setdefault(screen.name, [])
layout.enabled = len(l) > 0
layout.prop(context.screen, "toggle", toggle=True, text="%s (%d)" % (screen.name, len(l)))
bpy.types.Screen.toggle = bpy.props.BoolProperty(update=gonk)
bpy.types.VIEW3D_PT_background_image.append(bgimages)
You will see a button which tells me that two images in the Scripting screen 3DView can be added to the backround images of this 3D view in the Scripting screen of my new file. You will need to change the screen name to match the screen name of the original file.