8
8
using System . Runtime . Serialization ;
9
9
using UnityEditor . Formats . Fbx . Exporter . Visitors ;
10
10
using UnityEditor . Formats . Fbx . Exporter . CustomExtensions ;
11
+ using System . Security . Permissions ;
11
12
12
13
namespace UnityEditor . Formats . Fbx . Exporter
13
14
{
@@ -873,6 +874,7 @@ bool ExportMesh (MeshInfo meshInfo, FbxNode fbxNode)
873
874
/// <summary>
874
875
/// Export GameObject as a skinned mesh with material, bones, a skin and, a bind pose.
875
876
/// </summary>
877
+ [ SecurityPermission ( SecurityAction . LinkDemand ) ]
876
878
protected bool ExportSkinnedMesh ( GameObject unityGo , FbxScene fbxScene , FbxNode fbxNode )
877
879
{
878
880
if ( ! unityGo || fbxNode == null )
@@ -948,6 +950,7 @@ private Matrix4x4 GetBindPose(
948
950
/// Export bones of skinned mesh, if this is a skinned mesh with
949
951
/// bones and bind poses.
950
952
/// </summary>
953
+ [ SecurityPermission ( SecurityAction . LinkDemand ) ]
951
954
private bool ExportSkeleton ( SkinnedMeshRenderer skinnedMesh , FbxScene fbxScene , out Dictionary < SkinnedMeshRenderer , Transform [ ] > skinnedMeshToBonesMap )
952
955
{
953
956
skinnedMeshToBonesMap = new Dictionary < SkinnedMeshRenderer , Transform [ ] > ( ) ;
@@ -1285,6 +1288,7 @@ internal bool ExportTransform (UnityEngine.Transform unityTransform, FbxNode fbx
1285
1288
/// <summary>
1286
1289
/// if this game object is a model prefab then export with shared components
1287
1290
/// </summary>
1291
+ [ SecurityPermission ( SecurityAction . LinkDemand ) ]
1288
1292
protected bool ExportInstance ( GameObject unityGo , FbxNode fbxNode )
1289
1293
{
1290
1294
if ( ! unityGo || fbxNode == null )
@@ -1771,6 +1775,7 @@ protected bool ExportConstraints (GameObject unityGo, FbxScene fbxScene, FbxNode
1771
1775
/// <summary>
1772
1776
/// Return set of sample times to cover all keys on animation curves
1773
1777
/// </summary>
1778
+ [ SecurityPermission ( SecurityAction . LinkDemand ) ]
1774
1779
internal static HashSet < float > GetSampleTimes ( AnimationCurve [ ] animCurves , double sampleRate )
1775
1780
{
1776
1781
var keyTimes = new HashSet < float > ( ) ;
@@ -1798,6 +1803,7 @@ internal static HashSet<float> GetSampleTimes(AnimationCurve[] animCurves, doubl
1798
1803
/// <summary>
1799
1804
/// Return set of all keys times on animation curves
1800
1805
/// </summary>
1806
+ [ SecurityPermission ( SecurityAction . LinkDemand ) ]
1801
1807
internal static HashSet < float > GetKeyTimes ( AnimationCurve [ ] animCurves )
1802
1808
{
1803
1809
var keyTimes = new HashSet < float > ( ) ;
@@ -1868,6 +1874,7 @@ internal void ExportAnimationKeys (AnimationCurve uniAnimCurve, FbxAnimCurve fbx
1868
1874
/// <summary>
1869
1875
/// Export animation curve key samples
1870
1876
/// </summary>
1877
+ [ SecurityPermission ( SecurityAction . LinkDemand ) ]
1871
1878
internal void ExportAnimationSamples ( AnimationCurve uniAnimCurve , FbxAnimCurve fbxAnimCurve ,
1872
1879
double sampleRate ,
1873
1880
UnityToMayaConvertSceneHelper convertSceneHelper )
@@ -1964,6 +1971,7 @@ protected FbxProperty GetFbxProperty(FbxNode fbxNode, string fbxPropertyName, Sy
1964
1971
/// NOTE: This is not used for rotations, because we need to convert from
1965
1972
/// quaternion to euler and various other stuff.
1966
1973
/// </summary>
1974
+ [ SecurityPermission ( SecurityAction . LinkDemand ) ]
1967
1975
protected void ExportAnimationCurve ( FbxNode fbxNode ,
1968
1976
AnimationCurve uniAnimCurve ,
1969
1977
float frameRate ,
@@ -2063,6 +2071,7 @@ public float Convert(float value)
2063
2071
/// <summary>
2064
2072
/// Export an AnimationClip as a single take
2065
2073
/// </summary>
2074
+ [ SecurityPermission ( SecurityAction . LinkDemand ) ]
2066
2075
protected void ExportAnimationClip ( AnimationClip uniAnimClip , GameObject uniRoot , FbxScene fbxScene )
2067
2076
{
2068
2077
if ( ! uniAnimClip || ! uniRoot || fbxScene == null ) return ;
@@ -2229,6 +2238,7 @@ protected void ExportAnimationClip (AnimationClip uniAnimClip, GameObject uniRoo
2229
2238
/// <param name="dest">Destination, child of the source.</param>
2230
2239
/// <param name="sampleRate">Sample rate.</param>
2231
2240
/// <param name="unityCurves">Unity curves.</param>
2241
+ [ SecurityPermission ( SecurityAction . LinkDemand ) ]
2232
2242
private void TransferMotion ( Transform source , Transform dest , float sampleRate , ref Dictionary < GameObject , List < UnityCurve > > unityCurves ) {
2233
2243
// get sample times for curves in dest + source
2234
2244
// at each sample time, evaluate all 18 transfom anim curves, creating 2 transform matrices
@@ -2457,6 +2467,7 @@ ref Dictionary<GameObject, RotationCurve> rotations
2457
2467
/// <summary>
2458
2468
/// Export the Animator component on this game object
2459
2469
/// </summary>
2470
+ [ SecurityPermission ( SecurityAction . LinkDemand ) ]
2460
2471
protected void ExportAnimation ( GameObject uniRoot , FbxScene fbxScene )
2461
2472
{
2462
2473
if ( ! uniRoot )
@@ -2641,6 +2652,7 @@ internal int ExportTransformHierarchy(
2641
2652
/// but components are only exported if explicitly animated. Meshes are not exported.
2642
2653
/// </summary>
2643
2654
/// <returns>The number of nodes exported.</returns>
2655
+ [ SecurityPermission ( SecurityAction . LinkDemand ) ]
2644
2656
internal int ExportAnimationOnly (
2645
2657
GameObject unityGO ,
2646
2658
FbxScene fbxScene ,
@@ -2942,6 +2954,7 @@ private static int GetObjectToRootDepth(Transform startObject, Transform root){
2942
2954
/// <returns>The animation only hierarchy count.</returns>
2943
2955
/// <param name="exportSet">GameObject hierarchies selected for export.</param>
2944
2956
/// <param name="hierarchyToExportData">Map from GameObject hierarchy to animation export data.</param>
2957
+ [ SecurityPermission ( SecurityAction . LinkDemand ) ]
2945
2958
internal int GetAnimOnlyHierarchyCount ( Dictionary < GameObject , IExportData > hierarchyToExportData )
2946
2959
{
2947
2960
// including any parents of animated objects that are exported
@@ -2960,6 +2973,7 @@ internal int GetAnimOnlyHierarchyCount(Dictionary<GameObject, IExportData> hiera
2960
2973
return completeExpSet . Count ;
2961
2974
}
2962
2975
2976
+ [ SecurityPermission ( SecurityAction . LinkDemand ) ]
2963
2977
internal static Dictionary < GameObject , IExportData > GetExportData ( Object [ ] objects , IExportOptions exportOptions = null )
2964
2978
{
2965
2979
if ( exportOptions == null )
@@ -2990,6 +3004,7 @@ internal static Dictionary<GameObject, IExportData> GetExportData(Object[] objec
2990
3004
return exportData . Count == 0 ? null : exportData ;
2991
3005
}
2992
3006
3007
+ [ SecurityPermission ( SecurityAction . LinkDemand ) ]
2993
3008
internal static IExportData GetExportData ( GameObject rootObject , AnimationClip animationClip , IExportOptions exportOptions = null )
2994
3009
{
2995
3010
if ( exportOptions == null )
@@ -3090,6 +3105,7 @@ internal static IExportData GetExportData(GameObject go, IExportOptions exportOp
3090
3105
/// Transform components have already been exported.
3091
3106
/// This function exports the other components and animation.
3092
3107
/// </summary>
3108
+ [ SecurityPermission ( SecurityAction . LinkDemand ) ]
3093
3109
protected bool ExportComponents ( FbxScene fbxScene , bool exportAnim = true )
3094
3110
{
3095
3111
var animationNodes = new HashSet < GameObject > ( ) ;
@@ -3186,6 +3202,7 @@ internal int GetHierarchyCount (HashSet<GameObject> exportSet)
3186
3202
/// </summary>
3187
3203
/// <returns>The revised export set</returns>
3188
3204
/// <param name="unityExportSet">Unity export set.</param>
3205
+ [ SecurityPermission ( SecurityAction . LinkDemand ) ]
3189
3206
internal static HashSet < GameObject > RemoveRedundantObjects ( IEnumerable < UnityEngine . Object > unityExportSet )
3190
3207
{
3191
3208
// basically just remove the descendents from the unity export set
@@ -3296,6 +3313,7 @@ internal enum TransformExportType { Local, Global, Reset };
3296
3313
///
3297
3314
/// This refreshes the asset database.
3298
3315
/// </summary>
3316
+ [ SecurityPermission ( SecurityAction . LinkDemand ) ]
3299
3317
internal int ExportAll (
3300
3318
IEnumerable < UnityEngine . Object > unityExportSet ,
3301
3319
Dictionary < GameObject , IExportData > exportData )
@@ -3927,6 +3945,7 @@ internal static void UnRegisterMeshCallback(GetMeshForObject callback)
3927
3945
/// This goes through the callback system to find the right mesh and
3928
3946
/// allow plugins to substitute their own meshes.
3929
3947
/// </summary>
3948
+ [ SecurityPermission ( SecurityAction . LinkDemand ) ]
3930
3949
bool ExportMesh ( GameObject gameObject , FbxNode fbxNode )
3931
3950
{
3932
3951
// First allow the object-based callbacks to have a hack at it.
@@ -4060,6 +4079,7 @@ private static void OnExport ()
4060
4079
}
4061
4080
4062
4081
4082
+ [ SecurityPermission ( SecurityAction . LinkDemand ) ]
4063
4083
public static string ExportObjects (
4064
4084
string filePath ,
4065
4085
UnityEngine . Object [ ] objects = null ,
@@ -4073,6 +4093,7 @@ public static string ExportObjects(
4073
4093
/// Export a list of (Game) objects to FBX file.
4074
4094
/// Use the SaveFile panel to allow user to enter a file name.
4075
4095
/// <summary>
4096
+ [ SecurityPermission ( SecurityAction . LinkDemand ) ]
4076
4097
internal static string ExportObjects (
4077
4098
string filePath ,
4078
4099
UnityEngine . Object [ ] objects = null ,
@@ -4104,6 +4125,7 @@ internal static string ExportObjects (
4104
4125
return null ;
4105
4126
}
4106
4127
4128
+ [ SecurityPermission ( SecurityAction . LinkDemand ) ]
4107
4129
public static string ExportObject (
4108
4130
string filePath ,
4109
4131
UnityEngine . Object root ,
0 commit comments