Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make SVG textures usable as textures directly #4

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

GerkinDev
Copy link

@GerkinDev GerkinDev commented Sep 3, 2024

This PR makes USvgTexture inherit from texture, with all required methods proxied to the underlying Texture instance property.

I tested it with UI widgets, and it works well.

@GerkinDev GerkinDev marked this pull request as ready for review September 3, 2024 19:27
@GerkinDev
Copy link
Author

OK I made it work :)

image

It is probably not the best way to do it, but feel free to modify it to your liking

@etodanik
Copy link
Owner

etodanik commented Sep 6, 2024

This is super fun! I was actually thinking myself to do something like this, but felt the task is very daunting. I'll review & merge it upstream if all good.

May I ask your use case?

@etodanik etodanik added the enhancement New feature or request label Sep 6, 2024
@GerkinDev
Copy link
Author

GerkinDev commented Sep 7, 2024

For now I only use it for UI components, I still prefer to edit my graphical resources in a text editor ;)

here is a demo of what I achieved by cutting an svg into pieces with masks, importing them to UE and using material instances to rotate them image-1.png
This way I checked out that the proxy works also for material transforms

@etodanik
Copy link
Owner

etodanik commented Sep 8, 2024

I'll test your PR on android/ios/mac/win & then merge it. Important to also test Shipping & Packaged builds, since they behave differently & it took me a while to properly get a packaged build to work the first time round.

@GerkinDev
Copy link
Author

Yeah OK perfect, I didn't used android/ios/mac/linux at all during dev, only windows. But if it works everywhere, I'm the happiest guy on earth :)

The most probable thing I see is that some methods might need to be proxied too; I did not proxy everything, just the minimum to work in my use case.

Oh and there is still a minor issue: it seems that the texture needs to be re-baked every time at runtime in standalone builds. It works, but cause a bit of lagging when the texture loads the 1st time. I don't understand a thing about mips & stuff, but I feel like some baked data is not serialized/deserialized correctly, and is thus recomputed at runtime.

@etodanik
Copy link
Owner

etodanik commented Sep 8, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants