Use sprintf (or snprintf (if available this is the best )) to create a string in the form of "InputNumber%d", and pass that to the AnimationNodeInCreate function.
int i;
char label[ 15] = "";
for (i=0;i<36;i++)
{
sprintf ( label, "InputNum %d", i );
mInputs[i] = AnimationNodeInCreate ( i, label , ANIMATIONNODE_TYPE_NUMBER );
}
WolfPack
Postaholic
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
Use sprintf (or snprintf (if available this is the best )) to create a string in the form of "InputNumber%d", and pass that to the AnimationNodeInCreate function.
int i;
char label[ 15] = "";
for (i=0;i<36;i++)
{
sprintf ( label, "InputNum %d", i );
mInputs[i] = AnimationNodeInCreate ( i, label , ANIMATIONNODE_TYPE_NUMBER );
}
The format I would use is
sprintf ( label, "InputNum%04d", i );
This will tack on the number without spaces, and the number will be 4 digits, zero filled --InputNum0023 -- but that's just me... :mrgreen:
WaltP
Posting Sage w/ dash of thyme
10,505 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
I have one more question with my loop if you dont mind.
The ANIMATIONNODE_TYPE_NUMBER is one type of argument that the function accepts and it defines the input to be a float input, but I can also define my input to be a Vector type if I used ANIMATIONNODE_TYPE_VECTOR instead.
Now the problem is I have a total of 93 inputs that I need to create (36 float type and 57 Vector type)
The problem is the inputs are not in a clean sequence, meaning the first 3 inputs are vector type, then the next 2 are number type, then again 3 vector, 2 num.... etc and it alternates like that..
So How would I setup a loop to handle the 3 vector, 2 num type of a sequence?
Don't know if I understand your problem correctly, but there are a number of ways that you can solve this problem by using various kinds of loops.
One would be to use a loop that counts to 93, and check it the remainder or dividing the loop counter with 5 to decide if it is a vector or float.
for ( i = 0 ; i < 93; i++)
{
switch ( i % 5 )
{
case 0:
case 1:
case 2:
// this means the vector type
sprintf ( label, "InputNum %d", i );
mInputs[i] = AnimationNodeInCreate ( i, label , ANIMATIONNODE_TYPE_VECTOR );
break;
case 3:
case 4:
// this means the float type
sprintf ( label, "InputNum %d", i );
mInputs[i] = AnimationNodeInCreate ( i, label , ANIMATIONNODE_TYPE_NUMBER)
break;
}
}
WolfPack
Postaholic
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115