typing
This commit is contained in:
parent
c1b3cde57f
commit
d0c11a500c
3 changed files with 10 additions and 7 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue