Website Youtube GitHub

What does the setRelation() def do in a component's init?


#1

Hi Guys!

Been digging into making my own components over the last two weeks. Finally getting to grips with how everything fits together. Still one bit I haven’t been able to work out.

What does the setRelation() def do in the component’s init ? And how should I be using it?

Many thanks!
Justin


#2

Set the relation between the guide elements and the objects of the final rig build

for example:
self.relatives[“eff”] = self.eff_loc where the “eff” is the object in the guide
jointRelatives = the relatives for joint connection (if is not override with use index joint connection)
controlRelatives = for control pickwalk relatives
aliasRelatives = for reference arrays. For example IK space switch

def setRelation(self):
        """Set the relation beetween object from guide to rig"""

        self.relatives["root"] = self.div_cns[0]
        self.relatives["elbow"] = self.div_cns[self.settings["div0"] + 2]
        self.relatives["wrist"] = self.div_cns[-1]
        self.relatives["eff"] = self.eff_loc

        self.jointRelatives["root"] = 0
        self.jointRelatives["elbow"] = self.settings["div0"] + 2
        self.jointRelatives["wrist"] = len(self.div_cns) - 1
        self.jointRelatives["eff"] = -1

        self.controlRelatives["root"] = self.fk0_ctl
        self.controlRelatives["elbow"] = self.fk1_ctl
        self.controlRelatives["wrist"] = self.fk2_ctl
        self.controlRelatives["eff"] = self.fk2_ctl

        # here is really don't needed because the name is the same as the alias
        self.aliasRelatives["root"] = "root"
        self.aliasRelatives["elbow"] = "elbow"
        self.aliasRelatives["wrist"] = "wrist"
        self.aliasRelatives["eff"] = "hand"

I hope this helps


#3

awesome! Thanks Miquel!