Пример #1
0
/*********************************************************************\
	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
0
/*********************************************************************\
	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
0
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
0
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
0
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
0
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
0
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
0
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
0
	String	GetName(void *root,void *userdata,void *obj)
	{
		Filename* pfn = GetFile(root, obj);
		return pfn ? pfn->GetString() : String();
	}
Пример #10
0
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
0
/*********************************************************************\
	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
0
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);
		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();
}
Пример #13
0
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
0
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)
						{
							if (!getParameterLink(*tag, TEXTURETAG_MATERIAL, Mbase)) continue;
						
							haveMats = true;
							TextureTag* txttag = (TextureTag*)tag;
							BaseMaterial* material = txttag->GetMaterial();

							if(material == NULL)
							{
								GePrint("Material not found on " + ob->GetName() + "object.");
								return false;
							}
							//GePrint("Mat Name: " + material->GetName());						

							String restrict = getParameterString(*tag, TEXTURETAG_RESTRICTION);
							if (restrict.Content())
							{
								mObject.tempMats.Push(material);
								//GePrint("Selection: " + restrict);
								for(BaseTag* seltag = ob->GetFirstTag(); seltag != NULL; seltag = seltag->GetNext())
								{
									LONG seltyp = seltag->GetType();
									if(seltyp == Tpolygonselection && seltag->GetName() == restrict)
									{
										SelectionTag* selecttag = (SelectionTag*)seltag;
										BaseSelect* sel = selecttag->GetBaseSelect();
										//GePrint("sel data count: " + LongToString(sel->GetCount()));

										LONG seg = 0, a, b, p;
										while (sel->GetRange(seg++, &a, &b))
										{
											for (p = a; p <= b; ++p)
											{
												//GePrint("seltpolygon: " + LongToString(p));
												mObject.pmatidxArray[p] = mObject.tempMats.GetCount()-1;
											}
										}
									}
								}
							}
							else
							{
								mObject.tempMats[0] = material;
								mObject.pmatidxArray.Fill(0);
							}
						}
					}

					if(!mObject.tempMats[0])
					{
						matDefault->SetName("Default");

						BaseChannel* color = matDefault->GetChannel(CHANNEL_COLOR);
						if (!color) return false;	// return some error
						BaseContainer cdata = color->GetData();
						cdata.SetVector(BASECHANNEL_COLOR_EX, Vector(1.0f, 1.0f, 1.0f));
						
						//document->InsertMaterial(matDefault, NULL, FALSE);
						//matDefault->Update(TRUE, TRUE);
						//matDefault->Message(MSG_UPDATE);

						mObject.tempMats[0] = matDefault;
						//GePrint("Global material not found on object " + ob->GetName() + ".");
						//return false;
					}

					if(haveMats)
					{
						//GePrint("mObject.tempMats.GetCount(): " + LongToString(mObject.tempMats.GetCount()));
						for(LONG m = 0; m < mObject.tempMats.GetCount(); m++)
						{
							Bool inMats = false;
							//GePrint("materialArray.GetCount(): " + LongToString(materialArray.GetCount()));
							for(LONG n = 0; n < materialArray.GetCount(); n++)
							{
								if(mObject.tempMats[m]->GetName() == materialArray[n]->GetName())
								{
									inMats = true;
									break;
								}
							}
							if(!inMats)
							{
								materialArray.Push(mObject.tempMats[m]);
							}
						}
					}

					//String str1;
					//for (LONG p = 0; p < ob->GetPolygonCount(); p++)
					//{
					//	str1 += LongToString(mObject.pmatidxArray[p]) + ",";
					//}
					//GePrint(str1);
				}
/////////////////////////////////////////////////
				const Vector* vadr = ob->GetPointR();
				const CPolygon* padr = ob->GetPolygonR();
				LONG vcnt = ob->GetPointCount();
				LONG pcnt = ob->GetPolygonCount();

				mObject.Fpvnb.ReSize(pcnt);// poly counts
				for(LONG p = 0; p < pcnt; p++)
				{
					if(padr[p].c != padr[p].d)
					{
						mObject.Fpvnb[p] = 4;
					}
					else
					{
						mObject.Fpvnb[p] = 3;
					}
				}
				mObject.pVertexCount = PVertexLength(mObject);

				//Vertex positions
				mObject.Vp.ReSize(vcnt);
				Matrix mg = tM * ob->GetMgn();
				for (LONG v = 0; v < vcnt; v++)
				{
					mObject.Vp[v] = vadr[v] * mg;
					//GePrint("Point[" + LongToString(i) + "] " + LongToString(padr[i].x) + ", " + LongToString(padr[i].y) + ", " + LongToString(padr[i].z));
					//str = "v " + LongToString(vadr[p].x) + " " + LongToString(vadr[p].y) + " " + LongToString(vadr[p].z) + "\n";
					//this->WriteString(str, objfile);
				}
				
				mObject.Fv.ReSize(mObject.pVertexCount);
				LONG y=0;
				for (LONG p = 0; p < pcnt; p++)
				{
					if(mObject.Fpvnb[p] == 4)
					{
						mObject.Fv[y] = padr[p].d;
						mObject.Fv[y+1] = padr[p].c;
						mObject.Fv[y+2] = padr[p].b;
						mObject.Fv[y+3] = padr[p].a;
					}
					else
					{
						mObject.Fv[y] = padr[p].c;
						mObject.Fv[y+1] = padr[p].b;
						mObject.Fv[y+2] = padr[p].a;
					}

					y += mObject.Fpvnb[p];
				}
				
				//String str1;
				//for (LONG p = 0; p < mObject.Fv.GetCount(); p++)
				//{
				//	str1 += LongToString(mObject.Fv[p]) + " ";
				//}
				//GePrint(str1);
///////////////////////////////
///////////vertex UV
//////////////////////////////
				if(bc->GetBool(IDC_CHK_EXP_UV))
				{
					// Get first UV tag (if at least one)
					UVWTag* uvw_tag = (UVWTag*)ob->GetTag(Tuvw, 0);
					if(!uvw_tag)
					{
						GePrint("Object \"" + ob->GetName() + "\" has no UVW tag.\nUV coordinates can't be exported.");
						return FALSE;
					}
					else
					{
						mObject.Vt.ReSize(mObject.pVertexCount);
						mObject.Fvt.ReSize(mObject.pVertexCount);						
						const UVWHandle dataptr = uvw_tag->GetDataAddressR();
						UVWStruct res;
						
						for(LONG t=0, y=0; t < pcnt; t++)
						{
							//GePrint("y: " + LongToString(y));
							UVWTag::Get(dataptr, t, res);
							if(mObject.Fpvnb[t] == 4)
							{
								mObject.Vt[y] = res.d;
								mObject.Vt[y + 1] = res.c;
								mObject.Vt[y + 2] = res.b;
								mObject.Vt[y + 3] = res.a;
							
								mObject.Fvt[y] = y;
								mObject.Fvt[y + 1] = y + 1;
								mObject.Fvt[y + 2] = y + 2;
								mObject.Fvt[y + 3] = y + 3;

							}
							else
							{
								mObject.Vt[y] = res.c;
								mObject.Vt[y + 1] = res.b;
								mObject.Vt[y + 2] = res.a;

								mObject.Fvt[y] = y;
								mObject.Fvt[y + 1] = y + 1;
								mObject.Fvt[y + 2] = y + 2;

							}
							y += mObject.Fpvnb[t];
						}
					}
					//String str1;
					//for (LONG p = 0; p < mObject.Fvt.GetCount(); p++)
					//{
					//	str1 += LongToString(mObject.Fvt[p]) + " ";
					//}
					//GePrint(str1);

				}

				WriteExportFile(bc, ob, objfile, mObject, vcnt, pcnt);
				//GePrint("Fvt: " + LongToString(Fvt.GetCount()));
				vpcnt += mObject.Vp.GetCount();
				if(bc->GetBool(IDC_CHK_EXP_UV))
					vtcnt += mObject.Vt.GetCount();
			}
		}
		objfile->Close();

		if(expMat && materialArray.GetCount() > 0)
			WriteMatsFile(document, bc);
	}
	else
	{
		GePrint("No selected objects!");
	}

	BaseMaterial::Free(matDefault);
	return TRUE;
}
Пример #15
0
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);
								BaseShader *bs = chan->GetShader();
								BaseContainer* data = bs->GetDataInstance();
								
								data->SetVector(COLORSHADER_COLOR , m_palette.m_colors[i].AsVector());
							}
                            GetActiveDocument()->InsertMaterial(mat);
                            EventAdd();
                        }
                    }
                }
            }
            break;
		default:
			break;
    }
    return GeDialog::Command(id,msg);
}
Пример #16
0
Bool ReadPreset(const Filename& fnPreset)
{
	AutoAlloc <BaseFile> pFile;
	if (!pFile)
		return false;

	Filename fnTemp;
	PresetElement* pPreset;
	String strName;
	Int32 n;
	CDynamicArray <char> arLine;
	char* pszLine;
	Bool bHeaderRead = false;
	String str;

	fnTemp = fnPreset.GetFile();
	fnTemp.ClearSuffix();
	strName = fnTemp.GetString();
	bHeaderRead = false;

	for (n = 0; n < g_Presets.GetElementCount(); n++)
	{
		if (g_Presets[n]->strName == strName)
			break;
	}
	if (n != g_Presets.GetElementCount())
		return false;

	pPreset = g_Presets.GetNextObject();
	if (!pPreset)
		return false;

	pPreset->strName = strName;
	if (!pFile->Open(fnPreset))
		return false;

	while (ReadLine(pFile, arLine))
	{
		pszLine = arLine.GetArray();

		if (!bHeaderRead)
		{
			if (strstr(pszLine, FILE_HEADER) == pszLine)
			{
				bHeaderRead = true;
				continue;
			}
		}
		if (!bHeaderRead)
			break;

		while (*pszLine != '\0')
		{
			if (strstr(pszLine, ORIG_PATH) == pszLine)
			{
				pszLine += strlen(ORIG_PATH);
				ReadString(pszLine, pPreset->strOrigin);
			}
			if (strstr(pszLine, DEST_PATH) == pszLine)
			{
				pszLine += strlen(DEST_PATH);
				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;
}
Пример #17
0
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);
    
	return true;
}
Пример #18
0
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;
}