forked from LeenkxTeam/LNXSDK
37 lines
1.3 KiB
Python
37 lines
1.3 KiB
Python
from lnx.logicnode.lnx_nodes import *
|
|
|
|
class SetVelocityNode(LnxLogicTreeNode):
|
|
"""Sets the velocity of the given rigid body."""
|
|
bl_idname = 'LNSetRigidBodyVelocityNode'
|
|
bl_label = 'Set RB Velocity'
|
|
lnx_section = 'props'
|
|
lnx_version = 1
|
|
|
|
def update_sockets(self, context):
|
|
self.inputs[2].hide = self.property0 == 'Angular'
|
|
self.inputs[3].hide = self.property0 == 'Angular'
|
|
self.inputs[4].hide = self.property0 == 'Linear'
|
|
self.inputs[5].hide = self.property0 == 'Linear'
|
|
|
|
property0: HaxeEnumProperty(
|
|
'property0',
|
|
items=[('Both', 'Both', 'Set both velocities'),
|
|
('Linear', 'Linear', 'Set only linear velocity'),
|
|
('Angular', 'Angular', 'Set only angular velocity')],
|
|
name='Velocity',
|
|
default='Both',
|
|
update=update_sockets
|
|
)
|
|
|
|
def lnx_init(self, context):
|
|
self.add_input('LnxNodeSocketAction', 'In')
|
|
self.add_input('LnxNodeSocketObject', 'RB')
|
|
self.add_input('LnxVectorSocket', 'Linear')
|
|
self.add_input('LnxBoolSocket', 'Linear On Local Axis')
|
|
self.add_input('LnxVectorSocket', 'Angular')
|
|
self.add_input('LnxBoolSocket', 'Angular On Local Axis')
|
|
self.add_output('LnxNodeSocketAction', 'Out')
|
|
|
|
def draw_buttons(self, context, layout):
|
|
layout.prop(self, 'property0')
|