Saturday 9 August 2014

Script: Mirror pose in maya

This is a simple script for mirror pose ( X to -X, or -X to X )


download: pose


More sample video:
https://youtu.be/41ZaP04D0Cc
https://youtu.be/Coo0G3MXXJ8

Put the file under "Documents\maya\scripts"
usage:
import jp_poseModule as pose
reload(pose)

# you can use those command to change attrs Positive and negative to fit the rig axis.
pose.updateMirrorVector( "normalAttrs", -1,1,1,1,1,1 )
pose.updateMirrorVector( "ikAttrs", -1,1,1,1,1,-1 )
pose.updateMirrorVector( "centerAttrs", -1,1,1,1,-1,-1 )


pose.resetIkObjs() # setting ik ctrls by selecting controls and run this function.
pose.resetPoleVectorObjs()# setting poleVector ctrls by selecting controls and run this function.

for AnimShcool's Rig
pose.updateMirrorVector( "ikAttrs", -1,1,1,1,-1,-1 )



pose.copy() # store one farme value for selection

pose.mirror() # paste mirror value base on pose.copy()

pose.paste() # paste value to original object base on pose.copy()

To find out the mirror side. the script support side pattern below:
RIGHT; LEFT
RT; LF
_R_;  _L_
Right; Left,
Rt; Lf'
_r_; _l_


配合poseLib使用,以彌補貼上pose的不足






Friday 8 August 2014

How to: Joints follow Mesh vertex

http://forums.cgsociety.org/archive/index.php/t-728087.html
$pos = `getAttr mesh.vrts[ some_num ]` + `getAttr mesh.pnts[some_num]`;
import maya.cmds as cmds
cmds.emitter()


pointPosition pCube1.vtx[1];


It looks like a good way by using emitter and parentConstraint for the facial rig.
But, if emitter as the parent obj will be easy crash maya when do undo. So it will more stablelize adding locator as child.
I need do more test.
emitter+parentCons看來是不錯的方法
但是,如果直接用emitter當做父物件,如果undo似乎很容易照成Maya當機
多加上locator跟emitter連結,當調劑似乎又比較好一些
還要再多測試


Recently I've been tyring use point on poly constraint for facial rig. The result also quite good.
But when the mesh be changed the vertex position, the following obj which using point on poly constraint will not only change the translation but rotation, so need to add one more child obj to avoid this kind situation.
And one more thing, the face mesh for using point on poly needs to be triangular.


近來測試了利用Point On Poly constraint效果也還可以,也不會讓outliner有一堆因為使用emitter而產生出的set,雖然不影響功能,但看了很不舒服。但用point on poly會讓跟隨的物件連同旋轉值一起被約束,原想把旋轉的約束再解除,但似乎會造成檔案存檔後再開啟會損壞。所以還是在中間多加了兩層物件,一先跟隨模型的點,二是用來約束臉的骨骼。
使用這方法另一個要注意的是,臉部的模型必須都為三角面,才不會造成電腦計算位置錯誤。


FaceDrMesh(Must be triangle)


create followingNode(group) for each vertex point on FaceDrMesh and using Point On Poly constraint connecting them.


create frzNode(group) and hookNode( joint ) as a set for each followingNode and using point constraint connecting them.