VesCodes / ImGui

ImGui plugin for Unreal Engine
MIT License
107 stars 15 forks source link

Allow materials in TexID #15

Open Wyverex42 opened 2 months ago

Wyverex42 commented 2 months ago

Slate allows us to use texture objects as well as materials when setting up a brush, but the plugin currently always expects it to be a texture.

With this change you can pass in either a UTexture* or a UMaterialInterface* as the ImGui TextID. Since ImGui doesn't care what it is internally (it's just a pointer / uint after all), this works perfectly well, and we just need to cast when actually drawing.

Maybe you want to solve this differently though.

VesCodes commented 1 month ago

I think this also requires changing the ImTextureID define to a UObject pointer? Slightly cognisant of that being less self-documenting from a usage perspective but not a huge deal, I guess.

Additionally you should cast to UTexture rather than UTexture2D to retain support for render target textures (among other variants).