-
Notifications
You must be signed in to change notification settings - Fork 49
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
Implement Font type #248
Implement Font type #248
Conversation
Oh, I just realized this is also missing conversion from the old font property to this new one, so if a very old rbxm of rbxl is loaded with rbx-dom, its FontFace will be incorrect. What's the correct way to handle that case? Edit: I realize this isn't necessary to do. The object deserialized by rbx-dom will lack the new Font property, but that's fine because it will include the old font property which Roblox will convert to the new property fine. I was getting this confused with some other related issue caused by rbx-dom not having Font support. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a hurry at the moment so I can't do a more comprehensive review of the actual code, but here's one for the spec file at least.
It generally looks good, it just needs some changes to fit with the format we use throughout the spec files.
Co-authored-by: Micah <dekkonot@rocketmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gave the files a proper look!
This is mostly fine, but there's some cleanup I'd like done with FontWeight
and FontStyle
. We'd ideally not use .into()
or have to clone them, and most of my comments are related to that + cleanup from changing them.
* Use explicit from_x and to_x * Derive and use Copy * Nicer default when writing cached_face_id
My most last commit addresses all of your comments! |
(replaced by ScreenInsets)
Tests should pass now. It's unrelated to the font implementation -- probably related to updating the reflection database. Since IgnoreGuiInset no longer saves, it isn't present in the decoded or encoded rbxms. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
For anyone curious about the prior CI failure, the serialization of IgnoreGuiInserts
was changed in release 554 and updating the reflection database exposed us to that change. Thus (as expected) the test involving ScreenGuis failed.
We likely should try to fix this in the future so that Roblox reflection changes don't interfere with our tests like this, but that's well outside of scope for this PR.
I meant to leave a comment a while back answering your questions but I forgor and got caught in the review sauce, so you'll have to forgive me.
Roblox serializes their binary format with compression (every chunk is LZ4 compressed), but rbx-dom doesn't at the moment. That's the only difference I can think of.
I considered this while I was doing the review, and eventually decided that it was a good call. It doesn't really impact things for rbx-dom either way, but using enums should make it easier for Rojo to implement a good format for Font property types.
A younger less experienced version of me would say "we should error whenever we encounter unknown data" but as I've seen rbx-dom and Rojo get surprised by things, I'm inclined to say it's not a bad idea to maintain data when we can. The XML limit is a shame but isn't our fault because there's quite literally nothing we could do about it either way. At the very least this implementation will let binary files do what they need to do.
Anybody who cares about Font will be overriding it so it isn't a big deal and I'd rather use what Roblox's default is because it's probably what people will be expecting anyway. Not sure if this is what we do everywhere but I wouldn't be surprised if the same reasoning was used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the PR! Here are a few comments from me, then this change looks good to me.
The compatibility story for this property type might be a bit hairy. When merging older models without
rbx_binary does output compressed chunks. The compression code is here: rbx-dom/rbx_binary/src/chunk.rs Lines 79 to 102 in 3a3563e
and is referenced all over in the serializer: rbx-dom/rbx_binary/src/serializer/state.rs Line 443 in 3a3563e
We should match the default value for what Roblox does for creating the instance with |
That is rather embarrassing on my part! I thought I'd looked properly and I don't really have an excuse because I did in fact know that... I literally wrote the code for serializing
Every value of the Font enum has an equivalent |
I'm going to be away from home for the next week and may not have time to implement fixes it changes to this PR in that time. I'll get to it when I'm back, or maybe if I have some downtime while I'm gone! Just want to let you all know beforehand so you don't think I've forgotten or abandoned this PR. |
No rush on addressing feedback! These days I'm not around consistently. I've been working on trying to get myself out of the pipeline and find groups of maintainers for all this stuff I'm still the main blocker on.
I figure that's probably it. There are usually many ways to compress the same data, and LZ4 is tunable.
This is really good news. I wonder if this is something we should plan to do in rbx_binary if we get any user reports of weird behavior. Tools like Remodel and Rojo that aggregate models might produce some funny results if we don't do anything. |
If we do it in rbx_binary, we're essentially promising to do it a second time if anything like this happens again. I don't love that idea and would instead prefer we leave it up to consumers to patch files. This would let them decide how to handle it themselves and let them patch properties we don't/can't. However, if we do decide to implement it, I'd prefer we do it with a crate that wasn't rbx_binary. The idea of a codec that modifies data in that fashion feels wrong even if the intent is to fix something Roblox did. It should be done by someone else, regardless of it it's another rbx_dom crate or an upstream user. |
Just checking if anyone is still looking into this, and if it will be released soon? |
All of your feedback should be addressed now!
Does this mean the default trait does not need to be changed to reflect Roblox? Should we still change it to match? |
Hi, can someone explain how to link our local aftman.toml file to the WIP Uplift games? I tried a variety of URL formats and didn't have much success |
Our fork versions are one version ahead plus a prerelease tag. Here's what our rojo and remodel entries look like: [tools]
rojo = "UpliftGames/rojo@7.2.2-uplift.release.4"
remodel = "UpliftGames/remodel@0.12.0-uplift.release.9" Don't forget to switch back to |
@Corecii I tested changing my aftman file to what you have above, but I still encounter the same issue where fonts are not synced |
Sorry to bump again, but is there an update on when this might get merged? Or an answer to my above question as to why the forked version still exhibits the same issue? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nits
Nits fixed! @NecroticNanite thanks for this report! rbx_dom had been set to exclude Font types from the reflection database and I didn't catch that when implementing. Additionally, we must manually include the new version of rbx_dom in the plugin in the rojo repo. We didn't catch this at Uplift because we're not syncing in models with rojo -- we only needed updated rbx_dom for remodel. The fork should work now if you change the version to |
Thanks for fixing that - however, I cannot download that version :( |
@NecroticNanite You're correct! Again, a symptom of us not needing this (yet). I had GitHub generate the release draft but didn't go press publish on it when it was done. Try now! |
@Corecii Thanks a lot, that seems to have done the trick! Good timing too, we've got a tricky merge coming up and a release to sync to different environments :D |
@Corecii Hi, we're just testing this now.
It will throw the following error when trying to start Rojo:
Not sure how easy it will be to add back-compat for this - if it's not possible, will likely make this MR go from a minor hotfix into a full major version release, as anyone using it will have to do a fresh export of any model/rbxmx files. The fix (at least, it seems to fix it) is to delete the blank lines from any rbxmx files - possibly the parser should just ignore those empty blocks? (We're testing a few other things, and will send any issues along as/when we hit them) |
Oh that's fascinating! I'm sure we can just ignore it if it's empty. Do you happen to have any files you're willing to share which I can use to test a fix for this locally? Edit: I realize I can easily make an example given the snippet you posted. Thanks! I'm a little worried that there might be something similar in the binary rbxm though, and I'm not sure I have any models with this issue to test with. I'll just focus on fixing this issue with the xml for now. |
Conversation.rbxmx - Pastbin: https://pastebin.com/qhAUyGzP |
Everything else seems to be working great though! |
Updated the MSRV on master, should fix the CI build. |
Moving forward with the merge, plus follow-up changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I'm going to put in a follow-up commit to update the signatures of from_u8
and from_u16
for the sub-types of Font
.
Looks like we forgot to do this in #248
This PR implements the Font type:
This is my first time working with rbx-dom's code, so I may have gotten some things wrong! I also have some general questions and concerns:
Other
so that any new items should just work even if they're not nicely represented. Was this the correct move? I could have represented Weight with just a u16, but Style needs a u8 <-> name converter so that it can be serialized to/from xml.Other
enum variant here since I figured having support for unknown new values was a good thing, but that was before I saw how xml did it. This means unknown new FontStyles can go from binary -> binary, but not binary -> xml or xml -> anything. Is this okay, or do we want to remove theOther
variant here? Related: in cases where the variant is unknown, I default toNormal
. Would it be better to error?