@@ -64,6 +64,9 @@ namespace Editor
64
64
65
65
public class ModelExporter : System . IDisposable
66
66
{
67
+ // To be replaced by checkbox in Fbx Export settings
68
+ bool removeAnimationsFromSkinnedMeshRenderer = true ;
69
+
67
70
const string Title =
68
71
"exports static meshes with materials and textures" ;
69
72
@@ -1787,26 +1790,29 @@ protected void ExportAnimationClip (AnimationClip uniAnimClip, GameObject uniRoo
1787
1790
continue ;
1788
1791
}
1789
1792
1790
- int index = QuaternionCurve . GetQuaternionIndex ( uniCurveBinding . propertyName ) ;
1791
- if ( index >= 0 ) {
1792
- /* Rotation property; save it to convert quaternion -> euler later. */
1793
- RotationCurve rotCurve = GetRotationCurve < QuaternionCurve > ( uniGO , uniAnimClip . frameRate , ref rotations ) ;
1794
- rotCurve . SetCurve ( index , uniAnimCurve ) ;
1795
- continue ;
1796
- }
1793
+ // Do not create the curves if the component is a SkinnedMeshRenderer and if the option in FBX Export settings is toggled on.
1794
+ if ( ! removeAnimationsFromSkinnedMeshRenderer || ( removeAnimationsFromSkinnedMeshRenderer && uniGO . GetComponent < SkinnedMeshRenderer > ( ) == null && uniGO . GetComponentInChildren < SkinnedMeshRenderer > ( ) == null ) ) {
1795
+ int index = QuaternionCurve . GetQuaternionIndex ( uniCurveBinding . propertyName ) ;
1796
+ if ( index >= 0 ) {
1797
+ /* Rotation property; save it to convert quaternion -> euler later. */
1798
+ RotationCurve rotCurve = GetRotationCurve < QuaternionCurve > ( uniGO , uniAnimClip . frameRate , ref rotations ) ;
1799
+ rotCurve . SetCurve ( index , uniAnimCurve ) ;
1800
+ continue ;
1801
+ }
1797
1802
1798
- index = EulerCurve . GetEulerIndex ( uniCurveBinding . propertyName ) ;
1799
- if ( index >= 0 ) {
1800
- RotationCurve rotCurve = GetRotationCurve < EulerCurve > ( uniGO , uniAnimClip . frameRate , ref rotations ) ;
1801
- rotCurve . SetCurve ( index , uniAnimCurve ) ;
1802
- continue ;
1803
- }
1803
+ index = EulerCurve . GetEulerIndex ( uniCurveBinding . propertyName ) ;
1804
+ if ( index >= 0 ) {
1805
+ RotationCurve rotCurve = GetRotationCurve < EulerCurve > ( uniGO , uniAnimClip . frameRate , ref rotations ) ;
1806
+ rotCurve . SetCurve ( index , uniAnimCurve ) ;
1807
+ continue ;
1808
+ }
1804
1809
1805
- /* simple property (e.g. intensity), export right away */
1806
- ExportAnimationCurve ( uniGO , uniAnimCurve , uniAnimClip . frameRate ,
1807
- uniCurveBinding . propertyName ,
1808
- fbxScene ,
1809
- fbxAnimLayer ) ;
1810
+ /* simple property (e.g. intensity), export right away */
1811
+ ExportAnimationCurve ( uniGO , uniAnimCurve , uniAnimClip . frameRate ,
1812
+ uniCurveBinding . propertyName ,
1813
+ fbxScene ,
1814
+ fbxAnimLayer ) ;
1815
+ }
1810
1816
}
1811
1817
1812
1818
/* now export all the quaternion curves */
@@ -2512,7 +2518,6 @@ protected Dictionary<GameObject, AnimationOnlyExportData> GetAnimationExportData
2512
2518
/// </summary>
2513
2519
protected bool ExportComponents ( FbxScene fbxScene )
2514
2520
{
2515
- bool removeAnimationsFromSkinnedMeshRenderer = true ;
2516
2521
var animationNodes = new HashSet < GameObject > ( ) ;
2517
2522
2518
2523
int numObjectsExported = 0 ;
@@ -2548,8 +2553,6 @@ protected bool ExportComponents(FbxScene fbxScene)
2548
2553
ExportLight ( unityGo , fbxScene , fbxNode ) ;
2549
2554
}
2550
2555
2551
- bool hasSkinned = unityGo . GetComponent < SkinnedMeshRenderer > ( ) != null ;
2552
- Debug . Log ( unityGo . name + " hasSkinned " + hasSkinned . ToString ( ) ) ;
2553
2556
// check if this object contains animation, keep track of it
2554
2557
// if it does
2555
2558
if ( GameObjectHasAnimation ( unityGo ) ) {
0 commit comments