Skip to content

Commit aae42c4

Browse files
authored
Merge pull request #360 from Unity-Technologies/UNI-32798-1.3.0b1-forum-release
UNI-32798 1.3.0b1 forum release
2 parents d05e4f6 + b8b8dfd commit aae42c4

File tree

6 files changed

+71
-59
lines changed

6 files changed

+71
-59
lines changed

Assets/FbxExporters/Editor/ExportModelEditorWindow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ protected override bool Export(){
556556
return true;
557557
}
558558

559-
if (ModelExporter.ExportObjects (filePath, ToExport, SettingsObject, timelineAnim: m_isTimelineAnim) != null) {
559+
if (ModelExporter.ExportObjects (filePath, ToExport, SettingsObject) != null) {
560560
// refresh the asset database so that the file appears in the
561561
// asset folder view.
562562
AssetDatabase.Refresh ();

Assets/FbxExporters/Editor/FbxExporter.cs

Lines changed: 29 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1889,8 +1889,8 @@ protected void ExportAnimationClip (AnimationClip uniAnimClip, GameObject uniRoo
18891889
/// Transfers transform animation from source to dest. Replaces dest's Unity Animation Curves with updated animations.
18901890
/// NOTE: Source must be the parent of dest.
18911891
/// </summary>
1892-
/// <param name="source">Source.</param>
1893-
/// <param name="dest">Destination.</param>
1892+
/// <param name="source">Source animated object.</param>
1893+
/// <param name="dest">Destination, child of the source.</param>
18941894
/// <param name="sampleRate">Sample rate.</param>
18951895
/// <param name="unityCurves">Unity curves.</param>
18961896
private void TransferMotion(Transform source, Transform dest, float sampleRate, ref Dictionary<GameObject, List<UnityCurve>> unityCurves){
@@ -1933,14 +1933,23 @@ private void TransferMotion(Transform source, Transform dest, float sampleRate,
19331933
scaleKeyFrames[k] = new Keyframe[sampleTimes.Count];
19341934
}
19351935

1936+
// If we have a point in local coords represented as a column-vector x, the equation of x in coordinates relative to source's parent is:
1937+
// x_grandparent = source * dest * x
1938+
// Now we're going to change dest to dest' which has the animation from source. And we're going to change
1939+
// source to source' which has no animation. The equation of x will become:
1940+
// x_grandparent = source' * dest' * x
1941+
// We're not changing x_grandparent and x, so we need that:
1942+
// source * dest = source' * dest'
1943+
// We know dest and source (both animated) and source' (static). Solve for dest':
1944+
// dest' = (source')^-1 * source * dest
19361945
int keyIndex = 0;
1946+
var sourceStaticMatrixInverse = Matrix4x4.TRS(source.localPosition, source.localRotation, source.localScale).inverse;
19371947
foreach (var currSampleTime in sampleTimes)
19381948
{
19391949
var sourceLocalMatrix = GetTransformMatrix (currSampleTime, source, sourceUnityCurves);
19401950
var destLocalMatrix = GetTransformMatrix (currSampleTime, dest, destUnityCurves);
19411951

1942-
// child * parent
1943-
var newLocalMatrix = sourceLocalMatrix * destLocalMatrix;
1952+
var newLocalMatrix = sourceStaticMatrixInverse * sourceLocalMatrix * destLocalMatrix;
19441953

19451954
FbxVector4 translation, rotation, scale;
19461955
GetTRSFromMatrix (newLocalMatrix, out translation, out rotation, out scale);
@@ -2227,9 +2236,6 @@ protected int ExportTransformHierarchy(
22272236
// Use RSrs as the scaling inheritance instead.
22282237
fbxNode.SetTransformationInheritType (FbxTransform.EInheritType.eInheritRSrs);
22292238

2230-
if (TransformShouldBeReset (unityGo.transform)) {
2231-
exportType = TransformExportType.Reset;
2232-
}
22332239
ExportTransform (unityGo.transform, fbxNode, newCenter, exportType);
22342240

22352241
fbxNodeParent.AddChild (fbxNode);
@@ -2278,35 +2284,6 @@ protected int ExportTransformHierarchy(
22782284
return numObjectsExported;
22792285
}
22802286

2281-
/// <summary>
2282-
/// Checks if the transform should be reset.
2283-
/// Transform should be reset if animation is being transferred, and this transform
2284-
/// is either the animation source, destination, or between these nodes.
2285-
/// </summary>
2286-
/// <returns><c>true</c>, if transform should be reset, <c>false</c> otherwise.</returns>
2287-
/// <param name="t">Transform.</param>
2288-
private bool TransformShouldBeReset(Transform t){
2289-
var source = ExportOptions.AnimationSource;
2290-
var dest = ExportOptions.AnimationDest;
2291-
2292-
if (!source || !dest || source == dest) {
2293-
return false;
2294-
}
2295-
2296-
// don't want to reset destination, if it's a bone this could cause issues with the skinning
2297-
var curr = dest.parent;
2298-
while (curr != source && curr != null) {
2299-
if (t == curr) {
2300-
return true;
2301-
}
2302-
curr = curr.parent;
2303-
}
2304-
if (t == source) {
2305-
return true;
2306-
}
2307-
return false;
2308-
}
2309-
23102287
/// <summary>
23112288
/// Export data containing what to export when
23122289
/// exporting animation only.
@@ -2325,10 +2302,6 @@ public struct AnimationOnlyExportData {
23252302
// first clip to export
23262303
public AnimationClip defaultClip;
23272304

2328-
// TODO: find a better way to keep track of which components + properties we support
2329-
private static List<string> cameraProps = new List<string>{"field of view"};
2330-
private static List<string> lightProps = new List<string>{"m_Intensity", "m_SpotAngle", "m_Color.r", "m_Color.g", "m_Color.b"};
2331-
23322305
public AnimationOnlyExportData(
23332306
Dictionary<AnimationClip, GameObject> animClips,
23342307
HashSet<GameObject> exportSet,
@@ -2345,6 +2318,9 @@ public void ComputeObjectsInAnimationClips(
23452318
GameObject animationRootObject,
23462319
bool exportSkinnedMeshAnim = true
23472320
){
2321+
// NOTE: the object (animationRootObject) containing the animation is not necessarily animated
2322+
// when driven by an animator or animation component.
2323+
23482324
foreach (var animClip in animClips) {
23492325
if (this.animationClips.ContainsKey(animClip)) {
23502326
// we have already exported gameobjects for this clip
@@ -2368,11 +2344,12 @@ public void ComputeObjectsInAnimationClips(
23682344
continue;
23692345
}
23702346

2371-
if (lightProps.Contains (uniCurveBinding.propertyName)) {
2372-
this.exportComponent.Add (unityGo, typeof(Light));
2373-
} else if (cameraProps.Contains (uniCurveBinding.propertyName)) {
2374-
this.exportComponent.Add (unityGo, typeof(Camera));
2375-
}
2347+
// If we have a clip driving a camera or light then force the export of FbxNodeAttribute
2348+
// so that they point the right way when imported into Maya.
2349+
if (unityGo.GetComponent<Light>())
2350+
this.exportComponent[unityGo] = typeof(Light);
2351+
else if (unityGo.GetComponent<Camera>())
2352+
this.exportComponent[unityGo] = typeof(Camera);
23762353

23772354
this.goExportSet.Add (unityGo);
23782355
}
@@ -2534,9 +2511,6 @@ private bool ExportGameObjectAndParents(
25342511

25352512
// export regular transform if we are not a bone or failed to export as a bone
25362513
if(!exportedBoneTransform){
2537-
if (TransformShouldBeReset (unityGo.transform)) {
2538-
exportType = TransformExportType.Reset;
2539-
}
25402514
ExportTransform (unityGo.transform, fbxNode, newCenter, exportType);
25412515
}
25422516

@@ -3339,7 +3313,7 @@ public static void ExportSingleTimelineClip(TimelineClip timelineClipSelected, G
33393313
};
33403314

33413315
if (!string.IsNullOrEmpty (filePath)) {
3342-
ExportObjects (filePath, exportArray, timelineAnim: true);
3316+
ExportObjects (filePath, exportArray);
33433317
return;
33443318
}
33453319

@@ -3372,7 +3346,7 @@ public static void ExportAllTimelineClips(GameObject objectWithPlayableDirector,
33723346
}
33733347
string filePath = string.Format(AnimFbxFormat, folderPath, atObject.name, timelineClip.displayName);
33743348
UnityEngine.Object[] myArray = new UnityEngine.Object[] { atObject, timelineClip.animationClip };
3375-
ExportObjects (filePath, myArray, exportOptions, timelineAnim: true);
3349+
ExportObjects (filePath, myArray, exportOptions);
33763350
}
33773351
}
33783352
}
@@ -3866,8 +3840,7 @@ private static void OnExport ()
38663840
public static string ExportObjects (
38673841
string filePath,
38683842
UnityEngine.Object[] objects = null,
3869-
IExportOptions exportOptions = null,
3870-
bool timelineAnim = false)
3843+
IExportOptions exportOptions = null)
38713844
{
38723845
LastFilePath = filePath;
38733846

@@ -3881,7 +3854,8 @@ public static string ExportObjects (
38813854
}
38823855

38833856
Dictionary<GameObject, AnimationOnlyExportData> animationExportData = null;
3884-
if (timelineAnim) {
3857+
// if there are only two objects for export and the second is an animation clip, then we are exporting from the timeline
3858+
if (objects.Length == 2 && objects[1] is AnimationClip) {
38853859
// We expect the first argument in the list to be the GameObject, the second one is the Animation Clip/Track we are exporting from the timeline
38863860
GameObject rootObject = ModelExporter.GetGameObject (objects [0]);
38873861
AnimationClip timelineClip = objects [1] as AnimationClip;
@@ -3909,10 +3883,9 @@ public static string ExportObjects (
39093883

39103884
public static string ExportObject (
39113885
string filePath, UnityEngine.Object root,
3912-
IExportOptions exportOptions = null,
3913-
bool isTimelineAnim = false)
3886+
IExportOptions exportOptions = null)
39143887
{
3915-
return ExportObjects(filePath, new Object[] { root }, exportOptions, isTimelineAnim);
3888+
return ExportObjects(filePath, new Object[] { root }, exportOptions);
39163889
}
39173890

39183891
private static void EnsureDirectory (string path)

Assets/Integrations/Autodesk/maya/scripts/unityCommands.mel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ proc importFile(string $filePathStr){
234234
storeAttribute($unityExportSet, $UnityFbxFileNameAttr, "");
235235
storeAttribute($unityExportSet, $UnityFbxNamespaceAttr, "");
236236
}
237-
237+
238238
if(`namespaceInfo -cur -an` != $targetNamespace){
239239
namespace -set $targetNamespace;
240240
}

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ endif()
2323
message(STATUS "Building for ${CMAKE_BUILD_TYPE}")
2424

2525
if (NOT DEFINED PACKAGE_VERSION OR "${PACKAGE_VERSION}" STREQUAL "")
26-
set(PACKAGE_VERSION "sprint50")
26+
set(PACKAGE_VERSION "1.3.0b1")
2727
endif()
2828
message(STATUS "Using Package Version: ${PACKAGE_VERSION}")
2929

RELEASE_NOTES.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
RELEASE NOTES
22

3+
**Version**: 1.3.0b1
4+
5+
FIXES
6+
7+
* FbxExporter: if "Animated Skinned Mesh" off, don't export skinned mesh transform
8+
* Maya Integration: fix so saved files do not lose export set information on export
9+
* ConvertToPrefab: fix error when converting model instances whose file ends in .FBX (with capitals)
10+
11+
KNOWN ISSUES
12+
13+
* FbxExporter: animated skinned meshes must be in the bind pose on export (i.e. not being previewed in the Animation or Timeline windows, and the original rig's fbx must not contain animation)
14+
* FbxExporter: animated meshes in bone hierarchy are not supported
15+
* FbxExporter: for skinned meshes all bones must be descendants of the root bone
16+
* 3DIntegration: fbx containing rig must have file units in cm in order for animation exported from Unity to be properly applied
17+
* ConvertToPrefab: converting model instance that has been modified in the scene won't reexport fbx
18+
319
**Version**: sprint50
420

521
NEW FEATURES

RELEASE_NOTES_EXTERNAL.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
RELEASE NOTES
22

3+
**Version**: 1.3.0b1
4+
5+
NEW FEATURES
6+
* FbxExporter: Export animation clips from Timeline
7+
* FbxExportSettings: Added new UI to set export settings
8+
* FbxExportSettings: Added option to transfer transform animation on export
9+
* FbxExporterSettings: Added option to export model only
10+
* FbxExporterSettings: Added option to export animation only
11+
* FbxExporterSettings: Added option not to export animation on skinned meshes
12+
* FbxExportSettings: Added option to export meshes without renderers
13+
* FbxExportSettings: Added LOD export option
14+
* UnityMayaIntegration: Allow multi file import
15+
* UnityMayaIntegration: Allow multi file export by scene selection
16+
* FbxPrefabAutoUpdater: new UI to help manage name changes
17+
18+
FIXES
19+
* FbxExporter: link materials to objects connected to mesh instances
20+
* FbxExporter: export meshes in model prefab instances as mesh instances in fbx
21+
* ConvertToPrefab: Don't re-export fbx model instances
22+
* FbxExportSettings: fix console error on Mac when clicking "Install Unity Integration"
23+
* FbxExporter: fix so animating spot angle in Unity animates cone angle in Maya (not penumbra)
24+
* FbxExporter: export correct rotation order (xyz) for euler rotation animations (previously would export as zxy)
25+
326
**Version**: 1.3.0a1
427

528
NEW FEATURES

0 commit comments

Comments
 (0)