forked from LeenkxTeam/LNXSDK
t3du - Labels for finding nodes
This commit is contained in:
@ -18,6 +18,10 @@ class CallGroupNode(LnxLogicTreeNode):
|
|||||||
def lnx_init(self, context):
|
def lnx_init(self, context):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def update(self):
|
||||||
|
if self.group_tree:
|
||||||
|
self.label = f'Group: {self.group_tree.name}'
|
||||||
|
|
||||||
# Function to add input sockets and re-link sockets
|
# Function to add input sockets and re-link sockets
|
||||||
def update_inputs(self, tree, node, inp_sockets, in_links):
|
def update_inputs(self, tree, node, inp_sockets, in_links):
|
||||||
count = 0
|
count = 0
|
||||||
@ -58,10 +62,12 @@ class CallGroupNode(LnxLogicTreeNode):
|
|||||||
tree.links.new(current_socket, link)
|
tree.links.new(current_socket, link)
|
||||||
count = count + 1
|
count = count + 1
|
||||||
|
|
||||||
def remove_tree(self):
|
|
||||||
self.group_tree = None
|
|
||||||
|
|
||||||
def update_sockets(self, context):
|
def update_sockets(self, context):
|
||||||
|
if self.group_tree:
|
||||||
|
self.label = f'Group: {self.group_tree.name}'
|
||||||
|
else:
|
||||||
|
self.label = 'Call Node Group'
|
||||||
|
|
||||||
# List to store from and to sockets of connected nodes
|
# List to store from and to sockets of connected nodes
|
||||||
from_socket_list = []
|
from_socket_list = []
|
||||||
to_socket_list = []
|
to_socket_list = []
|
||||||
@ -107,6 +113,10 @@ class CallGroupNode(LnxLogicTreeNode):
|
|||||||
# Prperty to store group tree pointer
|
# Prperty to store group tree pointer
|
||||||
group_tree: PointerProperty(name='Group', type=bpy.types.NodeTree, update=update_sockets)
|
group_tree: PointerProperty(name='Group', type=bpy.types.NodeTree, update=update_sockets)
|
||||||
|
|
||||||
|
def edit_tree(self):
|
||||||
|
self.label = f'Group: {self.group_tree.name}'
|
||||||
|
bpy.ops.lnx.edit_group_tree()
|
||||||
|
|
||||||
def draw_label(self) -> str:
|
def draw_label(self) -> str:
|
||||||
if self.group_tree is not None:
|
if self.group_tree is not None:
|
||||||
return f'Group: {self.group_tree.name}'
|
return f'Group: {self.group_tree.name}'
|
||||||
@ -134,8 +144,9 @@ class CallGroupNode(LnxLogicTreeNode):
|
|||||||
op = row_name.operator('lnx.unlink_group_tree', icon='X', text='')
|
op = row_name.operator('lnx.unlink_group_tree', icon='X', text='')
|
||||||
op.node_index = self.get_id_str()
|
op.node_index = self.get_id_str()
|
||||||
row_ops.enabled = not self.group_tree is None
|
row_ops.enabled = not self.group_tree is None
|
||||||
op = row_ops.operator('lnx.edit_group_tree', icon='FULLSCREEN_ENTER', text='Edit tree')
|
op = row_ops.operator('lnx.node_call_func', icon='FULLSCREEN_ENTER', text='Edit tree')
|
||||||
op.node_index = self.get_id_str()
|
op.node_index = self.get_id_str()
|
||||||
|
op.callback_name = 'edit_tree'
|
||||||
|
|
||||||
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
|
def get_replacement_node(self, node_tree: bpy.types.NodeTree):
|
||||||
if self.lnx_version not in (0, 1, 2):
|
if self.lnx_version not in (0, 1, 2):
|
||||||
|
Reference in New Issue
Block a user