NokiMo
Megan Fox
Megan Fox

patreon


Blutilities

One reason I kind of grumble about Blutilities is they, eh. I don't like how you launch them. You have to go find them in your folder structure, or stuff them into your menu options up top, bleh. Editor Mode Utilities are nicer for stuff you use a lot, I think? But whatever, you do this:

And then, Ok! So this is a Blutility.

These look a LOT like how you define the little functions that pop up in the right panel, except these live in their own window and have an actual UI. They're child classes of EditorUtilityWidget, which means you just get, this, and whatever you define (in here) pops up as the window.

Again, the logic is straightforward enough there's really no point in explaining it. Here's the Event tied to that BAKE button,

and here's more of the code from Chicken Bake. Which, btw, is a tool I made that just renders any Material out to a static texture.

It's neat? The little party parrots do a little dance when it's baking, and it makes a fun DING sound when it's done, you can have fun with it. But that's about the extent of what you do with these. These are the tools you use when your UI just needs to let you input some arguments, and there's a button, and you press the button, and it (does something with those arguments) and then DING done.

More complicated than that? You wanna see the other post about Editor Mode Utilities. But most stuff is just, this. For most stuff, this is plenty!

There is one fancy bit though. See this weird thing?

That's the most powerful-but-simple thing you can use in Blutility, if you're a lazy af programmer who is using Blutilities specifically because fuck it, you just, want the user to give you some input and push a button and then let you process it, and god I don't want to define a UI just let me escape this hell etc. Because now look up there again at that fancy UI on Chicken Bake. Notice how I didn't define any of it myself, here? HA HAAAA!

That's because that top thing is a DetailsView.

It inspects the object you feed into it, and exposes the groups of public variables you say to expose, and it generates the UI for you. Look closer at my Blutilitity's Init.

Technically you can make it expose everything if you're even lazier, but trust me that's a lotttttt so I would just take a sec and break 'em up. But see? I just define the variables, group them, and then, TADA, HERE'S YOUR UI. It manages them for me, I just read the variables when they click the Bake button, everything just works.

It's so, sooooo much nicer than, you know, having to get off my butt and write UI. I hate UI. We all hate UI. Let the Blutility make your UI for you, that's its whole job.

BTW, this second Undefined Object?

That's just a SinglePropertyView, for that Filename field up there in the UI. You use it for when you don't want to show an entire group of values, but instead just a single variable argument.

So there you go! You're a tools programmer now! ENJOY!


Related Creators