STDMETHODIMP CUUEngine::put_BracketPolicy(BOOL newVal) { SetBoolProp(UUOPT_BRACKPOL, newVal); return S_OK; }
STDMETHODIMP CUUEngine::put_Overwrite(BOOL newVal) { SetBoolProp(UUOPT_OVERWRITE, newVal); OWriteOK = (newVal != 0); return S_OK; }
STDMETHODIMP CUUEngine::put_StrictFilenames(BOOL newVal) { SetBoolProp(UUOPT_STRICTFN, newVal); return S_OK; }
STDMETHODIMP CUUEngine::put_Verbose(BOOL newVal) { SetBoolProp(UUOPT_VERBOSE, newVal); return S_OK; }
STDMETHODIMP CUUEngine::put_UseText(BOOL newVal) { SetBoolProp(UUOPT_USETEXT, newVal); return S_OK; }
STDMETHODIMP CUUEngine::put_StrictMIME(BOOL newVal) { SetBoolProp(UUOPT_MOREMIME, newVal); return S_OK; }
STDMETHODIMP CUUEngine::put_RemoveAfter(BOOL newVal) { SetBoolProp(UUOPT_REMOVE, newVal); return S_OK; }
STDMETHODIMP CUUEngine::put_IgnoreReply(BOOL newVal) { SetBoolProp(UUOPT_IGNREPLY, newVal); return S_OK; }
STDMETHODIMP CUUEngine::put_FastMode(BOOL newVal) { SetBoolProp(UUOPT_FAST, newVal); return S_OK; }
STDMETHODIMP CUUEngine::put_Dumb(BOOL newVal) { SetBoolProp(UUOPT_DUMBNESS, newVal); return S_OK; }
STDMETHODIMP CUUEngine::put_Desperate(short newVal) { SetBoolProp(UUOPT_DESPERATE, newVal); return S_OK; }
int _tmain(int argc, _TCHAR* argv []) { std::cout << "usage : FbxRerouteSkeleton.exe /m:<origin mesh and skeleton data.fbx> /m:<other origin mesh and skeleton data.fbx> /a:<animated skeleton.fbx> /o:<output fbx> [/prefix:<prefix added to each bone in animated skeleton.fbx>]" << std::endl; std::vector<std::string> meshFiles; std::string skeletonFile; std::string outputPath; std::string prefix; for (auto ix = 1; ix < argc; ++ix){ std::wstring warg = argv[ix]; if (warg.find(L"/m:") == 0){ meshFiles.push_back(wstringToUtf8(warg.substr(3))); } else if (warg.find(L"/a:") == 0) { if (skeletonFile.size()>0){ std::wcout << L"only one animated skeleton file is allowed" << std::endl; return -2; } skeletonFile = wstringToUtf8(warg.substr(3)); } else if (warg.find(L"/o:") == 0){ if (outputPath.size() > 0){ std::wcout << L"only one output file is allowed" << std::endl; return -3; } CloseHandle(CreateFile(warg.substr(3).c_str(), GENERIC_READ | GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, 0, nullptr)); outputPath = wstringToUtf8(warg.substr(3)); } else if (warg.find(L"/prefix:") == 0){ if (prefix.size() > 0){ std::wcout << L"only one prefix is allowed" << std::endl; return -4; } prefix = wstringToUtf8(warg.substr(8)); } else{ std::wcout << L"unrecognized parameter " << warg << std::endl; return -1; } } if (meshFiles.size() == 0){ std::wcout << L"no origin mesh file" << std::endl; return -5; } if (skeletonFile.size() == 0){ std::wcout << L"skeleton file unspecified" << std::endl; return -6; } if (outputPath.size() == 0){ std::wcout << L"output file unspecified" << std::endl; return -7; } auto fbxManager = std::unique_ptr<FbxManager, FbxManagerDeleter>( FbxManager::Create()); auto iosettings = std::unique_ptr<FbxIOSettings, FbxDeleter>(FbxIOSettings::Create(fbxManager.get(), IOSROOT)); iosettings->SetBoolProp(IMP_FBX_MATERIAL, true); iosettings->SetBoolProp(IMP_FBX_TEXTURE, true); iosettings->SetBoolProp(IMP_FBX_LINK, true); iosettings->SetBoolProp(IMP_FBX_SHAPE, true); iosettings->SetBoolProp(IMP_FBX_GOBO, true); iosettings->SetBoolProp(IMP_FBX_ANIMATION, true); iosettings->SetBoolProp(IMP_SKINS, true); iosettings->SetBoolProp(IMP_DEFORMATION, true); iosettings->SetBoolProp(IMP_FBX_GLOBAL_SETTINGS, true); iosettings->SetBoolProp(IMP_TAKE, true); iosettings->SetBoolProp(EXP_FBX_MATERIAL, true); iosettings->SetBoolProp(EXP_FBX_TEXTURE, true); iosettings->SetBoolProp(EXP_MESHPOLY, true); iosettings->SetBoolProp(EXP_FBX_SHAPE, true); iosettings->SetBoolProp(EXP_FBX_GOBO, true); iosettings->SetBoolProp(EXP_FBX_ANIMATION, true); iosettings->SetBoolProp(EXP_SKINS, true); iosettings->SetBoolProp(EXP_DEFORMATION, true); iosettings->SetBoolProp(EXP_FBX_GLOBAL_SETTINGS, true); iosettings->SetBoolProp(EXP_MESHTRIANGLE, true); iosettings->SetBoolProp(EXP_EMBEDTEXTURE, true); fbxManager->SetIOSettings(iosettings.get()); auto importer = std::unique_ptr<FbxImporter, FbxDeleter> (FbxImporter::Create(fbxManager.get(), "SceneImporter")); importer->Initialize(skeletonFile.c_str(), -1, iosettings.get()); auto globalScene = std::unique_ptr<FbxScene, FbxDeleter>(FbxScene::Create(fbxManager.get(), "merged scene")); importer->Import(globalScene.get()); std::map<std::string, FbxNode*> animatedSkeletonNodesMap; populateNodeMap(animatedSkeletonNodesMap, globalScene->GetRootNode()); for (auto& f : meshFiles){ importAdditionalFile(globalScene.get(), importer.get(), f); } patchSkins(globalScene->GetRootNode(), animatedSkeletonNodesMap, prefix); auto exporter = std::unique_ptr<FbxExporter, FbxDeleter>(FbxExporter::Create(fbxManager.get(), "SceneExporter")); auto res = exporter->Initialize(outputPath.c_str(), -1, iosettings.get()); res = exporter->Export(globalScene.get()); auto status = exporter->GetStatus(); return 0; }