Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

access the Smooth skins value from selected vertices

lcinjpBXL87
Observer
Observer

access the Smooth skins value from selected vertices

lcinjpBXL87
Observer
Observer

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

0 Likes
Reply
Accepted solutions (1)
232 Views
1 Reply
Reply (1)

Kahylan
Advisor
Advisor
Accepted solution

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!

0 Likes