diff --git a/__init__.py b/__init__.py index fd1357d..7be2f5c 100644 --- a/__init__.py +++ b/__init__.py @@ -30,6 +30,7 @@ def register(): # Register Keymaps wm = bpy.context.window_manager + assert wm if wm.keyconfigs.addon: km = wm.keyconfigs.addon.keymaps.new(name='Node Editor', space_type='NODE_EDITOR') kmi = km.keymap_items.new("slicenode.group_make", 'G', 'PRESS', ctrl=True) diff --git a/core/nodeslicer/tree.py b/core/nodeslicer/tree.py index e2e0dca..a565144 100644 --- a/core/nodeslicer/tree.py +++ b/core/nodeslicer/tree.py @@ -143,10 +143,11 @@ class SLICENODE_OT_GroupToggle(Operator): @classmethod def poll(cls, context): + assert context.space_data return (context.space_data.type == 'NODE_EDITOR' and - context.space_data.tree_type == "SLICETREE_NodeTree") + context.space_data.tree_type == "SLICETREE_NodeTree") # pyright: ignore[reportAttributeAccessIssue] - def execute(self, context): + def execute(self, context) -> set[OperatorReturnItems]: space = context.space_data path = getattr(space, 'path', None) if not path: @@ -179,16 +180,17 @@ class SLICENODE_OT_GroupMake(Operator): @classmethod def poll(cls, context): + assert context.space_data return (context.space_data.type == 'NODE_EDITOR' and - context.space_data.edit_tree and - context.space_data.edit_tree.bl_idname == "SLICETREE_NodeTree" and - any(n.select for n in context.space_data.edit_tree.nodes)) + context.space_data.edit_tree and # pyright: ignore[reportAttributeAccessIssue, reportOptionalMemberAccess] + context.space_data.edit_tree.bl_idname == "SLICETREE_NodeTree" and # pyright: ignore[reportAttributeAccessIssue, reportOptionalMemberAccess] + any(n.select for n in context.space_data.edit_tree.nodes)) # pyright: ignore[reportAttributeAccessIssue, reportOptionalMemberAccess] def execute(self, context): import bpy from mathutils import Vector space = context.space_data - tree = space.edit_tree + tree = space.edit_tree # pyright: ignore[reportAttributeAccessIssue, reportOptionalMemberAccess] selected_nodes = [n for n in tree.nodes if n.select and n.bl_idname != 'NodeReroute'] if not selected_nodes: diff --git a/infra/blender/blender_slice_nodes_generic.py b/infra/blender/blender_slice_nodes_generic.py index dc625fc..4de1293 100644 --- a/infra/blender/blender_slice_nodes_generic.py +++ b/infra/blender/blender_slice_nodes_generic.py @@ -190,7 +190,7 @@ class SLICENODE_Group(bpy.types.NodeCustomGroup, AutoBlIdName): self.sync_sockets() - slicer_tree: bpy.props.PointerProperty( + slicer_tree: bpy.props.PointerProperty( # pyright: ignore[reportInvalidTypeForm] type=bpy.types.NodeTree, name="Node Tree", update=_tree_updated