Home Website Youtube GitHub

[SOLVED] Multiple parent spaces in one module

Hey there. I’m trying to make a custom bow/arrow Shifter component and it’s working great so far expect it doesn’t seem like I can add multiple AnimEnumParams for the purposes of space switching on the grip, bowstring, and arrow. It seems like if I add multiple the dagMenu won’t work, and if I only add one the attr HAS to be called ikref. For example, the following will break the dagMenu:

        if self.settings['grip_ikref_array']:
            grip_ref_names = self.get_valid_alias_list(self.settings["grip_ikref_array"].split(","))
            if len(grip_ref_names) > 1:
                self.grip_ikref_att = self.addAnimEnumParam("grip_ik_ref", "Grip Ik Ref", 0, grip_ref_names)

        if self.settings['string_ikref_array']:
            string_ref_names = self.get_valid_alias_list(self.settings["string_ikref_array"].split(","))
            if len(string_ref_names) > 1:
                self.string_ikref_att = self.addAnimEnumParam("string_ik_ref", "Bowstring Ik Ref", 0, string_ref_names)

        if self.settings['arrow_ikref_array']:
            arrow_ref_names = self.get_valid_alias_list(self.settings["arrow_ikref_array"].split(","))
            if len(arrow_ref_names) > 1:
                self.arrow_ikref_att = self.addAnimEnumParam("arrow_ik_ref", "Arrow Ik Ref", 0, arrow_ref_names)

Is this intentional? It seems like I should be able to do this, as all the parent constraints are set up correctly, and I can manually space switch from the channel box, but if the dagMenu won’t work then I don’t get the xform matching and that’s a huge negative.

Any tips on this?

For more info, the error warning is:

Error: TypeError: file C:\dev_path\mGear\scripts\mgear\core\dagmenu.py line 274: 'NoneType' object is not iterable

It does indeed look like it’s looking for a specific name for the attr, line 258.

So, I managed to get rid of the above error message by renaming my enum attrs from grip_ik_ref to gripikref. However, even though the error message goes away, the dagmenu does not change the params on the parentconstraint on the ik_cvs transform node.

EDIT: It looks like the parentConstraints get created but the weights are never connected to anything.

Sorry for rubber ducking out here in the open.

I tracked the issue to connectRef() and indeed it looks like you can only ever have one parent constraint in a component, per lines 1332-1336. It’s looking specifically for self.ikref_att, which there can obviously only be one of.

I moved to using connectRef2() and it all works now!

2 Likes