void CNodeVCompression::UpdateNode()
{
	bool bUseTangent = m_iCompressionMode == COMPRESSION_MODE_NORMAL_TANGENT;

	CUtlVector< BridgeRestoreInfo* >m_hRestoreBridges;
	CreateBridgeRestoreData_In( CBaseNode::BY_NAME, m_hRestoreBridges );

	GenerateJacks_Input( bUseTangent ? 2 : 1 );
	LockJackInput_Flags( 0, HLSLVAR_FLOAT4, "Normal" );
	if ( bUseTangent )
		LockJackInput_Flags( 1, HLSLVAR_FLOAT4, "Tangent" );

	RestoreBridgesFromList_In( m_hRestoreBridges );


	CreateBridgeRestoreData_Out( CBaseNode::BY_NAME, m_hRestoreBridges );

	GenerateJacks_Output( bUseTangent ? 2 : 1 );
	LockJackOutput_Flags( 0, HLSLVAR_FLOAT3, "Normal" );
	if ( bUseTangent )
		LockJackOutput_Flags( 1, HLSLVAR_FLOAT4, "Tangent" );

	RestoreBridgesFromList_Out( m_hRestoreBridges );

	OnUpdateHierachy( NULL, NULL );
}
void CNodeBreak::UpdateNode()
{
	int iJacksRequired = 1;
	for ( int i = 0; i < max( GetNumJacks_In(), GetNumJacks_Out() ); i++ )
	{
		const bool bJackInValid = i < GetNumJacks_In();
		const bool bJackOutValid = i < GetNumJacks_Out();
		if ( bJackInValid && GetJack_In( i )->GetNumBridgesConnected() )
			iJacksRequired++;
		else if ( bJackOutValid && GetJack_Out( i )->GetNumBridgesConnected() )
			iJacksRequired++;
	}

	//CUtlVector< int >hSmartTypes_Out;
	//for ( int i = 0; i < GetNumJacks_Out(); i++ )
	//	hSmartTypes_Out.AddToTail( GetJack_Out(i)->GetSmartType() );

	CUtlVector< BridgeRestoreInfo* >m_hRestoreBridges_In;
	CUtlVector< BridgeRestoreInfo* >m_hRestoreBridges_Out;
	CreateBridgeRestoreData_In( CBaseNode::BY_COUNT, m_hRestoreBridges_In );
	CreateBridgeRestoreData_Out( CBaseNode::BY_COUNT, m_hRestoreBridges_Out );

	GenerateJacks_Input( iJacksRequired );
	GenerateJacks_Output( iJacksRequired );

	RestoreBridgesFromList_In( m_hRestoreBridges_In );
	RestoreBridgesFromList_Out( m_hRestoreBridges_Out );

	//for ( int i = 0; i < GetNumJacks_Out(); i++ )
	//	GetJack_Out( i )->SetSmartType( hSmartTypes_Out[i] );
	//hSmartTypes_Out.Purge();

	OnUpdateHierachy( NULL, NULL );
}
void CNodeStdVLight::UpdateNode()
{
    CUtlVector< BridgeRestoreInfo* >m_hRestoreBridges;
    CreateBridgeRestoreData_In( CBaseNode::BY_NAME, m_hRestoreBridges );

    GenerateJacks_Input( m_bStaticLighting ? 3 : 1 );
    if ( m_bStaticLighting )
    {
        LockJackInput_Flags( 0, HLSLVAR_FLOAT3, "World pos" );
        LockJackInput_Flags( 1, HLSLVAR_FLOAT3, "World normal" );
        LockJackInput_Flags( 2, HLSLVAR_FLOAT3, "Static light" );
    }
    else
    {
        LockJackInput_Flags( 0, HLSLVAR_FLOAT3, "World pos" );
    }

    RestoreBridgesFromList_In( m_hRestoreBridges );

    CreateBridgeRestoreData_Out( CBaseNode::BY_NAME, m_hRestoreBridges );

    GenerateJacks_Output( 1 );
    if ( m_bStaticLighting )
        LockJackOutput_Flags( 0, HLSLVAR_FLOAT3, "Lighting" );
    else
        LockJackOutput_Flags( 0, HLSLVAR_FLOAT4, "VAttn" );

    RestoreBridgesFromList_Out( m_hRestoreBridges );
}
void CNodePSOutput::Setup( SETUP_HLSL_PS_Output info )
{
	int numInputs = 0;
	numInputs += info.iNumRTs;
	if ( info.bDepth )
		numInputs += 1;

	CUtlVector< BridgeRestoreInfo* >m_hRestoreBridges;
	CreateBridgeRestoreData_In( CBaseNode::BY_RESTYPE, m_hRestoreBridges );

	GenerateJacks_Input( numInputs );

	int curInput = 0;

	for ( int i = 0; i < info.iNumRTs; i++ )
	{
		GetJack_In( curInput )->SetResourceType( RESOURCETYPE_COLOR_0 + i );
		LockJackInput_Flags( curInput, HLSLVAR_FLOAT4, VarArgs("Color %i",i) );
		curInput++;
	}
	if ( info.bDepth )
	{
		GetJack_In( curInput )->SetResourceType( RESOURCETYPE_DEPTH );
		LockJackInput_Flags( curInput, HLSLVAR_FLOAT1, "Depth" );
		curInput++;
	}

	curSetup = info;
	RestoreBridgesFromList_In( m_hRestoreBridges );
}
void CNodeFinal::UpdateNode()
{
	CUtlVector< BridgeRestoreInfo* >m_hRestoreBridges;
	CreateBridgeRestoreData_In( CBaseNode::BY_NAME, m_hRestoreBridges );

	GenerateJacks_Input( b_writedepth ? 3 : 2 );
	LockJackInput_Flags( 0, HLSLVAR_FLOAT4, "Color" );
	LockJackInput_Flags( 1, HLSLVAR_FLOAT1, "Fog" );
	if ( b_writedepth )
		LockJackInput_Flags( 2, HLSLVAR_FLOAT1, "Proj z" );

	RestoreBridgesFromList_In( m_hRestoreBridges );
}
void CNodeCustom::UpdateNode()
{
	CUtlVector< BridgeRestoreInfo* >m_hRestoreBridges_In;
	CreateBridgeRestoreData_In( CBaseNode::BY_INDEX, m_hRestoreBridges_In );
	GenerateJacks_Input( m_hszVarNames_In.Count() );
	//GenerateJacks_Input( numJacksIn );


	CUtlVector< BridgeRestoreInfo* >m_hRestoreBridges_Out;
	CreateBridgeRestoreData_Out( CBaseNode::BY_INDEX, m_hRestoreBridges_Out );
	GenerateJacks_Output( m_hszVarNames_Out.Count() );


	for ( int i = 0; i < GetNumJacks_In(); i++ )
	{
		char *name = NULL;

		if ( m_hszVarNames_In.Count() > i && m_hszVarNames_In[ i ]->pszName != NULL &&
			Q_strlen( m_hszVarNames_In[ i ]->pszName ) > 0 )
			name = m_hszVarNames_In[ i ]->pszName;
		else
			name = GenerateDefaultName( i );

		LockJackInput_Flags( i, m_hszVarNames_In[ i ]->iFlag, name );
	}

	for ( int i = 0; i < GetNumJacks_Out(); i++ )
	{
		char *name = NULL;

		if ( m_hszVarNames_Out.Count() > i && m_hszVarNames_Out[ i ]->pszName != NULL &&
			Q_strlen( m_hszVarNames_Out[ i ]->pszName ) > 0 )
			name = m_hszVarNames_Out[ i ]->pszName;
		else
			name = GenerateDefaultName( i, true );

		LockJackOutput_Flags( i, m_hszVarNames_Out[ i ]->iFlag, name );
	}

	RestoreBridgesFromList_In( m_hRestoreBridges_In );
	RestoreBridgesFromList_Out( m_hRestoreBridges_Out );


	OnUpdateHierachy( NULL, NULL );
}
void CNodeStdSkinning::UpdateNode()
{
	CUtlVector< BridgeRestoreInfo* >m_hRestoreBridges;
	CreateBridgeRestoreData_In( CBaseNode::BY_NAME, m_hRestoreBridges );

	int numInputs = 3;
	if ( m_iSkinMode == STD_SKINNING_MODE_POS_NORMAL )
		numInputs = 4;
	else if ( m_iSkinMode == STD_SKINNING_MODE_POS_NORMAL_TANGENT )
		numInputs = 5;
	GenerateJacks_Input( numInputs );

	LockJackInput_Flags( 0, HLSLVAR_FLOAT4, "Bone indices" );
	LockJackInput_Flags( 1, HLSLVAR_FLOAT4, "Bone weights" );
	LockJackInput_Flags( 2, HLSLVAR_FLOAT3, "Obj pos" );
	if ( m_iSkinMode >= STD_SKINNING_MODE_POS_NORMAL )
		LockJackInput_Flags( 3, HLSLVAR_FLOAT3, "Obj normal" );
	if ( m_iSkinMode >= STD_SKINNING_MODE_POS_NORMAL_TANGENT )
		LockJackInput_Flags( 4, HLSLVAR_FLOAT4, "Obj tangent s" );

	RestoreBridgesFromList_In( m_hRestoreBridges );




	CreateBridgeRestoreData_Out( CBaseNode::BY_NAME, m_hRestoreBridges );

	int numOutputs = 1;
	if ( m_iSkinMode == STD_SKINNING_MODE_POS_NORMAL )
		numOutputs = 2;
	else if ( m_iSkinMode == STD_SKINNING_MODE_POS_NORMAL_TANGENT )
		numOutputs = 4;
	GenerateJacks_Output( numOutputs );

	LockJackOutput_Flags( 0, HLSLVAR_FLOAT3, "World pos" );
	if ( m_iSkinMode >= STD_SKINNING_MODE_POS_NORMAL )
		LockJackOutput_Flags( 1, HLSLVAR_FLOAT3, "World normal" );
	if ( m_iSkinMode >= STD_SKINNING_MODE_POS_NORMAL_TANGENT )
	{
		LockJackOutput_Flags( 2, HLSLVAR_FLOAT3, "World tangent s" );
		LockJackOutput_Flags( 3, HLSLVAR_FLOAT3, "World tangent t" );
	}

	RestoreBridgesFromList_Out( m_hRestoreBridges );
}
void CNodeStdMorph::UpdateNode()
{
	CUtlVector< BridgeRestoreInfo* >m_hRestoreBridges;
	CreateBridgeRestoreData_In( CBaseNode::BY_NAME, m_hRestoreBridges );

	int numInputs = 2;
	if ( m_iSkinMode == STD_SKINNING_MODE_POS_NORMAL )
		numInputs = 4;
	else if ( m_iSkinMode == STD_SKINNING_MODE_POS_NORMAL_TANGENT )
		numInputs = 5;
	GenerateJacks_Input( numInputs );

	LockJackInput_Flags( 0, HLSLVAR_FLOAT3, "Obj pos" );
	LockJackInput_Flags( 1, HLSLVAR_FLOAT3, "Flex delta" );
	//LockJackInput_Flags( 2, HLSLVAR_FLOAT2, "Morph coords" );
	if ( m_iSkinMode >= STD_SKINNING_MODE_POS_NORMAL )
	{
		LockJackInput_Flags( 2, HLSLVAR_FLOAT3, "Obj normal" );
		LockJackInput_Flags( 3, HLSLVAR_FLOAT3, "Flex normal" );
	}
	if ( m_iSkinMode >= STD_SKINNING_MODE_POS_NORMAL_TANGENT )
		LockJackInput_Flags( 4, HLSLVAR_FLOAT3, "Tangent s" );

	RestoreBridgesFromList_In( m_hRestoreBridges );




	CreateBridgeRestoreData_Out( CBaseNode::BY_NAME, m_hRestoreBridges );

	int numOutputs = 1;
	if ( m_iSkinMode == STD_SKINNING_MODE_POS_NORMAL )
		numOutputs = 2;
	else if ( m_iSkinMode == STD_SKINNING_MODE_POS_NORMAL_TANGENT )
		numOutputs = 3;
	GenerateJacks_Output( numOutputs );

	LockJackOutput_Flags( 0, HLSLVAR_FLOAT3, "Obj pos" );
	if ( m_iSkinMode >= STD_SKINNING_MODE_POS_NORMAL )
		LockJackOutput_Flags( 1, HLSLVAR_FLOAT3, "Obj normal" );
	if ( m_iSkinMode >= STD_SKINNING_MODE_POS_NORMAL_TANGENT )
		LockJackOutput_Flags( 2, HLSLVAR_FLOAT3, "Obj tangent s" );

	RestoreBridgesFromList_Out( m_hRestoreBridges );
}
void CNodeMCompose::UpdateNode()
{
	CUtlVector< BridgeRestoreInfo* >m_hRestoreBridges;
	CreateBridgeRestoreData_In( CBaseNode::BY_NAME, m_hRestoreBridges );

	int numInputs = 3;
	if ( iTargetMatrix == HLSLVAR_MATRIX4X4 ||
		(iTargetMatrix == HLSLVAR_MATRIX4X3 && bColumns) )
		numInputs = 4;

	GenerateJacks_Input( numInputs );

	int type = HLSLVAR_FLOAT3;
	if ( iTargetMatrix == HLSLVAR_MATRIX4X4 ||
		(iTargetMatrix == HLSLVAR_MATRIX4X3 && !bColumns) )
		type = HLSLVAR_FLOAT4;

	for ( int i = 0; i < numInputs; i++ )
		LockJackInput_Flags( i, type, VarArgs( "%c", (((int)'A')+i) ) );

	LockJackOutput_Flags( 0, iTargetMatrix );

	RestoreBridgesFromList_In( m_hRestoreBridges );
}