mgear-dev / mgear4

mGear v.4.x.x (python 3 ready) https://mgear4.readthedocs.io
MIT License
266 stars 94 forks source link

Mirror function doesn't work with custom side labels #311

Closed utkarsh6191 closed 10 months ago

utkarsh6191 commented 11 months ago

Hi, I am using mgear 4.1.1 and using l,r, and c for custom side labels for controls. I checked in animunitls and there seems to be something for custom labels

# try to find the mirror using custom side labels
    if node.hasAttr("side_label"):
        side = node.side_label.get()
        if side in "lr":
            # custom side label
            c_side = node.attr("{}_custom_side_label".format(side)).get()
            # mirror side label
            if side == "l":
                cm_side = node.attr("R_custom_side_label").get()
            elif side == "r":
                cm_side = node.attr("L_custom_side_label").get()
            return node.stripNamespace().replace(c_side, cm_side)
        else:
            return node.stripNamespace()

However, it is not working by default. After replacing L,R and LR with lower case, it seemed be working for my rig. It might be helpful to have global variable similar to skin where extension can be overridden instead of being hardcodded.