Fix missing context attribute access in asset shelf polls
When creating a new main window, the `context.object` attribute wouldn't exist, causing an error message to be printed. Rather than checking if the attribute extists, query the mode from context directly (this is always available), rather than querying it through the active object.
This commit is contained in:
@@ -7,7 +7,7 @@ class MyAssetShelf(bpy.types.AssetShelf):
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return bool(context.object and context.object.mode == 'OBJECT')
|
||||
return context.mode == 'OBJECT'
|
||||
|
||||
@classmethod
|
||||
def asset_poll(cls, asset):
|
||||
|
||||
Reference in New Issue
Block a user