示例#1
0
        public void TestExportOptionsReset()
        {
            var instance      = ExportSettings.instance;
            var go            = new GameObject("temp");
            var exportWindow  = ExportModelEditorWindow.Init(new Object[] { go });
            var convertWindow = ConvertToPrefabEditorWindow.Init(new GameObject[] { go });

            // test export window reset
            // change one setting from default
            instance.ExportModelSettings.info.SetExportFormat(ExportSettings.ExportFormat.Binary);
            Assert.That(instance.ExportModelSettings.info.ExportFormat, Is.EqualTo(ExportSettings.ExportFormat.Binary));

            // reset export settings
            instance.Reset();

            // check that setting was reverted to default
            Assert.That(instance.ExportModelSettings.info.ExportFormat, Is.EqualTo(ExportSettings.ExportFormat.ASCII));

            exportWindow.ResetSessionSettings();
            exportWindow.Close();

            // test convert prefab window reset
            // change one setting from default
            instance.ConvertToPrefabSettings.info.SetExportFormat(ExportSettings.ExportFormat.Binary);
            Assert.That(instance.ConvertToPrefabSettings.info.ExportFormat, Is.EqualTo(ExportSettings.ExportFormat.Binary));

            // reset export settings
            instance.Reset();

            // check that setting was reverted to default
            Assert.That(instance.ConvertToPrefabSettings.info.ExportFormat, Is.EqualTo(ExportSettings.ExportFormat.ASCII));

            convertWindow.ResetSessionSettings();
            convertWindow.Close();
        }
示例#2
0
        public void TestExportOptionsFbxSavePath()
        {
            // check that adding a path or modifying selection in export options window does not modify project
            // settings and vice versa
            var instance = ExportSettings.instance;

            var go           = new GameObject("temp");
            var exportWindow = ExportModelEditorWindow.Init(new Object[] { go }, isTimelineAnim: false);

            // clear any previous settings
            exportWindow.ResetSessionSettings();
            var savePathCount = exportWindow.FbxSavePaths.Count;

            // to begin the list of paths should match
            Assert.That(instance.GetCopyOfFbxSavePaths(), Is.EquivalentTo(exportWindow.FbxSavePaths));

            var randomFilePath = GetRandomFileNamePath();

            ExportSettings.AddSavePath(randomFilePath, exportWindow.FbxSavePaths);
            Assert.That(exportWindow.FbxSavePaths.Count, Is.EqualTo(savePathCount + 1));

            exportWindow.SaveExportSettings();

            // make sure the project settings didn't change
            Assert.That(instance.GetCopyOfFbxSavePaths(), Is.Not.EquivalentTo(exportWindow.FbxSavePaths));

            // now change the project settings and make sure the export options paths don't change
            var randomFilePath2 = GetRandomFileNamePath();

            ExportSettings.AddFbxSavePath(randomFilePath2);

            var projectSettingsFbxSavePaths = instance.GetCopyOfFbxSavePaths();

            Assert.That(exportWindow.FbxSavePaths, Is.Not.EquivalentTo(projectSettingsFbxSavePaths));
            Assert.That(exportWindow.FbxSavePaths.Count, Is.EqualTo(savePathCount + 1));

            // When the settings are cleared the file paths should match again
            exportWindow.ResetSessionSettings();

            Assert.That(projectSettingsFbxSavePaths, Is.EquivalentTo(exportWindow.FbxSavePaths));

            exportWindow.Close();
        }
示例#3
0
        public void TestExportOptionsWindow()
        {
            var instance = ExportSettings.instance;

            // check loading export settings from preset
            var exportSettingsPreset = ScriptableObject.CreateInstance(typeof(ExportModelSettings)) as ExportModelSettings;

            exportSettingsPreset.info.SetAnimatedSkinnedMesh(true);
            exportSettingsPreset.info.SetExportFormat(ExportSettings.ExportFormat.ASCII);
            var preset = new Preset(exportSettingsPreset);

            // set default preset
            var type = preset.GetPresetType();

            Assert.That(type.IsValidDefault(), Is.True);
            var defaultPreset = new DefaultPreset(string.Empty, preset);

            Assert.That(Preset.SetDefaultPresetsForType(type, new DefaultPreset[] { defaultPreset }), Is.True);

            // make sure the instance settings do not match the preset
            instance.ExportModelSettings.info.SetAnimatedSkinnedMesh(false);
            instance.ExportModelSettings.info.SetExportFormat(ExportSettings.ExportFormat.Binary);

            Assert.That(exportSettingsPreset.info.AnimateSkinnedMesh, Is.Not.EqualTo(instance.ExportModelSettings.info.AnimateSkinnedMesh));
            Assert.That(exportSettingsPreset.info.ExportFormat, Is.Not.EqualTo(instance.ExportModelSettings.info.ExportFormat));

            // create an empty object to have something in the export set
            var go = new GameObject("temp");

            var exportWindow = ExportModelEditorWindow.Init(new Object[] { go }, isTimelineAnim: false);

            // clear any previous settings
            exportWindow.ResetSessionSettings();
            Assert.That(exportWindow.ExportModelSettingsInstance.info.AnimateSkinnedMesh, Is.EqualTo(exportSettingsPreset.info.AnimateSkinnedMesh));
            Assert.That(exportWindow.ExportModelSettingsInstance.info.ExportFormat, Is.EqualTo(exportSettingsPreset.info.ExportFormat));
            exportWindow.Close();

            // check loading export settings from project settings
            // remove preset
            Preset.RemoveFromDefault(preset);
            Assert.That(Preset.GetDefaultPresetsForType(type), Is.Empty);

            exportWindow = ExportModelEditorWindow.Init(new Object[] { go }, isTimelineAnim: false);
            // clear any previous settings
            exportWindow.ResetSessionSettings();
            Assert.That(exportWindow.ExportModelSettingsInstance.info.AnimateSkinnedMesh, Is.EqualTo(instance.ExportModelSettings.info.AnimateSkinnedMesh));
            Assert.That(exportWindow.ExportModelSettingsInstance.info.ExportFormat, Is.EqualTo(instance.ExportModelSettings.info.ExportFormat));

            // check modifying export settings persist and don't modify project settings
            exportWindow.ExportModelSettingsInstance.info.SetAnimatedSkinnedMesh(true);
            exportWindow.ExportModelSettingsInstance.info.SetExportFormat(ExportSettings.ExportFormat.ASCII);
            exportWindow.SaveExportSettings();

            exportWindow.Close();
            exportWindow = ExportModelEditorWindow.Init(new Object[] { go }, isTimelineAnim: false);

            Assert.That(exportWindow.ExportModelSettingsInstance.info.AnimateSkinnedMesh, Is.Not.EqualTo(instance.ExportModelSettings.info.AnimateSkinnedMesh));
            Assert.That(exportWindow.ExportModelSettingsInstance.info.ExportFormat, Is.Not.EqualTo(instance.ExportModelSettings.info.ExportFormat));

            // make sure these settings don't persist and close window
            exportWindow.ResetSessionSettings();
            exportWindow.Close();
        }