> For the complete documentation index, see [llms.txt](https://nexon3333.gitbook.io/gga/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nexon3333.gitbook.io/gga/o-risovanii-grafiki-v-editor-ue.md).

# О рисовании графики в editor UE

Иногда нужно нарисовать некие фигуры, нужные для инстурментария (например сетка Landscape), но их можно не просто рисовать, а еще и добавить функционал, и для этого коректно отобразить указатель мыши. Для этого существует подобная структура:

```cpp
struct HBTGrabHandleProxy : public HHitProxy
{
	DECLARE_HIT_PROXY();

	EMouseCursor::Type OverrideCursorType;

	HBTGrabHandleProxy(EMouseCursor::Type InOverrideCursorType)
	    : HHitProxy(HPP_Wireframe)
	{
		OverrideCursorType = InOverrideCursorType;
	}

	virtual EMouseCursor::Type GetMouseCursor() override
	{
		return OverrideCursorType;
	}
};

IMPLEMENT_HIT_PROXY(HBTGrabHandleProxy, HHitProxy)
```

Ее можно использовать при рисовании в Render() функции модуля:

```cpp
void FBuildingToolsEdMode::Render(const FSceneView* View, FViewport* Viewport, FPrimitiveDrawInterface* PDI)
{
	/** Call parent implementation */
	FEdMode::Render(View, Viewport, PDI);

	auto z = 15.f;

	auto PivotTransform = FTransform::Identity;

	auto DrawIt = [&](EMouseCursor::Type NewCursorType, float Index = 1.f) {
		PDI->SetHitProxy(new HBTGrabHandleProxy(NewCursorType));
		PDI->DrawLine(PivotTransform.TransformPosition(FVector(0, 0, z * Index)), PivotTransform.TransformPosition(FVector(0, 100.f, z * Index)), CornerColour, SDPG_Foreground);
		PDI->SetHitProxy(NULL);
	};

	DrawIt(EMouseCursor::CardinalCross, 1);
	DrawIt(EMouseCursor::Crosshairs, 2);
	DrawIt(EMouseCursor::Default, 3);
	DrawIt(EMouseCursor::EyeDropper, 4);
	DrawIt(EMouseCursor::GrabHand, 5);
	DrawIt(EMouseCursor::GrabHandClosed, 6);
	DrawIt(EMouseCursor::Hand, 7);
	DrawIt(EMouseCursor::ResizeLeftRight, 8);
	DrawIt(EMouseCursor::ResizeSouthEast, 9);
	DrawIt(EMouseCursor::ResizeSouthWest, 10);
	DrawIt(EMouseCursor::ResizeUpDown, 11);
	DrawIt(EMouseCursor::SlashedCircle, 12);
	DrawIt(EMouseCursor::TextEditBeam, 13);
}
```

Подобная фунция дает вот такой результат:&#x20;

<div align="left"><img src="https://2235052365-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M_jtkk20xLw8KFfMT0x%2F-MbLSlTM3nrERVGGhMsC%2F-MbLb20hEPsmFbda2CSI%2FMouse%20Types.png?alt=media&amp;token=2e29d339-81c2-4a4b-ba75-201f9618ff38" alt=""></div>

FSnappingUtils::SnapLocationToNearestVertex(...)

```cpp
FLevelEditorViewportClient* LevelEditor
GUnrealEd->SetPivotMovedIndependently(true);
		LevelEditor->bOnlyMovedPivot = true;
		LevelEditor->GetModeTools()->SetPivotLocation(TraceLocation, false);
		LevelEditor->GetModeTools()->UpdateInternalData();
//GetMutableDefault<ULevelEditorViewportSettings>()->bSnapVertices = false;
```
