Skip to content

Commit b028e03

Browse files
committed
reset transforms that animation is being removed from
1 parent fa0ba82 commit b028e03

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Assets/FbxExporters/Editor/FbxExporter.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2199,6 +2199,9 @@ protected int ExportTransformHierarchy(
21992199
// Use RSrs as the scaling inheritance instead.
22002200
fbxNode.SetTransformationInheritType (FbxTransform.EInheritType.eInheritRSrs);
22012201

2202+
if (ResetTransform (unityGo.transform)) {
2203+
exportType = TransformExportType.Reset;
2204+
}
22022205
ExportTransform (unityGo.transform, fbxNode, newCenter, exportType);
22032206

22042207
fbxNodeParent.AddChild (fbxNode);
@@ -2247,6 +2250,24 @@ protected int ExportTransformHierarchy(
22472250
return numObjectsExported;
22482251
}
22492252

2253+
2254+
private bool ResetTransform(Transform t){
2255+
var source = ExportOptions.AnimationSource;
2256+
var dest = ExportOptions.AnimationDest;
2257+
2258+
var curr = dest;
2259+
while (curr != source && curr != null) {
2260+
if (t == curr) {
2261+
return true;
2262+
}
2263+
curr = curr.parent;
2264+
}
2265+
if (t == source) {
2266+
return true;
2267+
}
2268+
return false;
2269+
}
2270+
22502271
/// <summary>
22512272
/// Export data containing what to export when
22522273
/// exporting animation only.

0 commit comments

Comments
 (0)