本文整理汇总了C++中AutoAlloc::Close方法的典型用法代码示例。如果您正苦于以下问题:C++ AutoAlloc::Close方法的具体用法?C++ AutoAlloc::Close怎么用?C++ AutoAlloc::Close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AutoAlloc
的用法示例。
在下文中一共展示了AutoAlloc::Close方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: DestroyWindow
void ApplinkDialog::DestroyWindow(void)
{
if(dirty)
{
AutoAlloc<HyperFile> hyperfilePrefs;
if (hyperfilePrefs->Open(filenamePrefs.GetString(), GE_WRITE, FILE_NODIALOG))
{
saveSettings();
hyperfilePrefs->WriteContainer(gPreferences);
hyperfilePrefs->Close();
}
}
}
示例3: InitValues
Bool ApplinkDialog::InitValues(void)
{
if (!GeDialog::InitValues()) return false;
filenamePrefs = GeGetPluginPath()+ "preference.ini";
dirty = false;
AutoAlloc<HyperFile> hyperfilePrefs;
if(!GeFExist(filenamePrefs, false))
{
if (!hyperfilePrefs->Open('coat', filenamePrefs.GetString(), FILEOPEN_WRITE, FILEDIALOG_ANY)) return false;
gPreferences.SetString(IDC_TMP_FOLDER, "");
Filename path;
#if defined _WIN32 || defined _WIN64
path = GeGetC4DPath(C4D_PATH_MYDOCUMENTS);
#elif __APPLE__
path = GeGetC4DPath(C4D_PATH_HOME);
#endif
//file magic!
Filename exFolder = path + "3D-CoatV3" + "Exchange";
if(GeFExist(exFolder, true))
{
gPreferences.SetString(IDC_EXCH_FOLDER, exFolder.GetString());
}
else
{
exFolder = path + "3D-CoatV4" + "Exchange";
if (GeFExist(exFolder, true))
{
gPreferences.SetString(IDC_EXCH_FOLDER, exFolder.GetString());
}
else
{
GePrint("Not Find");
#if defined _WIN32 || defined _WIN64
GePrint(String("Folder ..\\MyDocuments\\3D-CoatV3\\Exchange not found!"));
#elif __APPLE__
GePrint(String("Folder ../Users/admin/3D-CoatV3/Exchange not found!"));
#endif
gPreferences.SetString(IDC_EXCH_FOLDER, "");
}
}
gPreferences.SetInt32(IDC_COMBO_MAP_TYPE, 0);
gPreferences.SetBool(IDC_CHK_EXP_MAT, true);
gPreferences.SetBool(IDC_CHK_EXP_UV, true);
gPreferences.SetBool(IDC_CHK_SKIP_IMP_DIALOG, false);
gPreferences.SetBool(IDC_CHK_SKIP_EXP_DIALOG, false);
gPreferences.SetBool(IDC_CHK_IMP_MAT, true);
gPreferences.SetInt32(IDC_COMBO_MAP_IMPORT, 0);
gPreferences.SetBool(IDC_CHK_IMP_UV, true);
gPreferences.SetBool(IDC_CHK_REPLACE, true);
gPreferences.SetBool(IDC_CHK_PROMPT, false);
gPreferences.SetString(IDC_COAT_EXE_PATH, "");
gPreferences.SetBool(IDC_CHK_COAT_START, false);
hyperfilePrefs->WriteContainer(gPreferences);
hyperfilePrefs->Close();
}
if(!hyperfilePrefs->Open('coat', filenamePrefs.GetString(), FILEOPEN_READ, FILEDIALOG_ANY)) return false;
hyperfilePrefs->ReadContainer(&gPreferences, true);
hyperfilePrefs->Close();
SetString(IDC_TMP_FOLDER, gPreferences.GetString(IDC_TMP_FOLDER));
SetString(IDC_EXCH_FOLDER, gPreferences.GetString(IDC_EXCH_FOLDER));
SetInt32(IDC_COMBO_MAP_TYPE, gPreferences.GetInt32(IDC_COMBO_MAP_TYPE));
SetBool(IDC_CHK_EXP_MAT, gPreferences.GetBool(IDC_CHK_EXP_MAT));
SetBool(IDC_CHK_EXP_UV, gPreferences.GetBool(IDC_CHK_EXP_UV));
SetBool(IDC_CHK_SKIP_IMP_DIALOG, gPreferences.GetBool(IDC_CHK_SKIP_IMP_DIALOG));
SetBool(IDC_CHK_SKIP_EXP_DIALOG, gPreferences.GetBool(IDC_CHK_SKIP_EXP_DIALOG));
SetBool(IDC_CHK_IMP_MAT, gPreferences.GetBool(IDC_CHK_IMP_MAT));
SetInt32(IDC_COMBO_MAP_IMPORT, gPreferences.GetInt32(IDC_COMBO_MAP_IMPORT));
SetBool(IDC_CHK_IMP_UV, gPreferences.GetBool(IDC_CHK_IMP_UV));
SetBool(IDC_CHK_REPLACE, gPreferences.GetBool(IDC_CHK_REPLACE));
SetBool(IDC_CHK_PROMPT, gPreferences.GetBool(IDC_CHK_PROMPT));
SetString(IDC_COAT_EXE_PATH, gPreferences.GetString(IDC_COAT_EXE_PATH));
SetBool(IDC_CHK_COAT_START, gPreferences.GetBool(IDC_CHK_COAT_START));
#ifdef __APPLE__
//------------ temp
//Enable(IDC_CHK_COAT_START, false);
//Enable(IDC_COAT_EXE_PATH, false);
//-------------
// SetString(IDS_STATIC12, "Folder ../Users/user/3D-CoatV3/Exchange not found!");
#endif
SetTimer(1000);
//.........这里部分代码省略.........
示例4: ReadPreset
//.........这里部分代码省略.........
ReadString(pszLine, pPreset->strDestination);
}
if (strstr(pszLine, CREATE_ZIP) == pszLine)
{
pszLine += strlen(CREATE_ZIP);
ReadBool(pszLine, pPreset->bCreateZipFile);
}
if (strstr(pszLine, CREATE_ZIP_COMPRESSION) == pszLine)
{
pszLine += strlen(CREATE_ZIP_COMPRESSION);
ReadInt32(pszLine, pPreset->lCreateZipCompressionLevel);
}
if (strstr(pszLine, CHECK_VERSION) == pszLine)
{
pszLine += strlen(CHECK_VERSION);
ReadBool(pszLine, pPreset->bCheckVersion);
}
if (strstr(pszLine, PARSE_SYMBOLS) == pszLine)
{
pszLine += strlen(PARSE_SYMBOLS);
ReadBool(pszLine, pPreset->bParseSymbols);
}
if (strstr(pszLine, WRITE_BUILD) == pszLine)
{
pszLine += strlen(WRITE_BUILD);
ReadBool(pszLine, pPreset->bWriteBuildInfo);
}
if (strstr(pszLine, REMOVE_SCC) == pszLine)
{
pszLine += strlen(REMOVE_SCC);
ReadBool(pszLine, pPreset->bRemoveSCC);
}
if (strstr(pszLine, BATCH) == pszLine)
{
pszLine += strlen(BATCH);
ReadBool(pszLine, pPreset->bBatch);
}
if (strstr(pszLine, PASSWORD) == pszLine)
{
pszLine += strlen(PASSWORD);
ReadString(pszLine, pPreset->strPassword);
pPreset->strPassword = DecryptPassword(pPreset->strPassword);
}
if (strstr(pszLine, FILTER_STRING) == pszLine)
{
pszLine += strlen(FILTER_STRING);
FilterElement* pFilter = pPreset->arFilters.GetNextObject();
if (!pFilter)
continue;
ReadString(pszLine, pFilter->str);
if (strstr(pszLine, FILTER_CONDITION) == pszLine)
{
pszLine += strlen(FILTER_CONDITION);
ReadString(pszLine, str);
if (str == W_FILTER_COND_FN_IS) pFilter->lCondition = FILTER_COND_FN_IS;
else if (str == W_FILTER_COND_FN_EXT) pFilter->lCondition = FILTER_COND_FN_EXT;
else if (str == W_FILTER_COND_PATH_CONTAINS) pFilter->lCondition = FILTER_COND_PATH_CONTAINS;
else if (str == W_FILTER_COND_PATH_IS) pFilter->lCondition = FILTER_COND_PATH_IS;
else if (str == W_FILTER_COND_DIRECTORY_IS) pFilter->lCondition = FILTER_COND_DIRECTORY_IS;
else DebugAssert(false);
}
if (strstr(pszLine, FILTER_ACTION) == pszLine)
{
pszLine += strlen(FILTER_ACTION);
ReadString(pszLine, str);
if (str == W_FILTER_ACTION_INCLUDE) pFilter->lAction = FILTER_ACTION_INCLUDE;
else if (str == W_FILTER_ACTION_EXCLUDE) pFilter->lAction = FILTER_ACTION_EXCLUDE;
else if (str == W_FILTER_ACTION_RENAME) pFilter->lAction = FILTER_ACTION_RENAME;
else if (str == W_FILTER_ACTION_COMPILE_INCL) pFilter->lAction = FILTER_ACTION_COMPILE_INCL;
else if (str == W_FILTER_ACTION_MOVE_TO) pFilter->lAction = FILTER_ACTION_MOVE_TO;
else if (str == W_FILTER_ACTION_FORCE_COPY) pFilter->lAction = FILTER_ACTION_FORCE_COPY;
else if (str == W_FILTER_ACTION_COMPILE_INCL_KILL) pFilter->lAction = FILTER_ACTION_COMPILE_INCL_KILL;
else DebugAssert(false);
}
if (strstr(pszLine, FILTER_RENAME) == pszLine)
{
DebugAssert(pFilter->lAction == FILTER_ACTION_RENAME);
pszLine += strlen(FILTER_RENAME);
ReadString(pszLine, pFilter->strRename);
}
else
DebugAssert(pFilter->lAction != FILTER_ACTION_RENAME);
if (strstr(pszLine, FILTER_FLAG) == pszLine)
{
pszLine += strlen(FILTER_FLAG);
ReadString(pszLine, str);
if (str == W_FILTER_FLAG_SET_XBIT) pFilter->bSetXBit = true;
else DebugAssert(false);
}
}
//if (pszLastPos != pszLine) always skip until the end of the line
break;
}
}
pFile->Close();
pPreset->ulCRC = GetPresetCrc(pPreset);
return true;
}
示例5: WriteElement
//.........这里部分代码省略.........
if (GetPresetCrc(pElement) == pElement->ulCRC && (GeFExist(fn + (strNewName + ".prf")) || GeFExist(GeGetC4DPath(C4D_PATH_RESOURCE) + String("distribution") + (strNewName + ".prf"))))
return;
fn += (strNewName + ".prf");
if (!ForceOpenFileWrite(pFile, fn))
{
GePrint(String("Could not write file ") + fn.GetString());
return;
}
AppendString(arLine, FILE_HEADER);
WriteLine(arLine, pFile);
AppendString(arLine, ORIG_PATH);
AppendString(arLine, arTempString, pElement->strOrigin);
WriteLine(arLine, pFile);
AppendString(arLine, DEST_PATH);
AppendString(arLine, arTempString, pElement->strDestination);
WriteLine(arLine, pFile);
AppendString(arLine, CREATE_ZIP);
AppendString(arLine, pElement->bCreateZipFile ? "1" : "0");
WriteLine(arLine, pFile);
Char *pszZipLevel = String::IntToString(pElement->lCreateZipCompressionLevel).GetCStringCopy();
if (pszZipLevel)
{
AppendString(arLine, CREATE_ZIP_COMPRESSION);
AppendString(arLine, pszZipLevel);
WriteLine(arLine, pFile);
DeleteMem(pszZipLevel);
}
AppendString(arLine, CHECK_VERSION);
AppendString(arLine, pElement->bCheckVersion ? "1" : "0");
WriteLine(arLine, pFile);
AppendString(arLine, PARSE_SYMBOLS);
AppendString(arLine, pElement->bParseSymbols ? "1" : "0");
WriteLine(arLine, pFile);
AppendString(arLine, WRITE_BUILD);
AppendString(arLine, pElement->bWriteBuildInfo ? "1" : "0");
WriteLine(arLine, pFile);
AppendString(arLine, BATCH);
AppendString(arLine, pElement->bBatch ? "1" : "0");
WriteLine(arLine, pFile);
AppendString(arLine, REMOVE_SCC);
AppendString(arLine, pElement->bRemoveSCC ? "1" : "0");
WriteLine(arLine, pFile);
AppendString(arLine, PASSWORD);
AppendString(arLine, arTempString, EncryptPassword(pElement->strPassword));
WriteLine(arLine, pFile);
Int32 lFilterCount = pElement->arFilters.GetElementCount();
FilterElement** ppFilterElements = pElement->arFilters.GetArray()->GetArray();
for (n = 0; n < lFilterCount; n++)
{
AppendString(arLine, FILTER_STRING);
AppendString(arLine, arTempString, ppFilterElements[n]->str);
AppendString(arLine, " " FILTER_CONDITION);
switch (ppFilterElements[n]->lCondition)
{
case FILTER_COND_FN_IS: AppendString(arLine, arTempString, W_FILTER_COND_FN_IS); break;
case FILTER_COND_FN_EXT: AppendString(arLine, arTempString, W_FILTER_COND_FN_EXT); break;
case FILTER_COND_PATH_CONTAINS: AppendString(arLine, arTempString, W_FILTER_COND_PATH_CONTAINS); break;
case FILTER_COND_PATH_IS: AppendString(arLine, arTempString, W_FILTER_COND_PATH_IS); break;
case FILTER_COND_DIRECTORY_IS: AppendString(arLine, arTempString, W_FILTER_COND_DIRECTORY_IS); break;
default:
DebugAssert(false);
}
AppendString(arLine, " " FILTER_ACTION);
switch (ppFilterElements[n]->lAction)
{
case FILTER_ACTION_INCLUDE: AppendString(arLine, arTempString, W_FILTER_ACTION_INCLUDE); break;
case FILTER_ACTION_EXCLUDE: AppendString(arLine, arTempString, W_FILTER_ACTION_EXCLUDE); break;
case FILTER_ACTION_RENAME: AppendString(arLine, arTempString, W_FILTER_ACTION_RENAME); AppendString(arLine, " " FILTER_RENAME); AppendString(arLine, arTempString, ppFilterElements[n]->strRename); break;
case FILTER_ACTION_COMPILE_INCL: AppendString(arLine, arTempString, W_FILTER_ACTION_COMPILE_INCL); break;
case FILTER_ACTION_MOVE_TO: AppendString(arLine, arTempString, W_FILTER_ACTION_MOVE_TO); break;
case FILTER_ACTION_FORCE_COPY: AppendString(arLine, arTempString, W_FILTER_ACTION_FORCE_COPY); break;
case FILTER_ACTION_COMPILE_INCL_KILL: AppendString(arLine, arTempString, W_FILTER_ACTION_COMPILE_INCL_KILL); break;
default:
DebugAssert(false);
}
if (ppFilterElements[n]->bSetXBit)
{
AppendString(arLine, " " FILTER_FLAG);
AppendString(arLine, arTempString, W_FILTER_FLAG_SET_XBIT);
}
WriteLine(arLine, pFile);
}
pFile->Close();
}
示例6: 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)
{
//.........这里部分代码省略.........
示例7: InitValues
Bool ApplinkDialog::InitValues(void)
{
if (!GeDialog::InitValues()) return FALSE;
filenamePrefs = GeGetPluginPath()+ "preference.ini";
dirty = FALSE;
AutoAlloc<HyperFile> hyperfilePrefs;
if(!GeFExist(filenamePrefs, FALSE))
{
if (!hyperfilePrefs->Open(filenamePrefs.GetString(), GE_WRITE, FILE_NODIALOG)) return FALSE;
gPreferences.SetString(IDC_TMP_FOLDER, "");
Filename exFolder = GeGetC4DPath(C4D_PATH_MYDOCUMENTS) + "3D-CoatV3" + "Exchange";
if(GeFExist(exFolder, TRUE))
{
gPreferences.SetString(IDC_EXCH_FOLDER, exFolder.GetString());
}
else
{
GePrint(String("Folder ..\\MyDocuments\\3D-CoatV3\\Exchange not found!"));
gPreferences.SetString(IDC_EXCH_FOLDER, "");
}
gPreferences.SetLong(IDC_COMBO_MAP_TYPE, 0);
gPreferences.SetBool(IDC_CHK_EXP_MAT, TRUE);
gPreferences.SetBool(IDC_CHK_EXP_UV, TRUE);
gPreferences.SetBool(IDC_CHK_IMP_MAT, TRUE);
gPreferences.SetLong(IDC_COMBO_MAP_IMPORT, 0);
gPreferences.SetBool(IDC_CHK_IMP_UV, TRUE);
gPreferences.SetBool(IDC_CHK_REPLACE, TRUE);
gPreferences.SetBool(IDC_CHK_PROMPT, FALSE);
gPreferences.SetString(IDC_COAT_EXE_PATH, "");
gPreferences.SetBool(IDC_CHK_COAT_START, FALSE);
hyperfilePrefs->WriteContainer(gPreferences);
hyperfilePrefs->Close();
}
if(!hyperfilePrefs->Open(filenamePrefs.GetString(), GE_READ, FILE_NODIALOG)) return FALSE;
hyperfilePrefs->ReadContainer(&gPreferences, TRUE);
hyperfilePrefs->Close();
SetString(IDC_TMP_FOLDER, gPreferences.GetString(IDC_TMP_FOLDER));
SetString(IDC_EXCH_FOLDER, gPreferences.GetString(IDC_EXCH_FOLDER));
SetLong(IDC_COMBO_MAP_TYPE, gPreferences.GetLong(IDC_COMBO_MAP_TYPE));
SetBool(IDC_CHK_EXP_MAT, gPreferences.GetBool(IDC_CHK_EXP_MAT));
SetBool(IDC_CHK_EXP_UV, gPreferences.GetBool(IDC_CHK_EXP_UV));
SetBool(IDC_CHK_IMP_MAT, gPreferences.GetBool(IDC_CHK_IMP_MAT));
SetLong(IDC_COMBO_MAP_IMPORT, gPreferences.GetLong(IDC_COMBO_MAP_IMPORT));
SetBool(IDC_CHK_IMP_UV, gPreferences.GetBool(IDC_CHK_IMP_UV));
SetBool(IDC_CHK_REPLACE, gPreferences.GetBool(IDC_CHK_REPLACE));
SetBool(IDC_CHK_PROMPT, gPreferences.GetBool(IDC_CHK_PROMPT));
SetString(IDC_COAT_EXE_PATH, gPreferences.GetString(IDC_COAT_EXE_PATH));
SetBool(IDC_CHK_COAT_START, gPreferences.GetBool(IDC_CHK_COAT_START));
SetTimer(1000);
return TRUE;
}