本文整理汇总了C++中Filename::SetDirectory方法的典型用法代码示例。如果您正苦于以下问题:C++ Filename::SetDirectory方法的具体用法?C++ Filename::SetDirectory怎么用?C++ Filename::SetDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Filename
的用法示例。
在下文中一共展示了Filename::SetDirectory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Timer
void ApplinkDialog::Timer(const BaseContainer &msg)
{
Bool b;
GetBool(IDC_CHK_PROMPT, b);
if(b)
{
Filename fn;
fn.SetDirectory(gPreferences.GetString(IDC_EXCH_FOLDER));
fn.SetFile("export.txt");
if(GeFExist(fn))
{
GePrint("File exists!");
SetTimer(0);
if(GeOutString("To import a new object?", GEMB_OKCANCEL) == GEMB_R_OK)
{
GePrint("Start import!");
BaseDocument* doc = GetActiveDocument();
ApplinkImporter* importer = NewObjClear(ApplinkImporter);
importer->Execute(doc, &gPreferences);
SetTimer(1000);
}
else
{
SetBool(IDC_CHK_PROMPT, false);
}
}
}
}
示例2: WriteMatsFile
Bool ApplinkExporter::WriteMatsFile(BaseDocument* document, BaseContainer* bc)
{
Filename filenameMTL;
filenameMTL.SetDirectory(bc->GetString(IDC_TMP_FOLDER));
filenameMTL.SetFile(document->GetDocumentName());
filenameMTL.SetSuffix("mtl");
GePrint(filenameMTL.GetString());
AutoAlloc<BaseFile> fileMTL;
if (!fileMTL->Open(filenameMTL, FILEOPEN_WRITE, FILEDIALOG_NONE, GeGetByteOrder())) return FALSE;
for(LONG i=0; i < materialArray.GetCount(); i++)
{
BaseMaterial* mat = materialArray[i];
String str;
str = "newmtl " + mat->GetName() + "\n";
this->WriteString(str, fileMTL);
//Ka
str = "Ka 0.300000 0.300000 0.300000\n";
this->WriteString(str, fileMTL);
/////////////////////////////////////////////////////////
////////////////////////////////////////////////////////
//Kd
if(getParameterLong(*mat, MATERIAL_USE_COLOR))
{
ExportChannel(document, fileMTL, *mat, MATERIAL_COLOR_SHADER, MATERIAL_COLOR_COLOR, "Kd");
}
//Ks
if(getParameterLong(*mat, MATERIAL_USE_REFLECTION))
{
ExportChannel(document, fileMTL, *mat, MATERIAL_REFLECTION_SHADER, MATERIAL_REFLECTION_COLOR, "Ks");
}
//Ns
str = "Ns 50.000000\n";
this->WriteString(str, fileMTL);
//Tr
str = "Tr 0.000000\n";
this->WriteString(str, fileMTL);
//illum
str = "illum 2\n";
this->WriteString(str, fileMTL);
this->WriteEndLine(fileMTL);
}
fileMTL->Close();
return TRUE;
}
示例3: LoadICCProfiles
void Color::LoadICCProfiles()
{
if(m_iccSearchPaths!= NULL){
delete m_iccSearchPaths;
}
const Int32 NUMSEARCHPATHS = 4;
m_iccSearchPaths = new String[NUMSEARCHPATHS];
Filename cmykDir = GeGetPluginPath();
cmykDir += Filename(String("cmyk"));
m_iccSearchPaths[0] = cmykDir.GetString();
m_iccSearchPaths[1] = "/Library/ColorSync/Profiles/";
m_iccSearchPaths[2] = "/Users/vidarn/Library/ColorSync";
m_iccSearchPaths[3] = "C:\\Windows\\System32\\Spool\\Drivers\\Color\\";
Logger::AddLine("Creating LAB profile",1);
m_LABProfile = cmsCreateLab4Profile(NULL);
Logger::AddLine("Creating default sRGB profile",1);
m_displayProfile = cmsCreate_sRGBProfile();
m_RGBProfiles.Insert(vnColorProfile("sRGB",m_displayProfile),0);
for(Int32 i=0;i<NUMSEARCHPATHS;++i){
BrowseFiles* bf = BrowseFiles::Alloc();
Filename dir(m_iccSearchPaths[i]);
bf->Init(dir,FALSE);
int RGBPos = m_RGBProfiles.GetCount();
int CMYKPos = m_CMYKProfiles.GetCount();
int spotPos = m_spotProfiles.GetCount();
if (bf)
{
while (bf->GetNext())
{
Filename fileName = bf->GetFilename();
fileName.SetDirectory(dir);
String str = fileName.GetString();
Char *buffer = new Char[str.GetCStringLen()+1];
str.GetCString(buffer,str.GetCStringLen()+1);
Logger::AddLine(buffer,1);
cmsHPROFILE profile = cmsOpenProfileFromFile(buffer, "r");
if(profile != NULL){
cmsColorSpaceSignature sig = cmsGetColorSpace(profile);
Int32 length = cmsGetProfileInfoASCII(profile,cmsInfoDescription,"en","US",NULL,0);
Char *buffer2 = new Char[length];
cmsGetProfileInfoASCII(profile,cmsInfoDescription,"en","US",buffer2,length);
String info(buffer2);
int pt = _cmsLCMScolorSpace(sig);
if(PT_RGB == pt){
Logger::AddLine("RGB profile",1);
m_RGBProfiles.Insert(vnColorProfile(info,profile),RGBPos);
RGBPos++;
}
if(PT_CMYK == pt){
cmsHTRANSFORM xform = cmsCreateTransform(profile,TYPE_NAMED_COLOR_INDEX,m_displayProfile,TYPE_RGB_DBL,INTENT_PERCEPTUAL,0);
if(xform != NULL){
cmsNAMEDCOLORLIST* colorList = cmsGetNamedColorList(xform);
if(colorList != NULL){
m_spotProfiles.Insert(vnColorProfile(info,profile),spotPos);
spotPos++;
}
else{
Logger::AddLine("CMYK profile",1);
m_CMYKProfiles.Insert(vnColorProfile(info,profile),CMYKPos);
CMYKPos++;
}
cmsDeleteTransform(xform);
}
}
delete buffer2;
} else {
Logger::AddLine("Invalid",1);
}
delete buffer;
}
}
BrowseFiles::Free(bf);
}
}
示例4: Execute
Bool ApplinkExporter::Execute(BaseDocument* document, BaseContainer* bc)
{
matDefault = BaseMaterial::Alloc(Mmaterial);
if(!matDefault) return false;
Filename fileObjPath;
fileObjPath.SetDirectory(bc->GetString(IDC_TMP_FOLDER));
fileObjPath.SetFile(document->GetDocumentName());
fileObjPath.SetSuffix("obj");
Filename fileObjOutPath;
fileObjOutPath.SetDirectory(bc->GetString(IDC_TMP_FOLDER));
fileObjOutPath.SetFile("output.obj");
Filename fileImport;
fileImport.SetDirectory(bc->GetString(IDC_EXCH_FOLDER));
fileImport.SetFile("import.txt");
GePrint(fileObjPath.GetString());
GePrint(fileObjOutPath.GetString());
GePrint(fileImport.GetString());
const Matrix tM(LVector(0.0f, 0.0f, 0.0f), LVector(1.0f, 0.0f, 0.0f), LVector(0.0f, 1.0f, 0.0f), LVector(0.0f, 0.0f, -1.0f));
//BaseDocument* doc = document->Polygonize();
AutoAlloc<AtomArray> oSel;
document->GetActiveObjects(oSel, GETACTIVEOBJECTFLAGS_0);
if(oSel->GetCount() > 0)
{
//Write import.txt//
AutoAlloc<BaseFile> basefileImport;
if (!basefileImport->Open(fileImport, FILEOPEN_WRITE, FILEDIALOG_NONE, GeGetByteOrder())) return FALSE;
this->WriteString(fileObjPath.GetString() + "\n", basefileImport);
this->WriteString(fileObjOutPath.GetString() + "\n", basefileImport);
this->WriteString(mapType(bc->GetLong(IDC_COMBO_MAP_TYPE)) + "\n", basefileImport);
Bool bSkipImp = bc->GetBool(IDC_CHK_SKIP_IMP_DIALOG);
if(bSkipImp)
{
this->WriteString("[SkipImport]\n", basefileImport);
}
Bool bSkipExp = bc->GetBool(IDC_CHK_SKIP_EXP_DIALOG);
if(bSkipExp)
{
this->WriteString("[SkipExport]\n", basefileImport);
}
GePrint(mapType(bc->GetLong(IDC_COMBO_MAP_TYPE)));
basefileImport->Close();
GePrint("File " + fileImport.GetString() + " write success!");
//Write file.obj//
AutoAlloc<BaseFile> objfile;
//if (!objfile) return FALSE;
if (!objfile->Open(fileObjPath, FILEOPEN_WRITE, FILEDIALOG_NONE, GeGetByteOrder())) return FALSE;
String str;
str = "#Wavefront OBJ Export for 3D-Coat\n";
this->WriteString(str, objfile);
DateTime t;
GetDateTimeNow(t);
str = "#File created: " + FormatTime("%d.%m.%Y %H:%M:%S", t) + "\n";
this->WriteString(str, objfile);
str = "#Cinema4D Version: " + LongToString(GetC4DVersion()) + "\n";
this->WriteString(str, objfile);
this->WriteEndLine(objfile);
Bool expMat = bc->GetBool(IDC_CHK_EXP_MAT);
vpcnt = vtcnt = 0;
for(int i = 0; i < oSel->GetCount(); i++)
{
StatusSetSpin();
PolygonObject* ob = (PolygonObject*) oSel->GetIndex(i);
if (ob->GetType() == Opolygon)
{
StatusSetText("Export object " + ob->GetName());
ExportObject mObject;
GePrint("Name " + ob->GetName());
//GePrint("Type " + LongToString(ob->GetType()));
if(expMat)
{
mObject.pmatidxArray.ReSize(ob->GetPolygonCount());
mObject.tempMats.ReSize(1);
mObject.pmatidxArray.Fill(0);
Bool haveMats = false;
//////////////////////////////////////////
for(BaseTag* tag = ob->GetFirstTag(); tag != NULL; tag = tag->GetNext())
{
LONG typ = tag->GetType();
if(typ == Ttexture)
{
//.........这里部分代码省略.........