Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

blendshape weighting on curve CVs

1 REPLY 1
SOLVED
Reply
Message 1 of 2
V4nDl0
626 Views, 1 Reply

blendshape weighting on curve CVs

V4nDl0
Enthusiast
Enthusiast

Hi,
I have lots of separate CV curves that have been combined into a single shape node and have a single blendshape deformer applied to all of them. I want the blendshape influence to fade out along the length of the curves.
At the moment, I am using the component editor to choose each CV down the length of the curves one by one and graduate the weighting manually
CV[14] = 0.5
CV[15] = 0.55
CV[16]=0.6
etc. etc.

There doesn't seem to be any way to paint or smooth blendshape weights on CVs, and nothing appears in the script editor when I'm setting the weight values
is there anything I could type in to MEL or any way to make this faster? I want the same values on the same CVs on every curve - i.e. CV[7] will always be 0.25

Thanks

0 Likes

blendshape weighting on curve CVs

Hi,
I have lots of separate CV curves that have been combined into a single shape node and have a single blendshape deformer applied to all of them. I want the blendshape influence to fade out along the length of the curves.
At the moment, I am using the component editor to choose each CV down the length of the curves one by one and graduate the weighting manually
CV[14] = 0.5
CV[15] = 0.55
CV[16]=0.6
etc. etc.

There doesn't seem to be any way to paint or smooth blendshape weights on CVs, and nothing appears in the script editor when I'm setting the weight values
is there anything I could type in to MEL or any way to make this faster? I want the same values on the same CVs on every curve - i.e. CV[7] will always be 0.25

Thanks

1 REPLY 1
Message 2 of 2
Kahylan
in reply to: V4nDl0

Kahylan
Advisor
Advisor
Accepted solution

Hi!

 

Does it have to be MEL?

 

Because I have a Python script that does what you want:

import maya.cmds as mc

def CRV_blendshape_falloff(shapeName = "",falloffWeights = [],startCV = 0):
    """
    creates a falloff in blendshape weights on CV's on selected curves.
    Takes Attributes, shapeName (string) for name of the blendshape,
    falloffWeights (list of floats) specifying the weights on the CV's,
    startCV (integer) specifying at what CV to start
    """
    
    #getting selected curves
    curves = mc.ls(selection = True, o = True)
    
    #looping through curves and cvs applying the weights specified in falloffWeights
    for c in curves:
        for w in range(0,len(falloffWeights)):
            mc.setAttr('{0}.inputTarget[0].inputTargetGroup[0].targetWeights[{1}]'.format(shapeName, startCV + w), falloffWeights[w])


CRV_blendshape_falloff(shapeName = "Blendshape",falloffWeights = [0.6,0.7,0.8,0.9], startCV = 0)

You would just have to swap out the information in the last line with the values you need. shapeName is the name of your Blendshape, in the Brackets of "falloffWeights =[]" the values for each CV that needs changing and start CV is the CV with the lowest index where change should start to happen.

 

I hope this helps!

Hi!

 

Does it have to be MEL?

 

Because I have a Python script that does what you want:

import maya.cmds as mc

def CRV_blendshape_falloff(shapeName = "",falloffWeights = [],startCV = 0):
    """
    creates a falloff in blendshape weights on CV's on selected curves.
    Takes Attributes, shapeName (string) for name of the blendshape,
    falloffWeights (list of floats) specifying the weights on the CV's,
    startCV (integer) specifying at what CV to start
    """
    
    #getting selected curves
    curves = mc.ls(selection = True, o = True)
    
    #looping through curves and cvs applying the weights specified in falloffWeights
    for c in curves:
        for w in range(0,len(falloffWeights)):
            mc.setAttr('{0}.inputTarget[0].inputTargetGroup[0].targetWeights[{1}]'.format(shapeName, startCV + w), falloffWeights[w])


CRV_blendshape_falloff(shapeName = "Blendshape",falloffWeights = [0.6,0.7,0.8,0.9], startCV = 0)

You would just have to swap out the information in the last line with the values you need. shapeName is the name of your Blendshape, in the Brackets of "falloffWeights =[]" the values for each CV that needs changing and start CV is the CV with the lowest index where change should start to happen.

 

I hope this helps!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report