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

Template-based scene tree + inspector #167

Merged
merged 8 commits into from
Jan 14, 2025
Merged

Template-based scene tree + inspector #167

merged 8 commits into from
Jan 14, 2025

Conversation

JMS55
Copy link
Contributor

@JMS55 JMS55 commented Jan 11, 2025

TODO: Not sure how to add hover styling to rows yet. Going to remove it for now, we can figure out how to add it back later.

Things could maybe be a little more declarative to combine the setup pane and update rows into one template, but I'm fairly happy with how it's setup currently.

@JMS55 JMS55 marked this pull request as ready for review January 14, 2025 01:47
@JMS55 JMS55 changed the title Template-based scene tree Template-based scene tree + inspector Jan 14, 2025
world.commands().entity(row_entity).despawn_recursive();
});
template! {
{entity}: (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It hadn't occurred to me that you would be able to use entities as anchors like this. Pleased to see that's not too complex.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah apparently entity's impl whatever trait you use for naming, which is great because otherwise the list order / hover state / etc would break when renaming an entity, if I went off of Name.

Copy link
Contributor

@NthTensor NthTensor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet! I notice you didn't end up needing the b!() macro or conditional stuff too much. Was that something you avoided due to the constraints of the macro, or just not something that was needed?

@JMS55
Copy link
Contributor Author

JMS55 commented Jan 14, 2025

Tbh I never tried it. I ended up writing functions returning Template, using a branch to return one of two different templates, and then splicing it into a larger template. This was just the natural way for me to write things, I didn't actually consider using conditional stuff.

But also there's not much state in these widgets so far, they're pretty much all view-only. I might end up needing them later, no idea.

@JMS55 JMS55 added this pull request to the merge queue Jan 14, 2025
Merged via the queue into main with commit efe4fea Jan 14, 2025
6 checks passed
@NthTensor NthTensor mentioned this pull request Jan 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants