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:
@@ -8335,7 +8335,7 @@ class VIEW3D_AST_sculpt_brushes(bpy.types.AssetShelf):
|
||||
if not prefs.experimental.use_extended_asset_browser:
|
||||
return False
|
||||
|
||||
return bool(context.object and context.object.mode == 'SCULPT')
|
||||
return context.mode == 'SCULPT'
|
||||
|
||||
@classmethod
|
||||
def asset_poll(cls, asset):
|
||||
|
||||
@@ -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