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


C++ AutoAlloc类代码示例

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


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

示例1: LMax

/*********************************************************************\
	Function name    : CCompareTableDialog::SaveResult
	Description      :
	Created at       : 10.10.01, @ 22:16:07
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
void CCompareTableDialog::SaveResult()
{
	Filename fn;
	if (!fn.FileSelect(FILESELECTTYPE_ANYTHING, FILESELECT_SAVE, String())) return;

	Int32 lMaxLen = 0;

	Int32 a, lNumItems;
	lNumItems = m_wndOutputList.GetItemCount();

	for (a = 0; a < lNumItems; a++)
	{
		BaseContainer data;
		m_wndOutputList.GetItem(a, &data);
		lMaxLen = LMax(lMaxLen, data.GetString(COMPARE_LIST_NAME).GetLength());
	}
	lMaxLen += 2;

	AutoAlloc <BaseFile> pFile;
	if (!pFile)
		return;

	pFile->Open(fn, FILEOPEN_WRITE);
	for (a = 0; a < lNumItems; a++)
	{
		BaseContainer data;
		m_wndOutputList.GetItem(a, &data);
		String str = data.GetString(COMPARE_LIST_NAME);
		WriteString(pFile, str);
		Int32 b = lMaxLen - str.GetLength();
		while (b--) WriteString(pFile, " ");
		WriteString(pFile, data.GetString(COMPARE_LIST_DATA));
		LineBreak(pFile, "");
	}
}
开发者ID:phohale,项目名称:ResEdit,代码行数:42,代码来源:CompareTableDialog.cpp

示例2: BrowsePath

/*********************************************************************\
	Function name    : CResEditBrowser::BrowsePath
	Description      :
	Created at       : 26.09.01, @ 11:59:42
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
void CResEditBrowser::BrowsePath(Filename fn)
{
	AutoAlloc <BrowseFiles> pBrowse;
	pBrowse->Init(fn, false);

	Filename fnBrowse;
	TreeViewItem* pNewItem;

	//TRACE_STRING(fn.GetString());

	while (pBrowse->GetNext())
	{
		fnBrowse = pBrowse->GetFilename();
		if (pBrowse->IsDir())
		{
			BrowsePath(fn + fnBrowse);
			continue;
		}
		pNewItem = nullptr;
		if (fnBrowse.CheckSuffix("res"))
			pNewItem = m_wndTreeView.AddItem(fnBrowse.GetFileString(), m_pDialogsItem);
		else if (fnBrowse.CheckSuffix("tif") || fnBrowse.CheckSuffix("jpg") || fnBrowse.CheckSuffix("bmp"))
			pNewItem = m_wndTreeView.AddItem(fnBrowse.GetFileString(), m_pImagesItem);

		if (pNewItem)
			pNewItem->GetData()->SetString(ITEM_PATH_NAME, (fn + fnBrowse).GetString());
	}
}
开发者ID:nr-plugins,项目名称:resedit,代码行数:35,代码来源:ResEditBrowser.cpp

示例3: Init

Bool SDKGradientClass::Init(GeListNode *node)
{
	BaseContainer *data = ((BaseShader*)node)->GetDataInstance();

	AutoAlloc<Gradient> gradient;
	if (!gradient) return FALSE;

	GradientKnot k1,k2;
	k1.col =Vector(0.0,0.0,1.0);
	k1.pos =0.0;

	k2.col =1.0;
	k2.pos =1.0;

	gradient->InsertKnot(k1);
	gradient->InsertKnot(k2);

	data->SetData(SDKGRADIENTSHADER_COLOR,GeData(CUSTOMDATATYPE_GRADIENT,gradient));
	data->SetBool(SDKGRADIENTSHADER_CYCLE,FALSE);
	data->SetLong(SDKGRADIENTSHADER_MODE,0);
	data->SetReal(SDKGRADIENTSHADER_ANGLE,0.0);

	data->SetReal(SDKGRADIENTSHADER_TURBULENCE,0.0);
	data->SetReal(SDKGRADIENTSHADER_OCTAVES,5.0);
	data->SetReal(SDKGRADIENTSHADER_SCALE,1.0);
	data->SetReal(SDKGRADIENTSHADER_FREQ,1.0);
	data->SetBool(SDKGRADIENTSHADER_ABSOLUTE,FALSE);
	
	return TRUE;
}
开发者ID:vidarn,项目名称:color4d,代码行数:30,代码来源:gradientshader.cpp

示例4: switch

/*********************************************************************\
	Function name    : CCustomElementSettings::Command
	Description      :
	Created at       : 26.03.02, @ 13:18:45
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
Bool CCustomElementSettings::Command(Int32 lID, const BaseContainer &msg)
{
    switch (lID)
    {
    case IDC_CUSTOM_GUI_LIST:
    {
        Int32 lItemID = msg.GetInt32(LV_SIMPLE_ITEM_ID);
        AutoAlloc<BaseSelect> pSel;
        m_wndListView.GetSelection(pSel);
        if (!pSel) break;
        if (!pSel->IsSelected(lItemID)) break;

        if (m_lLastID != lItemID)
        {
            m_pElement->m_lElement = lItemID;
            m_lLastID = lItemID;

            CCustomElements* pElement = g_pCustomElements->GetItem(m_pElement->m_lElement);
            if (pElement)
            {
                m_pElement->m_strName = GeLoadString(IDS_CUSTOM_ELEMENT) + " [" + pElement->m_strName + "]";;
                m_pElement->SetDescr(m_pElement->m_strName);
                m_wndSubDlg.Refresh(m_pSettingsDialog, pElement->m_pProp, m_pElement);
            }
            m_pElement->ItemChanged();
            m_pElement->GetDocument()->UpdateAllViews(true, false);
        }
    }
    break;
    }
    return true;
}
开发者ID:nr-plugins,项目名称:resedit,代码行数:39,代码来源:DialogCustomElement.cpp

示例5: MouseInput

Bool PickObjectTool::MouseInput(BaseDocument* doc, BaseContainer& data, BaseDraw* bd, EditorWindow* win, const BaseContainer& msg)
{
	Int32						mode = data.GetInt32(MDATA_PICKOBJECT_MODE);
	Int32						x, y, l, xr = 0, yr = 0, wr = 0, hr = 0;
	Matrix4d				m;
	ViewportPixel** pix = nullptr;
	String					str;
	char ch[200];
	Bool ret = false;
	AutoAlloc<C4DObjectList> list;
	if (!list)
		return false;

	VIEWPORT_PICK_FLAGS flags = VIEWPORT_PICK_FLAGS_ALLOW_OGL | VIEWPORT_PICK_FLAGS_USE_SEL_FILTER;
	if (data.GetBool(MDATA_PICKOBJECT_ONLY_VISIBLE))
		flags |= VIEWPORT_PICK_FLAGS_OGL_ONLY_VISIBLE;
	x = msg.GetInt32(BFM_INPUT_X);
	y = msg.GetInt32(BFM_INPUT_Y);
	Float64 timer = 0.0;
	if (mode == MDATA_PICKOBJECT_MODE_CIRCLE)
	{
		Int32 rad = data.GetInt32(MDATA_PICKOBJECT_CIRCLE_RAD);
		timer = GeGetMilliSeconds();
		ret = ViewportSelect::PickObject(bd, doc, x, y, rad, xr, yr, wr, hr, pix, flags, nullptr, list, &m);
		timer = GeGetMilliSeconds() - timer;
	}
	else if (mode == MDATA_PICKOBJECT_MODE_RECTANGLE)
	{
		Int32 width	 = data.GetInt32(MDATA_PICKOBJECT_RECT_W);
		Int32 height = data.GetInt32(MDATA_PICKOBJECT_RECT_H);
		x -= width / 2;
		y -= height / 2;
		timer = GeGetMilliSeconds();
		ret = ViewportSelect::PickObject(bd, doc, x, y, x + width, y + height, xr, yr, wr, hr, pix, flags, nullptr, list, &m);
		timer = GeGetMilliSeconds() - timer;
	}
	if (ret)
	{
		sprintf(ch, "Picking region from (%d, %d), size (%d, %d)|", xr, yr, wr, hr);
		str += ch;
		for (l = 0; l < list->GetCount(); l++)
		{
			sprintf(ch, ", z = %.4f|", list->GetZ(l));
			str += "Found Object " + list->GetObject(l)->GetName() + ch;
		}
	}
	else
	{
		str	= "PickObject failed";
	}
	sprintf(ch, "|Time: %.2f us", float(timer) * 1000.0f);
	str += ch;

	DeleteMem(pix);
	GeOutString(str, GEMB_OK);

	return true;
}
开发者ID:archimy,项目名称:cinema4d_cpp_sdk,代码行数:58,代码来源:pickobject.cpp

示例6: GePrint

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;
}
开发者ID:oyaGG,项目名称:3DCoat_Applinks,代码行数:58,代码来源:ApplinkExporter.cpp

示例7: _Init

/*********************************************************************\
	Function name    : CCustomElementSettings::SetData
	Description      :
	Created at       : 11.08.01, @ 23:18:59
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
void CCustomElementSettings::SetData()
{
    _Init();

    CreateElementList();

    // fill the list view with the elements
    Int32 a = 0;
    while (m_wndListView.RemoveItem(a)) {
        a++;
    }


    if (!g_pCustomElements) return;
    Int32 lElementCount = g_pCustomElements->Entries();
    if (lElementCount == 0) return;

    CCustomElements* pFirst = g_pCustomElements->First();
    a = 0;

    while (pFirst)
    {
        BaseContainer data;
        data.SetString('name', pFirst->m_strName);
        data.SetString('resy', pFirst->m_pChResSym);
        data.SetString('ceid', String::IntToString(pFirst->m_lID));

        m_wndListView.SetItem(a, data);
        a++;
        pFirst = g_pCustomElements->Next(pFirst);
    }

    m_wndListView.DataChanged();

    AutoAlloc<BaseSelect> pSel;
    if (pSel)
    {
        pSel->Select(m_pElement->m_lElement);
        m_lLastID = -1;
        m_wndListView.SetSelection(pSel);
        m_wndListView.DataChanged();
    }

    // write the custom object properties
    if (g_pCustomElements && m_pElement->m_lElement >= 0 && m_pElement->m_lElement < g_pCustomElements->Entries())
    {
        CCustomElements* pElement = g_pCustomElements->GetItem(m_pElement->m_lElement);
        BasePlugin* pPlug = nullptr;
        if (pElement) pPlug = pElement->m_pPlug;
        if (pPlug)
        {
            CustomProperty *prop = CallCustomGuiCmd(pPlug, GetProperties)();
            m_wndSubDlg.Refresh(m_pSettingsDialog, prop, m_pElement);
        }
    }
}
开发者ID:nr-plugins,项目名称:resedit,代码行数:63,代码来源:DialogCustomElement.cpp

示例8: GeGetStartupPath

/*********************************************************************\
	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);
}
开发者ID:nr-plugins,项目名称:resedit,代码行数:66,代码来源:LanguageList.cpp

示例9: 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();
		}
	}
}
开发者ID:oyaGG,项目名称:3DCoat_Applinks,代码行数:14,代码来源:ApplinkDialog.cpp

示例10: ReadDistriPrefs

static void ReadDistriPrefs(const Filename &fnDir)
{
	AutoAlloc <BrowseFiles> pBrowse;
	if (!pBrowse)
		return;

	Filename fn = fnDir;
	Filename fnPreset;
	pBrowse->Init(fn, false);
	while (pBrowse->GetNext())
	{
		fnPreset = fn + pBrowse->GetFilename();

		ReadPreset(fnPreset);
	}
}
开发者ID:phohale,项目名称:ResEdit,代码行数:16,代码来源:Distri.cpp

示例11: RegisterGradient

Bool RegisterGradient(void)
{
	Filename fn = GeGetPluginPath()+"res"+"gradienttypes.tif";
	AutoAlloc<BaseBitmap> bmp;
	if (IMAGERESULT_OK!=bmp->Init(fn)) return FALSE;

	RegisterIcon(200000135,bmp,0*32,0,32,32,ICONFLAG_COPY);
	RegisterIcon(200000136,bmp,1*32,0,32,32,ICONFLAG_COPY);
	RegisterIcon(200000137,bmp,2*32,0,32,32,ICONFLAG_COPY);
	RegisterIcon(200000138,bmp,3*32,0,32,32,ICONFLAG_COPY);
	RegisterIcon(200000139,bmp,4*32,0,32,32,ICONFLAG_COPY);
	RegisterIcon(200000140,bmp,5*32,0,32,32,ICONFLAG_COPY);
	RegisterIcon(200000141,bmp,6*32,0,32,32,ICONFLAG_COPY);
	RegisterIcon(200000142,bmp,7*32,0,32,32,ICONFLAG_COPY);

	// be sure to use a unique ID obtained from www.plugincafe.com
	return RegisterShaderPlugin(1001161,GeLoadString(IDS_SDKGRADIENT),0,SDKGradientClass::Alloc,"Xsdkgradient",0);
}
开发者ID:vidarn,项目名称:color4d,代码行数:18,代码来源:gradientshader.cpp

示例12: GeGetStartupPath

/*********************************************************************\
	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);
					}
				}
			}
		}
	}
}
开发者ID:phohale,项目名称:ResEdit,代码行数:56,代码来源:LanguageList.cpp

示例13: GetCursorInfo

Bool PickObjectTool::GetCursorInfo(BaseDocument* doc, BaseContainer& data, BaseDraw* bd, Float x, Float y, BaseContainer& bc)
{
	if (bc.GetId() == BFM_CURSORINFO_REMOVE)
	{
		_lastBaseDraw = nullptr;
	}
	else
	{
		_lastBaseDraw = bd;
		_mouseX = (Int32)x;
		_mouseY = (Int32)y;

		AutoAlloc<C4DObjectList> list;
		if (list)
		{
			// get the z position of the topmost object. The z range for objects is from -1 to 1.
			Float		 z = 1.0;
			String	 str;
			Matrix4d m;
			ViewportSelect::PickObject(bd, doc, _mouseX, _mouseY, 1, VIEWPORT_PICK_FLAGS_ALLOW_OGL | VIEWPORT_PICK_FLAGS_USE_SEL_FILTER | VIEWPORT_PICK_FLAGS_OGL_ONLY_TOPMOST, nullptr, list, &m);
			if (list->GetCount() > 0)
				z = list->GetZ(0);
			if (z < 1.0)
			{
				Vector v = GetWorldCoordinates(bd, m, x, y, z);
				char	 ch[200];
				sprintf(ch, "Mouse coordinates: (%d, %d), world coordinates: (%.4f, %.4f, %.4f)", _mouseX, _mouseY, v.x, v.y, v.z);
				str = ch;
			}
			else
			{
				str = "Mouse cursor is not over an object";
			}
			StatusSetText(str);
		}
	}
	SpecialEventAdd(EVMSG_UPDATEHIGHLIGHT);
	return true;
}
开发者ID:archimy,项目名称:cinema4d_cpp_sdk,代码行数:39,代码来源:pickobject.cpp

示例14: GetActiveDocument

void SculptSelectionBrush::StartStroke(Int32 strokeCount, const BaseContainer& data)
{
	//When the user starts a brush stroke we get the currently active document and store it for later use.
	_doc = GetActiveDocument();

	//Since we are handling Undo ourselves we need to call StartUndo.
	_doc->StartUndo();

	//This tool will change the selection on a PolygonObject. Since at this point we don't know what object
	//the user is going to be using the brush on we will get all the PolygonObjects that are currently selected
	//in the scene and add an Undo for each of them.
	AutoAlloc<AtomArray> selection;
	_doc->GetActiveObjects(selection, GETACTIVEOBJECTFLAGS_0);

	Int32 a;
	for (a = 0; a < selection->GetCount(); ++a)
	{
		C4DAtom* atom = selection->GetIndex(a);

		if (atom && atom->IsInstanceOf(Opolygon))
		{
			BaseObject* pBase = (BaseObject*)atom;
			if (IsObjectEnabled(pBase))
			{
				//Because you can not create a selection of the high res sculpted object, only the base object, that
				//means the sculpting tools can not be used to create selections on an object with a Sculpt Tag.
				//Because of this plugins such as this that modify the Selection on the PolygonObject
				//should only be allowed on PolygonObjects that DO NOT have a sculpt tag.
				if (!pBase->GetTag(Tsculpt))
				{
					_doc->AddUndo(UNDOTYPE_CHANGE_SELECTION, pBase);
				}
			}
		}
	}
}
开发者ID:phohale,项目名称:cinema4d_cpp_sdk,代码行数:36,代码来源:selectionbrush.cpp

示例15: Save

IMAGERESULT BFFSaverData::Save(const Filename& name, BaseBitmap* bm, BaseContainer* data, SAVEBIT savebits)
{
	Int32	 y, bw, bh;
	Bool	 ok = true;
	UChar* line = nullptr;
	AutoAlloc<BaseFile> file;
	if (!file)
		return IMAGERESULT_OUTOFMEMORY;

	if (!file->Open(name, FILEOPEN_WRITE, FILEDIALOG_NONE, BYTEORDER_MOTOROLA))
		return IMAGERESULT_FILEERROR;

	bw = bm->GetBw();
	bh = bm->GetBh();

	file->WriteInt32(0x42464600);
	file->WriteInt32(bw);
	file->WriteInt32(bh);

	if (bw > 0)
		line = NewMemClear(UChar, 3 * bw);
	if (!line)
	{
		DeleteMem(line);
		return IMAGERESULT_OUTOFMEMORY;
	}

	for (y = 0; y < bh; y++)
	{
		bm->GetPixelCnt(0, y, bw, line, COLORBYTES_RGB, COLORMODE_RGB, PIXELCNT_0);
		file->WriteBytes(line, bw * 3);
	}

	ok = file->GetError() == FILEERROR_NONE;
	DeleteMem(line);

	return ok ? IMAGERESULT_OK : IMAGERESULT_FILEERROR;
}
开发者ID:phohale,项目名称:cinema4d_cpp_sdk,代码行数:38,代码来源:bff.cpp


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