Blendshape pains

376 views
Skip to first unread message

Mark Jackson

unread,
Nov 21, 2014, 1:58:51 PM11/21/14
to python_inside_maya

I'm in the middle of writing a new facial pipeline for Red9 clients and and trying to get a solid corrective sculpt pipeline up and running, but I'm hitting issues with blendshapes, or rather, the god awful support that Maya has for actually editing them in code.

So case in point, I'm sculpted the 'jaw_open' shape already and I want to re-sculpt it, and replace that target in the blendshape, but try as I might I'll be damned if I can get the blendshape command to behave as I want. Adding new targets is easy, but replacing them feels like pulling teeth.

cmds.blendShape(sculptBlend, edit=True, t=(faceMesh, activeTargetIndex, activeSculpt, 1))

Anybody got any good pointers for this, I'd assumed that something like the above would work, where sculptBlend is the blend node, faceMesh is the baseMesh,  targetIndex is the current index of the target I want to update and activeSculpt is the new sculpt to replace it with, but it doesn't seem to have the effect. 

Neither does removing a target from the blend. Surely there has to be better support for this stuff as at the moment the safest way seems to be just to recreate the blendNode each time. I know we've done it like this in the past because of similar issues managing the blendShape node. The issue I have with this project is that we're sculpting ontop of a pretty heavy mesh and keeping all the targets in the scene is bloating it massively.

Any pointers guys??

thanks

Mark


-------------------------------------
Mark Jackson
CEO / Technical Director
red9consultancy.com

Eduardo Grana

unread,
Nov 21, 2014, 5:53:02 PM11/21/14
to python_in...@googlegroups.com
Hello Mark,

Not sure if this is what you are looking for,
I'm writing this very quickly hope it makes sense,

#remove an existing blend
blendNode = 'blendShape1'
base = 'pSphere2'
target = 'pSphere3'
index = 1
maxValue = 1.0
mc.blendShape( blendNode, edit=True, rm=True, t=[(base, index, target, maxValue),(base, index, target, maxValue)] )

#add blend (must be an empty slot, if its used, you have to remove it first)
target = 'pSphere1'
index = 2

mc.blendShape( blendNode, edit=True,  t=(base, index, target, maxValue) )

#replace blend via connection
blendNode = 'blendShape1'
meshIn = 'pSphereShape4'
geoIndex = 0
index = 1
mc.connectAttr( '%s.worldMesh[0]' % meshIn,
    '%s.inputTarget[%s].inputTargetGroup[%s].inputTargetItem[6000].inputGeomTarget' % (blendNode, geoIndex, index), f=1 )

Hope it's usefull.
Cheers!
Eduardo

--
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAGQH2FH99yw4YbHvvc7PODtvfbzxT3ydM5uggjFfkbp%2BE3WXMg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.



--

Mark Jackson

unread,
Nov 22, 2014, 11:00:51 AM11/22/14
to python_inside_maya
Thanks Eduardo, that's pretty much what I ended up with but the point though is that replacing / updating a target shouldn't be so hard, I mean, look at the command string you've just done in the connect command to update that target, could it be any more convoluted ;)

thanks

Mark


For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages