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


C++ AutoAlloc::GetCount方法代码示例

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


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

示例1: 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

示例2: 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

示例3: StartStroke

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

示例4: Execute

Bool ApplinkExporter::Execute(BaseDocument* document, BaseContainer* bc)
{
	matDefault = BaseMaterial::Alloc(Mmaterial);
	if(!matDefault) return false;

	Filename fileObjPath;
	fileObjPath.SetDirectory(bc->GetString(IDC_TMP_FOLDER));
	fileObjPath.SetFile(document->GetDocumentName());
	fileObjPath.SetSuffix("obj");
	Filename fileObjOutPath;
	fileObjOutPath.SetDirectory(bc->GetString(IDC_TMP_FOLDER));
	fileObjOutPath.SetFile("output.obj");
	Filename fileImport;
	fileImport.SetDirectory(bc->GetString(IDC_EXCH_FOLDER));
	fileImport.SetFile("import.txt");

	GePrint(fileObjPath.GetString());
	GePrint(fileObjOutPath.GetString());
	GePrint(fileImport.GetString());

	const Matrix tM(LVector(0.0f, 0.0f, 0.0f), LVector(1.0f, 0.0f, 0.0f), LVector(0.0f, 1.0f, 0.0f), LVector(0.0f, 0.0f, -1.0f));

	//BaseDocument* doc = document->Polygonize();
	AutoAlloc<AtomArray> oSel;
	document->GetActiveObjects(oSel, GETACTIVEOBJECTFLAGS_0);

	if(oSel->GetCount() > 0)
	{
//Write import.txt//
		AutoAlloc<BaseFile> basefileImport;
		
		if (!basefileImport->Open(fileImport, FILEOPEN_WRITE, FILEDIALOG_NONE, GeGetByteOrder())) return FALSE;
		
		this->WriteString(fileObjPath.GetString() + "\n", basefileImport);
		this->WriteString(fileObjOutPath.GetString() + "\n", basefileImport);
		this->WriteString(mapType(bc->GetLong(IDC_COMBO_MAP_TYPE)) + "\n", basefileImport);

		Bool bSkipImp = bc->GetBool(IDC_CHK_SKIP_IMP_DIALOG);

		if(bSkipImp)
		{
			this->WriteString("[SkipImport]\n", basefileImport);
		}

		Bool bSkipExp = bc->GetBool(IDC_CHK_SKIP_EXP_DIALOG);

		if(bSkipExp)
		{
			this->WriteString("[SkipExport]\n", basefileImport);
		}

		GePrint(mapType(bc->GetLong(IDC_COMBO_MAP_TYPE)));
		basefileImport->Close();

		GePrint("File " + fileImport.GetString() + " write success!");

//Write file.obj//
		AutoAlloc<BaseFile> objfile;

		//if (!objfile) return FALSE;
		if (!objfile->Open(fileObjPath, FILEOPEN_WRITE, FILEDIALOG_NONE, GeGetByteOrder())) return FALSE;

		String str;
		str = "#Wavefront OBJ Export for 3D-Coat\n";
		this->WriteString(str, objfile);
		DateTime t;
		GetDateTimeNow(t);
		str = "#File created: " + FormatTime("%d.%m.%Y  %H:%M:%S", t) + "\n";
		this->WriteString(str, objfile);
		str = "#Cinema4D Version: " + LongToString(GetC4DVersion()) + "\n";
		this->WriteString(str, objfile);
		this->WriteEndLine(objfile);

		Bool expMat = bc->GetBool(IDC_CHK_EXP_MAT);
		vpcnt = vtcnt = 0;

		for(int i = 0; i < oSel->GetCount(); i++)
		{
			StatusSetSpin();
			PolygonObject* ob = (PolygonObject*) oSel->GetIndex(i);
			if (ob->GetType() == Opolygon)
			{
				StatusSetText("Export object " + ob->GetName());
				ExportObject mObject;

				GePrint("Name " + ob->GetName());
				//GePrint("Type " + LongToString(ob->GetType()));

				if(expMat)
				{
					mObject.pmatidxArray.ReSize(ob->GetPolygonCount());
					mObject.tempMats.ReSize(1);
					mObject.pmatidxArray.Fill(0);
					Bool haveMats = false;
	//////////////////////////////////////////
					for(BaseTag* tag = ob->GetFirstTag(); tag != NULL; tag = tag->GetNext())
					{
						LONG typ = tag->GetType();
						if(typ == Ttexture)
						{
//.........这里部分代码省略.........
开发者ID:oyaGG,项目名称:3DCoat_Applinks,代码行数:101,代码来源:ApplinkExporter.cpp


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