Home Youtube GitHub



Not sure if that’s a bug or if I’m doing something wrong.

What I’m trying to do:
I have a character that has many hairs that each should be controlled with lite_chain_stack, this would take to long to align manually so I’ve generated curves for each one and from this, I’m getting space locator at the correct position and orientation.
Next, I would like to duplicate my hair module and align to each locator.

The issue I have is that the duplicate function is multiplying its own results.
So for:
1 curve = 1 module duplicated
2 curves = 3 modules duplicated
5 curves = 15 modules duplicated etc.

Support much appreciated :wink:

Heres the script: https://gist.github.com/kmarcinowski/54d248c77904f51079e734847f1d08f1
Scene: https://www.dropbox.com/s/fmdwuf426rdcmad/test.ma

Thanks in advance,


Tried on a clean scene duplicating any module with this code:

import pymel.core as pm
import mgear.shifter as shifter

rig = shifter.Rig() 
module = pm.PyNode("chain_C0_root")

for i in range(20):
    print i
    newGuide = rig.guide.duplicate(module)

It’s creating 210 duplicates. Any idea?


Always good to ask on the forum :wink: I think I have a solution. It seems like it’s a problem with class instance, or just I think it is it.

So it’s working when I define rig everytime in the loop. If someone could explain it to me would be awesome :wink:

import mgear.shifter as shifter
import pymel.core as pm

for i in range(20):
    rig = shifter.Rig() 


Hello @Krzym thanks for the feedback here.

To be honest I never tried to do that so I will have to test it. Maybe it will take me a litter to tackle this but I have logged in GitHub so I will not forget



Yeah, even if you don’t run it in a loop, it adds one extra one, every single time you run the command. So it isn’t multiplying, but it is accumulating. I tested and it happens on any component root. (Just in case it was a bug with the chain_01)

iteration: copies made (total)
1: 1 copy (2)
2: 2 copies (4)
3: 3 (7)
4: 4 (11)
5: 5 (16)
6: 6 (22)

I looked in the guide_manager code, and when you run duplicate from the mGear menu, the bug doesn’t occur, because it does exactly what @Krzym discovered. It re-instantiates the guide.

guide_manager.py line 47:

oSel = pm.selected()
    if oSel:
        root = oSel[0]
        guide = shifter.guide.Rig() # <----- RIGHT HERE!
        guide.duplicate(root, sym)
        mgear.log("Select one component root to edit properties",