In a blank scene:
[ol]
[li]Create a joint
[/li][li]Create a nurbs curve
[/li][li]Add an attribute to the curve: float, 0 min, 1 max, 1 default
[/li][li]Set Driven Key … driver: curve.new_attr, driven: joint1.scaleX (0,0) (1,1)
[/li][li]parent constrain the joint (constrainee) to the curve (constrainer)
[/li][li]Export joint as an animated fbx.
[/li][li]
[/li][/ol]
In the fbx text file, the set driven key’s second key time will be 8200761993330688 , which is over 100,000 frames. (Unity says a time range of 176160, then barfs)
Why? Only happens when:
joint has a parent constraint AND
there’s a set driven key on the joint scale AND
there’s no keys on the driving attribute
A fix is to put a key on the driving attribute. Looks like the fbx exporter will pay attention to this key, instead of the set driven keys, luckily.
Anyone seen anything like this?
Here’s a script to run to repro. Pretty obscure problem… but annoying.
#exports a test fbx to see if it contains 8200761993330688, which is a bad frame range / time.
import pymel.core as pm
import tempfile
import random
import os
#create the joint, curve. Set the scene up
#pm.newFile() makes everything barf here
pm.select(clear = True)
the_joint = pm.joint()
the_curve = pm.circle(ch = False)[0]
pm.addAttr(longName = 'Some_Attr', attributeType = 'double', min = 0, max = 1, dv = 1)
pm.setAttr(the_curve.Some_Attr, keyable = True)
pm.select(the_joint)
pm.setDrivenKeyframe(at = 'scaleX', cd = the_curve.Some_Attr)
pm.select(clear = True)
the_curve.Some_Attr.set(0)
the_joint.scaleX.set(0)
pm.select(the_joint)
pm.setDrivenKeyframe(at = 'scaleX', cd = the_curve.Some_Attr)
pm.select(clear = True)
pm.parentConstraint(the_curve, the_joint, mo = True)
pm.select(clear = True)
#done setting up scene, now export
pm.Mel.eval('FBXResetExport;')
pm.Mel.eval('FBXExportInAscii -v true')
pm.Mel.eval('FBXExportAnimationOnly -v true')
temp_file = ''
temp_file = tempfile.gettempdir()
if not os.path.exists(temp_file):
os.makedirs(temp_file)
temp_file = temp_file + '/fbx_dumb_test_' + str(random.randint(1,2000)) + "_" + ".fbx"
temp_file = temp_file.replace('\\', '/')
pm.select(the_joint)
pm.Mel.eval('FBXExport -f \"' + temp_file + '\" -s on;')
#check if export contains 8200761993330688
file_obj = open(temp_file, 'r')
the_text = file_obj.read()
file_obj.close
if the_text.find('8200761993330688') > 0:
print 'BAD EXPORT. Unity will complain if this fbx is imported'
else:
print 'Great job everyone. Really, splendid work.'