3D World

IS THERE A WAY TO STOP SOMETHING BEING DELETED IN MAYA?

Steven Pickering, Milton Keynes

- Antony Ward replies

For a technical artist, as well as making your rigs more efficient and user-friendly, you also need to make sure they can’t be inadverten­tly broken by the animator. Unfortunat­ely, there are lots of ways this can happen and with just an innocent pick walk up the hierarchy, a group or another node is then being animated and keyed rather than the intended control, which can cause all sorts of issues, especially when exporting to a game engine. Luckily, most issues can be easily avoided by simply taking the time to go through and lock any attributes that are off limits. It also helps to hide them too, just to be extra cautious.

These actions do help to keep your rig tamper proof, but one thing they can’t do is prevent someone from simply selecting a part of the rig and deleting it. Now, an obvious part like an arm or a leg can be undone, but it’s those hidden nodes, the important ones holding key data for the scene or the rig’s constructi­on, that are easily mistaken for rubbish and deleted while cleaning the scene.

So how do you prevent them from being removed? Like most things in Maya the answer isn’t found in the menus, instead it’s a simple piece of code:

cmds.locknode(“nodename”, lock=false)

With this bit of Python you can lock the intended object. All you need to do is replace “nodename” with the name of the object you wish to lock. For example:

cmds.locknode(“arm_control”, lock=false)

Now if you try to delete it, you will get the following error:

// Error: file: C:/program Files/autodesk/ Maya2019/scripts/others/dodelete.mel line 111: Cannot delete locked node ‘arm_control’. //

(If you want to reverse this and unlock something instead, just set the “lock” flag to “True”.)

Your nodes will be nice and safe now and will resist any attempt to remove them.

 ??  ?? It’s frustratin­g when things are accidental­ly deleted in your scene, but can you prevent it from happening?
It’s frustratin­g when things are accidental­ly deleted in your scene, but can you prevent it from happening?
 ??  ??

Newspapers in English

Newspapers from Australia