Skip to content

Commit 45e8fce

Browse files
committed
PR changes.
1 parent c48587d commit 45e8fce

File tree

5 files changed

+39
-13
lines changed

5 files changed

+39
-13
lines changed

Assets/com.unity.formats.fbx.tests/ConvertToModelTest.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ public void TestStaticHelpers()
9393
var aFbx = ConvertToModel.GetOrCreateFbxAsset(a, fbxFullPath: GetRandomFbxFilePath());
9494
var bFbx = ConvertToModel.GetOrCreateInstance(aFbx);
9595
Assert.AreNotEqual(aFbx, bFbx);
96-
Assert.AreEqual(aFbx, PrefabUtility.GetPrefabParent(bFbx));
96+
Assert.AreEqual(aFbx, PrefabUtility.GetCorrespondingObjectFromSource(bFbx));
9797

9898
// Test on an prefab asset
9999
var aPrefab = PrefabUtility.CreatePrefab(GetRandomPrefabAssetPath(), a);
100100
var bPrefab = ConvertToModel.GetOrCreateInstance(aPrefab);
101101
Assert.AreNotEqual(aPrefab, bPrefab);
102-
Assert.AreEqual(aPrefab, PrefabUtility.GetPrefabParent(bPrefab));
102+
Assert.AreEqual(aPrefab, PrefabUtility.GetCorrespondingObjectFromSource(bPrefab));
103103
}
104104

105105
// Test SetupFbxPrefab
@@ -122,13 +122,13 @@ public void TestStaticHelpers()
122122

123123
var aPath = GetRandomPrefabAssetPath();
124124
var aPrefab = ConvertToModel.ApplyOrCreatePrefab(a, prefabFullPath: aPath);
125-
Assert.AreEqual(aPrefab, PrefabUtility.GetPrefabParent(a));
125+
Assert.AreEqual(aPrefab, PrefabUtility.GetCorrespondingObjectFromSource(a));
126126

127127
// Now apply it again (replacing aPrefab). Make sure we use the
128128
// same file rather than creating a new one.
129129
var bPath = GetRandomPrefabAssetPath();
130130
var bPrefab = ConvertToModel.ApplyOrCreatePrefab(a, prefabFullPath: bPath);
131-
Assert.AreEqual(bPrefab, PrefabUtility.GetPrefabParent(a));
131+
Assert.AreEqual(bPrefab, PrefabUtility.GetCorrespondingObjectFromSource(a));
132132
Assert.AreEqual(aPath, AssetDatabase.GetAssetPath(bPrefab));
133133
}
134134

@@ -227,7 +227,7 @@ public void BasicTest()
227227
Assert.That(cube); // we kept the original
228228
Assert.That(cubePrefab); // we got the new
229229
Assert.AreEqual("Cube", cubePrefab.name); // it has the right name
230-
Assert.AreSame(PrefabUtility.GetPrefabParent(cube), cubePrefab); // the original and new are the same
230+
Assert.AreSame(PrefabUtility.GetCorrespondingObjectFromSource(cube), cubePrefab); // the original and new are the same
231231
Assert.That(!EditorUtility.IsPersistent(cube));
232232
Assert.That(EditorUtility.IsPersistent(cubePrefab));
233233

@@ -265,7 +265,7 @@ public void ExhaustiveTests() {
265265
{
266266
var a = CreateHierarchy();
267267
var aConvert = ConvertToModel.Convert(a, fbxFullPath: GetRandomFbxFilePath(), prefabFullPath: GetRandomPrefabAssetPath());
268-
Assert.AreEqual(aConvert, PrefabUtility.GetPrefabParent(a));
268+
Assert.AreEqual(aConvert, PrefabUtility.GetCorrespondingObjectFromSource(a));
269269
}
270270

271271
// Test Convert on a prefab asset.
@@ -295,7 +295,7 @@ public void ExhaustiveTests() {
295295
var aPrefab = PrefabUtility.CreatePrefab(aPrefabPath, a);
296296
var bPrefabPath = GetRandomPrefabAssetPath();
297297
var aConvert = ConvertToModel.Convert(a, fbxFullPath: GetRandomFbxFilePath(), prefabFullPath: bPrefabPath);
298-
Assert.AreEqual(aConvert, PrefabUtility.GetPrefabParent(a));
298+
Assert.AreEqual(aConvert, PrefabUtility.GetCorrespondingObjectFromSource(a));
299299
Assert.AreEqual(bPrefabPath, AssetDatabase.GetAssetPath(aConvert));
300300
Assert.AreEqual(aPrefabPath, AssetDatabase.GetAssetPath(aPrefab));
301301
Assert.AreNotEqual(aPrefabPath, AssetDatabase.GetAssetPath(aConvert));
@@ -437,7 +437,7 @@ public void TestInstanceNameMatchesFilename()
437437

438438
Assert.That (cube);
439439
Assert.That (cubePrefab);
440-
Assert.AreSame (cubePrefab, PrefabUtility.GetPrefabParent(cube));
440+
Assert.AreSame (cubePrefab, PrefabUtility.GetCorrespondingObjectFromSource(cube));
441441

442442
Assert.AreEqual (Path.GetFileNameWithoutExtension (path), cube.name);
443443
}
@@ -476,7 +476,7 @@ public void TestConvertModelInstance()
476476
GameObject converted = ConvertToModel.Convert (fbxInstance,
477477
fbxFullPath: GetRandomFbxFilePath(),
478478
prefabFullPath: GetRandomPrefabAssetPath());
479-
Assert.That (converted, Is.EqualTo (PrefabUtility.GetPrefabParent(fbxInstance)));
479+
Assert.That (converted, Is.EqualTo (PrefabUtility.GetCorrespondingObjectFromSource(fbxInstance)));
480480

481481
// check meshes link to original fbx
482482
var prefabCubeMesh = fbxInstance.GetComponent<MeshFilter>().sharedMesh;

Assets/com.unity.formats.fbx.tests/FbxCameraTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// NOTE: uncomment the next line to leave temporary FBX files on disk
1+
// NOTE: uncomment the next line to leave temporary FBX files on disk
22
// and create a imported object in the scene.
33
//#define DEBUG_UNITTEST
44

@@ -73,7 +73,7 @@ public void GameCameraTest()
7373
Assert.That( srcCam.nearClipPlane, Is.EqualTo(origCam.nearClipPlane));
7474
}
7575

76-
#if UNITY_2018_2_OR_NEWER || UNITY_2018_2_OR_LATER
76+
#if UNITY_2018_2_OR_NEWER
7777
[Test]
7878
public void PhysicalCameraTest()
7979
{

Packages/com.unity.formats.fbx/Editor/Scripts/CameraVisitor.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using UnityEngine;
32
using Unity.FbxSdk;
43
using FbxExporters.CustomExtensions;
@@ -62,7 +61,7 @@ private static FbxCamera ConfigureGameCamera (FbxCamera fbxCamera, Camera unityC
6261
return fbxCamera;
6362
}
6463

65-
#if UNITY_2018_2_OR_NEWER || UNITY_2018_2_OR_LATER
64+
#if UNITY_2018_2_OR_NEWER
6665
/// <summary>
6766
/// Configure FbxCameras from a Physical Camera
6867
/// </summary>

Packages/com.unity.formats.fbxsdk/Scripts/GlobalsPINVOKE.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,21 @@ private static int InitFbxAllocators()
694694
[global::System.Runtime.InteropServices.DllImport(DllImportName, EntryPoint="CSharp_UnityfFbxSdk_FbxPropertyEWrapMode_EvaluateValue__SWIG_2___")]
695695
public static extern int FbxPropertyEWrapMode_EvaluateValue__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1);
696696

697+
[global::System.Runtime.InteropServices.DllImport(DllImportName, EntryPoint="CSharp_UnityfFbxSdk_FbxPropertyEGateFit_Set___")]
698+
public static extern global::System.IntPtr FbxPropertyEGateFit_Set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
699+
700+
[global::System.Runtime.InteropServices.DllImport(DllImportName, EntryPoint="CSharp_UnityfFbxSdk_FbxPropertyEGateFit_Get___")]
701+
public static extern int FbxPropertyEGateFit_Get(global::System.Runtime.InteropServices.HandleRef jarg1);
702+
703+
[global::System.Runtime.InteropServices.DllImport(DllImportName, EntryPoint="CSharp_UnityfFbxSdk_FbxPropertyEGateFit_EvaluateValue__SWIG_0___")]
704+
public static extern int FbxPropertyEGateFit_EvaluateValue__SWIG_0(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2, bool jarg3);
705+
706+
[global::System.Runtime.InteropServices.DllImport(DllImportName, EntryPoint="CSharp_UnityfFbxSdk_FbxPropertyEGateFit_EvaluateValue__SWIG_1___")]
707+
public static extern int FbxPropertyEGateFit_EvaluateValue__SWIG_1(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
708+
709+
[global::System.Runtime.InteropServices.DllImport(DllImportName, EntryPoint="CSharp_UnityfFbxSdk_FbxPropertyEGateFit_EvaluateValue__SWIG_2___")]
710+
public static extern int FbxPropertyEGateFit_EvaluateValue__SWIG_2(global::System.Runtime.InteropServices.HandleRef jarg1);
711+
697712
[global::System.Runtime.InteropServices.DllImport(DllImportName, EntryPoint="CSharp_UnityfFbxSdk_FbxLayerElement_SetMappingMode___")]
698713
public static extern void FbxLayerElement_SetMappingMode(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2);
699714

@@ -3657,6 +3672,9 @@ private static int InitFbxAllocators()
36573672
[global::System.Runtime.InteropServices.DllImport(DllImportName, EntryPoint="CSharp_UnityfFbxSdk_FbxCamera_AspectHeight_get___")]
36583673
public static extern global::System.IntPtr FbxCamera_AspectHeight_get(global::System.Runtime.InteropServices.HandleRef jarg1);
36593674

3675+
[global::System.Runtime.InteropServices.DllImport(DllImportName, EntryPoint="CSharp_UnityfFbxSdk_FbxCamera_GateFit_get___")]
3676+
public static extern global::System.IntPtr FbxCamera_GateFit_get(global::System.Runtime.InteropServices.HandleRef jarg1);
3677+
36603678
[global::System.Runtime.InteropServices.DllImport(DllImportName, EntryPoint="CSharp_UnityfFbxSdk_FbxCamera_FieldOfView_get___")]
36613679
public static extern global::System.IntPtr FbxCamera_FieldOfView_get(global::System.Runtime.InteropServices.HandleRef jarg1);
36623680

@@ -3669,6 +3687,12 @@ private static int InitFbxAllocators()
36693687
[global::System.Runtime.InteropServices.DllImport(DllImportName, EntryPoint="CSharp_UnityfFbxSdk_FbxCamera_FilmAspectRatio_get___")]
36703688
public static extern global::System.IntPtr FbxCamera_FilmAspectRatio_get(global::System.Runtime.InteropServices.HandleRef jarg1);
36713689

3690+
[global::System.Runtime.InteropServices.DllImport(DllImportName, EntryPoint="CSharp_UnityfFbxSdk_FbxCamera_FilmOffsetX_get___")]
3691+
public static extern global::System.IntPtr FbxCamera_FilmOffsetX_get(global::System.Runtime.InteropServices.HandleRef jarg1);
3692+
3693+
[global::System.Runtime.InteropServices.DllImport(DllImportName, EntryPoint="CSharp_UnityfFbxSdk_FbxCamera_FilmOffsetY_get___")]
3694+
public static extern global::System.IntPtr FbxCamera_FilmOffsetY_get(global::System.Runtime.InteropServices.HandleRef jarg1);
3695+
36723696
[global::System.Runtime.InteropServices.DllImport(DllImportName, EntryPoint="CSharp_UnityfFbxSdk_FbxCamera_ProjectionType_get___")]
36733697
public static extern global::System.IntPtr FbxCamera_ProjectionType_get(global::System.Runtime.InteropServices.HandleRef jarg1);
36743698

@@ -4186,6 +4210,9 @@ private static int InitFbxAllocators()
41864210
[global::System.Runtime.InteropServices.DllImport(DllImportName, EntryPoint="CSharp_UnityfFbxSdk_FbxPropertyEWrapMode_SWIGUpcast___")]
41874211
public static extern global::System.IntPtr FbxPropertyEWrapMode_SWIGUpcast(global::System.IntPtr jarg1);
41884212

4213+
[global::System.Runtime.InteropServices.DllImport(DllImportName, EntryPoint="CSharp_UnityfFbxSdk_FbxPropertyEGateFit_SWIGUpcast___")]
4214+
public static extern global::System.IntPtr FbxPropertyEGateFit_SWIGUpcast(global::System.IntPtr jarg1);
4215+
41894216
[global::System.Runtime.InteropServices.DllImport(DllImportName, EntryPoint="CSharp_UnityfFbxSdk_FbxLayerElementTemplateFbxVector4_SWIGUpcast___")]
41904217
public static extern global::System.IntPtr FbxLayerElementTemplateFbxVector4_SWIGUpcast(global::System.IntPtr jarg1);
41914218

0 commit comments

Comments
 (0)