Skip to content

Commit

Permalink
Update arm_sockets.py
Browse files Browse the repository at this point in the history
Upgrading and testing on Blender 4.3
  • Loading branch information
Onek8 authored Aug 6, 2024
1 parent fd9fe31 commit 277d5dd
Showing 1 changed file with 44 additions and 20 deletions.
64 changes: 44 additions & 20 deletions blender/arm/logicnode/arm_sockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,27 +595,51 @@ def draw_socket_layout_split(socket: bpy.types.NodeSocket, layout: bpy.types.UIL
layout.prop(socket, prop_name, text='')


def _make_socket_interface(interface_name: str, bl_idname: str) -> Type[bpy.types.NodeSocketInterface]:
"""Create a socket interface class that is used by Blender for node
groups. We currently don't use real node groups, but without these
classes Blender will (incorrectly) draw the socket borders in light grey.
"""
def draw(self, context, layout):
pass
if bpy.app.version < (4, 1, 0):
def _make_socket_interface(interface_name: str, bl_idname: str) -> Type[bpy.types.NodeSocketInterface]:
"""Create a socket interface class that is used by Blender for node
groups. We currently don't use real node groups, but without these
classes Blender will (incorrectly) draw the socket borders in light grey.
"""
def draw(self, context, layout):
pass

def draw_color(self, context):
# This would be used if we were using "real" node groups
return 0, 0, 0, 1

cls = type(
interface_name,
(bpy.types.NodeSocketInterface, ), {
'bl_socket_idname': bl_idname,
'draw': draw,
'draw_color': draw_color,
}
)
return cls
else:
def _make_socket_interface(interface_name: str, bl_idname: str) -> Type[bpy.types.NodeTreeInterfaceSocket]:
"""Create a socket interface class that is used by Blender for node
groups. We currently don't use real node groups, but without these
classes Blender will (incorrectly) draw the socket borders in light grey.
"""
def draw(self, context, layout):
pass

def draw_color(self, context):
# This would be used if we were using "real" node groups
return 0, 0, 0, 1

cls = type(
interface_name,
(bpy.types.NodeTreeInterfaceSocket, ), {
'bl_socket_idname': bl_idname,
'draw': draw,
'draw_color': draw_color,
}
)
return cls

def draw_color(self, context):
# This would be used if we were using "real" node groups
return 0, 0, 0, 1

cls = type(
interface_name,
(bpy.types.NodeSocketInterface, ), {
'bl_socket_idname': bl_idname,
'draw': draw,
'draw_color': draw_color,
}
)
return cls


ArmActionSocketInterface = _make_socket_interface('ArmActionSocketInterface', 'ArmNodeSocketAction')
Expand Down

0 comments on commit 277d5dd

Please sign in to comment.