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: 

access the Smooth skins value from selected vertices

1 REPLY 1
SOLVED
Reply
Message 1 of 2
lcinjpBXL87
229 Views, 1 Reply

access the Smooth skins value from selected vertices

hi guys,

im new to scripting so please bear with me😀

let me clearly state what i wish to do here so we don't get confused.

 

im trying to help my folks at the company so that when they are in the Component Editor,

under Smooth Skins tab,

they can just click one column of values (or more),

run my cute little script (i'll do the work here),

and it will do some IFs or what not and apply to their values with the result.

 

from my experiment and googling for one morning,

the act of selecting columns, joint values in the Component Editor-

doesn't seem to have any effect on the object level (where MEL operates)

 

im just saying no matter what I select in the Components Editor, the results of
$select[] = `ls -sl`;

are always the same: pSphere1.vtx[xxx:xxx]

 

please give me a hand here it'd be greatly appreciated 😀

 

have a good day

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

Hi!

 

If you really want to go for selected columns in the Component Editor you'd have to create a callback using the Python- or C++ API that listens to the column selection in the Component Editor. There isn't really a way to do that in "normal" MEL or Python scripting.

 

You can use other functions to access the information of the skincluster on a vertex selection.

For example, this is a python script that I use to read out the joint influences on a vertex selection:

import maya.cmds as mc

obj = mc.ls(sl = True, o =True)
vertices = mc.ls(sl = True, fl = True)
objHistory = mc.listHistory(object)
for obj in objHistory:
    if mc.objectType(obj) == "skinCluster":
        sCluster = obj
        break

superDict = {}
for vtx in vertices:
    values = mc.skinPercent(sCluster,vtx, q= True, v = True)
    transforms = mc.skinPercent(sCluster,vtx, q= True, t = None)
    tvDict = {}
    
    for n in range(0,len(values)):
        if values[n] != 0.0:
            tvDict[transforms[n]] = values[n]
            
    superDict[vtx] = tvDict
    
for k in superDict:
    print(k, superDict[k])
        

 

You can also use the skinPercent() function to directly change skincluster values on a specified vertex. That could probably be helpful for the script you are writing.

 

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