Exemplo n.º 1
0
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 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 CNodeCallback::RestoreFromKeyValues_Specific( KeyValues *pKV )
{
	const char *cbname = pKV->GetString( "sz_callbackname" );

	if ( Q_strlen( cbname ) )
	{
		delete [] szCallbackName;
		szCallbackName = new char [ Q_strlen( cbname ) + 1 ];
		Q_strcpy( szCallbackName, cbname );
	}

	iNumComponents = pKV->GetInt( "i_numc", iNumComponents );

	UpdateNode();
	OnUpdateHierachy( NULL, NULL );
}
Exemplo n.º 4
0
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 CNodeMultiply::RestoreFromKeyValues_Specific( KeyValues *pKV )
{
	m_bMatrixRotation = pKV->GetInt( "i_mat_rotation" ) != 0;

	OnUpdateHierachy( NULL, NULL );
}