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