ngSkinTools automated Import/Export

Hello all, hope that you are all doing well!

I would like to find out if anyone has managed to create an automated workflow using the ngSkinTools API?

Using the documentation provided an example that was given to export skin weights:

I used this to save out the json file:

with open(“test.json”, “w”) as jsonFile:
json.dump(jsonContents, jsonFile, indent = 4)

The issue that I am having is when looking at the contents of the newly created json file all weight information is savd in one long line.

Normally it is displayed as follows:

Also when importing the weights back it doesn’t override the existing layer that are there it just stacks ontop, is there a way of solving this?

All in all what has been given in the documentation works at a basic level but lacks those few elements when using the tool manually.

I am really excited to hear what everyone else has to say about this topic and I am looking forward to seeing what other solutions are out there regarding this workflow.

Thank you all in advance!

Building one of these is on my list too. Someone need to help this man.
I’m not sure about this because I haven’t really ever tried using json, but I think that format is a feature of json data? I think to write it out nicely you have to give it some parameters…

This is a pretty good video for the json basics, and is literally everything I know about json so far. Maybe it’ll be helpful

Hi @Alex_Mann, thank you very much for the share of the video. Much appreciated! I will be sure to go through it thoroughly to see if there is anything extra that I can pick up to help.

I had the same problem. Found out it’s because of the json module. json.dump() dumps the raw data into the file including the \n characters that are the new lines. So instead you can use something like this:

def saveJsonToFile(data, filename):
with open(filename, 'w') as f:
1 Like

You can set the formatting of the saved data and use dumps instead of dump:

json.dumps(data, sort_keys=True, indent=4)