本文整理汇总了C++中CTFileName::NoExt方法的典型用法代码示例。如果您正苦于以下问题:C++ CTFileName::NoExt方法的具体用法?C++ CTFileName::NoExt怎么用?C++ CTFileName::NoExt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTFileName
的用法示例。
在下文中一共展示了CTFileName::NoExt方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConvertMesh
// convert ascii mesh into binary
BOOL CSeriousSkaStudioApp::ConvertMesh(CTFileName fnMesh)
{
CMesh mesh;
_yy_pMesh = &mesh;
// parse fnMesh
if(!StartParser(fnMesh))
{
// if failed clear mesh and return
mesh.Clear();
return FALSE;
}
// count optimization results
int ctmlods = mesh.msh_aMeshLODs.Count();
int imlod=0;
for(;imlod<ctmlods;imlod++)
{
ctMeshVxBeforeOpt += mesh.msh_aMeshLODs[imlod].mlod_aVertices.Count();
}
// optimize mesh
mesh.Optimize();
mesh.NormalizeWeights();
// count optimization results
for(imlod=0;imlod<ctmlods;imlod++)
{
ctMeshVxAfterOpt += mesh.msh_aMeshLODs[imlod].mlod_aVertices.Count();
}
// save binary mesh
try
{
mesh.Save_t(fnMesh.NoExt() + ".bm");
}
catch(char *strErr)
{
ErrorMessage(strErr);
}
// clear from memory
mesh.Clear();
_yy_pMesh = NULL;
// reload mesh in stock
CMesh *pMesh;
try
{
// load mesh
pMesh = _pMeshStock->Obtain_t(fnMesh.NoExt() + ".bm");
// reload it
pMesh->Reload();
// release mesh
_pMeshStock->Release(pMesh);
}
catch(char *strError)
{
if(strError != NULL) ErrorMessage(strError);
return FALSE;
}
return TRUE;
}
示例2: SaveAnimSetFile
// save anim set file
BOOL CSeriousSkaStudioApp::SaveAnimSetFile(CAnimSet &as, BOOL bConvert)
{
DisableRendering();
CTFileName fnAnimSet = as.GetName();
fnAnimSet = fnAnimSet.NoExt() + ".aal";
try {
fnAnimSet.RemoveApplicationPath_t();
} catch(char *){}
// back up current skeleton list file
CTString strBackUp;
try {
strBackUp.Load_t(fnAnimSet);
} catch(char*){}
CTFileStream ostrFile;
try {
ostrFile.Create_t(fnAnimSet,CTStream::CM_TEXT);
SaveAnimSet_t(as,ostrFile);
ostrFile.Close();
} catch(char *strError) {
ErrorMessage(strError);
EnableRendering();
return FALSE;
}
if(bConvert) {
ConvertAnimSet(fnAnimSet);
}
EnableRendering();
return TRUE;
}
示例3: WriteFont_t
extern void WriteFont_t(CFontData &fdFont, const CImageInfo &iiFont, const CImageInfo &iiGrid, const CTFileName &fnFont)
{
MEX inMex = Max(iiFont.ii_Height,iiFont.ii_Width);
INDEX ctMipmaps = 0;// GetNoOfMipmaps(iiFont.ii_Width,iiFont.ii_Height);
CTFileName fnName = fnFont.NoExt();
try {
fnName.RemoveApplicationPath_t();
} catch(char *) {
}
// save font tga file
iiFont.SaveTGA_t(fnName + ".tga");
iiGrid.SaveTGA_t(fnName + "G.tga");
// create tex file from saved targa
CreateTexture_t( fnName+".tga", fnName+".tex", inMex, ctMipmaps, TEX_CONSTANT);
CreateTexture_t( fnName+"G.tga", fnName+"G.tex", inMex, ctMipmaps);
// set texture source to saved font
fdFont.fd_ptdTextureData = _pTextureStock->Obtain_t(fnName+".tex");
fdFont.fd_ptdTextureData->Reload();
fdFont.fd_ptdTextureData->Force(TEX_CONSTANT); // don't mess with created textures
fdFont.fd_fnTexture = fnName+".tex";
_ptdGrid = _pTextureStock->Obtain_t(fnName + "G.tex");
if(_ptdGrid!=NULL) {
_ptdGrid->Reload();
_ptdGrid->Force(TEX_CONSTANT); // don't mess with created textures
}
// finaly save fnt file
CTFileStream ostr;
ostr.Create_t(fnName + ".fnt");
fdFont.Write_t(&ostr);
}
示例4: CAM_Start
void CAM_Start(const CTFileName &fnmDemo)
{
_bCameraOn = FALSE;
CTFileName fnmScript = fnmDemo.NoExt()+".ini";
if( cam_bRecord) {
try {
_strScript.Create_t(fnmScript);
} catch(char *strError) {
CPrintF("Camera: %s\n", strError);
return;
};
_cp.cp_vPos = FLOAT3D(0,0,0);
_cp.cp_aRot = ANGLE3D(0,0,0);
_cp.cp_aFOV = 90.0f;
_cp.cp_fSpeed = 1;
_cp.cp_tmTick = 0.0f;
} else {
try {
_strScript.Open_t(fnmScript);
} catch(char *strError) {
(void)strError;
return;
};
}
_bCameraOn = TRUE;
_bInitialized = FALSE;
}
示例5: ConvertSkeleton
// convert ascii skeleton into binary
BOOL CSeriousSkaStudioApp::ConvertSkeleton(CTFileName fnSkeleton)
{
CSkeleton skeleton;
_yy_pSkeleton = &skeleton;
if(!StartParser(fnSkeleton))
{
//if failed clear skeleton and return
skeleton.Clear();
return FALSE;
}
// sort bones
skeleton.SortSkeleton();
try
{
// save binary skeleton
skeleton.Save_t(fnSkeleton.NoExt() + ".bs");
}
catch(char *strErr)
{
ErrorMessage(strErr);
}
// clear skeleton
skeleton.Clear();
_yy_pSkeleton = NULL;
// reload skeleton in stock
CSkeleton *pSkeleton;
try
{
// load skeleton
pSkeleton = _pSkeletonStock->Obtain_t(fnSkeleton.NoExt() + ".bs");
// reload skeleton
pSkeleton->Reload();
// release skeleton
_pSkeletonStock->Release(pSkeleton);
}
catch(char *strError)
{
if(strError != NULL) ErrorMessage("%s",strError);
return FALSE;
}
return TRUE;
}
示例6: ConvertAnimSet
// convert ascii anim set into binary
BOOL CSeriousSkaStudioApp::ConvertAnimSet(CTFileName fnAnimSet)
{
CAnimSet animset;
_yy_pAnimSet = &animset;
if(!StartParser(fnAnimSet))
{
//if failed clear animset and return
animset.Clear();
return FALSE;
}
animset.Optimize();
try
{
// save animset as binary
animset.Save_t(fnAnimSet.NoExt() + ".ba");
}
catch(char *strErr)
{
ErrorMessage(strErr);
}
// clear from memory
animset.Clear();
_yy_pAnimSet = NULL;
// reload animset in stock
CAnimSet *pAnimSet;
try
{
// load animset
pAnimSet = _pAnimSetStock->Obtain_t(fnAnimSet.NoExt() + ".ba");
// reload animset
pAnimSet->Reload();
// release animset
_pAnimSetStock->Release(pAnimSet);
}
catch(char *strError)
{
if(strError != NULL) ErrorMessage("%s",strError);
return FALSE;
}
return TRUE;
}
示例7: SaveSkeletonListFile
// save skeleton list file
BOOL CSeriousSkaStudioApp::SaveSkeletonListFile(CSkeleton &skl, BOOL bConvert)
{
DisableRendering();
CTFileName fnSkeletonList = skl.GetName();
fnSkeletonList = fnSkeletonList.NoExt() + ".asl";
try {
fnSkeletonList.RemoveApplicationPath_t();
}
catch(char *){}
// back up current skeleton list file
CTString strBackUp;
try {
strBackUp.Load_t(fnSkeletonList);
}
catch(char*){}
CTFileStream ostrFile;
try {
ostrFile.Create_t(fnSkeletonList,CTStream::CM_TEXT);
SaveSkeletonList_t(skl,ostrFile);
ostrFile.Close();
} catch(char *strError) {
ErrorMessage(strError);
EnableRendering();
return FALSE;
}
if(bConvert) {
if(!ConvertSkeleton(fnSkeletonList)) {
// convert failed
if(strBackUp.Length()>0) {
// try returning old mesh list file
try {
strBackUp.Save_t(fnSkeletonList);
}
catch(char*){}
}
}
}
EnableRendering();
return TRUE;
}
示例8: SaveMeshListFile
// save mesh list file
BOOL CSeriousSkaStudioApp::SaveMeshListFile(MeshInstance &mshi, BOOL bConvert)
{
DisableRendering();
// get mesh list filename
CTFileName fnMeshList = mshi.mi_pMesh->GetName();
fnMeshList = fnMeshList.NoExt() + ".aml";
try {
fnMeshList.RemoveApplicationPath_t();
} catch(char *){}
CTString strBackUp;
try {
// back up current mesh list file
strBackUp.Load_t(fnMeshList);
} catch(char*){}
// save mesh instance in new mesh list file
CTFileStream ostrFile;
try {
ostrFile.Create_t(fnMeshList,CTStream::CM_TEXT);
SaveMeshInstance_t(mshi,ostrFile);
ostrFile.Close();
} catch(char *strError) {
ErrorMessage(strError);
EnableRendering();
return FALSE;
}
// if new mesh list file needs to be converted
if(bConvert) {
if(!ConvertMesh(fnMeshList)) {
// convert failed
if(strBackUp.Length()>0) {
// try returning old mesh list file
try {
strBackUp.Save_t(fnMeshList);
} catch(char*){}
}
}
}
EnableRendering();
return TRUE;
}
示例9: OnSaveDocument
BOOL CModelerDoc::OnSaveDocument(LPCTSTR lpszPathName)
{
CMainFrame* pMainFrame = STATIC_DOWNCAST(CMainFrame, AfxGetMainWnd());
//return CDocument::OnSaveDocument(lpszPathName);
CTFileName fnModelFile = CTString(lpszPathName);
try
{
fnModelFile.RemoveApplicationPath_t();
}
catch( char *err_str)
{
AfxMessageBox( err_str);
return FALSE;
}
#if BUILD_PUBLISHER
WarningMessage(
"Saving is disabled in this version!");
return FALSE;
#else
try
{
m_emEditModel.Save_t( fnModelFile);
m_emEditModel.SaveMapping_t( fnModelFile.NoExt()+".map", 0);
}
catch( char *err_str)
{
MessageBoxA(pMainFrame->m_hWnd, err_str, "Warning! Model Save failed.", MB_OK|MB_ICONHAND|MB_SYSTEMMODAL);
return FALSE;
}
SetModifiedFlag( FALSE);
CModelerView *pModelerView = CModelerView::GetActiveView();
if( pModelerView != NULL)
{
pModelerView->SaveThumbnail();
}
// reload attachments of all loaded models
POSITION pos = theApp.m_pdtModelDocTemplate->GetFirstDocPosition();
while (pos!=NULL)
{
CModelerDoc *pmdCurrent = (CModelerDoc *)theApp.m_pdtModelDocTemplate->GetNextDoc(pos);
if( pmdCurrent != this)
{
BOOL bUpdateAttachments = TRUE;
// if document is modified
if( pmdCurrent->IsModified())
{
CTString strMessage;
CTFileName fnDoc = CTString(pmdCurrent->GetPathName());
strMessage.PrintF("Do you want to save model \"%s\" before reloading its attachments?", fnDoc.FileName() );
if( ::MessageBox( pMainFrame->m_hWnd, strMessage,
"Warning !", MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON1 |
MB_TASKMODAL | MB_TOPMOST) != IDYES)
{
bUpdateAttachments = FALSE;
}
// save document
else
{
pmdCurrent->OnSaveDocument(pmdCurrent->GetPathName());
}
}
if( bUpdateAttachments)
{
POSITION pos = pmdCurrent->GetFirstViewPosition();
while (pos != NULL)
{
CView* pView = GetNextView(pos);
((CModelerView *)pView)->m_ModelObject.AutoSetAttachments();
//CModelData *pmd = (CModelData *) ((CModelerView *)pView)->m_ModelObject.GetData();
//pmd->Reload();
}
}
}
}
return TRUE;
#endif
}
示例10: OnScriptMakeModel
void CScriptView::OnScriptMakeModel()
{
// First we save script file
CModelerDoc *pDoc = (CModelerDoc *) GetDocument();
CTFileName fnScriptName = CTString(pDoc->GetPathName());
CTFileName fnModelName = fnScriptName.FileDir() + fnScriptName.FileName() + ".mdl";
try
{
fnScriptName.RemoveApplicationPath_t();
}
catch( char *err_str)
{
AfxMessageBox( err_str);
return;
}
pDoc->OnSaveDocument( pDoc->GetPathName());
// close mdl document with same name
POSITION pos = theApp.m_pdtModelDocTemplate->GetFirstDocPosition();
while (pos!=NULL)
{
CModelerDoc *pmdCurrent = (CModelerDoc *)theApp.m_pdtModelDocTemplate->GetNextDoc(pos);
if( CTFileName( CTString(pmdCurrent->GetPathName())) == fnModelName)
{
pmdCurrent->OnCloseDocument();
break;
}
}
// Now we will create one instance of new document of type CModelerDoc
CDocument* pDocument = theApp.m_pdtModelDocTemplate->CreateNewDocument();
if (pDocument == NULL)
{
TRACE0("CDocTemplate::CreateNewDocument returned NULL.\n");
AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
return;
}
ASSERT_VALID(pDocument);
BOOL bAutoDelete = pDocument->m_bAutoDelete;
pDocument->m_bAutoDelete = FALSE; // don't destroy if something goes wrong
CFrameWnd* pFrame = theApp.m_pdtModelDocTemplate->CreateNewFrame(pDocument, NULL);
pDocument->m_bAutoDelete = bAutoDelete;
if (pFrame == NULL)
{
AfxMessageBox(AFX_IDP_FAILED_TO_CREATE_DOC);
delete pDocument; // explicit delete on error
return;
}
ASSERT_VALID(pFrame);
pDocument->SetPathName( fnModelName, FALSE);
pDocument->SetTitle( fnModelName.FileName() + fnModelName.FileExt());
char strError[ 256];
if( !((CModelerDoc *)pDocument)->CreateModelFromScriptFile( fnScriptName, strError))
{
pDocument->OnCloseDocument();
AfxMessageBox( strError);
return;
}
theApp.m_pdtModelDocTemplate->InitialUpdateFrame(pFrame, pDocument, TRUE);
((CModelerDoc *)pDocument)->m_emEditModel.edm_md.md_bPreparedForRendering = FALSE;
pDocument->SetModifiedFlag();
// add textures from .ini file
CTFileName fnIniFileName = fnScriptName.NoExt() + ".ini";
try
{
((CModelerDoc *)pDocument)->m_emEditModel.CSerial::Load_t(fnIniFileName);
}
catch( char *strError)
{
// ignore errors
(void) strError;
}
}