Home Website Youtube GitHub

Leg Pole vector Ikspace issue

If i set the leg upvector to “root” it stays pinned, even if i translate/ rotate the root control

Is this a known issue?

Yeah it might be related to this known bug. I don’t know if anyone ever fixed it yet. But I did share a POST Python script that I run to fix it. (This fix is a hack, and would break if anyone ever legitimately fixes it.)

You can double check if this is the issue by looking at the condition nodes and see if they are connected to the correct target. Or look at the parentConstraint and see if it is actually set to the correct target.

1 Like

i will check it Chris!

i get this error when executing



An exception of type OSError occurred. 

Traceback (most recent call last):
  File "C:\Users\godfather\Documents\maya\modules\scripts\mgear\shifter\guide.py", line 1335, in runStep
    customStep = imp.load_source(fileName, runPath)
  File "C:\Program Files\Autodesk\Maya2023\Python\lib\imp.py", line 171, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 711, in _load
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 846, in exec_module
  File "<frozen importlib._bootstrap_external>", line 982, in get_code
  File "C:\Program Files\Autodesk\Maya2023\Python\lib\imp.py", line 157, in get_data
    return super().get_data(path)
  File "<frozen importlib._bootstrap_external>", line 1039, in get_data
OSError: [Errno 22] Invalid argument: '\\Maya\\data\\Mgear\\CustomSteps\\Post\\LegUpVSpace.py'

its as you said, the constraints targets are not beeing set correctly

It’s from 2019 when the mGear modules were organized differently. This might work. I just removed it from the whole customShifterStep class. It’s just basic PyMEL anyway:

import pymel.core as pm

def fix_polevector_index(side):
    '''
    Here is a hack! There is a problem in the leg module, where it adds "Global"
    automatically to the leg pole vector spaces. So the indeces after Global are
    shifted incorrectly. This reorders the indeces in the condition nodes that drive it.
    This is a brittle fix. It depends on the bug existing and being in the correct order... :(
    '''
    # if leg_L1 exists, it is a quadruped, so do all 4 limbs. Otherwise just the leg_L0 ones.
    if pm.objExists('leg_L1_upv_ctl'):
        limbs = [0, 1]
    else:
        limbs = [0]
    for limb in limbs:
        poleControl = pm.PyNode('leg_{}{}_upv_ctl'.format(side, limb))
        poleConstraint = list(set(poleControl.getParent().inputs(type='constraint')))[0]
        conditionInputs= poleConstraint.inputs(type='condition')

        counter = 0.0
        for i, each in enumerate(conditionInputs):
            if 'world' in each.outputs(plugs=True)[0].name():
                each.secondTerm.set(len(conditionInputs))
            else:
                each.secondTerm.set(counter)
                counter += 1.0

for side in 'LR':
    fix_polevector_index(side)


still no luck!

,
An exception of type OSError occurred.

Traceback (most recent call last):
File “C:\Users\godfather\Documents\maya\modules\scripts\mgear\shifter\guide.py”, line 1335, in runStep
customStep = imp.load_source(fileName, runPath)
File “C:\Program Files\Autodesk\Maya2023\Python\lib\imp.py”, line 171, in load_source
module = _load(spec)
File “”, line 711, in _load
File “”, line 680, in _load_unlocked
File “”, line 846, in exec_module
File “”, line 982, in get_code
File “C:\Program Files\Autodesk\Maya2023\Python\lib\imp.py”, line 157, in get_data
return super().get_data(path)
File “”, line 1039, in get_data
OSError: [Errno 22] Invalid argument: ‘d:/Projects/Maya/data/Mgear/CustomSteps\:\Projects\Maya\data\Mgear\CustomSteps\Post\LegUpVSpace.py’
,

If you put your code between triple backticks it will show up well-formatted. ```

I’m not sure that error doesn’t seem related to the script itself, but to something else.

I’ll have to test in Maya 2023. Maybe that is the problem.

@actoratwork Can you share a screenshot of your “Custom Steps” tab in your guide?

The error looks like a bad path:

d:/Projects/Maya/data/Mgear/CustomSteps\:\Projects\Maya\data\Mgear\CustomSteps\Post\LegUpVSpace.py

How do you load the scripts into your guide? Do you use the menu to browse for the file? Or do you enter the path manually? It just looks like the path is getting some bugs in it.

i actually just open the guide settings - post scripts tab - add new script.

Or do i still have to check Maya,s environment file apart from that?

that was the issue!

under my “CustomSteps” folder i added

“data”/“scripts”/“post” folders

then it worked