ciao.
Ho il seguente problema trovato in un esempio di codice :
codice:
dichiarazione nel file stesso della funzione, io ho messo questa dichiarazione nel file .h con tutte le altre dichiarazioni.
void DisplayChannels(KFbxNode* pNode, KFbxAnimLayer* pAnimLayer,
void (*DisplayCurve) (KFCurve *pCurve),
void (*DisplayListCurve) (KFCurve *pCurve, KFbxProperty* pProperty),
bool isSwitcher);
impl.
void DisplayChannels(KFbxNode* pNode, KFbxAnimLayer* pAnimLayer, void (*DisplayCurve) (KFCurve *pCurve), void (*DisplayListCurve) (KFCurve *pCurve, KFbxProperty* pProperty), bool isSwitcher)
{
KFbxAnimCurve* lAnimCurve = NULL;
// Display general curves.
if (!isSwitcher)
{
lAnimCurve = pNode->LclTranslation.GetCurve<KFbxAnimCurve>(pAnimLayer, KFCURVENODE_T_X);
if (lAnimCurve)
{
printf(" TX\n");
DisplayCurve(lAnimCurve->GetKFCurve());
}
lAnimCurve = pNode->LclTranslation.GetCurve<KFbxAnimCurve>(pAnimLayer, KFCURVENODE_T_Y);
if (lAnimCurve)
.
.
.
le due funzioni usate come parametri nella funzione sono(DisplayCurveKeys e, DisplayListCurveKeys.
Quello che non ho capito è come si passano le funzioni per parametro.
codice:
void CFbxAnimation::DisplayCurveKeys(KFCurve *pCurve)
{
static char* interpolation[] = { "?", "constant", "linear", "cubic"};
static char* constantMode[] = { "?", "Standard", "Next" };
static char* cubicMode[] = { "?", "Auto", "Auto break", "Tcb", "User", "Break", "User break" };
static char* tangentWVMode[] = { "?", "None", "Right", "Next left" };
KTime lKeyTime;
float lKeyValue;
char lTimeString[256];
KString lOutputString;
int lCount;
int lKeyCount = pCurve->KeyGetCount();
for(lCount = 0; lCount < lKeyCount; lCount++)
{
lKeyValue = static_cast<float>(pCurve->KeyGetValue(lCount));
lKeyTime = pCurve->KeyGetTime(lCount);
lOutputString = " Key Time: ";
lOutputString += lKeyTime.GetTimeString(lTimeString);
lOutputString += ".... Key Value: ";
lOutputString += lKeyValue;
/*lOutputString += " [ ";
lOutputString += interpolation[ InterpolationFlagToIndex(pCurve->KeyGetInterpolation(lCount)) ];
if ((pCurve->KeyGetInterpolation(lCount)&KFCURVE_INTERPOLATION_CONSTANT) == KFCURVE_INTERPOLATION_CONSTANT)
{
lOutputString += " | ";
lOutputString += constantMode[ ConstantmodeFlagToIndex(pCurve->KeyGetConstantMode(lCount)) ];
}
else if ((pCurve->KeyGetInterpolation(lCount)&KFCURVE_INTERPOLATION_CUBIC) == KFCURVE_INTERPOLATION_CUBIC)
{
lOutputString += " | ";
lOutputString += cubicMode[ TangentmodeFlagToIndex(pCurve->KeyGetTangeantMode(lCount)) ];
lOutputString += " | ";
lOutputString += tangentWVMode[ TangentweightFlagToIndex(pCurve->KeyGetTangeantWeightMode(lCount)) ];
lOutputString += " | ";
lOutputString += tangentWVMode[ TangentVelocityFlagToIndex(pCurve->KeyGetTangeantVelocityMode(lCount)) ];
}
lOutputString += " ]";*/
lOutputString += "\n";
printf (lOutputString);
}
}
void CFbxAnimation::DisplayListCurveKeys(KFCurve *pCurve, KFbxProperty* pProperty)
{
KTime lKeyTime;
int lKeyValue;
char lTimeString[256];
KString lListValue;
KString lOutputString;
int lCount;
int lKeyCount = pCurve->KeyGetCount();
for(lCount = 0; lCount < lKeyCount; lCount++)
{
lKeyValue = static_cast<int>(pCurve->KeyGetValue(lCount));
lKeyTime = pCurve->KeyGetTime(lCount);
lOutputString = " Key Time: ";
lOutputString += lKeyTime.GetTimeString(lTimeString);
lOutputString += ".... Key Value: ";
lOutputString += lKeyValue;
lOutputString += " (";
lOutputString += pProperty->GetEnumValue(lKeyValue);
lOutputString += ")";
lOutputString += "\n";
printf (lOutputString);
}
}
mi da questi due errori
Error 1 error C3867: 'CFbxAnimation:
isplayCurveKeys': function call missing argument list; use '&CFbxAnimation:
isplayCurveKeys' to create a pointer to member c:\programmazione\old2\old\wild magic 4\geometrictools\wildmagic4\samplegraphics\materia ltextures\fbxanimation.cpp 292
Error 2 error C3867: 'CFbxAnimation:
isplayListCurveKeys': function call missing argument list; use '&CFbxAnimation:
isplayListCurveKeys' to create a pointer to member c:\programmazione\old2\old\wild magic 4\geometrictools\wildmagic4\samplegraphics\materia ltextures\fbxanimation.cpp 292
1)che utilità da questo tipo di gestione dei parametri con puntatore a funzione e i puntatorii a funzione in generale?
2)come posso convertire e rendere compilabile utilizzando le dichiarazioni nel .h anzichè nello stesso cpp?
grazie.