Is there a way to propagate the color settings from the guide settings to existing control buffer shapes? If not, is there any way to use the existing control buffer shapes, but ignore the color and use the guide settings’ values? Alternatively, I assume I could use a post build script to update the colors as well, but just wanted to make sure I wasn’t missing any built in options before writing something custom.
Are you using RGB colors on your control shapes? Because if not, I thought the build did override the controlBuffer index colors.
I’m a few versions behind though. What version are you using?
In the color settings, I’ve specified ‘Use RGB Colors’. However, the original shapes were using the default index colors, if that makes any difference. And we’re on 4.2.2, which I believe is the latest release?
I meant what are the controlBuffers (under the controlBuffers_org group) set to when you hit build? index or RGB? If they have RGB colors, then the build won’t override those. The build only overrides the index color. (As far as I’m caught up to date.)
So the answer to your question might be no. You might need a post Python script.
I forget when RGB colors were added to mGear. But now that you can set RGB in the guide settings, the build probably should override any controlBuffer RGB colors, and use the guide settings. Probably a good feature request if it doesn’t already do that.
I wrote a postscript yesterday to set the rig’s controls once it is built to the guide settings.
They can get messed up for multiple reasons. We swap out shapes from our internal library, which can remove the control’s existing settings. Our tool should propagate them back. Once these controls get into the control buffer, mGear doesn’t reset the indexes, as far as I know.
Here’s the code snippet; you’ll have to excuse the meta reference. We have an internal mgear_meta class that wraps any component that’s built.
So we can do things like.
import jam.dcc.jam_maya.mgear_meta as mgm
rig = mgm.get_one_rig()
rig.function.set_rig_control_colors()
def set_rig_control_colors(self):
indexes = {"l": [6, 18], "r": [23, 14], "c":[13, 17]} # could get this from the guide data
for c in self.meta.get_components():
if c.component_type() != "Digi_Face":
for ctl in c.get_controls():
side_label = ctl.side_label.get().lower()
role = ctl.ctl_role.get()
for s in ctl.getShapes():
s.overrideEnabled.set(1)
value = indexes[side_label][0]
if "ik" in role:
value = indexes[side_label][1]
s.overrideColor.set(value)
Was able to dig into the code and track it down. It looks like if there’s a controlBuffer shape, it will only use its color, regardless of index or rgb value. The color being passed into the addCtl() function is correct (from the guide settings), but it gets stomped when it pulls the current color from the existing buffer shape.
I could see it going either way, really. It makes sense to retain the colors of the buffers, assuming you’ve maybe done some customization after the build. But my use case was wanting to essentially do a full re-color based on the guide settings values, but retain all my buffer shapes. Commenting out the color assignment from the existing shape got me what I needed as a workaround, but might be nice as a guide settings option? Maybe a ‘Force colors on build’ option or something?