from lnx.logicnode.lnx_nodes import * def toggle_second_input(self, context): """Show/hide the second input socket based on the 'On Any Object' checkbox""" if self.property0: # "On Any Object" is enabled # Hide the second input socket if len(self.inputs) > 1: self.inputs.remove(self.inputs.values()[-1]) else: # "On Any Object" is disabled # Show the second input socket if it doesn't exist if len(self.inputs) == 1: self.add_input('LnxNodeSocketObject', 'RB 2') class HasContactNode(LnxLogicTreeNode): """Returns whether the given rigid body has contact with another given rigid body.""" bl_idname = 'LNHasContactNode' bl_label = 'Has Contact' lnx_section = 'contact' lnx_version = 1 property0: HaxeBoolProperty( 'property0', name='On Any Object', description='If enabled, returns true if the rigid body has contact with any object', default=False, update=toggle_second_input) def lnx_init(self, context): self.add_input('LnxNodeSocketObject', 'RB 1') self.add_input('LnxNodeSocketObject', 'RB 2') self.add_output('LnxBoolSocket', 'Has Contact') def draw_buttons(self, context, layout): layout.prop(self, 'property0') # "On Any Object" checkbox