How to use python Group the import blendshapes?

How to use python Group the import blendshapes?

Xiangyun32
Explorer Explorer
1,661 Views
6 Replies
Message 1 of 7

How to use python Group the import blendshapes?

Xiangyun32
Explorer
Explorer

Hey, guys, I got a problem with python import many blendshapes. But the blendshapes is too many. I want to use python group it. How to achieve that goal?

 

Any help will be appreciated.

 

微信图片_20200419100202.png微信图片_20200419100209.png

0 Likes
1,662 Views
6 Replies
Replies (6)
Message 2 of 7

jmreinhart
Advisor
Advisor

So if you use the import/export in Maya's shape editor the groups will be preserved. This is the code for that.

import maya.cmds as cmds
cmds.blendShape('blendShape1',e = True, export = 'D:/My Documents/temporary_exports/shapes.shp')
cmds.blendShape('blendShape1',e = True, ip = 'D:/My Documents/temporary_exports/shapes.shp')

 If you want to have a script to create/rename/organize the groups in the shape editor you will need to use the "targetDirectory" attributes on the blendShapes node. You can see what those attributes are for in the blendShape nodes documentation. https://help.autodesk.com/cloudhelp/2018/ENU/Maya-Tech-Docs/Nodes/blendShape.html

 

 

0 Likes
Message 3 of 7

Xiangyun32
Explorer
Explorer

Hi,jonahrnhrt, thank you very much for your help.  

 

My case is want to create/rename/organize the groups in the shape editor. The fbx file imported is made by Daz3d with many blendshapes. I want to write a Python script to organize the blendshapes after imported. But the documentation about the blendShape node doesn't explain how to create/rename/organize the groups. Could you give me a code for example?

 

Thank you very much.

0 Likes
Message 4 of 7

jmreinhart
Advisor
Advisor

Hi, 

 

I actually had never tried to do those sorts of things in the shape editor via a script. There is no command that I could find that makes that easy. So I've started writing a set of utility scripts that perform the required functions. It's still very much a work in progress (I'll post another update when it's more polished, I just wanted you to know that it is possible and I am working on making it easier).

0 Likes
Message 5 of 7

Xiangyun32
Explorer
Explorer

Wow! It's awfully nice of you to do this.

 

I download the script and read it. It is too difficult for me because there is some API script. But thank you very much. It gave me a direction to group the blendshapes. I am happy with it. Thank you very much. I will learn the API code to understand how the script works. 

 

Thank you very much again.

 

0 Likes
Message 6 of 7

jmreinhart
Advisor
Advisor

You don't need to worry about not knowing the API stuff, because I'm packaging it so you can just use the provided functions.

0 Likes
Message 7 of 7

Xiangyun32
Explorer
Explorer

OK,Thank you very much.

0 Likes