Welcome back.
It's time for your next challenge.
Now you're going to make a new widget controller for the Attribute menu.
Call this attribute menu, widget controller and base this off of our base class or a widget controller.
So make sure that you do that so you can inherit a couple of functions that are important.
You're going to override those.
You can go ahead and leave them empty for now, but override them so you have them in your class.
This is all stuff that you're familiar with.
You should be able to do this without any problems.
So pause the video and make your widget controller now.
All right.
Welcome back.
Now, I just opened my editor.
There's my attribute info data asset, but I'm done with it for now.
I know it's all filled out.
It's all looking good.
I'm going to close it.
I'm going to close project settings and we're going to make our widget controller class.
So I'm going to go into C plus plus classes Aura public.
This will go into UI and I have a widget controller folder.
I'm going to put it here and this will be based on Aura widget controller.
So I'm going to right click on that, make a class derived from it that saves me some searching there.
And this will be called my attribute Menu Widget Controller.
So attribute Menu Widget controller.
Let's create that class.
I'm going to go ahead and let the editor close and I'm going to get that open so I don't need these
files.
I'm going to close all tabs and open my widget controller.
There's my CP, here's my header file and we have it.
Now I want a public section and we're going to override a couple of important functions.
As we've mentioned, we want to override bind callbacks to dependencies.
So we're going to say virtual void bind.
Go ahead and let writer fill that out for me.
And virtual void broadcast broadcast initial values.
So we have those two very important functions and that's looking great.
We can go ahead and generate the definitions for these both and we don't need the call to super because
if we open aura widget controller, we see that those are empty, right?
So no need to really call super in these cases.
We're going to go ahead and not do that.
We'll just have to remember, if we put something in the parent class that we want called, then we'll
come back and call super.
When we add that if we do so, now that we have bind callbacks to dependencies and broadcast initial
values and we have our widget controller class, this is great because this will be used by our attribute
menu, which means our attribute menu needs to have its widget controller set, or at least find a way
to set the widget controller itself.
And we need a place that this widget controller should be constructed.
Now if you'll recall, our other widget controller overlay widget controller is constructed in Orerokpe.
It's constructed with the get overlay widget controller function, which requires widget controller
params.
Right now, widget controllers have those four key variables that can be packaged up into widget controller
params.
So our aura HUD is probably a good place to construct and store all of these as the aura.
HUD class itself has an overlay widget controller variable.
Now it's private.
We have to go through the getter to get it, and if the getter sees that this hasn't been constructed
yet, it will construct one for the first time and return it right?
So this is the pattern that I'd like to follow for our new attribute menu Widget Controller.
We're going to set all of that up.
I'd like to do that next.
And I'd also like a way for us to easily get the widget controller without having to go through a bunch
of classes in order to find the widget controller.
Because if we'd like a widget to set its own widget controller, I don't want it to have to find the
HUD class and ask the HUD class for a widget controller.
I'd like just some really easy to use blueprint function that we can use to access the widget controller.
And this is a perfect use case for creating a blueprint function library.
If we create a blueprint function library, we can create some blueprint callable static functions perhaps,
and we can use those functions to access things in an easy manner in blueprint.
So that's one of the things I'd like to do next.
We'll have a nice blueprint function library that we can use to access the widget controllers, of which
our project should only have one for the overlay widget controller and only one for the attribute menu
widget controller as well.
So we'll do those things next and I'll see you soon.