00:00Before we talk about our custom properties, we will first talk about the drivers.
00:06Drivers may look a bit abstract at a first glance, but they are very simple.
00:11Note that they can be used on whatever you want.
00:15To add a driver, simply right click on any input and add driver.
00:19The property will turn pink and it will open by default a quick driver editor.
00:26Because most of the time editing a driver is very simple.
00:30We enter one or two information and that's it.
00:33So if this cube was a car, it would need a driver.
00:37And here we haven't set any driver.
00:40So it's in red as if it was a modifier that doesn't work.
00:44Since no one cares about driving this car, I'm able to freely modify this car value.
00:50But I will have a little message downwards.
00:53So Blender asked me to define a driver.
00:57To do so, we will open a new window by dragging as usual.
01:01And we will open the driver editor.
01:04With my cube selected, I can see that I have a cube mesh with a driver inside driving the C scale.
01:13Since the scale-in can be modified, it is represented as a curve.
01:18The vertical's value defines the scale of the cube, while the horizontal value defines an input.
01:25To define this input, let's open the driver panel.
01:29And as an object, select the sphere.
01:32Since we have defined a driver, I'm no longer able to scale the cube on the z-axis.
01:39Because to scale the cube, I will have to use the driver.
01:42So something about the sphere.
01:45So let's try to comprehend what we have here.
01:47The driver is made for the cube.
01:50It's influencing the z-scale of the cube.
01:52It's using a script expression.
01:55And the output value is 1.
01:57So let's try to understand what is a script expression.
02:00Currently, it's just what's written here.
02:03Var plus 1.
02:04So since the result is 1, the var is probably 0.
02:09And the var is currently the name of this little panel.
02:14And the panel is outputting the value of the x-location inward space of the sphere, which is 0.
02:21So 0 plus 1 equals 1.
02:24Since this var is based on the sphere position,
02:28if I move the sphere on the x-axis, you can see the cube scaling on its z-axis.
02:34So the name var or var, it's nothing.
02:37It's the name by default.
02:39We could have called this sphere.
02:40And then it would have been sphere plus 1 equal the result.
02:45But if I get rid of the plus 1 here, the var will be the output.
02:51So the x-position inward space of the sphere will drive the scale of the z.
02:58Since then, I can guess the z-scale of the cube is equal to the x-location of the sphere.
03:03So I can even read it here.
03:05So when we are using a simple transform channel as a driver,
03:09we don't need to use a script expression.
03:12We can use an average value.
03:14And it will just translate the value of the selected channel as a driver.
03:19So again, if I move my sphere by 0.8 units on the x-axis, the z-scale of the cube will be 0.8 units.
03:33If I now get back to script expression and I multiply the result of the variable by 2,
03:40it will simply multiply by 2 the x-axis value of the sphere.
03:45And we can see the results here.
03:48In the driver type, we can select other types like maximum, minimum, sum, etc.
03:54And you can add other variables so that multiple variables will drive the value.
04:00I will duplicate the sphere so that we have two elements that we will use as a variable.
04:06And I will just add a new variable, select the new sphere.
04:12And in its properties, I will be using its transform channel.
04:16Now, if I change the type from script expression to maximum, for example,
04:22Blender will just compare both x-locations in world space of the 2-sphere value.
04:28And it will use the highest. So in this case, 3.4.
04:32If I get back, it will get stuck on the first sphere, which has the highest value on the x-axis.
04:40And that's it.
04:40So don't worry if it's a bit confusing for you.
04:44When we will be using the drivers, it will be the most simple one.
04:48One thing, though, is that the driver is based on a curve.
04:54And as it is a curve, we can modify it.
04:57And this can be very powerful.
04:59So if I select back the cube and I select the curve and I select a point,
05:05I can press V to set the curve to 3, for example, so that it becomes editable.
05:11And I can rotate the curve or move, etc.
05:14I can press I to insert a keyframe.
05:18So it's basically using the same tool as the animation.
05:22So even if it's not really a keyframe, it will work this way.
05:27Now, with this weird curve, if I move my sphere on the x-axis from 0 to 2.5,
05:34I will have different scaling values that will occur.
05:37So you may need to update the dependencies.
05:40It will refresh the driver.
05:42Then you can see that it gets bigger, smaller and bigger again,
05:46following the curve value.
05:48So this little dotted point here show us what Blender is currently reading.
05:56And so what value is currently read on the y-axis.
06:02So enough with driver.
06:04It might have been the six longer minutes you've spent on this course for the time being.
06:09We will now talk about custom properties.
06:14So I will get rig of our cube and I will add a new one instead.
06:19And I will add a new driver on its Z scale again.
06:23I think you may have already seen a custom properties tab,
06:28because those custom properties can be anywhere.
06:31As soon as you're in a tab where you can add data,
06:34you will have the possibility to create a custom property.
06:38So in our case, a custom property will only be a slot where we will store informations.
06:44For ease of use, we'll use the object information of the sphere,
06:50and we'll click the custom properties and add.
06:53It will add a new properties.
06:55If we edit it, we can see that we can name it.
06:58So I will call it a cube size, for example.
07:01We can see we have the name and we have a value.
07:04And the idea is to use this value to drive our Z scale driver.
07:09But the thing we don't know is how to select this very information
07:13and input it into the driver, since we don't know how to find the path.
07:18But if you right click on this value,
07:20you will have the possibility to copy the data path.
07:24It's like copying the address where this information is.
07:28So now when I edit the driver,
07:30if instead of using the transform channel,
07:33I select a single property and I passed by pressing Ctrl V this information,
07:40then when I will get back to this custom property,
07:43I will be able to size the cube by editing it.
07:46When editing the property, we can set the current value,
07:50set the default value.
07:52Note that if you are using 1.0, it will use float numbers.
07:58Why?
07:58If you use a default value of 1, it will use wall numbers or integers.
08:04This is very useful because you can use it to drive a modifier.
08:08For example, if you want to enable or disable it,
08:11you can add a driver to its trigger.
08:14And when you use a value of 0, it will set to false.
08:18So it won't be used. A value of 1 will activate the modifier.
08:22Then you can set a range to set the minimum
08:25and the maximum value you can reach with this custom property.
08:29So it's pretty linear.
08:33Since we have created a property bone in the previous video,
08:37we will use it to stack the different custom properties
08:41and use them to control drivers on our constraints.
Comments