本文整理汇总了C++中Filename::GetString方法的典型用法代码示例。如果您正苦于以下问题:C++ Filename::GetString方法的具体用法?C++ Filename::GetString怎么用?C++ Filename::GetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Filename
的用法示例。
在下文中一共展示了Filename::GetString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
/*********************************************************************\
Function name : CLanguageList::Init
Description :
Created at : 26.09.01, @ 16:11:23
Created by : Thomas Kunert
Modified by :
\*********************************************************************/
void CLanguageList::Init()
{
Filename resourcepath = GeGetStartupPath() + Filename("resource");
if (GetC4DVersion() >= 16000) {
// R16 has a new resource directory structure. The c4d_language.str
// files we are searching for are in resource/modules/c4dplugin/strings_xx.
// Fix for https://github.com/nr-plugins/resedit/issues/4
resourcepath = resourcepath + "modules" + "c4dplugin";
}
AutoAlloc <BrowseFiles> pBrowse;
pBrowse->Init(resourcepath, false);
while (pBrowse->GetNext())
{
if (pBrowse->IsDir())
{
Filename fn = pBrowse->GetFilename();
if (fn.GetString().SubStr(0, 8).ToLower() == "strings_")
{
String idx = fn.GetString();
idx.Delete(0, 8);
Filename stringname = resourcepath + fn+Filename("c4d_language.str");
AutoAlloc <BaseFile> pFile;
if (!pFile)
return;
if (!GeFExist(stringname))
{
GeOutString("Missing c4d_language.str to identify the string directory!!!", GEMB_ICONEXCLAMATION);
}
else if (pFile->Open(stringname))
{
Int32 len = pFile->GetLength();
Char *buffer = NewMemClear(Char,len + 2);
if (buffer)
{
pFile->ReadBytes(buffer,len);
buffer[len]=0;
Int32 i;
for (i = 0; i < len && buffer[i] >= ' '; i++) { }
buffer[i] = 0;
for (i--; i > 0 && buffer[i]== ' '; i--) { }
buffer[i + 1] = 0;
AddLanguage(buffer, idx);
DeleteMem(buffer);
}
}
}
}
}
CriticalAssert(GetNumLanguages() > 0);
}
示例2: Init
/*********************************************************************\
Function name : CLanguageList::Init
Description :
Created at : 26.09.01, @ 16:11:23
Created by : Thomas Kunert
Modified by :
\*********************************************************************/
void CLanguageList::Init()
{
Filename resourcepath = GeGetStartupPath() + Filename("resource");
AutoAlloc <BrowseFiles> pBrowse;
pBrowse->Init(resourcepath, false);
while (pBrowse->GetNext())
{
if (pBrowse->IsDir())
{
Filename fn = pBrowse->GetFilename();
if (fn.GetString().SubStr(0, 8).ToLower() == "strings_")
{
String idx = fn.GetString();
idx.Delete(0, 8);
Filename stringname = resourcepath + fn+Filename("c4d_language.str");
AutoAlloc <BaseFile> pFile;
if (!pFile)
return;
if (!GeFExist(stringname))
{
GeOutString("Missing c4d_language.str to identify the string directory!!!", GEMB_ICONEXCLAMATION);
}
else if (pFile->Open(stringname))
{
Int32 len = pFile->GetLength();
Char *buffer = NewMemClear(Char,len + 2);
if (buffer)
{
pFile->ReadBytes(buffer,len);
buffer[len]=0;
Int32 i;
for (i = 0; i < len && buffer[i] >= ' '; i++) { }
buffer[i] = 0;
for (i--; i > 0 && buffer[i]== ' '; i--) { }
buffer[i + 1] = 0;
AddLanguage(buffer, idx);
DeleteMem(buffer);
}
}
}
}
}
}
示例3: ExportChannel
void ApplinkExporter::ExportChannel(BaseDocument* document, BaseFile* file, BaseMaterial& material, LONG shaderId, LONG colorId, const String s)
{
String str = s + " ";
// get texture strength and base colour
Vector color = getParameterVector(material, colorId);
str += RealToString(color.x, NULL, 6) + " " + RealToString(color.y, NULL, 6) + " " + RealToString(color.z, NULL, 6) + "\n";
this->WriteString(str, file);
// fetch bitmap shader, if available
BaseList2D* bitmapLink = ApplinkExporter::getParameterLink(material, shaderId, Xbitmap);
if(bitmapLink)
{
// if we are here, we've got a bitmap shader -> let's create an imagemap texture
Filename bitmapPath = ApplinkExporter::getParameterFilename(*bitmapLink, BITMAPSHADER_FILENAME);
Filename fullBitmapPath;
GenerateTexturePath(document->GetDocumentPath(), bitmapPath, Filename(), &fullBitmapPath);
str = "map_" + s + " ";
str += fullBitmapPath.GetString() + "\n";
this->WriteString(str, file);
}
}
示例4: 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;
}
示例5: CreateFromFilename
void Asset::CreateFromFilename(const Filename& filename)
{
// First, try and get the file from the archive manager, if it is present
if (ArchiveManager::IsInstanceCreated())
{
archiveFile_=siArchiveManager->GetFile(filename);
}
// If we couldn't get the directory from the archive manager, try to get it from the file system, if it is present
if (!archiveFile_ && Platform::GetPlatform_FileSystem())
{
file_=Platform::GetPlatform_FileSystem()->CreateFileObject(filename.GetString());
}
// If we couldn't get the file from neither the archive manager nor the filesystem, we trigger an assert for
// debug builds, and just reports the file as being empty for release builds.
Assert(archiveFile_ || file_,
"Error creating AssetEnumerator - No filesystem or archive manager present, or file not found.");
}
示例6: Init
void Logger::Init()
{
Filename dir = GeGetStartupWritePath();
dir += Filename(String("color4d_log.txt"));
String filename = dir.GetString();
#ifdef _WINDOWS
Int32 fnLength = filename.GetCStringLen(STRINGENCODING_XBIT);
m_filename = NewMem(char,fnLength+1);
filename.GetCString(m_filename, fnLength+1, STRINGENCODING_XBIT);
#else
Int32 fnLength = filename.GetCStringLen(STRINGENCODING_UTF8);
m_filename = NewMem(char,fnLength+1);
filename.GetCString(m_filename, fnLength+1, STRINGENCODING_UTF8);
#endif
FILE *f = fopen(m_filename,"wt");
if(f){
fprintf(f,"----- Color4D Log -----\n");
fclose(f);
}
}
示例7: CreateCursor
void InputManager::CreateCursor(int id, const Filename& image, int hotspotX, int hotspotY)
{
for (int i=0; i<cursors_.GetItemCount(); i++)
{
Assert(cursors_.Get(i).id!=id,"A cursor with that ID already exists");
if (cursors_.Get(i).id==id)
{
return;
}
}
Cursor cursor;
cursor.id=id;
cursor.handle=0;
if (image.GetString() && Platform::GetPlatform_Input())
{
Bitmap_16bitAlpha cursorImage(image);
cursor.handle=Platform::GetPlatform_Input()->CreateMouseCursor(cursorImage.GetHPitch(),cursorImage.GetVPitch(),hotspotX,hotspotY,cursorImage.GetColorData(),cursorImage.GetAlphaData());
}
cursors_.Add(cursor);
}
示例8: Save
void ImageFormat_TGA::Save(const Filename& filename, int width, int height, void* data)
{
tga_image tga;
MemSet(&tga,0,sizeof(tga));
tga.image_id_length=0;
tga.color_map_type=0;
tga.image_type=TGA_IMAGE_TYPE_BGR;
tga.color_map_origin=0;
tga.color_map_length=0;
tga.color_map_depth=0;
tga.origin_x=0;
tga.origin_y=0;
tga.width=(unsigned short)width;
tga.height=(unsigned short)height;
tga.pixel_depth=32;
tga.image_descriptor=TGA_T_TO_B_BIT;
tga.image_id=0;
tga.color_map_data=0;
tga.image_data=static_cast<unsigned char*>(data);
tga_write(filename.GetString(),&tga);
}
示例9: GetFile
String GetName(void *root,void *userdata,void *obj)
{
Filename* pfn = GetFile(root, obj);
return pfn ? pfn->GetString() : String();
}
示例10: Filename
CCompareTableDialog::CCompareTableDialog(Filename fnOriginal, Filename fnNew)
{
fnOriginal.SetSuffix("");
fnNew.SetSuffix("");
String str;
str = fnNew.GetString();
fnNew = Filename(str.SubStr(0, str.GetLength() - 1));
str = fnOriginal.GetString();
fnOriginal = Filename(str.SubStr(0, str.GetLength() - 1));
String strOriginalFileString = fnOriginal.GetFileString();
String strNewFileString = fnNew.GetFileString();
Filename fn;
Bool bOriginalDiag = false, bNewDiag = false;
fn = fnOriginal.GetDirectory(); // fn contains strings_* or dialogs
if (fn.GetFileString().LexCompare("dialogs") == 0)
{
fn = fn.GetDirectory(); // now, we are in the strings_* path
bOriginalDiag = true;
}
fn = fn.GetDirectory();
fnOriginal = fn;
fn = fnNew.GetDirectory(); // fn contains strings_* or dialogs
if (fn.GetFileString().LexCompare("dialogs") == 0)
{
fn = fn.GetDirectory(); // now, we are in the strings_* path
bNewDiag = true;
}
fn = fn.GetDirectory();
fnNew = fn;
TRACE_STRING(fnOriginal.GetString());
TRACE_STRING(fnNew.GetString());
m_OriginalDoc.LoadGlobalStringTable(fnOriginal, strOriginalFileString);
m_NewDoc.LoadGlobalStringTable(fnNew, strNewFileString);
TRACE_STRING(fnNew.GetDirectory().GetFileString());
m_pOriginalTable = m_OriginalDoc.GetStringTable();
m_pNewTable = m_NewDoc.GetStringTable();
if (bOriginalDiag)
m_fnOriginal = fnOriginal + String("strings_*") + String("dialogs") + (strOriginalFileString + ".str");
else
m_fnOriginal = fnOriginal + String("strings_*") + (strOriginalFileString + ".str");
if (bNewDiag)
m_fnNew = fnNew + String("strings_*") + String("dialogs") + (strNewFileString + ".str");
else
m_fnNew = fnNew + String("strings_*") + (strNewFileString + ".str");
//TRACE_STRING(m_fnNew.GetString());
//TRACE_STRING(m_fnOriginal.GetString());
m_bIsCommandTable = (m_OriginalDoc.m_StringTableType == typeCommandStrings) &&
(m_NewDoc.m_StringTableType == typeCommandStrings);
}
示例11: FillList
/*********************************************************************\
Function name : CResEditBrowser::FillList
Description :
Created at : 25.09.01, @ 22:58:07
Created by : Thomas Kunert
Modified by :
\*********************************************************************/
void CResEditBrowser::FillList()
{
SetTitle(GeLoadString(IDS_BROWSER_CAPT) + " - " + m_strPath.GetString());
GeShowMouse(MOUSE_BUSY);
m_wndTreeView.LockWindowUpdate();
m_wndTreeView.Reset();
m_pDialogsItem = m_wndTreeView.AddItem(GeLoadString(IDS_BROWSER_DIALOGS));
m_pImagesItem = m_wndTreeView.AddItem(GeLoadString(IDS_BROWSER_IMAGES));
m_pStringTablesItem = m_wndTreeView.AddItem(GeLoadString(IDS_BROWSER_STRIG_TABLES));
BrowsePath(m_strPath);
// add global string table(s)
CDoubleLinkedList <CStringTableName> stringList;
AutoAlloc <BrowseFiles> pBrowse;
pBrowse->Init(m_strPath, false);
while (pBrowse->GetNext())
{
if (!pBrowse->IsDir()) continue;
Filename fnNew = pBrowse->GetFilename();
if (fnNew.GetString().SubStr(0, 8).ToLower() == "strings_")
{
Filename fnStringTable = m_strPath + fnNew;
TRACE("Found string table path ");
//TRACE_STRING(fnStringTable.GetString());
AutoAlloc <BrowseFiles> pBrowseTable;
pBrowseTable->Init(fnStringTable, false);
while (pBrowseTable->GetNext())
{
Filename fnTable = pBrowseTable->GetFilename();
if (fnTable.CheckSuffix("str"))
{
TRACE(" ");
//TRACE_STRING(fnTable.GetString());
String strNewName = fnTable.GetString();
// check, if we didn't find this table before
CStringTableName *pSearch = stringList.First();
Bool bFound = false;
while (pSearch)
{
if (pSearch->strName == strNewName)
{
bFound = true;
break;
}
pSearch = stringList.Next(pSearch);
}
if (bFound) continue;
CStringTableName *pNewItem = NewObjClear(CStringTableName);
pNewItem->strName = strNewName;
stringList.Append(pNewItem);
}
}
}
}
CStringTableName *pInsert = stringList.First();
while (pInsert)
{
TreeViewItem* pNewItem = m_wndTreeView.AddItem(pInsert->strName, m_pStringTablesItem);
pNewItem->GetData()->SetString(ITEM_PATH_NAME, pInsert->strName);
pInsert = stringList.Next(pInsert);
}
stringList.FreeList();
m_wndTreeView.SortChildren(m_pDialogsItem);
m_wndTreeView.SortChildren(m_pImagesItem);
m_wndTreeView.SortChildren(m_pStringTablesItem);
m_wndTreeView.UnlockWindowUpdate();
GeShowMouse(MOUSE_NORMAL);
}
示例12: WriteElement
void WriteElement(PresetElement* pElement)
{
CDynamicArray <char> arLine, arTempString;
AutoAlloc <BaseFile> pFile;
Filename fn = GeGetC4DPath(C4D_PATH_PREFS) + String("ResEdit");
if (!pFile)
return;
String strNewName;
Int32 n;
for (n = 0; n < pElement->strName.GetLength(); n++)
{
UInt16 w = (UInt16)pElement->strName[n];
#if defined _WINDOWS
if (('0' <= w && w <= '9') || ('A' <= w && w <= 'z') || w == ' ' || w == '_' || w == (UInt16)'�' || w == (UInt16)'�' || w == (UInt16)'�' ||
w == (UInt16)'�' || w == (UInt16)'�' || w == (UInt16)'�' || w == (UInt16)'�')
#elif defined __MAC
if (('0' <= w && w <= '9') || ('A' <= w && w <= 'z') || w == ' ' || w == '_' || w == (UInt16)'Š' || w == (UInt16)'š' || w == (UInt16)'Ÿ' ||
w == (UInt16)'€' || w == (UInt16)'…' || w == (UInt16)'†' || w == (UInt16)'§')
#elif defined __LINUX
if (('0' <= w && w <= '9') || ('A' <= w && w <= 'z') || w == ' ' || w == '_' || w == (UInt16)'ü' || w == (UInt16)'ö' || w == (UInt16)'ä' ||
w == (UInt16)'Ü' || w == (UInt16)'Ö' || w == (UInt16)'Ä' || w == (UInt16)'ß')
#else
#error Wrong operating system
#endif
strNewName += String(1, w);
else
strNewName += String(1, '_');
}
if (!AssertPathExists(fn))
{
GePrint(String("Could not create path ") + fn.GetString());
return;
}
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);
//.........这里部分代码省略.........
示例13: 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);
}
}
示例14: 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)
{
//.........这里部分代码省略.........
示例15: Command
Bool PaletteSubDialog::Command(Int32 id,const BaseContainer &msg)
{
GeDynamicArray<Palette> pals;
Palette pal;
Filename fn;
switch (id)
{
case 3:
switch(msg.GetInt32(BFM_ACTION_VALUE)){
case ACTION_NEW:
pal.SetColor(0, Color(0.f, 0.f, 0.f).SetSource(COLOR_SOURCE_DISPLAY));
id = Palette::AddPalette(pal);
m_controlsShown = FALSE;
LoadPalette(id);
SaveSettings();
Palette::UpdateAll();
return TRUE;
case ACTION_LOAD:
if(fn.FileSelect(FILESELECTTYPE_ANYTHING, FILESELECT_LOAD, "Load")){
String s = fn.GetString();
if(Palette::LoadASEFile(s, pal)){
id = Palette::AddPalette(pal);
m_controlsShown = FALSE;
LoadPalette(id);
SaveSettings();
Palette::UpdateAll();
}
}
return TRUE;
case ACTION_SAVE:
if(fn.FileSelect(FILESELECTTYPE_ANYTHING, FILESELECT_SAVE, "Save", "ase")){
String s = fn.GetString();
Palette::SaveASEFile(s, m_palette);
}
return TRUE;
case ACTION_LABEL:
ShowControls(!m_showControls);
return TRUE;
}
if(msg.GetInt32(BFM_ACTION_VALUE) >= ACTION_COUNT){
m_controlsShown = FALSE;
LoadPalette(msg.GetInt32(BFM_ACTION_VALUE)-ACTION_COUNT);
SaveSettings();
}
return TRUE;
case IDC_LAYOUT_DIRECTION:
m_controlsShown = FALSE;
LoadPalette(m_paletteID);
SaveSettings();
break;
case IDC_ROWS:
PaletteLayout();
SaveSettings();
break;
case IDC_LABELCHECKBOX:
GetBool(m_labelCheckArea, m_showLabel);
LoadPalette(m_paletteID);
SaveSettings();
break;
case IDC_NAME:
if(m_nameArea != NULL){
GetString(m_nameArea, m_palette.m_name);
Palette::SetPaletteName(m_paletteID, m_palette.m_name);
LoadPalette(m_paletteID);
}
break;
case IDC_HIDE:
ShowControls(FALSE);
break;
case IDC_SEARCHTEXT:
PaletteLayout();
SaveSettings();
break;
case IDC_CREATEMATERIAL:
{
Bool linkColors;
GetBool(m_linkColor,linkColors);
for(Int32 i=m_palette.m_colors.GetCount()-1;i>=0;--i){
BaseMaterial *mat = BaseMaterial::Alloc(Mmaterial);
String name = "PaletteMaterial";
if(m_palette[i].m_name != ""){
name = m_palette[i].m_name;
}
mat->SetName(name);
if(mat != nullptr){
BaseChannel *chan = mat->GetChannel(CHANNEL_COLOR);
if(chan != nullptr){
BaseContainer bc;
if(linkColors){
bc.SetInt32(BASECHANNEL_SHADERID, PALETTE_SHADER_ID);
chan->SetData(bc);
BaseShader *bs = chan->GetShader();
BaseContainer* data = bs->GetDataInstance();
data->SetInt32(PALETTESHADER_PALETTE_ID, 1+m_paletteID);
data->SetInt32(PALETTESHADER_COLOR_ID, 1+i);
} else {
// Color Shader ID: 5832
bc.SetInt32(BASECHANNEL_SHADERID, 5832);
chan->SetData(bc);
//.........这里部分代码省略.........