Skip to content

Commit 7e2cb21

Browse files
committed
give different warning if export set contains animation
1 parent f64128c commit 7e2cb21

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

Assets/FbxExporters/Editor/ConvertToPrefabEditorWindow.cs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,19 @@ protected override void OnEnable ()
8282
m_prefabExtLabelWidth = m_fbxExtLabelStyle.CalcSize (new GUIContent (".prefab")).x;
8383
}
8484

85+
protected bool ExportSetContainsAnimation ()
86+
{
87+
foreach(var obj in ToExport)
88+
{
89+
var go = ModelExporter.GetGameObject(obj);
90+
if(go.GetComponentInChildren<Animation>() || go.GetComponentInChildren<Animator>())
91+
{
92+
return true;
93+
}
94+
}
95+
return false;
96+
}
97+
8598
protected override bool Export ()
8699
{
87100
if (string.IsNullOrEmpty (m_exportFileName)) {
@@ -107,11 +120,16 @@ protected override bool Export ()
107120

108121
if (SettingsObject.UseMayaCompatibleNames && SettingsObject.AllowSceneModification)
109122
{
123+
string warning = "Names of objects in the hierarchy may change with the Compatible Naming option turned on";
124+
if (ExportSetContainsAnimation())
125+
{
126+
warning = "Compatible Naming option turned on. Names of objects in hierarchy may change and break animations.";
127+
}
128+
110129
// give a warning dialog that indicates that names in the scene may change
111130
int result = UnityEditor.EditorUtility.DisplayDialogComplex(
112-
string.Format("{0} Warning", ModelExporter.PACKAGE_UI_NAME),
113-
"Names of objects in the hierarchy may change with the Compatible Naming option turned on",
114-
"OK", "Turn off and convert", "Cancel");
131+
string.Format("{0} Warning", ModelExporter.PACKAGE_UI_NAME), warning, "OK", "Turn off and convert", "Cancel"
132+
);
115133
if (result == 1)
116134
{
117135
// turn compatible naming off

0 commit comments

Comments
 (0)