Skip to content

Commit 9505d8c

Browse files
committed
small warning fixes
- add properties to fields in structs - make a couple of functions properties - move preset selector receiver delegates outside of class - move FbxPrefabException out of FbxPrefabAutoUpdater
1 parent 6a2d5b8 commit 9505d8c

File tree

6 files changed

+64
-36
lines changed

6 files changed

+64
-36
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33

44
namespace UnityEditor.Formats.Fbx.Exporter
55
{
6+
public delegate void SelectionChangedDelegate();
7+
public delegate void DialogClosedDelegate();
8+
69
public class FbxExportPresetSelectorReceiver : PresetSelectorReceiver
710
{
811
UnityEngine.Object m_Target;
912
Preset m_InitialValue;
10-
11-
public delegate void SelectionChangedDelegate();
13+
1214
public event SelectionChangedDelegate SelectionChanged;
13-
14-
public delegate void DialogClosedDelegate();
1515
public event DialogClosedDelegate DialogClosed;
1616

1717
public override void OnSelectionClosed(Preset selection)

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

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

149149
if (GUILayout.Button (repairMissingScripts)) {
150150
var componentUpdater = new UnityEditor.Formats.Fbx.Exporter.RepairMissingScripts ();
151-
var filesToRepairCount = componentUpdater.GetAssetsToRepairCount ();
151+
var filesToRepairCount = componentUpdater.AssetsToRepairCount;
152152
var dialogTitle = "FBX Prefab Component Updater";
153153
if (filesToRepairCount > 0) {
154154
bool result = UnityEditor.EditorUtility.DisplayDialog (dialogTitle,

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

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1432,13 +1432,24 @@ protected bool ExportCommonConstraintProperties<TUnityConstraint,TFbxConstraint>
14321432

14331433
protected struct ExpConstraintSource
14341434
{
1435-
public FbxNode node;
1436-
public float weight;
1435+
private FbxNode m_node;
1436+
public FbxNode node
1437+
{
1438+
get { return m_node; }
1439+
set { m_node = value; }
1440+
}
1441+
1442+
private float m_weight;
1443+
public float weight
1444+
{
1445+
get { return m_weight; }
1446+
set { m_weight = value; }
1447+
}
14371448

14381449
public ExpConstraintSource(FbxNode node, float weight)
14391450
{
1440-
this.node = node;
1441-
this.weight = weight;
1451+
this.m_node = node;
1452+
this.m_weight = weight;
14421453
}
14431454
}
14441455

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

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,25 +40,32 @@ private string[] AssetsToRepair{
4040
}
4141
}
4242

43-
public static string GetSourceCodeSearchID()
43+
public static string SourceCodeSearchID
4444
{
45-
var fbxPrefabObj = AssetDatabase.LoadMainAssetAtPath(FbxPrefabAutoUpdater.FindFbxPrefabAssetPath());
46-
string searchID = null;
47-
string guid;
45+
get
46+
{
47+
var fbxPrefabObj = AssetDatabase.LoadMainAssetAtPath(FbxPrefabAutoUpdater.FindFbxPrefabAssetPath());
48+
string searchID = null;
49+
string guid;
4850
#if UNITY_2018_2_OR_NEWER
49-
long fileId;
51+
long fileId;
5052
#else
5153
int fileId;
5254
#endif
53-
if(AssetDatabase.TryGetGUIDAndLocalFileIdentifier(fbxPrefabObj, out guid, out fileId))
54-
{
55-
searchID = string.Format(IdFormat, fileId, guid);
55+
if (AssetDatabase.TryGetGUIDAndLocalFileIdentifier(fbxPrefabObj, out guid, out fileId))
56+
{
57+
searchID = string.Format(IdFormat, fileId, guid);
58+
}
59+
return searchID;
5660
}
57-
return searchID;
5861
}
5962

60-
public int GetAssetsToRepairCount(){
61-
return AssetsToRepair.Length;
63+
public int AssetsToRepairCount
64+
{
65+
get
66+
{
67+
return AssetsToRepair.Length;
68+
}
6269
}
6370

6471
public string[] GetAssetsToRepair(){
@@ -114,7 +121,7 @@ private static bool AssetNeedsRepair(string filePath)
114121

115122
public bool ReplaceGUIDInTextAssets ()
116123
{
117-
string sourceCodeSearchID = GetSourceCodeSearchID();
124+
string sourceCodeSearchID = SourceCodeSearchID;
118125
if(string.IsNullOrEmpty(sourceCodeSearchID))
119126
{
120127
return false;

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@
77

88
namespace UnityEditor.Formats.Fbx.Exporter
99
{
10+
/// <summary>
11+
/// Exception that denotes a likely programming error.
12+
/// </summary>
13+
[System.Serializable]
14+
public class FbxPrefabException : System.Exception
15+
{
16+
public FbxPrefabException() { }
17+
public FbxPrefabException(string message) : base(message) { }
18+
public FbxPrefabException(string message, System.Exception inner) : base(message, inner) { }
19+
protected FbxPrefabException(SerializationInfo info, StreamingContext context) : base(info, context) { }
20+
}
21+
1022
/// <summary>
1123
/// This class handles updating prefabs that are linked to an FBX source file.
1224
///
@@ -512,18 +524,6 @@ public static void Append<TKey1, TKey2, TValue>(ref Dictionary<TKey1, Dictionary
512524
Append(thesubmap, key2, item);
513525
}
514526

515-
/// <summary>
516-
/// Exception that denotes a likely programming error.
517-
/// </summary>
518-
[System.Serializable]
519-
public class FbxPrefabException : System.Exception
520-
{
521-
public FbxPrefabException() { }
522-
public FbxPrefabException(string message) : base(message) { }
523-
public FbxPrefabException(string message, System.Exception inner) : base(message, inner) { }
524-
protected FbxPrefabException(SerializationInfo info, StreamingContext context) : base(info, context) { }
525-
}
526-
527527
/// <summary>
528528
/// Representation of a hierarchy with components.
529529
///

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,18 @@ public AnimationCurve[] Curves
2626

2727

2828
protected struct Key {
29-
public FbxTime time;
30-
public FbxVector4 euler;
29+
private FbxTime m_time;
30+
public FbxTime time
31+
{
32+
get { return m_time; }
33+
set { m_time = value; }
34+
}
35+
private FbxVector4 m_euler;
36+
public FbxVector4 euler
37+
{
38+
get { return m_euler; }
39+
set { m_euler = value; }
40+
}
3141
}
3242

3343
protected RotationCurve() { }
@@ -69,7 +79,7 @@ private Key [] ComputeKeys(UnityEngine.Quaternion restRotation, FbxNode node) {
6979
var fbxFinalQuat = fbxPreRotationInverse * fbxFinalAnimation;
7080

7181
// Store the key so we can sort them later.
72-
Key key;
82+
Key key = new Key();
7383
key.time = FbxTime.FromSecondDouble(seconds);
7484
key.euler = ModelExporter.QuaternionToEuler (fbxFinalQuat);
7585
keys[i++] = key;

0 commit comments

Comments
 (0)