Pluglug
When saving a file that uses library overrides, the following error appears in the console. It does not affect functionality but clutters the logs.
Traceback (most recent call last):
File ".../ZenSets/sets/objects/object_panel_list.py", line 51, in get_zen_object_index
p_act_obj = context.object
^^^^^^^^^^^^^^
AttributeError: 'Context' object has no attribute 'object'
Environment:
- Windows 10
- Blender 4.3.2
- ZenSets 2.4.4.0
Steps to Reproduce
- Create two
.blendfiles:- “Perfect_Character_Final_Fix_5_Latest.blend”
- Create a collection named “Character_LINKME”.
- Add some objects to the collection.
- “Shot20_Using_LibraryData.blend” (working file)
- Go to Top Bar > File > Link.
- Select “Perfect_Character_Final_Fix_5_Latest.blend”.
- Navigate to Collections > Character_LINKME and link it.
- In the Outliner, select the linked collection.
- Go to Library Override > Make > Selected and execute.
- Check the console for the error.
- Saving the file produces the same error.
- “Perfect_Character_Final_Fix_5_Latest.blend”
Simple Fix: Add a Fallback
class ZsObjectPanelUtils:
def get_zen_object_index(self):
context = bpy.context
# Use only 'object' but not 'active_object' !!!
p_act_obj = getattr(context, "object", None)
if p_act_obj is None:
Log.error("AttributeError: 'Context' object has no attribute 'object'")
Log.info(f"context.mode: {getattr(context, 'mode', 'UNKNOWN')}")
Log.info(f"context.screen: {getattr(context, 'screen', 'UNKNOWN')}")
Log.info(f"context.area: {getattr(context, 'area', 'UNKNOWN')}")
Log.info(f"context.region: {getattr(context, 'region', 'UNKNOWN')}")
Log.info(f"context.scene: {getattr(context, 'scene', 'UNKNOWN')}")
Log.info(f"context.view_layer: {getattr(context, 'view_layer', 'UNKNOWN')}")
Log.info(f"context.window: {getattr(context, 'window', 'UNKNOWN')}")
Log.info(f"context.window_manager: {getattr(context, 'window_manager', 'UNKNOWN')}")
Log.info(f"context.active_object: {getattr(context, 'active_object', 'UNKNOWN')}")
return -1
Zen Sets is an amazing addon! Thank you for your hard work!
Imported from Discord