当前位置: 首页>>代码示例>>C++>>正文


C++ CTFileName类代码示例

本文整理汇总了C++中CTFileName的典型用法代码示例。如果您正苦于以下问题:C++ CTFileName类的具体用法?C++ CTFileName怎么用?C++ CTFileName使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CTFileName类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetDocument

// Save smc file
void CSeriousSkaStudioApp::SaveSmcFile(CModelInstance &mi,BOOL bSaveChildren)
{
	CSeriousSkaStudioDoc *pDoc = GetDocument();

  // first get first model instance that has its file
  CModelInstance *pmiParent=NULL;
  CModelInstance *pmiFirst=&mi;
  CTFileName fnSmc = mi.mi_fnSourceFile;
  CModelInstance *pfmi = mi.GetFirstNonReferencedParent(GetDocument()->m_ModelInstance);
  if(pfmi!=NULL) {
    pmiParent = pfmi->GetParent(pDoc->m_ModelInstance);
    pmiFirst = pfmi;
    fnSmc = pfmi->mi_fnSourceFile;
  }

  DisableRendering();
  try
  {
    fnSmc.RemoveApplicationPath_t();
  }
  catch(char *){}

  CTFileStream ostrFile;
  // try to save model instance
  try {
    ostrFile.Create_t(fnSmc,CTStream::CM_TEXT);
    SaveModelInstance_t(pmiFirst,pmiParent,ostrFile,bSaveChildren);
    ostrFile.Close();
    NotificationMessage("Smc '%s' saved.",pmiFirst->mi_fnSourceFile); 
  } catch(char *strError) {
    ErrorMessage(strError);
  }
  EnableRendering();
}
开发者ID:AdamFlores,项目名称:Serious-Engine,代码行数:35,代码来源:SeriousSkaStudio.cpp

示例2: GetDocument

void CScriptView::OnScriptUpdateMipmodels() 
{
	// find document with same name
  CModelerDoc *pDoc = (CModelerDoc *) GetDocument();
  CTFileName fnScriptName = CTString(pDoc->GetPathName());
  CTFileName fnModelName = fnScriptName.FileDir() + fnScriptName.FileName() + ".mdl";

	POSITION pos = theApp.m_pdtModelDocTemplate->GetFirstDocPosition();
  while (pos!=NULL)
  {
    CModelerDoc *pmdCurrent = (CModelerDoc *)theApp.m_pdtModelDocTemplate->GetNextDoc(pos);
    if( CTFileName( CTString(pmdCurrent->GetPathName())) == fnModelName)
    {
      POSITION pos = pmdCurrent->GetFirstViewPosition();
      CView *pView = pmdCurrent->GetNextView( pos);
      if( DYNAMIC_DOWNCAST(CModelerView, pView) != NULL)
      {
        CModelerView* pModelerView = (CModelerView *) pView;
        if(pModelerView != NULL)
        {
          pModelerView->OnScriptUpdateMipmodels();
          pModelerView->SetActiveWindow();
          pModelerView->SetFocus();
          CMainFrame* pMainFrame = STATIC_DOWNCAST(CMainFrame, AfxGetMainWnd());
          pMainFrame->MDIActivate(pModelerView->GetParentFrame());
        }
      }
      break;
    }
  }
}
开发者ID:RocketersAlex,项目名称:LCSource,代码行数:31,代码来源:ScriptView.cpp

示例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);
}
开发者ID:RocketersAlex,项目名称:LCSource,代码行数:34,代码来源:FontGen.cpp

示例4: FillDirList_internal

void FillDirList_internal(const CTFileName &fnmBasePath,
  CDynamicStackArray<CTFileName> &afnm, const CTFileName &fnmDir, const CTString &strPattern, BOOL bRecursive,
  CDynamicStackArray<CTFileName> *pafnmInclude, CDynamicStackArray<CTFileName> *pafnmExclude)
{
  // add the directory to list of directories to search
  CListHead lhDirs;
  CDirToRead *pdrFirst = new CDirToRead;
  pdrFirst->dr_strDir = fnmDir;
  lhDirs.AddTail(pdrFirst->dr_lnNode);

  // while the list of directories is not empty
  while (!lhDirs.IsEmpty()) {
    // take the first one
    CDirToRead *pdr = LIST_HEAD(lhDirs, CDirToRead, dr_lnNode);
    CTFileName fnmDir = pdr->dr_strDir;
    delete pdr;

    // if the dir is not allowed
    if (pafnmInclude!=NULL &&
      (!FileMatchesList(*pafnmInclude, fnmDir) || FileMatchesList(*pafnmExclude, fnmDir)) ) {
      // skip it
      continue;
    }
    
    // start listing the directory
    struct _finddata_t c_file; long hFile;
    hFile = _findfirst( (const char *)(fnmBasePath+fnmDir+"*"), &c_file );
    
    // for each file in the directory
    for (
      BOOL bFileExists = hFile!=-1; 
      bFileExists; 
      bFileExists = _findnext( hFile, &c_file )==0) {

      // if dummy dir (this dir, parent dir, or any dir starting with '.')
      if (c_file.name[0]=='.') {
        // skip it
        continue;
      }

      // get the file's filepath
      CTFileName fnm = fnmDir+c_file.name;

      // if it is a directory
      if (c_file.attrib&_A_SUBDIR) {
        // if recursive reading
        if (bRecursive) {
          // add it to the list of directories to search
          CDirToRead *pdrNew = new CDirToRead;
          pdrNew->dr_strDir = fnm+"\\";
          lhDirs.AddTail(pdrNew->dr_lnNode);
        }
      // if it matches the pattern
      } else if (strPattern=="" || fnm.Matches(strPattern)) {
        // add that file
        afnm.Push() = fnm;
      }
    }
  }
}
开发者ID:0-T-0,项目名称:Serious-Engine,代码行数:60,代码来源:Directory.cpp

示例5: BrowseAttachement

BOOL CDlgPgInfoAttachingPlacement::BrowseAttachement( CAttachedModel *pam)
{
  CModelerView *pModelerView = CModelerView::GetActiveView();
  if(pModelerView == NULL) return FALSE;
  CModelerDoc* pDoc = pModelerView->GetDocument();

  CTFileName fnOldModel = pam->am_moAttachedModel.GetName();
  CTFileName fnModel = _EngineGUI.FileRequester( "Select model to attach",
				  FILTER_MDL FILTER_END, "Attaching models directory",
				  _fnmApplicationPath + fnOldModel.FileDir(),
				  fnOldModel.FileName()+fnOldModel.FileExt());
  if( fnModel == "") return FALSE;

  try
  {
    pam->SetModel_t( fnModel);
  }
  catch( char *strError)
  {
    (void) strError;
    return FALSE;
  }
  pam->am_bVisible = TRUE;

  pDoc->ClearAttachments();
  pDoc->SetupAttachments();

  pDoc->SetModifiedFlag();
  pDoc->UpdateAllViews( NULL);

  UpdateData(FALSE);
  return TRUE;
}
开发者ID:ArcticPheenix,项目名称:Serious-Engine,代码行数:33,代码来源:DlgPgInfoAttachingPlacement.cpp

示例6: module

CUnixDynamicLoader::CUnixDynamicLoader(const char *libname)
    : module(NULL),
      err(NULL)
{
    if (libname == NULL) {
        DoOpen(NULL);
    } else {
        CTFileName fnm = ConvertLibNameToPlatform(libname);

        // Always try to dlopen from inside the game dirs before trying
        //  system libraries...
        if (fnm.FileDir() == "") {
            char buf[MAX_PATH];
            _pFileSystem->GetExecutablePath(buf, sizeof (buf));
            CTFileName fnmDir = CTString(buf);
            fnmDir = fnmDir.FileDir() + fnm;
            DoOpen(fnmDir);
            if (module != NULL) {
                return;
            }
        }

        DoOpen(fnm);
    }
}
开发者ID:DrItanium,项目名称:Serious-Engine,代码行数:25,代码来源:UnixDynamicLoader.cpp

示例7: DisableRendering

// 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;
}
开发者ID:AdamFlores,项目名称:Serious-Engine,代码行数:34,代码来源:SeriousSkaStudio.cpp

示例8: CTString

BOOL CModelerDoc::OnOpenDocument(LPCTSTR lpszPathName) 
{
	m_bDocLoadedOk = FALSE;
  CTFileName fnModelFile = CTString(lpszPathName);

  try
  {
    fnModelFile.RemoveApplicationPath_t();
  }
  catch( char *err_str)
  {
    AfxMessageBox( err_str);
    return FALSE;
  }

  try
  {
    m_emEditModel.Load_t( fnModelFile);
  }
  catch( char *err_str)
  {
    CMainFrame* pMainFrame = STATIC_DOWNCAST(CMainFrame, AfxGetMainWnd());
    MessageBoxA(pMainFrame->m_hWnd, err_str, "Warning! Model load failed.", MB_OK|MB_ICONHAND|MB_SYSTEMMODAL);
    return FALSE;
  }

  INDEX ctLoadedModels=m_emEditModel.edm_aamAttachedModels.Count();
  INDEX ctAttachmentPositions=m_emEditModel.edm_md.md_aampAttachedPosition.Count();
  
  if(ctLoadedModels<ctAttachmentPositions)
  {
    for( INDEX iPos=ctLoadedModels; iPos<ctAttachmentPositions; iPos++)
    {
      m_emEditModel.edm_aamAttachedModels.New();
      m_emEditModel.edm_aamAttachedModels.Lock();
      CAttachedModel &am=m_emEditModel.edm_aamAttachedModels[iPos];
      DECLARE_CTFILENAME( fnAxis, "Data\\Models\\Editor\\Axis.mdl");
      am.am_bVisible=TRUE;
      am.am_strName="Not loaded";
      am.am_iAnimation=0;
      try
      {
        am.SetModel_t(fnAxis);
      }
      catch( char *strError)
      {
        WarningMessage( strError);
      }
      m_emEditModel.edm_aamAttachedModels.Unlock();
    }
  }

	m_bDocLoadedOk = TRUE;
  // flush stale caches
  _pShell->Execute("FreeUnusedStock();");
  SelectSurface( 0, TRUE);
  return TRUE;
}
开发者ID:RocketersAlex,项目名称:LCSource,代码行数:58,代码来源:ModelerDoc.cpp

示例9: OnBrowseBcgPicture

void CDlgRenderingPreferences::OnBrowseBcgPicture() 
{
  CTFileName fnBcgPicture = _EngineGUI.FileRequester( "Select background texture",
    "Texture (*.tex)\0*.tex\0" FILTER_TEX FILTER_END, "Background textures", "");
  if( fnBcgPicture == "") return;
  sprintf( theApp.m_vpViewPrefs[ m_iBuffer].m_achrBcgPicture, "%s", fnBcgPicture);
  m_strBcgTexture = fnBcgPicture.FileName();
  UpdateData( FALSE);
}
开发者ID:EgoIncarnate,项目名称:Serious-Engine,代码行数:9,代码来源:DlgRenderingPreferences.cpp

示例10: 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;
}
开发者ID:AdamFlores,项目名称:Serious-Engine,代码行数:58,代码来源:SeriousSkaStudio.cpp

示例11: FileMatchesList

extern BOOL FileMatchesList(CDynamicStackArray<CTFileName> &afnm, const CTFileName &fnm)
{
  for(INDEX i=0; i<afnm.Count(); i++) {
    if (fnm.Matches(afnm[i]) || fnm.HasPrefix(afnm[i])) {
      return TRUE;
    }
  }
  return FALSE;
}
开发者ID:bsmr-games,项目名称:Serious-Engine,代码行数:9,代码来源:Stream.cpp

示例12: CTString

CTFileName CDynamicLoader::ConvertLibNameToPlatform(const char *libname)
{
    #if PLATFORM_MACOSX
    const char *DLLEXTSTR = ".dylib";
    #else
    const char *DLLEXTSTR = ".so";
    #endif
    CTFileName fnm = CTString(libname);
    CTString libstr((strncmp("lib", fnm.FileName(), 3) == 0) ? "" : "lib");
    return(fnm.FileDir() + libstr + fnm.FileName() + DLLEXTSTR);
}
开发者ID:DrItanium,项目名称:Serious-Engine,代码行数:11,代码来源:UnixDynamicLoader.cpp

示例13: 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;
}
开发者ID:angelog,项目名称:Rockets-Forever,代码行数:27,代码来源:Camera.cpp

示例14: MakeDirList

void CDlgClient::OnShowWindow(BOOL bShow, UINT nStatus) 
{
  CComboBox *cbShader = ((CComboBox*)GetDlgItem(IDC_CB_SHADER));
  if((bShow==TRUE) && (cbShader!=NULL))
  {
    // read all shaders files
    CDynamicStackArray<CTFileName> afnShaders;
    MakeDirList( afnShaders, CTString("Shaders\\"), "*.sha", 0);
    cbShader->ResetContent();
    for(INDEX ifn=0; ifn<afnShaders.Count(); ifn++)
    {
      CTFileName fnShader = afnShaders[ifn];
      cbShader->AddString(CString(fnShader.FileName()));
    }
  }
	CDialog::OnShowWindow(bShow, nStatus);
}
开发者ID:AdamFlores,项目名称:Serious-Engine,代码行数:17,代码来源:DlgClient.cpp

示例15: ParseSmcFile_t

// Parse smc file in existing model instance
void ParseSmcFile_t(CModelInstance &mi, const CTString &fnSmcFile)
{
  // Clear given model instance before parsing
  mi.Clear();

  CTFileName fnFileName = fnSmcFile;
  try {
    fnFileName.RemoveApplicationPath_t();
  } catch (char *) {
  }

  CTString strIncludeFile;
  strIncludeFile.Load_t(fnFileName);

  _yy_mi = &mi;
  SMCPushBuffer(fnFileName, strIncludeFile, TRUE);
  syyparse();
}
开发者ID:ArcticPheenix,项目名称:Serious-Engine,代码行数:19,代码来源:ModelInstance.cpp


注:本文中的CTFileName类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。