liboverride_troubleshoot_operation(): fails with context incorrect, even with screen.areas.type == 'OUTLINER' #118299

Closed
opened 2024-02-14 22:56:04 +01:00 by James Tomkinson · 13 comments

System Information
Operating system: Windows-10-10.0.22631-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 2060/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 546.33

Blender Version
Broken: version: 4.0.2, branch: blender-v4.0-release, commit date: 2023-12-05 07:41, hash: 9be62e85b727
Worked: (newest version of Blender that worked as expected)

Short description of error
liboverride_troubleshoot_operation(): fails with context incorrect, even a loop test for screen.areas.type == 'OUTLINER'

Exact steps for others to reproduce the error

save the file library.blend in a folder.

save the file problem.blend in the same folder.

open the file problem.blend

Run the displayed text python script.

Notice the error in console window:
RuntimeError: Operator bpy.ops.outliner.liboverride_troubleshoot_operation.poll() failed, context is incorrect

**System Information** Operating system: Windows-10-10.0.22631-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 2060/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 546.33 **Blender Version** Broken: version: 4.0.2, branch: blender-v4.0-release, commit date: 2023-12-05 07:41, hash: `9be62e85b727` Worked: (newest version of Blender that worked as expected) **Short description of error** liboverride_troubleshoot_operation(): fails with context incorrect, even a loop test for ```screen.areas.type == 'OUTLINER'``` **Exact steps for others to reproduce the error** save the file [library.blend](/attachments/9122159d-0ad7-4f4a-9ac4-4704b0f7dac1) in a folder. save the file [problem.blend](/attachments/71373c8b-b445-4a13-a6cb-2a4fc1c71448) in the same folder. open the file [problem.blend](/attachments/71373c8b-b445-4a13-a6cb-2a4fc1c71448) Run the displayed text python script. Notice the error in console window: ```RuntimeError: Operator bpy.ops.outliner.liboverride_troubleshoot_operation.poll() failed, context is incorrect```
James Tomkinson added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2024-02-14 22:56:05 +01:00
Member

I think the operator is primarily meant for UI usage.

Why not use the API for that?

https://docs.blender.org/api/4.2/bpy.types.IDOverrideLibrary.html#bpy.types.IDOverrideLibrary

object.override_library.resync()
object.override_library.reset()
object.override_library.destroy()
I think the operator is primarily meant for UI usage. Why not use the API for that? https://docs.blender.org/api/4.2/bpy.types.IDOverrideLibrary.html#bpy.types.IDOverrideLibrary ``` object.override_library.resync() object.override_library.reset() object.override_library.destroy() ```
Philipp Oeser added
Status
Needs Information from User
and removed
Status
Needs Triage
labels 2024-02-15 09:19:40 +01:00

I think the operator is primarily meant for UI usage.

Why not use the API for that?

https://docs.blender.org/api/4.2/bpy.types.IDOverrideLibrary.html#bpy.types.IDOverrideLibrary

object.override_library.resync()
object.override_library.reset()
object.override_library.destroy()

because blender crashes? "Houston: we have a problem". See attached crash logs. Also updating problem.blend used in combo with library.blend to update the script that causes a crash. note that I had to reference rig instead of Jeans, as jeans returns None for object.override_library

> I think the operator is primarily meant for UI usage. > > Why not use the API for that? > > https://docs.blender.org/api/4.2/bpy.types.IDOverrideLibrary.html#bpy.types.IDOverrideLibrary > > ``` > object.override_library.resync() > object.override_library.reset() > object.override_library.destroy() > ``` because blender crashes? "Houston: we have a problem". See attached crash logs. Also updating problem.blend used in combo with library.blend to update the script that causes a crash. note that I had to reference rig instead of Jeans, as jeans returns None for ```object.override_library```
Philipp Oeser added
Status
Needs Triage
and removed
Status
Needs Information from User
labels 2024-02-16 09:02:48 +01:00
Member

I can confirm we now have a problem :)

1  lib_override_library_resync                                lib_override.cc    2192 0xdce05a  
2  lib_override_library_main_resync_on_library_indirect_level lib_override.cc    3351 0xde0655  
3  BKE_lib_override_library_main_resync                       lib_override.cc    3610 0xde4d61  
4  setup_app_data                                             blendfile.cc       944  0x82575c  
5  setup_app_blend_file_data                                  blendfile.cc       968  0x8259c9  
6  BKE_blendfile_read_setup_readfile                          blendfile.cc       1006 0x825f02  
7  WM_file_read                                               wm_files.cc        1042 0x4847645 
8  wm_file_read_opwrap                                        wm_files.cc        2776 0x4854db3 
9  wm_open_mainfile__open                                     wm_files.cc        2902 0x4855e5a 
10 wm_open_mainfile_exec                                      wm_files.cc        2933 0x485606e 
11 wm_handler_fileselect_do                                   wm_event_system.cc 2806 0x480660d 
12 wm_handler_fileselect_call                                 wm_event_system.cc 2898 0x4807ef1 
13 wm_handlers_do_intern                                      wm_event_system.cc 3390 0x48141b2 
14 wm_handlers_do                                             wm_event_system.cc 3444 0x4814830 
15 wm_event_do_handlers                                       wm_event_system.cc 4071 0x481ed7a 
16 WM_main                                                    wm.cc              619  0x47c8abb 
17 main                                                       creator.cc         574  0x7ff67a  

I can now not open the problem.blend anymore without crashing. (even in slightly older blender versions)
Have you updated the file(s) in the original report description as well (the first comment)?
So are has any of object.override_library.XXX() already run in problem.blend? (that might have "corrupted" it)

Note we also had a related fix just in (you know, #118055)

I can confirm we now have a problem :) ``` 1 lib_override_library_resync lib_override.cc 2192 0xdce05a 2 lib_override_library_main_resync_on_library_indirect_level lib_override.cc 3351 0xde0655 3 BKE_lib_override_library_main_resync lib_override.cc 3610 0xde4d61 4 setup_app_data blendfile.cc 944 0x82575c 5 setup_app_blend_file_data blendfile.cc 968 0x8259c9 6 BKE_blendfile_read_setup_readfile blendfile.cc 1006 0x825f02 7 WM_file_read wm_files.cc 1042 0x4847645 8 wm_file_read_opwrap wm_files.cc 2776 0x4854db3 9 wm_open_mainfile__open wm_files.cc 2902 0x4855e5a 10 wm_open_mainfile_exec wm_files.cc 2933 0x485606e 11 wm_handler_fileselect_do wm_event_system.cc 2806 0x480660d 12 wm_handler_fileselect_call wm_event_system.cc 2898 0x4807ef1 13 wm_handlers_do_intern wm_event_system.cc 3390 0x48141b2 14 wm_handlers_do wm_event_system.cc 3444 0x4814830 15 wm_event_do_handlers wm_event_system.cc 4071 0x481ed7a 16 WM_main wm.cc 619 0x47c8abb 17 main creator.cc 574 0x7ff67a ``` I can now not open the `problem.blend` anymore without crashing. (even in slightly older blender versions) Have you updated the file(s) in the original report description as well (the first comment)? So are has any of object.override_library.XXX() already run in `problem.blend`? (that might have "corrupted" it) Note we also had a related fix just in (you know, #118055)
Member

The crash logs are from 4.0.2 which does not have the mentioned fix, have you retried this in a fresh build from https://builder.blender.org/download/daily/ ?

The crash logs are from 4.0.2 which does not have the mentioned fix, have you retried this in a fresh build from https://builder.blender.org/download/daily/ ?
Member

Oh, now I see 4.0.2 still opens it fine, checking...

Oh, now I see 4.0.2 still opens it fine, checking...
Member

OK, so seems the lib was using Library Override templates?
These were removed in 25ab53a4af [which will now crash loading problem.blend]
Unless you have No Override Auto Resync turned ON :
image

@mont29 : I can imagine this is expected behavior?

Coming back to the original problem:

  • IF I have the above checked I can still open problem.blend
  • running the code below does not really make sense then (since all override data has been removed...)
import bpy
o= bpy.data.objects['JBUJeans_9015.Shape.001']
o.override_library.resync( bpy.context.scene, do_hierarchy_enforce=True )

So I guess this leaves us with the following:

  • @jamestomk : can you come up with example files not using Library Override templates that still have an issue with using the API object.override_library.XXX() ?
OK, so seems the lib was using `Library Override templates`? These were removed in 25ab53a4af571a25339cad7c8f687c9b72408269 [which will now crash loading `problem.blend`] Unless you have `No Override Auto Resync` turned ON : ![image](/attachments/c8b37676-c389-4e62-ac01-59a5e14930fb) @mont29 : I can imagine this is expected behavior? Coming back to the original problem: - IF I have the above checked I can still open `problem.blend` - running the code below does not really make sense then (since all override data has been removed...) ``` import bpy o= bpy.data.objects['JBUJeans_9015.Shape.001'] o.override_library.resync( bpy.context.scene, do_hierarchy_enforce=True ) ``` So I guess this leaves us with the following: - @jamestomk : can you come up with example files **not** using `Library Override templates` that still have an issue with using the API `object.override_library.XXX()` ?
Philipp Oeser added
Status
Needs Information from User
and removed
Status
Needs Triage
labels 2024-02-16 12:02:57 +01:00

LibOverrides templates have been removed, yes, but this should not crash. Expected behavior is to just get regular local data in such case.

Fix incoming.

LibOverrides templates have been removed, yes, but this should not crash. Expected behavior is to just get regular local data in such case. Fix incoming.
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2024-02-16 15:16:55 +01:00
Member

@mont29 : thx for the fix.

Will reopen though since the original issue is about something else

@mont29 : thx for the fix. Will reopen though since the original issue is about something else
Blender Bot added
Status
Confirmed
and removed
Status
Resolved
labels 2024-02-16 15:18:59 +01:00
Philipp Oeser added
Status
Needs Information from User
Type
Report
and removed
Module
Core
Status
Confirmed
Type
Bug
labels 2024-02-16 15:19:37 +01:00
Member

So I guess this leaves us with the following:

  • @jamestomk : can you come up with example files not using Library Override templates that still have an issue with using the API object.override_library.XXX() ?

poking on this one ^^

> So I guess this leaves us with the following: > - @jamestomk : can you come up with example files **not** using `Library Override templates` that still have an issue with using the API `object.override_library.XXX()` ? poking on this one ^^

So I guess this leaves us with the following:

  • @jamestomk : can you come up with example files not using Library Override templates that still have an issue with using the API object.override_library.XXX() ?

poking on this one ^^

this confuses me. I'm not sure when I'd ever use a library_override method on anything not involving a linked library that needs an override.

> > So I guess this leaves us with the following: > > - @jamestomk : can you come up with example files **not** using `Library Override templates` that still have an issue with using the API `object.override_library.XXX()` ? > > poking on this one ^^ this confuses me. I'm not sure when I'd ever use a library_override method on anything not involving a linked library that needs an override.

I have just re-tested with the daily build "blender-4.2.0-alpha+main.fbf47b9a126a-windows.amd64-release" and I still get a crash.

I have just re-tested with the daily build "blender-4.2.0-alpha+main.fbf47b9a126a-windows.amd64-release" and I still get a crash.
Member

So I guess this leaves us with the following:

  • @jamestomk : can you come up with example files not using Library Override templates that still have an issue with using the API object.override_library.XXX() ?

poking on this one ^^

this confuses me. I'm not sure when I'd ever use a library_override method on anything not involving a linked library that needs an override.

The comment was about not using Library Override templates (and the original file from this report are using these, no?)
I am saying this because when using Library Override templates, you get this in the console after their removal in 25ab53a4af

WARN (bke.liboverride_resync): source/blender/blenkernel/intern/lib_override.cc:3472 lib_override_library_main_resync_on_library_indirect_level: Keeping user-edited ID override NTHair Color Chooser.Zack.002 from library level 0 still found as needing resync, and being isolated from its hierarchy root. This can happen when its otherwise unchanged linked reference was moved around in the library file (e.g. if an object was moved into another sub-collection of the same hierarchy).
WARN (bke.liboverride_resync): source/blender/blenkernel/intern/lib_override.cc:3461 lib_override_library_main_resync_on_library_indirect_level: Deleting unused ID override NTZackHairColor.002 from library level 0, still found as needing resync, and being isolated from its hierarchy root. This can happen when its otherwise unchanged linked reference was moved around in the library file (e.g. if an object was moved into another sub-collection of the same hierarchy).

Warning: Library override templates have been removed: removing all override data from the data-block 'OBMuscleShirt_15736.Shape.009'
Warning: Library override templates have been removed: removing all override data from the data-block 'MEMuscleShirt_15736.011'
Warning: Library override templates have been removed: removing all override data from the data-block 'MEMuscleShirt_15736.011'
Warning: Library override templates have been removed: removing all override data from the data-block 'MAJBUShirt_15141_Buttons'
Warning: Library override templates have been removed: removing all override data from the data-block 'MAJBUShirt_15141_Buttons.002'
Warning: Library override templates have been removed: removing all override data from the data-block 'MAJBUShirt_15141_Collar'
Warning: Library override templates have been removed: removing all override data from the data-block 'MAJBUShirt_15141_Collar.002'
Warning: Library override templates have been removed: removing all override data from the data-block 'MAJBUShirt_15141_ShirtBack'
Warning: Library override templates have been removed: removing all override data from the data-block 'MAJBUShirt_15141_ShirtBack.002'
Warning: Library override templates have been removed: removing all override data from the data-block 'MAJBUShirt_15141_ShirtFront'
Warning: Library override templates have been removed: removing all override data from the data-block 'MAJBUShirt_15141_ShirtFront.002'
Warning: Library override templates have been removed: removing all override data from the data-block 'MAJBUShirt_15141_Sleeves'
Warning: Library override templates have been removed: removing all override data from the data-block 'MAJBUShirt_15141_Sleeves.002'
Warning: Library override templates have been removed: removing all override data from the data-block 'MAMuscleShirt_15736_MuscleShirt.001'
Warning: Library override templates have been removed: removing all override data from the data-block 'NTHair Color'
Warning: Library override templates have been removed: removing all override data from the data-block 'NTHair Color Chooser.Toulouse'
Warning: Library override templates have been removed: removing all override data from the data-block 'NTHair Color Chooser.Toulouse.002'
Warning: Library override templates have been removed: removing all override data from the data-block 'NTHair Color.002'
Warning: Library override templates have been removed: removing all override data from the data-block 'NTJeans Color Override'
Warning: Library override templates have been removed: removing all override data from the data-block 'NTJeans Color Override.002'
Warning: Library override templates have been removed: removing all override data from the data-block 'NTShirt Color Override'
Warning: Library override templates have been removed: removing all override data from the data-block 'NTShirt Color Override.002'
Warning: Library override templates have been removed: removing all override data from the data-block 'NTStrands Color'
Warning: Library override templates have been removed: removing all override data from the data-block 'NTStrands Color.002'
Warning: Library override templates have been removed: removing all override data from the data-block 'NTToulouseBaseColor.001'
Warning: Library override templates have been removed: removing all override data from the data-block 'NTToulouseBaseColor.003'
Warning: Library override templates have been removed: removing all override data from the data-block 'NTToulouseStrandsColor'
Warning: Library override templates have been removed: removing all override data from the data-block 'NTToulouseStrandsColor.002'

I have just re-tested with the daily build "blender-4.2.0-alpha+main.fbf47b9a126a-windows.amd64-release" and I still get a crash.

fbf47b9a12 is from Feb07 (so that one does not have the fix in), could you check if this is still crashing for you in 4.1 or other fresh builds? On my side I dont get a crash here anymore. Also, if I use the files from #118299 (comment), the script can now be executed without errors, can you confirm this?

> > > So I guess this leaves us with the following: > > > - @jamestomk : can you come up with example files **not** using `Library Override templates` that still have an issue with using the API `object.override_library.XXX()` ? > > > > poking on this one ^^ > > this confuses me. I'm not sure when I'd ever use a library_override method on anything not involving a linked library that needs an override. The comment was about not using `Library Override templates` (and the original file from this report are using these, no?) I am saying this because when using `Library Override templates`, you get this in the console after their removal in 25ab53a4af ``` WARN (bke.liboverride_resync): source/blender/blenkernel/intern/lib_override.cc:3472 lib_override_library_main_resync_on_library_indirect_level: Keeping user-edited ID override NTHair Color Chooser.Zack.002 from library level 0 still found as needing resync, and being isolated from its hierarchy root. This can happen when its otherwise unchanged linked reference was moved around in the library file (e.g. if an object was moved into another sub-collection of the same hierarchy). WARN (bke.liboverride_resync): source/blender/blenkernel/intern/lib_override.cc:3461 lib_override_library_main_resync_on_library_indirect_level: Deleting unused ID override NTZackHairColor.002 from library level 0, still found as needing resync, and being isolated from its hierarchy root. This can happen when its otherwise unchanged linked reference was moved around in the library file (e.g. if an object was moved into another sub-collection of the same hierarchy). Warning: Library override templates have been removed: removing all override data from the data-block 'OBMuscleShirt_15736.Shape.009' Warning: Library override templates have been removed: removing all override data from the data-block 'MEMuscleShirt_15736.011' Warning: Library override templates have been removed: removing all override data from the data-block 'MEMuscleShirt_15736.011' Warning: Library override templates have been removed: removing all override data from the data-block 'MAJBUShirt_15141_Buttons' Warning: Library override templates have been removed: removing all override data from the data-block 'MAJBUShirt_15141_Buttons.002' Warning: Library override templates have been removed: removing all override data from the data-block 'MAJBUShirt_15141_Collar' Warning: Library override templates have been removed: removing all override data from the data-block 'MAJBUShirt_15141_Collar.002' Warning: Library override templates have been removed: removing all override data from the data-block 'MAJBUShirt_15141_ShirtBack' Warning: Library override templates have been removed: removing all override data from the data-block 'MAJBUShirt_15141_ShirtBack.002' Warning: Library override templates have been removed: removing all override data from the data-block 'MAJBUShirt_15141_ShirtFront' Warning: Library override templates have been removed: removing all override data from the data-block 'MAJBUShirt_15141_ShirtFront.002' Warning: Library override templates have been removed: removing all override data from the data-block 'MAJBUShirt_15141_Sleeves' Warning: Library override templates have been removed: removing all override data from the data-block 'MAJBUShirt_15141_Sleeves.002' Warning: Library override templates have been removed: removing all override data from the data-block 'MAMuscleShirt_15736_MuscleShirt.001' Warning: Library override templates have been removed: removing all override data from the data-block 'NTHair Color' Warning: Library override templates have been removed: removing all override data from the data-block 'NTHair Color Chooser.Toulouse' Warning: Library override templates have been removed: removing all override data from the data-block 'NTHair Color Chooser.Toulouse.002' Warning: Library override templates have been removed: removing all override data from the data-block 'NTHair Color.002' Warning: Library override templates have been removed: removing all override data from the data-block 'NTJeans Color Override' Warning: Library override templates have been removed: removing all override data from the data-block 'NTJeans Color Override.002' Warning: Library override templates have been removed: removing all override data from the data-block 'NTShirt Color Override' Warning: Library override templates have been removed: removing all override data from the data-block 'NTShirt Color Override.002' Warning: Library override templates have been removed: removing all override data from the data-block 'NTStrands Color' Warning: Library override templates have been removed: removing all override data from the data-block 'NTStrands Color.002' Warning: Library override templates have been removed: removing all override data from the data-block 'NTToulouseBaseColor.001' Warning: Library override templates have been removed: removing all override data from the data-block 'NTToulouseBaseColor.003' Warning: Library override templates have been removed: removing all override data from the data-block 'NTToulouseStrandsColor' Warning: Library override templates have been removed: removing all override data from the data-block 'NTToulouseStrandsColor.002' ``` > I have just re-tested with the daily build "blender-4.2.0-alpha+main.fbf47b9a126a-windows.amd64-release" and I still get a crash. > fbf47b9a126a is from Feb07 (so that one does not have the fix in), could you check if this is still crashing for you in 4.1 or other fresh builds? On my side I dont get a crash here anymore. Also, if I use the files from https://projects.blender.org/blender/blender/issues/118299#issuecomment-1124740, the script can now be executed without errors, can you confirm this?

Yes this seems to work!

import bpy

if  bpy.context.scene.name=='benched.002':
    # ... 
    
    # fix overrides to resync troublesome objects
    override_objs = [ 'rig-dz0.004' ]
    for window in bpy.context.window_manager.windows:
        screen = window.screen

        for area in screen.areas:
            if area.type == 'OUTLINER':
                for oNm in override_objs:
                    o = bpy.data.objects[ oNm ]
                    o.select_set( True )
                    with bpy.context.temp_override(scene=bpy.context.scene, window=window, area=area):
                        #bpy.ops.outliner.liboverride_operation( )
                        bpy.ops.outliner.liboverride_troubleshoot_operation( )
Yes this seems to work! ``` import bpy if bpy.context.scene.name=='benched.002': # ... # fix overrides to resync troublesome objects override_objs = [ 'rig-dz0.004' ] for window in bpy.context.window_manager.windows: screen = window.screen for area in screen.areas: if area.type == 'OUTLINER': for oNm in override_objs: o = bpy.data.objects[ oNm ] o.select_set( True ) with bpy.context.temp_override(scene=bpy.context.scene, window=window, area=area): #bpy.ops.outliner.liboverride_operation( ) bpy.ops.outliner.liboverride_troubleshoot_operation( ) ```
Blender Bot added
Status
Archived
and removed
Status
Needs Information from User
labels 2024-04-04 23:07:54 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#118299
No description provided.