This commit is contained in:
Nicolas Predella 2026-06-02 12:32:56 +03:00
parent c1b3cde57f
commit d0c11a500c
3 changed files with 10 additions and 7 deletions

View file

@ -30,6 +30,7 @@ def register():
# Register Keymaps # Register Keymaps
wm = bpy.context.window_manager wm = bpy.context.window_manager
assert wm
if wm.keyconfigs.addon: if wm.keyconfigs.addon:
km = wm.keyconfigs.addon.keymaps.new(name='Node Editor', space_type='NODE_EDITOR') 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) kmi = km.keymap_items.new("slicenode.group_make", 'G', 'PRESS', ctrl=True)

View file

@ -143,10 +143,11 @@ class SLICENODE_OT_GroupToggle(Operator):
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):
assert context.space_data
return (context.space_data.type == 'NODE_EDITOR' and 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 space = context.space_data
path = getattr(space, 'path', None) path = getattr(space, 'path', None)
if not path: if not path:
@ -179,16 +180,17 @@ class SLICENODE_OT_GroupMake(Operator):
@classmethod @classmethod
def poll(cls, context): def poll(cls, context):
assert context.space_data
return (context.space_data.type == 'NODE_EDITOR' and return (context.space_data.type == 'NODE_EDITOR' and
context.space_data.edit_tree and context.space_data.edit_tree and # pyright: ignore[reportAttributeAccessIssue, reportOptionalMemberAccess]
context.space_data.edit_tree.bl_idname == "SLICETREE_NodeTree" and 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)) any(n.select for n in context.space_data.edit_tree.nodes)) # pyright: ignore[reportAttributeAccessIssue, reportOptionalMemberAccess]
def execute(self, context): def execute(self, context):
import bpy import bpy
from mathutils import Vector from mathutils import Vector
space = context.space_data 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'] selected_nodes = [n for n in tree.nodes if n.select and n.bl_idname != 'NodeReroute']
if not selected_nodes: if not selected_nodes:

View file

@ -190,7 +190,7 @@ class SLICENODE_Group(bpy.types.NodeCustomGroup, AutoBlIdName):
self.sync_sockets() self.sync_sockets()
slicer_tree: bpy.props.PointerProperty( slicer_tree: bpy.props.PointerProperty( # pyright: ignore[reportInvalidTypeForm]
type=bpy.types.NodeTree, type=bpy.types.NodeTree,
name="Node Tree", name="Node Tree",
update=_tree_updated update=_tree_updated