Home Website Youtube GitHub

Values in the HEAD REF attributes

I want to change the initial order of the values in the HEAD REF attributes to a value other than self.
I am using the neck_ik_01 component.
Thank you very much!

Do you actually want to change the order, or just the default value?

1 Like

the configuration when creating the default rig in the Head Ref option is Self, which can be another item in the list and not the head itself.

the head itself

“self” actually means the head will follow the neck, since that section of the UI is talking about the neck.

I’m still not sure which way you are asking:

  1. You want to remove self from the list? Or perhaps rename it.
  2. “self” can stay in the list, but you want the default value to be something different?

#2. To set a new default is easy. In a post script, if you want body_C0_ctl to be the default value, you can do that with a Python command. Oddly, it’s the “addAttr” command, instead of “editAttr” as you might expect.

This script should work. Make sure the correct attribute name is listed. And select the number of the attribute you want. In your gif, “self” is 0, “Body” is 1, “Local” is 2, “Spine” is 3.

import pymel.core as pm
headUI = pm.PyNode('head_UI_C0_ctl')
spaceAttribute = headUI.neck_headref
# Use addAttr() with the defaultValue and edit flags.
pm.addAttr(spaceAttribute, defaultValue=1, edit=True)
# Then set the value to the one you want.
spaceAttribute.set(1)

For #1, I don’t know if removing one or resorting might change some of the connections, because I think it uses the number in a conditionNode to set the correct parentConstraint. So I don’t recommend removing it or reordering it. But you could rename it from “self” to “neck” if it makes things clearer.

import pymel.core as pm
headUI = pm.PyNode('head_UI_C0_ctl')
spaceAttribute = headUI.neck_headref
pm.addAttr(spaceAttribute, edit=True, enumName="neck:body_C0_ctl:local_C0_ctl:spine_C0_tip")

Or you could rename them all to be simpler:

pm.addAttr(spaceAttribute, edit=True, enumName="neck:body:local:spine")

And then you can still change the default too.

4 Likes

#2. To set a new default is easy.
Wow!
This is what I needed, thank you very much for everything!

1 Like