Skip to content

Commit 7781f92

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/master' into UNI-30766-add-camera-export
2 parents 71c7e85 + cd0309f commit 7781f92

35 files changed

+722
-1340
lines changed

Assets/FbxExporters/Editor/ConvertToModel.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
// ***********************************************************************
2-
// Copyright (c) 2017 Unity Technologies. All rights reserved.
3-
//
4-
// Licensed under the ##LICENSENAME##.
5-
// See LICENSE.md file in the project root for full license information.
6-
// ***********************************************************************
7-
81
using System.IO;
92
using System.Collections.Generic;
103
using UnityEngine;

Assets/FbxExporters/Editor/EditorRotate.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
// ***********************************************************************
2-
// Copyright (c) 2017 Unity Technologies. All rights reserved.
3-
//
4-
// Licensed under the ##LICENSENAME##.
5-
// See LICENSE.md file in the project root for full license information.
6-
// ***********************************************************************
7-
8-
9-
using System.Collections;
1+
using System.Collections;
102
using System.Collections.Generic;
113
using UnityEngine;
124
using UnityEditor;

Assets/FbxExporters/Editor/FbxExportSettings.cs

Lines changed: 161 additions & 73 deletions
Large diffs are not rendered by default.

Assets/FbxExporters/Editor/FbxExporter.cs

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
// ***********************************************************************
2-
// Copyright (c) 2017 Unity Technologies. All rights reserved.
3-
//
4-
// Licensed under the ##LICENSENAME##.
5-
// See LICENSE.md file in the project root for full license information.
6-
// ***********************************************************************
7-
81
using System.IO;
92
using System.Collections.Generic;
103
using UnityEngine;
@@ -54,6 +47,12 @@ public class ModelExporter : System.IDisposable
5447

5548
public const string PACKAGE_UI_NAME = "FBX Exporter";
5649

50+
public enum ExportFormat
51+
{
52+
Binary = 0,
53+
ASCII = 1
54+
}
55+
5756
/// <summary>
5857
/// name of the scene's default camera
5958
/// </summary>
@@ -252,7 +251,7 @@ void ExportComponentAttributes (MeshInfo mesh, FbxMesh fbxMesh, int[] unmergedTr
252251
// set texture coordinates per vertex
253252
FbxLayerElementArray fbxElementArray = fbxLayerElement.GetDirectArray ();
254253

255-
// TODO: only copy unique UVs into this array, and index appropriately
254+
// (Uni-31596) only copy unique UVs into this array, and index appropriately
256255
for (int n = 0; n < mesh.VertexColors.Length; n++) {
257256
// Converting to Color from Color32, as Color32 stores the colors
258257
// as ints between 0-255, while FbxColor and Color
@@ -305,7 +304,7 @@ static void ExportUVs(FbxMesh fbxMesh, MeshInfo mesh, int[] unmergedTriangles)
305304
// set texture coordinates per vertex
306305
FbxLayerElementArray fbxElementArray = fbxLayerElement.GetDirectArray ();
307306

308-
// TODO: only copy unique UVs into this array, and index appropriately
307+
// (Uni-31596) only copy unique UVs into this array, and index appropriately
309308
for (int n = 0; n < uvs[i].Length; n++) {
310309
fbxElementArray.Add (new FbxVector2 (uvs[i] [n] [0],
311310
uvs[i] [n] [1]));
@@ -1118,7 +1117,11 @@ public int ExportAll (IEnumerable<UnityEngine.Object> unityExportSet)
11181117

11191118
// Initialize the exporter.
11201119
// fileFormat must be binary if we are embedding textures
1121-
int fileFormat = fbxManager.GetIOPluginRegistry ().FindWriterIDByDescription ("FBX ascii (*.fbx)");
1120+
int fileFormat = -1;
1121+
if (EditorTools.ExportSettings.instance.ExportFormatSelection == (int)ExportFormat.ASCII)
1122+
{
1123+
fileFormat = fbxManager.GetIOPluginRegistry().FindWriterIDByDescription("FBX ascii (*.fbx)");
1124+
}
11221125

11231126
status = fbxExporter.Initialize (m_tempFilePath, fileFormat, fbxManager.GetIOSettings ());
11241127
// Check that initialization of the fbxExporter was successful
@@ -1380,7 +1383,7 @@ public Vector3 [] Normals { get {
13801383
} }
13811384

13821385
/// <summary>
1383-
/// TODO: Gets the binormals for the vertices.
1386+
/// Gets the binormals for the vertices.
13841387
/// </summary>
13851388
/// <value>The normals.</value>
13861389
private Vector3[] m_Binormals;
@@ -1408,7 +1411,7 @@ public Vector3 [] Binormals {
14081411
}
14091412

14101413
/// <summary>
1411-
/// TODO: Gets the tangents for the vertices.
1414+
/// Gets the tangents for the vertices.
14121415
/// </summary>
14131416
/// <value>The tangents.</value>
14141417
private Vector4[] m_tangents;
@@ -1420,7 +1423,7 @@ public Vector4 [] Tangents { get {
14201423
} }
14211424

14221425
/// <summary>
1423-
/// TODO: Gets the vertex colors for the vertices.
1426+
/// Gets the vertex colors for the vertices.
14241427
/// </summary>
14251428
/// <value>The vertex colors.</value>
14261429
private Color32 [] m_vertexColors;

Assets/FbxExporters/Editor/FbxPrefabAutoUpdater.cs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -773,11 +773,11 @@ void ClassifyComponents(Transform newFbx, Transform prefab)
773773
// same node), we line up the components in the order they
774774
// appear. This never happens in stock Unity, someone must have
775775
// added an AssetPostprocessor for it to occur.
776-
// TODO: do something smarter.
776+
// (Uni-31604) Improve how the auto-updater classifies components
777777
//
778778
// If the node isn't going to be in the prefab, we don't care
779779
// about what components might be on it.
780-
foreach(var name in m_nodesInUpdatedPrefab)
780+
foreach (var name in m_nodesInUpdatedPrefab)
781781
{
782782
if (!m_new.HasNode(name)) {
783783
// It's not in the FBX, so clearly we're not updating any components.
@@ -794,18 +794,12 @@ void ClassifyComponents(Transform newFbx, Transform prefab)
794794
List<string> prefabValues = null; // get them only if we need them.
795795

796796
// If we have multiple identical-type components, match them up by index.
797-
// TODO: match them up to minimize the diff instead.
798797
int oldN = oldValues.Count;
799798
int newN = newValues.Count;
800799
for(int i = 0, n = System.Math.Max(oldN, newN); i < n; ++i) {
801800
if (/* isNew */ i < newN) {
802801
var newValue = newValues[i];
803-
804-
// Special case on Transform: if we reparented
805-
// this node then always update the transform
806-
// (UNI-25526). That's because when we do the
807-
// reparenting, it changes the 'prefabValue' in
808-
// a complicated way.
802+
809803
var isReparentedTransform = (typename == "UnityEngine.Transform"
810804
&& m_reparentings.ContainsKey(name));
811805

Assets/FbxExporters/Editor/FbxPrefabInspector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public override void OnInspectorGUI() {
1818

1919
var fbxPrefabUtility = new FbxPrefabAutoUpdater.FbxPrefabUtility (fbxPrefab);
2020
var oldFbxAsset = fbxPrefabUtility.GetFbxAsset();
21-
var newFbxAsset = EditorGUILayout.ObjectField("Source Fbx Asset", oldFbxAsset,
21+
var newFbxAsset = EditorGUILayout.ObjectField(new GUIContent("Source Fbx Asset", "The FBX file that is linked to this Prefab"), oldFbxAsset,
2222
typeof(GameObject), allowSceneObjects: false) as GameObject;
2323
if (newFbxAsset && !AssetDatabase.GetAssetPath(newFbxAsset).EndsWith(".fbx")) {
2424
Debug.LogError("FbxPrefab must point to an Fbx asset (or none).");

0 commit comments

Comments
 (0)