MakeCustomVerts not work,why?

赵净ZJ
Sat, 02 Nov 2024 20:38:49 +0000
UI

UFUNCTION(blueprintCallable, Category = "Mybpf")
	static void DrawVtx(UPARAM(ref) FPaintContext& Context,
		FWidgetTransform InTransform,
		USlateBrushAsset* Brush,
		TArray<FVector2f> Vertexs,
		TArray<int> Indexs
		)
	{
		TArray<FSlateVertex> vertexs;
		TArray<SlateIndex> indexs;
		auto RenderTransform = InTransform.ToSlateRenderTransform();
		for (auto vtx : Vertexs)
		{
			vertexs.Add(
			FSlateVertex::Make<ESlateVertexRounding::Disabled>(RenderTransform, vtx, FVector2f(),FColor(1,1,1,1))
				);
		}
		for (auto idx : Indexs)
		{
			indexs.Add(idx);
		}

		FSlateResourceHandle handle = FSlateApplication::Get().GetRenderer()->GetResourceHandle(Brush->Brush);
		Context.MaxLayer++;
		FSlateDrawElement::MakeCustomVerts(	Context.OutDrawElements,Context.MaxLayer,handle,vertexs,indexs,nullptr,0,0);
	}

1 post - 1 participant