Skip to content

Commit

Permalink
RPRBLN-2281: Mac Mini M2 crash on addon deactivation. (#631)
Browse files Browse the repository at this point in the history
Put apart un/registration for node, socket, and socket interface classes and changed its order.
  • Loading branch information
VascoPi authored Jun 12, 2023
1 parent 2801e04 commit 36cd6f9
Showing 1 changed file with 24 additions and 13 deletions.
37 changes: 24 additions & 13 deletions src/rprblender/nodes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,28 +143,34 @@ def func(cls, context):
from . import sockets
from . import rpr_nodes

register_classes, unregister_classes = bpy.utils.register_classes_factory([
sockets.RPRSocketColorInterface,
register_socket_classes, unregister_socket_classes = bpy.utils.register_classes_factory([
sockets.RPRSocketColor,
sockets.RPRSocketFloatInterface,
sockets.RPRSocketFloat,
sockets.RPRSocketWeightInterface,
sockets.RPRSocketWeight,
sockets.RPRSocketWeightSoftInterface,
sockets.RPRSocketWeightSoft,
sockets.RPRSocketMin1Max1Interface,
sockets.RPRSocketMin1Max1,
sockets.RPRSocketLinkInterface,
sockets.RPRSocketLink,
sockets.RPRSocketIORInterface,
sockets.RPRSocketIOR,
sockets.RPRSocket_Float_Min0_SoftMax10Interface,
sockets.RPRSocket_Float_Min0_SoftMax10,
sockets.RPRSocketAngle360Interface,
sockets.RPRSocketAngle360,
sockets.RPRSocketValueInterface,
sockets.RPRSocketValue,
])


register_socket_interface_classes, unregister_socket_interface_classes = bpy.utils.register_classes_factory([
sockets.RPRSocketColorInterface,
sockets.RPRSocketFloatInterface,
sockets.RPRSocketWeightInterface,
sockets.RPRSocketWeightSoftInterface,
sockets.RPRSocketMin1Max1Interface,
sockets.RPRSocketLinkInterface,
sockets.RPRSocketIORInterface,
sockets.RPRSocket_Float_Min0_SoftMax10Interface,
sockets.RPRSocketAngle360Interface,
sockets.RPRSocketValueInterface,
])

register_node_classes, unregister_node_classes = bpy.utils.register_classes_factory([
rpr_nodes.RPRShaderNodeUber,
rpr_nodes.RPRShaderNodeDiffuse,
rpr_nodes.RPRShaderNodePassthrough,
Expand Down Expand Up @@ -195,12 +201,17 @@ def register():
old_shader_node_category_poll = ShaderNodeCategory.poll
ShaderNodeCategory.poll = hide_cycles_and_eevee_poll(ShaderNodeCategory.poll)

register_classes()
register_socket_interface_classes()
register_socket_classes()
register_node_classes()
register_node_categories("RPR_NODES", node_categories)


def unregister():
if old_shader_node_category_poll and ShaderNodeCategory.poll is not old_shader_node_category_poll:
ShaderNodeCategory.poll = old_shader_node_category_poll
unregister_node_categories("RPR_NODES")
unregister_classes()
unregister_node_classes()
# it's important to keep this order to avoid Blender crash on M2
unregister_socket_interface_classes()
unregister_socket_classes()

0 comments on commit 36cd6f9

Please sign in to comment.