@ -18,10 +18,10 @@ from bpy.props import *
import math
import math
from PyHSPlasma import *
from PyHSPlasma import *
from . node_core import PlasmaNodeBase , PlasmaNodeSocketBase , PlasmaNodeVariableInput
from . node_core import *
from . . properties . modifiers . physics import bounds_types
from . . properties . modifiers . physics import bounds_types
class PlasmaClickableNode ( PlasmaNodeVariableInput , bpy . types . Node ) :
class PlasmaClickableNode ( PlasmaNodeBase , bpy . types . Node ) :
bl_category = " CONDITIONS "
bl_category = " CONDITIONS "
bl_idname = " PlasmaClickableNode "
bl_idname = " PlasmaClickableNode "
bl_label = " Clickable "
bl_label = " Clickable "
@ -37,12 +37,32 @@ class PlasmaClickableNode(PlasmaNodeVariableInput, bpy.types.Node):
items = bounds_types ,
items = bounds_types ,
default = " hull " )
default = " hull " )
def init ( self , context ) :
input_sockets = {
self . inputs . new ( " PlasmaClickableRegionSocket " , " Avatar Inside Region " , " region " )
" region " : {
self . inputs . new ( " PlasmaFacingTargetSocket " , " Avatar Facing Target " , " facing " )
" text " : " Avatar Inside Region " ,
self . inputs . new ( " PlasmaRespCommandSocket " , " Local Reenable " , " enable_callback " )
" type " : " PlasmaClickableRegionSocket " ,
self . outputs . new ( " PlasmaPythonReferenceNodeSocket " , " References " , " keyref " )
} ,
self . outputs . new ( " PlasmaConditionSocket " , " Satisfies " , " satisfies " )
" facing " : {
" text " : " Avatar Facing Target " ,
" type " : " PlasmaFacingTargetSocket " ,
} ,
" enable_callback " : {
" text " : " Local Reenable " ,
" type " : " PlasmaRespCommandSocket " ,
" spawn_empty " : True ,
}
}
output_sockets = {
" keyref " : {
" text " : " References " ,
" type " : " PlasmaPythonReferenceNodeSocket " ,
} ,
" satisfies " : {
" text " : " Satisfies " ,
" type " : " PlasmaConditionSocket " ,
} ,
}
def draw_buttons ( self , context , layout ) :
def draw_buttons ( self , context , layout ) :
layout . prop_search ( self , " clickable " , bpy . data , " objects " , icon = " MESH_DATA " )
layout . prop_search ( self , " clickable " , bpy . data , " objects " , icon = " MESH_DATA " )
@ -121,9 +141,6 @@ class PlasmaClickableNode(PlasmaNodeVariableInput, bpy.types.Node):
def harvest_actors ( self ) :
def harvest_actors ( self ) :
return ( self . clickable , )
return ( self . clickable , )
def update ( self ) :
self . ensure_sockets ( " PlasmaRespCommandSocket " , " Local Reenable " , " enable_callback " )
class PlasmaClickableRegionNode ( PlasmaNodeBase , bpy . types . Node ) :
class PlasmaClickableRegionNode ( PlasmaNodeBase , bpy . types . Node ) :
bl_category = " CONDITIONS "
bl_category = " CONDITIONS "
@ -138,8 +155,12 @@ class PlasmaClickableRegionNode(PlasmaNodeBase, bpy.types.Node):
items = bounds_types ,
items = bounds_types ,
default = " hull " )
default = " hull " )
def init ( self , context ) :
output_sockets = {
self . outputs . new ( " PlasmaClickableRegionSocket " , " Satisfies " , " satisfies " )
" satisfies " : {
" text " : " Satisfies " ,
" type " : " PlasmaClickableRegionSocket " ,
}
}
def draw_buttons ( self , context , layout ) :
def draw_buttons ( self , context , layout ) :
layout . prop_search ( self , " region " , bpy . data , " objects " , icon = " MESH_DATA " )
layout . prop_search ( self , " region " , bpy . data , " objects " , icon = " MESH_DATA " )
@ -200,8 +221,12 @@ class PlasmaFacingTargetNode(PlasmaNodeBase, bpy.types.Node):
description = " How far away from the target the avatar can turn (in degrees) " ,
description = " How far away from the target the avatar can turn (in degrees) " ,
min = - 180 , max = 180 , default = 45 )
min = - 180 , max = 180 , default = 45 )
def init ( self , context ) :
output_sockets = {
self . outputs . new ( " PlasmaFacingTargetSocket " , " Satisfies " , " satisfies " )
" satisfies " : {
" text " : " Satisfies " ,
" type " : " PlasmaFacingTargetSocket " ,
} ,
}
def draw_buttons ( self , context , layout ) :
def draw_buttons ( self , context , layout ) :
layout . prop ( self , " directional " )
layout . prop ( self , " directional " )
@ -271,8 +296,13 @@ class PlasmaVolumeReportNode(PlasmaNodeBase, bpy.types.Node):
description = " How many objects should be in the region for it to trigger " ,
description = " How many objects should be in the region for it to trigger " ,
min = 1 )
min = 1 )
def init ( self , context ) :
output_sockets = {
self . outputs . new ( " PlasmaVolumeSettingsSocketOut " , " Trigger Settings " )
" settings " : {
" text " : " Trigger Settings " ,
" type " : " PlasmaVolumeSettingsSocketOut " ,
" valid_link_sockets " : { " PlasmaVolumeSettingsSocketIn " } ,
} ,
}
def draw_buttons ( self , context , layout ) :
def draw_buttons ( self , context , layout ) :
layout . prop ( self , " report_when " )
layout . prop ( self , " report_when " )
@ -306,11 +336,30 @@ class PlasmaVolumeSensorNode(PlasmaNodeBase, bpy.types.Node):
( " dynamics " , " Dynamics " , " Any non-avatar dynamic physical object (eg kickables) " ) ] ,
( " dynamics " , " Dynamics " , " Any non-avatar dynamic physical object (eg kickables) " ) ] ,
default = { " avatar " } )
default = { " avatar " } )
def init ( self , context ) :
input_sockets = {
self . inputs . new ( " PlasmaVolumeSettingsSocketIn " , " Trigger on Enter " , " enter " )
" enter " : {
self . inputs . new ( " PlasmaVolumeSettingsSocketIn " , " Trigger on Exit " , " exit " )
" text " : " Trigger on Enter " ,
self . outputs . new ( " PlasmaPythonReferenceNodeSocket " , " References " , " keyref " )
" type " : " PlasmaVolumeSettingsSocketIn " ,
self . outputs . new ( " PlasmaConditionSocket " , " Satisfies " , " satisfies " )
" valid_link_sockets " : { " PlasmaVolumeSettingsSocketOut " } ,
} ,
" exit " : {
" text " : " Trigger on Exit " ,
" type " : " PlasmaVolumeSettingsSocketIn " ,
" valid_link_sockets " : { " PlasmaVolumeSettingsSocketOut " } ,
} ,
}
output_sockets = {
" keyref " : {
" text " : " References " ,
" type " : " PlasmaPythonReferenceNodeSocket " ,
" valid_link_nodes " : { " PlasmaPythonFileNode " } ,
} ,
" satisfies " : {
" text " : " Satisfies " ,
" type " : " PlasmaConditionSocket " ,
} ,
}
def draw_buttons ( self , context , layout ) :
def draw_buttons ( self , context , layout ) :
layout . prop ( self , " report_on " )
layout . prop ( self , " report_on " )