- Hi, everyone, this is
Pierrick from P2design. Blender 4.0 is about to land and with it, several critical updates
for its rigging system. These updates may break your rig if you have a custom rig UI. In this video, we'll check
some of these updates and how to fix your custom rig UI. (tranquil music)
(graphics whooshing) From this presentation,
I'm going to use one of the new character rig I
created for my upcoming course. You may have already seen
it in the first teaser for the course and if you missed it, just follow the link in the description. If you're familiar with Blender's rigging, you may know that so far, Blender was using bone
layers to organize the bones. And if you have my Art of
Effective Rigging course or if you follow me on this channel, you probably know about the Bone Manager, and add-on developed
by Fin that allows you to name your layers
and create a custom UI, and even export this
custom UI as a script. But if you open the same ring
in 4.0, you'd be like that, searching for your layers. While bone layers don't exist anymore, they are replaced by bone collections. The benefit is that you can
create as many collection as you want and you don't
need an add-on to name them. The plan for the future is to be able to nest those collection exactly as our usual scene collections. Be aware that the M shortcut to move a bone into a
collection may conflict if you still have the
Bone Manager activated. Pressing the M key shortcut will move or assign a bone to a single collection or to a new collection. The shortcut Shift plus M
allows you to add the bone to another collection or remove
it from another collection. As for our scene collection,
a bone can be assigned to one collection or multiple collections. This can also be performed directly through the bone collection panel. We can see which bone
collection a bone is assigned to thanks to the dot icon displayed in front of the collection's name. This bone is currently in all collection, but collection D. Collections' visibility can be triggered using the little eye icon on the right. And now we can also add custom properties to a bone collection. If your bone was in a locked
layer in your previous version of Blender, it will be
marked as unselectable in Blender 4.0 and above. Bone groups is no longer a thing, so you can stop searching
for them any longer. Bone color is now a bone property and the color of a bone will
be displayed in pose mode, but also in edit mode. You can find bone color
under viewport display. As said before, you can
see the color in edit mode, but you can also specify another color when you switch to pose mode. So you can assign two different
colors to a single bone: one for edit mode, one for pose mode. By default, the same color
will be used in both context. The bendy bones behavior has been improved and the Pose Library too. Check out the release note
linked in the description if you want to know more. If you wanna learn animation, rigging and much more in Blender, discover my extensive courses
on p2design-academy.com. Learn actual professional techniques or enjoy all my exclusive
free character rigs only on p2design-academy.com. If you generated your custom rig UI using the Bone Manager add-on, or if you did it by hand, it probably looks something like that. And it's similar to the way
Rigify generate the custom UI. Each time we create a new row and then we fill this row
with those informations. And basically, what is
displayed is the layer property of the active object. The layer is identified using its index and it's shown as a button using the label we will specify in text. Now, to make sure that the specific rig UI is assigned to the proper armature, each armature has an
identification number. And when we run the script, before displaying the rig UI, it checks if the rig ID number fits. If you check out the armature
custom properties, you can see that it has one custom
property, the rig ID, which is basically a string
of random characters. You don't need to know
that to fix the rig, but it's always interesting. So basically, since layers
don't exist anymore, sourcing the layers to be
displayed won't work anymore. What we want instead is to display the bone collection
visibility as a button. So we need to know the
path to that information. And to do so, I can simply
hover over the eye icon and I will see this information. Now, we don't need to copy it by hand, we can simply right click on the eye icon and choose copy full data path. Or you can use the shortcut
Shift + Control + Alt + C. I will paste it in the script so that we have a better look at it. And basically, what it says is that it's looking at the armature data of the armature called Armature in those that are the specific collection called Layer 2: DEF_GUN and the property exposed is the visibility of this collection. So basically, we could use
this to replace the layers, but first, we can simplify the
way we're going to write it by identifying what is
common to everything, what's common to all the lines
we're going to write down. And basically, it's the fact that we're looking at collection. So we can create a
variable called collection and say collection is, and copy and paste this part of the script as this is the path to
the armature collection. So I can remove this
from our full data path and I can simply copy the
variable name collection and use it in the script
that generates our UI. It will replace the
context active object data, but right now it, point
at all the collections, not a specific collection. So we need to add the name
of the collection next to it between brackets and quotation marks, exactly as it was in our full data path. Now the property we want to expose is not layers but is_visible. So between these apostrophe
.target property, we can write down is_visible. Index doesn't make sense
anymore, we can remove it and we need to keep the toggle equal true, and the text will be
whatever label we want to give to our button. If I run the script now, it should work, but it may not. Often enough, whenever you
are editing text as I do, basically butchering it, you will have some indentation problem. First, I can get rid of this line because it's no longer useful and then I can select all
the text I just created, go to format, convert
white spaces to tabs. If I now run the script again, I will no longer have an error message and I have in my rig UI
a button called Root. And whenever I click on it, it will enable or disable the visibility
of the collection DEF_GUN. And you can see some bones appearing and disappearing on the gun. Now, this button was originally created to display the root bone layer. So I simply need to copy the name of the root bone collection and paste it in the
collection name in my script. This is what identifies the collection. It's important to have
exactly the same name. Then in the text label, I can
write down wherever I want. Now when I run the script,
you can see that I'm enabling and disabling my root bone. And basically, that's the trick. So now what I can do is
to copy this piece of code and paste it wherever I need it. Then I simply need to put
in the right collection name to get the corresponding button. The latest version of
Rigify uses another method to generate the custom UI
and I don't understand it. Now beware, if you ever
rename a collection, then the script won't work anymore because the script uses
the bone collection name to point at it. So whenever you change the
name of a bone collection, you have to update the script accordingly, pasting the new name. Again, big disclaimer, I'm not a scripter. I'm kind of able to read
a bit of Python script and so far, it has been enough for me to create my own custom
UI, including bone layers and bone collection, rig custom properties and reuse the snap
utilities by my friend Fin on all my rigs. There are probably more
clever way to do it, but in real time, it
took me like five minute to fix this rig. And I'm happy to say that all the free rigs
on p2design-academy.com are updated for Blender
4.0 with a specific script. And all the course files of the "Alive!" animation
course have been updated too for Blend 4.0. I hope you learned something
new and you enjoyed this video and I'll see you very, very soon. (tranquil music) (tranquil music continues)