@@ -1536,8 +1536,8 @@ protected void ExportAnimationCurve (UnityEngine.Object uniObj,
1536
1536
Debug . Log ( "Exporting animation for " + uniObj . ToString ( ) + " (" + uniPropertyName + ")" ) ;
1537
1537
}
1538
1538
1539
- FbxPropertyChannelPair fbxPropertyChannelPair ;
1540
- if ( ! FbxPropertyChannelPair . TryGetValue ( uniPropertyName , out fbxPropertyChannelPair ) ) {
1539
+ FbxPropertyChannelPair [ ] fbxPropertyChannelPairs ;
1540
+ if ( ! FbxPropertyChannelPair . TryGetValue ( uniPropertyName , out fbxPropertyChannelPairs ) ) {
1541
1541
Debug . LogWarning ( string . Format ( "no mapping from Unity '{0}' to fbx property" , uniPropertyName ) ) ;
1542
1542
return ;
1543
1543
}
@@ -1555,39 +1555,35 @@ protected void ExportAnimationCurve (UnityEngine.Object uniObj,
1555
1555
return ;
1556
1556
}
1557
1557
1558
- // map unity property name to fbx property
1559
- var fbxProperty = fbxNode . FindProperty ( fbxPropertyChannelPair . Property , false ) ;
1560
- if ( ! fbxProperty . IsValid ( ) )
1561
- {
1562
- var fbxNodeAttribute = fbxNode . GetNodeAttribute ( ) ;
1563
- if ( fbxNodeAttribute != null )
1564
- {
1565
- fbxProperty = fbxNodeAttribute . FindProperty ( fbxPropertyChannelPair . Property , false ) ;
1558
+ foreach ( var fbxPropertyChannelPair in fbxPropertyChannelPairs ) {
1559
+ // map unity property name to fbx property
1560
+ var fbxProperty = fbxNode . FindProperty ( fbxPropertyChannelPair . Property , false ) ;
1561
+ if ( ! fbxProperty . IsValid ( ) ) {
1562
+ var fbxNodeAttribute = fbxNode . GetNodeAttribute ( ) ;
1563
+ if ( fbxNodeAttribute != null ) {
1564
+ fbxProperty = fbxNodeAttribute . FindProperty ( fbxPropertyChannelPair . Property , false ) ;
1565
+ }
1566
+ }
1567
+ if ( ! fbxProperty . IsValid ( ) ) {
1568
+ Debug . LogError ( string . Format ( "no fbx property {0} found on {1} node or nodeAttribute " , fbxPropertyChannelPair . Property , fbxNode . GetName ( ) ) ) ;
1569
+ return ;
1566
1570
}
1567
- }
1568
- if ( ! fbxProperty . IsValid ( ) )
1569
- {
1570
- Debug . LogError ( string . Format ( "no fbx property {0} found on {1} node or nodeAttribute " , fbxPropertyChannelPair . Property , fbxNode . GetName ( ) ) ) ;
1571
- return ;
1572
- }
1573
1571
1574
- // Create the AnimCurve on the channel
1575
- FbxAnimCurve fbxAnimCurve = fbxProperty . GetCurve ( fbxAnimLayer , fbxPropertyChannelPair . Channel , true ) ;
1572
+ // Create the AnimCurve on the channel
1573
+ FbxAnimCurve fbxAnimCurve = fbxProperty . GetCurve ( fbxAnimLayer , fbxPropertyChannelPair . Channel , true ) ;
1576
1574
1577
- // create a convert scene helper so that we can convert from Unity to Maya
1578
- // AxisSystem (LeftHanded to RightHanded) and FBX's default units
1579
- // (Meters to Centimetres)
1580
- var convertSceneHelper = new UnityToMayaConvertSceneHelper ( uniPropertyName ) ;
1575
+ // create a convert scene helper so that we can convert from Unity to Maya
1576
+ // AxisSystem (LeftHanded to RightHanded) and FBX's default units
1577
+ // (Meters to Centimetres)
1578
+ var convertSceneHelper = new UnityToMayaConvertSceneHelper ( uniPropertyName ) ;
1581
1579
1582
- // TODO: we'll resample the curve so we don't have to
1583
- // configure tangents
1584
- if ( ModelExporter . ExportSettings . BakeAnimation )
1585
- {
1586
- ExportAnimationSamples ( uniAnimCurve , fbxAnimCurve , frameRate , convertSceneHelper ) ;
1587
- }
1588
- else
1589
- {
1590
- ExportAnimationKeys ( uniAnimCurve , fbxAnimCurve , convertSceneHelper ) ;
1580
+ // TODO: we'll resample the curve so we don't have to
1581
+ // configure tangents
1582
+ if ( ModelExporter . ExportSettings . BakeAnimation ) {
1583
+ ExportAnimationSamples ( uniAnimCurve , fbxAnimCurve , frameRate , convertSceneHelper ) ;
1584
+ } else {
1585
+ ExportAnimationKeys ( uniAnimCurve , fbxAnimCurve , convertSceneHelper ) ;
1586
+ }
1591
1587
}
1592
1588
}
1593
1589
@@ -1642,75 +1638,78 @@ public FbxPropertyChannelPair(string p, string c):this() {
1642
1638
/// Map a Unity property name to the corresponding FBX property and
1643
1639
/// channel names.
1644
1640
/// </summary>
1645
- public static bool TryGetValue ( string uniPropertyName , out FbxPropertyChannelPair prop )
1641
+ public static bool TryGetValue ( string uniPropertyName , out FbxPropertyChannelPair [ ] prop )
1646
1642
{
1647
1643
System . StringComparison ct = System . StringComparison . CurrentCulture ;
1648
1644
1649
1645
// Transform Scaling
1650
1646
if ( uniPropertyName . StartsWith ( "m_LocalScale.x" , ct ) || uniPropertyName . EndsWith ( "S.x" , ct ) ) {
1651
- prop = new FbxPropertyChannelPair ( "Lcl Scaling" , Globals . FBXSDK_CURVENODE_COMPONENT_X ) ;
1647
+ prop = new FbxPropertyChannelPair [ ] { new FbxPropertyChannelPair ( "Lcl Scaling" , Globals . FBXSDK_CURVENODE_COMPONENT_X ) } ;
1652
1648
return true ;
1653
1649
}
1654
1650
if ( uniPropertyName . StartsWith ( "m_LocalScale.y" , ct ) || uniPropertyName . EndsWith ( "S.y" , ct ) ) {
1655
- prop = new FbxPropertyChannelPair ( "Lcl Scaling" , Globals . FBXSDK_CURVENODE_COMPONENT_Y ) ;
1651
+ prop = new FbxPropertyChannelPair [ ] { new FbxPropertyChannelPair ( "Lcl Scaling" , Globals . FBXSDK_CURVENODE_COMPONENT_Y ) } ;
1656
1652
return true ;
1657
1653
}
1658
1654
if ( uniPropertyName . StartsWith ( "m_LocalScale.z" , ct ) || uniPropertyName . EndsWith ( "S.z" , ct ) ) {
1659
- prop = new FbxPropertyChannelPair ( "Lcl Scaling" , Globals . FBXSDK_CURVENODE_COMPONENT_Z ) ;
1655
+ prop = new FbxPropertyChannelPair [ ] { new FbxPropertyChannelPair ( "Lcl Scaling" , Globals . FBXSDK_CURVENODE_COMPONENT_Z ) } ;
1660
1656
return true ;
1661
1657
}
1662
1658
1663
1659
// Transform Translation
1664
1660
if ( uniPropertyName . StartsWith ( "m_LocalPosition.x" , ct ) || uniPropertyName . EndsWith ( "T.x" , ct ) ) {
1665
- prop = new FbxPropertyChannelPair ( "Lcl Translation" , Globals . FBXSDK_CURVENODE_COMPONENT_X ) ;
1661
+ prop = new FbxPropertyChannelPair [ ] { new FbxPropertyChannelPair ( "Lcl Translation" , Globals . FBXSDK_CURVENODE_COMPONENT_X ) } ;
1666
1662
return true ;
1667
1663
}
1668
1664
if ( uniPropertyName . StartsWith ( "m_LocalPosition.y" , ct ) || uniPropertyName . EndsWith ( "T.y" , ct ) ) {
1669
- prop = new FbxPropertyChannelPair ( "Lcl Translation" , Globals . FBXSDK_CURVENODE_COMPONENT_Y ) ;
1665
+ prop = new FbxPropertyChannelPair [ ] { new FbxPropertyChannelPair ( "Lcl Translation" , Globals . FBXSDK_CURVENODE_COMPONENT_Y ) } ;
1670
1666
return true ;
1671
1667
}
1672
1668
if ( uniPropertyName . StartsWith ( "m_LocalPosition.z" , ct ) || uniPropertyName . EndsWith ( "T.z" , ct ) ) {
1673
- prop = new FbxPropertyChannelPair ( "Lcl Translation" , Globals . FBXSDK_CURVENODE_COMPONENT_Z ) ;
1669
+ prop = new FbxPropertyChannelPair [ ] { new FbxPropertyChannelPair ( "Lcl Translation" , Globals . FBXSDK_CURVENODE_COMPONENT_Z ) } ;
1674
1670
return true ;
1675
1671
}
1676
1672
1677
1673
if ( uniPropertyName . StartsWith ( "m_Intensity" , ct ) )
1678
1674
{
1679
- prop = new FbxPropertyChannelPair ( "Intensity" , null ) ;
1675
+ prop = new FbxPropertyChannelPair [ ] { new FbxPropertyChannelPair ( "Intensity" , null ) } ;
1680
1676
return true ;
1681
1677
}
1682
1678
1683
1679
if ( uniPropertyName . StartsWith ( "m_SpotAngle" , ct ) )
1684
1680
{
1685
- prop = new FbxPropertyChannelPair ( "OuterAngle" , null ) ;
1681
+ prop = new FbxPropertyChannelPair [ ] {
1682
+ new FbxPropertyChannelPair ( "OuterAngle" , null ) ,
1683
+ new FbxPropertyChannelPair ( "InnerAngle" , null )
1684
+ } ;
1686
1685
return true ;
1687
1686
}
1688
1687
1689
1688
if ( uniPropertyName . StartsWith ( "m_Color.r" , ct ) )
1690
1689
{
1691
- prop = new FbxPropertyChannelPair ( "Color" , Globals . FBXSDK_CURVENODE_COLOR_RED ) ;
1690
+ prop = new FbxPropertyChannelPair [ ] { new FbxPropertyChannelPair ( "Color" , Globals . FBXSDK_CURVENODE_COLOR_RED ) } ;
1692
1691
return true ;
1693
1692
}
1694
1693
1695
1694
if ( uniPropertyName . StartsWith ( "m_Color.g" , ct ) )
1696
1695
{
1697
- prop = new FbxPropertyChannelPair ( "Color" , Globals . FBXSDK_CURVENODE_COLOR_GREEN ) ;
1696
+ prop = new FbxPropertyChannelPair [ ] { new FbxPropertyChannelPair ( "Color" , Globals . FBXSDK_CURVENODE_COLOR_GREEN ) } ;
1698
1697
return true ;
1699
1698
}
1700
1699
1701
1700
if ( uniPropertyName . StartsWith ( "m_Color.b" , ct ) )
1702
1701
{
1703
- prop = new FbxPropertyChannelPair ( "Color" , Globals . FBXSDK_CURVENODE_COLOR_BLUE ) ;
1702
+ prop = new FbxPropertyChannelPair [ ] { new FbxPropertyChannelPair ( "Color" , Globals . FBXSDK_CURVENODE_COLOR_BLUE ) } ;
1704
1703
return true ;
1705
1704
}
1706
1705
1707
1706
if ( uniPropertyName . StartsWith ( "field of view" , ct ) )
1708
1707
{
1709
- prop = new FbxPropertyChannelPair ( "FieldOfView" , null ) ;
1708
+ prop = new FbxPropertyChannelPair [ ] { new FbxPropertyChannelPair ( "FieldOfView" , null ) } ;
1710
1709
return true ;
1711
1710
}
1712
1711
1713
- prop = new FbxPropertyChannelPair ( ) ;
1712
+ prop = new FbxPropertyChannelPair [ ] { } ;
1714
1713
return false ;
1715
1714
}
1716
1715
}
0 commit comments