Funny enough I actually have written those helper scripts since it was 
pretty simple as their JSON files are quite well formatted.  Honestly I 
never really looked further than ngSkinTools as they're the most complete 
and functional skinning toolset I've come across and used for many years.  
Apologies as this is quite old code and not very well structured:

import json
import maya.cmds as mc

def copy_bind_from_ng_file(file):
    """ Copies skinCluster from ngSkinTools JSON file to make the same 
skinCluster before importing weights.
    Args:
        file (str): file...
    Returns [str]: list of influences that we used to build the skinCluster
    Usage:
        
copy_bind_from_ng_file('path_to_your_ng_skin_tools_weights_file.json')
    """
    influences = []
    missing_influences = []

    with open(file) as f:
        data = f.read()
        json_data = json.loads(data)
        f.close()

    for value in json_data['influences']:
        influence = json_data['influences'][value]['path'].split('|')[-1]
        if mc.objExists(influence):
            influences.append(influence)
        else:
            missing_influences.append(influence)
    
    if missing_influences:
        print 'Missing Influences from your file: 
\n{}'.format(missing_influences)

    result = cmds.confirmDialog(b=['OK','CANCEL'], m='You have %d missing 
influences...continue adding skin cluster from file with %d influences?' % 
(len(missing_influences), len(influences)))

    if result == 'OK':
        mc.skinCluster(influences, mc.ls(sl=True)[0], tsb=True)

    return influences




On Thursday, June 20, 2019 at 6:34:29 PM UTC-4, AK Eric wrote:
>
> I've recently changed companies and starting something from scratch.  One 
> of the tools I need (and we had before) is a bulletproof solution for skin 
> weight export/import.  I'm a bit out of touch with what's out there in the 
> community since I've not had to look into this for years.  Maya's built-in 
> solutions are sorely lacking when used on any sort of complex asset.  
>
> Are there any off-the-shelf tools available ($ is fine) that people would 
> recommend?
>
> I've been looking at ngSkinTools, but it's export\import step seems pretty 
> clunky as well.  As in, you can't import weights unless the mesh is already 
> skinned, which sort of defeats the purpose.  I could introspect the json 
> weight files and pre-skin the assets based on my own wrapper code, but... 
> if I paid for it why should I have to do it?  I figured *someone* by now 
> has solved this problem and is trying to profit from it.
>
> Any other suggestions?  Much appreciated.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/229c6f4d-32af-4843-a79f-9880d9794f55%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to