WEBVTT

00:00.470 --> 00:01.760
Welcome back.

00:01.760 --> 00:04.610
It's time for your next challenge.

00:04.790 --> 00:09.110
Now you're going to make a new widget controller for the Attribute menu.

00:09.200 --> 00:17.060
Call this attribute menu, widget controller and base this off of our base class or a widget controller.

00:17.060 --> 00:23.060
So make sure that you do that so you can inherit a couple of functions that are important.

00:23.060 --> 00:24.770
You're going to override those.

00:24.770 --> 00:30.260
You can go ahead and leave them empty for now, but override them so you have them in your class.

00:30.260 --> 00:32.300
This is all stuff that you're familiar with.

00:32.330 --> 00:35.060
You should be able to do this without any problems.

00:35.060 --> 00:38.870
So pause the video and make your widget controller now.

00:42.870 --> 00:43.560
All right.

00:43.560 --> 00:44.610
Welcome back.

00:44.610 --> 00:46.440
Now, I just opened my editor.

00:46.470 --> 00:52.050
There's my attribute info data asset, but I'm done with it for now.

00:52.050 --> 00:53.540
I know it's all filled out.

00:53.550 --> 00:54.420
It's all looking good.

00:54.420 --> 00:55.260
I'm going to close it.

00:55.260 --> 00:59.820
I'm going to close project settings and we're going to make our widget controller class.

00:59.820 --> 01:04.430
So I'm going to go into C plus plus classes Aura public.

01:04.470 --> 01:08.550
This will go into UI and I have a widget controller folder.

01:08.550 --> 01:12.390
I'm going to put it here and this will be based on Aura widget controller.

01:12.390 --> 01:18.420
So I'm going to right click on that, make a class derived from it that saves me some searching there.

01:18.420 --> 01:22.470
And this will be called my attribute Menu Widget Controller.

01:22.470 --> 01:26.070
So attribute Menu Widget controller.

01:26.070 --> 01:27.870
Let's create that class.

01:28.020 --> 01:34.740
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

01:34.740 --> 01:35.100
files.

01:35.100 --> 01:38.580
I'm going to close all tabs and open my widget controller.

01:38.580 --> 01:43.330
There's my CP, here's my header file and we have it.

01:43.360 --> 01:49.270
Now I want a public section and we're going to override a couple of important functions.

01:49.270 --> 01:54.520
As we've mentioned, we want to override bind callbacks to dependencies.

01:54.520 --> 01:57.190
So we're going to say virtual void bind.

01:57.490 --> 02:00.250
Go ahead and let writer fill that out for me.

02:00.250 --> 02:04.960
And virtual void broadcast broadcast initial values.

02:04.960 --> 02:09.850
So we have those two very important functions and that's looking great.

02:09.850 --> 02:18.430
We can go ahead and generate the definitions for these both and we don't need the call to super because

02:18.430 --> 02:21.850
if we open aura widget controller, we see that those are empty, right?

02:21.850 --> 02:25.150
So no need to really call super in these cases.

02:25.150 --> 02:27.790
We're going to go ahead and not do that.

02:28.940 --> 02:34.370
We'll just have to remember, if we put something in the parent class that we want called, then we'll

02:34.370 --> 02:35.720
come back and call super.

02:35.720 --> 02:42.080
When we add that if we do so, now that we have bind callbacks to dependencies and broadcast initial

02:42.080 --> 02:51.020
values and we have our widget controller class, this is great because this will be used by our attribute

02:51.020 --> 02:57.980
menu, which means our attribute menu needs to have its widget controller set, or at least find a way

02:57.980 --> 03:00.890
to set the widget controller itself.

03:00.890 --> 03:05.570
And we need a place that this widget controller should be constructed.

03:05.600 --> 03:13.100
Now if you'll recall, our other widget controller overlay widget controller is constructed in Orerokpe.

03:13.400 --> 03:20.690
It's constructed with the get overlay widget controller function, which requires widget controller

03:20.690 --> 03:21.230
params.

03:21.230 --> 03:29.070
Right now, widget controllers have those four key variables that can be packaged up into widget controller

03:29.070 --> 03:29.790
params.

03:29.790 --> 03:36.540
So our aura HUD is probably a good place to construct and store all of these as the aura.

03:36.570 --> 03:41.940
HUD class itself has an overlay widget controller variable.

03:41.940 --> 03:43.470
Now it's private.

03:43.500 --> 03:49.920
We have to go through the getter to get it, and if the getter sees that this hasn't been constructed

03:49.920 --> 03:54.300
yet, it will construct one for the first time and return it right?

03:54.300 --> 04:01.170
So this is the pattern that I'd like to follow for our new attribute menu Widget Controller.

04:01.170 --> 04:03.150
We're going to set all of that up.

04:03.150 --> 04:04.830
I'd like to do that next.

04:04.830 --> 04:13.260
And I'd also like a way for us to easily get the widget controller without having to go through a bunch

04:13.260 --> 04:16.440
of classes in order to find the widget controller.

04:16.440 --> 04:22.950
Because if we'd like a widget to set its own widget controller, I don't want it to have to find the

04:22.950 --> 04:27.540
HUD class and ask the HUD class for a widget controller.

04:27.540 --> 04:34.920
I'd like just some really easy to use blueprint function that we can use to access the widget controller.

04:34.920 --> 04:42.630
And this is a perfect use case for creating a blueprint function library.

04:42.630 --> 04:49.860
If we create a blueprint function library, we can create some blueprint callable static functions perhaps,

04:49.860 --> 04:55.680
and we can use those functions to access things in an easy manner in blueprint.

04:55.680 --> 04:58.770
So that's one of the things I'd like to do next.

04:58.800 --> 05:06.510
We'll have a nice blueprint function library that we can use to access the widget controllers, of which

05:06.540 --> 05:13.200
our project should only have one for the overlay widget controller and only one for the attribute menu

05:13.200 --> 05:14.490
widget controller as well.

05:14.490 --> 05:17.820
So we'll do those things next and I'll see you soon.
