设为首页 加入收藏

TOP

Autodesk FBX SDK Program 中文 (二)(二)
2015-07-24 05:46:46 来源: 作者: 【 】 浏览:18
Tags:Autodesk FBX SDK Program 中文
tack 信息:\n"); animStackCount=pFbxImporter->GetAnimStackCount(); printf("数量:%d\n ",animStackCount); printf("名称:%s\n ",pFbxImporter->GetActiveAnimStackName()); for (int i = 0; i < animStackCount; i++) { FbxTakeInfo *pFbxTakeInfo=pFbxImporter->GetTakeInfo(i); printf("Animation Stack %d\n",i); printf(" Name: %s\n",pFbxTakeInfo->mName.Buffer()); printf(" Description: %s\n",pFbxTakeInfo->mDescription.Buffer()); printf(" Import Name: %s\n",pFbxTakeInfo->mImportName.Buffer()); //导入进来的名字 printf(" Import State: %s\n",pFbxTakeInfo->mSelect ?"true":"false"); } //导入内容设置,默认导入所有内容 g_pFbxManager->GetIOSettings()->SetBoolProp(IMP_FBX_MATERIAL,true); g_pFbxManager->GetIOSettings()->SetBoolProp(IMP_FBX_TEXTURE,true); g_pFbxManager->GetIOSettings()->SetBoolProp(IMP_FBX_LINK,true); g_pFbxManager->GetIOSettings()->SetBoolProp(IMP_FBX_SHAPE,true); g_pFbxManager->GetIOSettings()->SetBoolProp(IMP_FBX_GOBO,true); g_pFbxManager->GetIOSettings()->SetBoolProp(IMP_FBX_ANIMATION,true); g_pFbxManager->GetIOSettings()->SetBoolProp(IMP_FBX_GLOBAL_SETTINGS,true); } //如果导入的文件不是FBX格式,那就没有上面的逻辑 //导入Fbx到场景 bRet = pFbxImporter->Import(scene); //如果文件导入出错,并且是返回错误Code是密码错误 if(bRet==false && pFbxImporter->GetStatus().GetCode()==FbxStatus::ePasswordError) { printf("请输入密码:\n"); password[0]='\0'; FBXSDK_CRT_SECURE_NO_WARNING_BEGIN//这个宏是用来关闭4996警告。类似scanf strcpy strcat在vs下都会有警告 scanf("%s",password); FBXSDK_CRT_SECURE_NO_WARNING_END FbxString passwdStr(password); g_pFbxManager->GetIOSettings()->SetStringProp(IMP_FBX_PASSWORD,passwdStr);//对FbxIOSetting设置StringProp,即字符串属性,Prop这里指property g_pFbxManager->GetIOSettings()->SetBoolProp(IMP_FBX_PASSWORD_ENABLE,true);//设置Bool属性,是否使用密码 bRet=pFbxImporter->Import(scene); //输入密码后重新Import if(bRet==false && pFbxImporter->GetStatus().GetCode()==FbxStatus::ePasswordError) { printf("文件导入错误,密码错误!"); } } pFbxImporter->Destroy(); return bRet; } /*** 导出FbxScene到模型文件 ***/ bool ExportFbxSceneToModel(FbxScene* scene,const char* exportfilename,int exportformat,bool pexportmedia) { bool bRet=false; //创建FbxExporter FbxExporter *pFbxExport = FbxExporter::Create(g_pFbxManager,""); if(exportformat<0 || exportformat>=g_pFbxManager->GetIOPluginRegistry()->GetWriterFormatCount()) { //如果选择导出的文件格式不支持 printf(" 不支持导出该种格式!! \n"); return false; exportformat=g_pFbxManager->GetIOPluginRegistry()->GetNativeWriterFormat(); printf(" 尝试默认的格式(FBX)导出:%d ",exportformat); if(!pexportmedia) //如果不导出多媒体 { int formatcount=g_pFbxManager->GetIOPluginRegistry()->GetWriterFormatCount(); //尝试导出FBX的 ascii文件,即能看到内容能够的 for (int i = 0; i < formatcount; i++) { if(g_pFbxManager->GetIOPluginRegistry()->WriterIsFBX(i)) { FbxString desStr=g_pFbxManager->GetIOPluginRegistry()->GetWriterFormatDescription(i); if(desStr.Find("ascii")>=0) { exportformat=i; break; } } } } } //选择导出格式正确的话就没有上面的逻辑 if(!pFbxExport->Initialize(exportfilename,-1,g_pFbxManager->GetIOSettings())) { printf("FbxExport->Initialize Faild \n"); printf("FbxExport 初始化失败原因:%s",pFbxExport->GetStatus().GetErrorString()); return false; } if(g_pFbxManager->GetIOPluginRegistry()->WriterIsFBX(exportformat)) { g_pFbxManager->GetIOSettings()->SetBoolProp(EXP_FBX_MATERIAL,true); g_pFbxManager->GetIOSettings()->SetBoolProp(EXP_FBX_TEXTURE,true); g_pFbxManager->GetIOSettings()->SetBoolProp(EXP_FBX_EMBEDDED,pexportmedia); g_pFbxM
首页 上一页 1 2 3 下一页 尾页 2/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇HDU 1394 Minimum Inversion Numb.. 下一篇uva 766 - Sum of powers(数学+递..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: