Fix #147476: errors/crashes calling node menus outside the Node Editor
Calling node menus in the context of a different editor can lead to errors in many places (e.g. checking on space_data tree_type/ node_tree_sub_type), so to resolve, add a very general poll function to the NodeMenu class. Pull Request: https://projects.blender.org/blender/blender/pulls/147512
This commit is contained in:
committed by
Philipp Oeser
parent
d989117f09
commit
8d4f883d27
@@ -115,6 +115,10 @@ class NodeMenu(Menu):
|
||||
root_asset_menu: str
|
||||
pathing_dict: dict[str, str]
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.space_data.type == 'NODE_EDITOR'
|
||||
|
||||
@classmethod
|
||||
def node_operator(cls, layout, node_type, *, label=None, poll=None, search_weight=0.0, translate=True):
|
||||
"""The main operator defined for the node menu.
|
||||
|
||||
Reference in New Issue
Block a user