Is there a way to maintain hierarchy objects after we Make Local several linked objects the scene ?

I notice that if we try Make Local the parent object, the child will be put outside the parent, in my code example below, the last for loop was to make every objects that start with prefix "C_" will be made local, but I can't find a way how to order the loop so it would start from child to parent, instead of randomly pick the object.

import bpy

context = bpy.context
scene = context.scene

filepath = "C:/Char/C_Character.blend"

# append all objects starting with 'C_'
with bpy.data.libraries.load(filepath, link=True) as (data_from, data_to):
    data_to.objects = [name for name in data_from.objects if name.startswith("C_")]

# link them to scene
for obj in data_to.objects:
    if obj is not None:

# make them local
for obj in scene.objects:
    if obj.name.startswith("C_"):

enter image description here

Thanks a lot !


1 Answer 1


I somehow accidentally using Operator Search (F3) and type in Make Local to selected objects, and the hierarchy perfectly maintain, though using operator is not really ideal, but it works at the moment. EDIT : Please make sure you turn off Empty and Curve object display, it need to local mesh first to mantain hierarchy

so I change the script to :

# make them local
for obj in scene.objects:
    if obj.name.startswith("C_"):

So I hope this can be helpful



You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .