Library override make editable in python, blender 3.2

Hello Blender users!

I need some help on this little problem.
I try to make objects in my scene “Editable” in Library override mode, but I don’t know how to do that in python.
When I do it by hand I use one of these Ops:

bpy.ops.outliner.id_operation(type=“OVERRIDE_LIBRARY_MAKE_EDITABLE”)
bpy.ops.ed.lib_id_override_editable_toggle()

But I didn’t find the wright way to use them in code, and there might be some better way to access the parameter.

I second this question. I simply cannot find any proper way to handle this in the API.
Our animators will go crazy having to do multiple clicks for every asset by hand.

Same here. Ther only solution is to use scripts to get a proper context(
Update: Script doesn’t work(
I need 1 click context independent button to make Editable Overrides

Hello, could you elaborate on the exact usecase for this workflow ? I can’t find how to call this particular feature.

Hello, to elaborate a bit:
The problem is when an object is in library override, to modify it’s data (for example the location) you need it to be “Editable”:

I’m looking for a way to make it editable in python, so I can -for example- unlock every object I know i’ll be moving.

Hello everybody. I’m struggling too trying to make it works.
I try to share my (poor) progress:


       
#make outliner fullscreen
            for window in context.window_manager.windows:
                screen = window.screen
                for area in screen.areas:
                    if area.type == 'OUTLINER':
                        with context.temp_override(window=window, area=area):
                            bpy.ops.screen.screen_full_area()
#--------------------#                            
                            #deselect all
                            bpy.ops.object.select_all(action='DESELECT')
                            #select the target layer_collection 
                            coll = bpy.context.view_layer.layer_collection.children[0]   #here the target collection, this is an exsample
                            #make the collection active in the outliner
                            bpy.context.view_layer.active_layer_collection = coll
                            
                            #make it editable !! this gives the ERROR!!!!
                            bpy.ops.outliner.id_operation(type = 'OVERRIDE_LIBRARY_MAKE_EDITABLE')
                       break

This code seems to correctly select the collection, but when it launch the id_operation it returns:

ret = _op_call(self.idname_py(), None, kw)
TypeError: Converting py args to operator properties: enum “OVERRIDE_LIBRARY_MAKE_EDITABLE” not found in (‘UNLINK’, ‘LOCAL’, ‘SINGLE’, ‘DELETE’, ‘REMAP’, ‘OVERRIDE_LIBRARY_RESET’, ‘OVERRIDE_LIBRARY_RESET_HIERARCHY’, ‘OVERRIDE_LIBRARY_RESYNC_HIERARCHY’, ‘OVERRIDE_LIBRARY_RESYNC_HIERARCHY_ENFORCE’, ‘OVERRIDE_LIBRARY_CLEAR_SINGLE’, ‘OVERRIDE_LIBRARY_CLEAR_HIERARCHY’, ‘COPY’, ‘PASTE’, ‘ADD_FAKE’, ‘CLEAR_FAKE’, ‘RENAME’, ‘SELECT_LINKED’)

This make me think about two options:
(the nice one) The way I’m trying to select the collection is still wrong.
(the bad one) It’s not possibile to do it.

It would be supercool to have this feature, please help! Thanks everybody :pray:

P.S:
Could you tell me more about this?

bpy.ops.ed.lib_id_override_editable_toggle()

In witch context should be called?

1 Like

Hello!
One of my coworker found a solution! :sparkles: :sparkles:

def make_override_editable(obj):
    if not obj.override_library:
        return
    if not obj.override_library.is_system_override:
        # already user editable
        return

    override = bpy.context.copy()
    override["id"] = obj.override_library.id_data
    with bpy.context.temp_override(**override):
        bpy.ops.ed.lib_id_override_editable_toggle()

I don’t really know how he managed to do it but it works, big nameless shoutout to him!
Hope it can help others too ~

2 Likes

Hey there. I asked the developer of the Overrides system, Bastien Montagne, and it turns out there is a nice and easy way to do this:

obj.override_library.is_system_override = False
Documentation: docs.blender.org/api/master/bpy.types.IDOverrideLibrary.html#bpy.types.IDOverrideLibrary.is_system_override

2 Likes