Website Youtube GitHub

Floating lips. Rebuild instead wires


Wires, used in Lips Rigger script, so bugged. Playing with dropoff, scale, rotate options did not fix wire lips.
This shit-script replace this wires with rebuild nodes.



import pymel.core as pm

def convert_wires_to_reba():
	#### for 2.xx ####
	xxx = [
	['lips_C_upCrv_ctlShape', 'lips_C_upperLipShape'],
	['lips_C_lowCrv_ctlShape', 'lips_C_lowerLipShape'],
	['lips_C_upCrv_ctlShape', 'lips_C_upRope_crvShape'],
	['lips_C_lowCrv_ctlShape', 'lips_C_lowRope_crvShape'],

	['lips_C_upCrv_upvShape', 'lips_C_upRope_upvShape'],
	['lips_C_lowCrv_upvShape', 'lips_C_lowRope_upvShape']
	#### for 3.xx ####
	xxx = [
	['lips_C_upCtl_crvShape', 'lips_C_upperLipShape'],
	['lips_C_lowCtl_crvShape', 'lips_C_lowerLipShape'],
	['lips_C_upCtl_crvShape', 'lips_C_upRope_crvShape'],
	['lips_C_lowCtl_crvShape', 'lips_C_lowRope_crvShape'],

	['lips_C_upCrv_upvShape', 'lips_C_upRope_upvShape'],
	['lips_C_lowCrv_upvShape', 'lips_C_lowRope_upvShape']

	for src_name, trg_name in xxx:
		wireNode = pm.listConnections( src_name+'.worldSpace[0]', d=1, s=0,type='wire')
		print('wireNode:', wireNode)
		src = pm.PyNode(src_name)
		trg = pm.PyNode(trg_name)
		spans_num = trg.spans.get()
		reba = pm.rebuildCurve(src, ch=1, rpo=0, rt=0, end=1, kr=0, kcp=0, kep=1, kt=0, s=spans_num, d=3, tol=0.01, object=0, smooth=2 )[0]
		reba.outputCurve >> trg.create
		print(src_name, ' >> ', trg_name, 'spans_num:', spans_num)



Hi Alexey,

Cool thanks for sharing! I’m going to test this to learn what you did. I’ve used rebuildCurve for ribbon effects before and it works well.

But in the meantime, the way I fixed my buggy lips was this. I mentioned wireDropoff in another thread, but I think this was mentioned somewhere else. The curves need to be constrained to the head space. (I have 2 head controls, so mine is “head_C1_0_jnt”. Default mGear might be “head_C0_0_jnt”)

This is, I believe everything I do, and this fixes my lips:

# Fix lip drift and flipping:
# 1. Set the corner lips constraint to "shortest" interpolation
for lipCtrl in'lips_L_corner_ctl', 'lips_R_corner_ctl'):
    lipCons = list(set(lipCtrl.getParent().inputs(type='parentConstraint')))[0]
    print lipCons.interpType.set(2) # shortest
# 2. Constrain lips_C_crvs to the head space
headJoint = pm.PyNode('head_C1_0_jnt')
lipCurvesGrp = pm.PyNode('lips_C_crvs')
pm.parentConstraint(headJoint, lipCurvesGrp, mo=True)
pm.scaleConstraint(headJoint, lipCurvesGrp, mo=True)

# a hack or solution? Mouth wires don't follow rig 100% unless you crank up the dropoffDistance.
# So when the character moves large distances, the mouth slowly begins to collapse.
for each in'wire'):