Adverti horiz upsell

ZV Parent Master 1.3.3 for Maya (maya script)

Animate interacting objects with ease

License
Button download
23,682 Downloads

Compatibility

  • 2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009, 2008

Operating Systems

  • Linux
  • Mac
  • Windows

History

Created:09/09/2009
Last Modified:02/10/2019
File Size: 41.7 KB

Bugs

Baking constraint

Statusclosed
Prioritymedium
Date09/26/2013
Submitted byToke Jepsen Toke Jepsen
Found a problem with some scenes dont bake correctly. Basically the anim curves from the locator, doesnt get named correctly. Solution is below:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
def _applyBakedAnimation(obj):
	'' 'Connect bake the animation of the locator object.'''
 
	# If the locator is not 'created (nothing to Bakare) exit
	locatorName = obj + _locSfx
	locExists = cmds.ls(locatorName)
	if not locExists:
		return
 
	# If this exists deletes the node rigidBody and the solver
	try:
		rb = _getRigidBody(obj)
		if rb:
			solver = cmds.listConnections(rb + '.generalForce', s=False)[0]
			cmds.delete(rb)
			# If a non-rigid solver and 'delete used
			if not cmds.listConnections(solver + '.generalForce', d=False):
				cmds.delete(solver)
	# If the node rigidBody and 'referenced only then disconnect the choice by the attributes of the object
	except:
		for choice in cmds.listConnections(obj, d=False, s=True, t='choice'):
			cmds.disconnectAttr(choice + '.output', cmds.listConnections(choice + '.output', p=True)[0])
 
	# Delete any keys in the node object's transformation
	cmds.cutKey(obj, at=['t', 'r'])
 
	# Find the animation curves of the locator
	animCurves = cmds.listConnections(locatorName, d=False, type='animCurve')
 
	# rinominale
	for crv in animCurves:
 
		newName=obj+'_'+crv.split('_')[-1]
		cmds.rename(crv,newName)
 
	# Connect the animation curves of the object
	attrs = cmds.listAttr([obj + '.t', obj + '.r'], u=True, s=True)
 
	if not attrs:
		return
 
	for attr in attrs:
		curveNameAttr = '%s_%s.output' % (obj, attr)
		cmds.connectAttr(curveNameAttr, '%s.%s' % (obj, attr))
 
	# pulisci le curve
	sys.stdout.write('Optimizing translation and rotation keys...\n')
	_cleanCurves(['%s.%s' % (obj, s) for s in ['tx', 'ty', 'tz', 'rx', 'ry', 'rz']])
 
	# cancella il locator
	cmds.delete(locatorName)

 


Comments on this bug:

  • leevice

    leevice said over 11 years ago:

    Hey man, thanks about that! :)
  • Toke Jepsen

    Toke Jepsen said over 11 years ago:

    the code insertion seems a bit messed up, so here the raw text. def _applyBakedAnimation(obj): '' 'Connect bake the animation of the locator object.''' # If the locator is not 'created (nothing to Bakare) exit locatorName = obj + _locSfx locExists = cmds.ls(locatorName) if not locExists: return # If this exists deletes the node rigidBody and the solver try: rb = _getRigidBody(obj) if rb: solver = cmds.listConnections(rb + '.generalForce', s=False)[0] cmds.delete(rb) # If a non-rigid solver and 'delete used if not cmds.listConnections(solver + '.generalForce', d=False): cmds.delete(solver) # If the node rigidBody and 'referenced only then disconnect the choice by the attributes of the object except: for choice in cmds.listConnections(obj, d=False, s=True, t='choice'): cmds.disconnectAttr(choice + '.output', cmds.listConnections(choice + '.output', p=True)[0]) # Delete any keys in the node object's transformation cmds.cutKey(obj, at=['t', 'r']) # Find the animation curves of the locator animCurves = cmds.listConnections(locatorName, d=False, type='animCurve') # rinominale for crv in animCurves: newName=obj+'_'+crv.split('_')[-1] cmds.rename(crv,newName) # Connect the animation curves of the object attrs = cmds.listAttr([obj + '.t', obj + '.r'], u=True, s=True) if not attrs: return for attr in attrs: curveNameAttr = '%s_%s.output' % (obj, attr) cmds.connectAttr(curveNameAttr, '%s.%s' % (obj, attr)) # pulisci le curve sys.stdout.write('Optimizing translation and rotation keys...\n') _cleanCurves(['%s.%s' % (obj, s) for s in ['tx', 'ty', 'tz', 'rx', 'ry', 'rz']]) # cancella il locator cmds.delete(locatorName)
  • leevice

    leevice said about 11 years ago:

    Hey man, I just need to know how to replicate the bug. When does this error happen? Maybe on certain control names?
  • Toke Jepsen

    Toke Jepsen said about 11 years ago:

    its happens when you have a controller thats in a namespace, and your current namespace is something else or the root. the animcurves goes into the current namespace, and the renaming of the animcurves fails. might be a 2014 problem but havent tested it on any others.
  • leevice

    leevice said about 11 years ago:

    It was giving me error while creating the constraint too. Now it should be fixed. Thanks for reporting this bug! Paolo
  • Toke Jepsen

    Toke Jepsen said about 11 years ago:

    I would also suggest running a euler filter on the baked animation curves. Experiencing quite a few flips in the baked animation. Dunno how backward compatible that would be to implement though.

Post a comment: