Beispiel #1
0
//----------------------------------------------------------------------------------------------------------------------

        //Support Toggle, FloatField, etc
        private F AddPlayerConfigField <F, V>(VisualTreeAsset template, VisualElement parent, GUIContent content,
                                              Action <MeshSyncPlayerConfig, V> onValueChanged) where F : VisualElement, INotifyValueChanged <V>, new()
        {
            TemplateContainer templateInstance = template.CloneTree();
            VisualElement     fieldContainer   = templateInstance.Query <VisualElement>("FieldContainer").First();
//		F field = templateInstance.Query<F>().First();
            Label label = templateInstance.Query <Label>().First();

            label.text    = content.text;
            label.tooltip = content.tooltip;

            F field = new F();

            field.AddToClassList("general-settings-field");
            field.RegisterValueChangedCallback((ChangeEvent <V> changeEvent) => {
                MeshSyncPlayerConfig config = field.userData as MeshSyncPlayerConfig;
                if (null == config)
                {
                    Debug.LogError("[MeshSync] Field doesn't have the correct user data");
                    return;
                }

                onValueChanged(config, changeEvent.newValue);
                MeshSyncRuntimeSettings.GetOrCreateSettings().SaveSettings();
            });

            fieldContainer.Add(field);
            parent.Add(templateInstance);
            m_playerConfigUIElements.Add(field);
            return(field);
        }
Beispiel #2
0
//----------------------------------------------------------------------------------------------------------------------
        private PopupField <T> AddPlayerConfigPopupField <T>(VisualTreeAsset template, VisualElement parent, GUIContent content,
                                                             List <T> options, Action <MeshSyncPlayerConfig, int> onValueChanged)
        {
            TemplateContainer templateInstance = template.CloneTree();
            VisualElement     fieldContainer   = templateInstance.Query <VisualElement>("FieldContainer").First();
            PopupField <T>    popupField       = new PopupField <T>(options, options[0]);

            popupField.AddToClassList("general-settings-field");

            Label label = templateInstance.Query <Label>().First();

            label.text    = content.text;
            label.tooltip = content.tooltip;
            popupField.RegisterValueChangedCallback((ChangeEvent <T> changeEvent) => {
                MeshSyncPlayerConfig config = popupField.userData as MeshSyncPlayerConfig;
                if (null == config)
                {
                    Debug.LogError("[MeshSync] Toggle doesn't have the correct user data");
                    return;
                }

                onValueChanged(config, popupField.index);
                MeshSyncRuntimeSettings.GetOrCreateSettings().SaveSettings();
            });

            fieldContainer.Add(popupField);
            parent.Add(templateInstance);
            m_playerConfigUIElements.Add(popupField);
            return(popupField);
        }
Beispiel #3
0
        protected static bool DrawMiscSettings(BaseMeshSync t)
        {
            bool changed = false;
            MeshSyncPlayerConfig playerConfig = t.GetConfigV();

            // Misc
            t.foldMisc = EditorGUILayout.Foldout(t.foldMisc, "Misc", true, GetBoldFoldoutStyle());
            if (t.foldMisc)
            {
                changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Sync Material List",
                                                                  guiFunc: () => EditorGUILayout.Toggle("Sync Material List", playerConfig.SyncMaterialList),
                                                                  updateFunc: (bool toggle) => { playerConfig.SyncMaterialList = toggle; }
                                                                  );

                changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Progressive Display",
                                                                  guiFunc: () => EditorGUILayout.Toggle("Progressive Display", playerConfig.ProgressiveDisplay),
                                                                  updateFunc: (bool toggle) => { playerConfig.ProgressiveDisplay = toggle; }
                                                                  );


                changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Logging",
                                                                  guiFunc: () => EditorGUILayout.Toggle("Logging", playerConfig.Logging),
                                                                  updateFunc: (bool toggle) => { playerConfig.Logging = toggle; }
                                                                  );

                changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Profiling",
                                                                  guiFunc: () => EditorGUILayout.Toggle("Profiling", playerConfig.Profiling),
                                                                  updateFunc: (bool toggle) => { playerConfig.Profiling = toggle; }
                                                                  );

                EditorGUILayout.Space();
            }

            return(changed);
        }
        public static GameObject CreateSceneCachePlayerPrefab(string path)
        {
            GameObject go = CreateSceneCachePlayer(path);

            if (go == null)
            {
                return(null);
            }

            // export materials & animation and generate prefab
            SceneCachePlayer player = go.GetComponent <SceneCachePlayer>();

            player.UpdatePlayer();
            player.ExportMaterials(false, true);
            player.ResetTimeAnimation();
            player.handleAssets = false;
            SceneData scene = player.GetLastScene();

            if (!scene.submeshesHaveUniqueMaterial)
            {
                MeshSyncPlayerConfig config = player.GetConfig();
                config.SyncMaterialList = false;
            }

            string prefabPath = string.Format("Assets/SceneCache/{0}.prefab", go.name);

            PrefabUtility.SaveAsPrefabAssetAndConnect(go, prefabPath, InteractionMode.AutomatedAction);
            return(go);
        }
//----------------------------------------------------------------------------------------------------------------------



        public override void OnInspectorGUI()
        {
            int numTargets = m_targets.Count;

            if (numTargets >= 2)
            {
                ShowReloadSelectedSceneCacheFilesGUI();
                return;
            }

            Undo.RecordObject(target, "SceneCachePlayer Update");

            EditorGUILayout.Space();
            DrawCacheSettings();
            DrawPlayerSettings(m_sceneCachePlayer);
            MeshSyncPlayerConfig config = m_sceneCachePlayer.GetConfig();

            if (config.Profiling)
            {
                EditorGUILayout.TextArea(m_sceneCachePlayer.dbgProfileReport, GUILayout.Height(120));
                EditorGUILayout.Space();
            }

            DrawMaterialList(m_sceneCachePlayer);
            DrawTextureList(m_sceneCachePlayer);
            DrawAnimationTweak(m_sceneCachePlayer);
            DrawExportAssets(m_sceneCachePlayer);
            DrawPluginVersion();

            PrefabUtility.RecordPrefabInstancePropertyModifications(m_sceneCachePlayer);
        }
Beispiel #6
0
//----------------------------------------------------------------------------------------------------------------------

        protected static bool DrawAssetSyncSettings(BaseMeshSync t)
        {
            t.foldSyncSettings = EditorGUILayout.Foldout(t.foldSyncSettings, "Asset Sync Settings", true, GetBoldFoldoutStyle());
            MeshSyncPlayerConfig config = t.GetConfigV();

            if (!t.foldSyncSettings)
            {
                return(false);
            }

            bool changed = false;

            changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Sync Transform",
                                                              guiFunc: () => EditorGUILayout.Toggle("Update Transform", config.SyncTransform),
                                                              updateFunc: (bool toggle) => { config.SyncTransform = toggle; }
                                                              );

            ComponentSyncSettings syncCameraSettings = config.GetComponentSyncSettings(MeshSyncPlayerConfig.SYNC_CAMERA);

            changed |= MeshSyncInspectorUtility.DrawComponentSyncSettings(t, "Cameras", syncCameraSettings);

            using (new EditorGUI.DisabledScope(!(syncCameraSettings.CanCreate && syncCameraSettings.CanUpdate))) {
                EditorGUI.indentLevel++;

                changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Physical Camera Params",
                                                                  guiFunc: () => EditorGUILayout.Toggle("Use Physical Params", config.IsPhysicalCameraParamsUsed()),
                                                                  updateFunc: (bool toggle) => { config.UsePhysicalCameraParams(toggle); }
                                                                  );

                EditorGUI.indentLevel--;
            }

            changed |= MeshSyncInspectorUtility.DrawComponentSyncSettings(t, "Lights",
                                                                          config.GetComponentSyncSettings(MeshSyncPlayerConfig.SYNC_LIGHTS));


            changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Sync Meshes",
                                                              guiFunc: () => EditorGUILayout.Toggle("Meshes", config.SyncMeshes),
                                                              updateFunc: (bool toggle) => { config.SyncMeshes = toggle; }
                                                              );

            EditorGUI.indentLevel++;
            changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Update Mesh Colliders",
                                                              guiFunc: () => EditorGUILayout.Toggle("Update Mesh Colliders", config.UpdateMeshColliders),
                                                              updateFunc: (bool toggle) => { config.UpdateMeshColliders = toggle; }
                                                              );
            EditorGUI.indentLevel--;

            changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Sync Visibility",
                                                              guiFunc: () => EditorGUILayout.Toggle("Visibility", config.SyncVisibility),
                                                              updateFunc: (bool toggle) => { config.SyncVisibility = toggle; }
                                                              );

            EditorGUILayout.Space();

            return(changed);
        }
        protected static bool DrawImportSettings(BaseMeshSync t)
        {
            bool changed = false;
            MeshSyncPlayerConfig playerConfig = t.GetConfigV();

            t.foldImportSettings = EditorGUILayout.Foldout(t.foldImportSettings, "Import Settings", true, GetBoldFoldoutStyle());
            if (t.foldImportSettings)
            {
                MeshSyncInspectorUtility.DrawModelImporterSettingsGUI(t, playerConfig.GetModelImporterSettings());

                changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Animation Interpolation",
                                                                  guiFunc: () => EditorGUILayout.Popup(new GUIContent("Animation Interpolation"),
                                                                                                       playerConfig.AnimationInterpolation, MeshSyncEditorConstants.ANIMATION_INTERPOLATION_ENUMS),
                                                                  updateFunc: (int val) => { playerConfig.AnimationInterpolation = val; }
                                                                  );


                changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Keyframe Reduction",
                                                                  guiFunc: () => EditorGUILayout.Toggle("Keyframe Reduction", playerConfig.KeyframeReduction),
                                                                  updateFunc: (bool toggle) => { playerConfig.KeyframeReduction = toggle; }
                                                                  );

                if (playerConfig.KeyframeReduction)
                {
                    EditorGUI.indentLevel++;

                    changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Threshold",
                                                                      guiFunc: () => EditorGUILayout.FloatField("Threshold", playerConfig.ReductionThreshold),
                                                                      updateFunc: (float val) => { playerConfig.ReductionThreshold = val; }
                                                                      );

                    changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Erase Flat Curves",
                                                                      guiFunc: () => EditorGUILayout.Toggle("Erase Flat Curves", playerConfig.ReductionEraseFlatCurves),
                                                                      updateFunc: (bool toggle) => { playerConfig.ReductionEraseFlatCurves = toggle; }
                                                                      );
                    EditorGUI.indentLevel--;
                }

                changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Z-Up Correction",
                                                                  guiFunc: () => EditorGUILayout.Popup(new GUIContent("Z-Up Correction"), playerConfig.ZUpCorrection,
                                                                                                       MeshSyncEditorConstants.Z_UP_CORRECTION_ENUMS),
                                                                  updateFunc: (int val) => { playerConfig.ZUpCorrection = val; }
                                                                  );

                EditorGUILayout.Space();
            }

            return(changed);
        }
//----------------------------------------------------------------------------------------------------------------------

        private void UpdatePlayerConfigUIElements(MeshSyncPlayerType playerType)
        {
            MeshSyncProjectSettings projectSettings = MeshSyncProjectSettings.GetOrCreateSettings();
            MeshSyncPlayerConfig    config          = projectSettings.GetDefaultPlayerConfig(playerType);

            //sync
            m_syncVisibilityToggle.SetValueWithoutNotify(config.SyncVisibility);
            m_syncTransformToggle.SetValueWithoutNotify(config.SyncTransform);
            m_syncCamerasToggle.SetValueWithoutNotify(config.SyncCameras);
            m_syncLightsToggle.SetValueWithoutNotify(config.SyncLights);
            m_syncMeshesToggle.SetValueWithoutNotify(config.SyncMeshes);
            m_updateMeshCollidersToggle.SetValueWithoutNotify(config.UpdateMeshColliders);
            m_syncMaterialsToggle.SetValueWithoutNotify(config.SyncMaterials);
            m_findMaterialFromAssetsToggle.SetValueWithoutNotify(config.FindMaterialFromAssets);

            //Import
            m_animationInterpolationPopup.SetValueWithoutNotify(m_animationInterpolationEnums[config.AnimationInterpolation]);
            m_keyframeReductionToggle.SetValueWithoutNotify(config.KeyframeReduction);
            m_reductionThresholdField.SetValueWithoutNotify(config.ReductionThreshold);
            m_reductionEraseFlatCurves.SetValueWithoutNotify(config.ReductionEraseFlatCurves);
            m_zUpCorrectionPopup.SetValueWithoutNotify(m_zUpCorrectionEnums[config.ZUpCorrection]);

            //Misc
            m_syncMaterialListToggle.SetValueWithoutNotify(config.SyncMaterialList);
            m_progressiveDisplayToggle.SetValueWithoutNotify(config.ProgressiveDisplay);
            m_loggingToggle.SetValueWithoutNotify(config.Logging);
            m_profilingToggle.SetValueWithoutNotify(config.Profiling);

            //Animation Tweak
            AnimationTweakSettings animationTweakSettings = config.GetAnimationTweakSettings();

            m_animationTweakTimeScaleField.SetValueWithoutNotify(animationTweakSettings.TimeScale);
            m_animationTweakTimeOffsetField.SetValueWithoutNotify(animationTweakSettings.TimeOffset);
            m_animationTweakDropStepField.SetValueWithoutNotify(animationTweakSettings.DropStep);
            m_animationTweakReductionThresholdField.SetValueWithoutNotify(animationTweakSettings.ReductionThreshold);
            m_animationTweakEraseFlatCurvesToggle.SetValueWithoutNotify(animationTweakSettings.EraseFlatCurves);

            //userData
            foreach (VisualElement uiElement in m_playerConfigUIElements)
            {
                uiElement.userData = config;
            }


            m_selectedPlayerType = playerType;
        }
Beispiel #9
0
//----------------------------------------------------------------------------------------------------------------------

        public override void OnInspectorGUI()
        {
            int numTargets = m_targets.Count;

            if (numTargets >= 2)
            {
                ShowReloadSelectedSceneCacheFilesGUI();
                return;
            }

            //prevent errors when applying new SceneCacheImporter settings
            if (null == m_sceneCachePlayer)
            {
                return;
            }


            EditorGUILayout.Space();
            bool changed = DrawCacheFile(m_sceneCachePlayer);

            DrawCacheInfo(m_sceneCachePlayer);
            changed |= DrawPlaybackMode(m_sceneCachePlayer);
            changed |= DrawAssetSyncSettings(m_sceneCachePlayer);
            changed |= DrawSceneCacheImportSettings(m_sceneCachePlayer);
            changed |= DrawMiscSettings(m_sceneCachePlayer);

            MeshSyncPlayerConfig config = m_sceneCachePlayer.GetConfigV();

            if (config.Profiling)
            {
                EditorGUILayout.TextArea(m_sceneCachePlayer.dbgProfileReport, GUILayout.Height(120));
                EditorGUILayout.Space();
            }

            changed |= DrawDefaultMaterialList(m_sceneCachePlayer);
            DrawExportAssets(m_sceneCachePlayer);
            DrawPluginVersion();

            if (!changed)
            {
                return;
            }

            PrefabUtility.RecordPrefabInstancePropertyModifications(m_sceneCachePlayer);
        }
        public override void OnInspectorGUI()
        {
            var so             = serializedObject;
            SceneCachePlayer t = target as SceneCachePlayer;

            EditorGUILayout.Space();
            DrawCacheSettings(t, so);
            DrawPlayerSettings(t, so);
            MeshSyncPlayerConfig config = t.GetConfig();

            if (config.Profiling)
            {
                EditorGUILayout.TextArea(t.dbgProfileReport, GUILayout.Height(120));
                EditorGUILayout.Space();
            }

            DrawMaterialList(t);
            DrawTextureList(t);
            DrawAnimationTweak(t);
            DrawExportAssets(t);
            DrawPluginVersion();

            so.ApplyModifiedProperties();
        }
//----------------------------------------------------------------------------------------------------------------------

        private static bool DrawSceneCacheImportSettings(SceneCachePlayer t)
        {
            bool changed = false;
            MeshSyncPlayerConfig playerConfig = t.GetConfigV();

            t.foldImportSettings = EditorGUILayout.Foldout(t.foldImportSettings, "Import Settings", true, GetBoldFoldoutStyle());
            if (t.foldImportSettings)
            {
                IHasModelImporterSettings importer         = AssetImporter.GetAtPath(t.GetSceneCacheFilePath()) as IHasModelImporterSettings;
                ModelImporterSettings     importerSettings = playerConfig.GetModelImporterSettings();

                if (null == importer)
                {
                    MeshSyncInspectorUtility.DrawModelImporterSettingsGUI(t, importerSettings);
                }
                else
                {
                    bool isOverride = t.IsModelImporterSettingsOverridden();

                    EditorGUILayout.BeginHorizontal();
                    EditorGUIDrawerUtility.DrawUndoableGUI(t, "Override",
                                                           guiFunc: () => GUILayout.Toggle(isOverride, "", GUILayout.MaxWidth(15.0f)),
                                                           updateFunc: (bool overrideValue) => { t.OverrideModelImporterSettings(overrideValue); });

                    using (new EditorGUI.DisabledScope(!isOverride)) {
                        EditorGUIDrawerUtility.DrawUndoableGUI(t, "Create Materials",
                                                               guiFunc: () => (bool)EditorGUILayout.Toggle("Create Materials", importerSettings.CreateMaterials),
                                                               updateFunc: (bool createMat) => { importerSettings.CreateMaterials = createMat; });
                    }

                    EditorGUILayout.EndHorizontal();

                    using (new EditorGUI.DisabledScope(!isOverride)) {
                        ++EditorGUI.indentLevel;
                        MeshSyncInspectorUtility.DrawModelImporterMaterialSearchMode(t, importerSettings);
                        --EditorGUI.indentLevel;
                    }
                }



                changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Animation Interpolation",
                                                                  guiFunc: () => EditorGUILayout.Popup(new GUIContent("Animation Interpolation"),
                                                                                                       playerConfig.AnimationInterpolation, MeshSyncEditorConstants.ANIMATION_INTERPOLATION_ENUMS),
                                                                  updateFunc: (int val) => { playerConfig.AnimationInterpolation = val; }
                                                                  );


                changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Keyframe Reduction",
                                                                  guiFunc: () => EditorGUILayout.Toggle("Keyframe Reduction", playerConfig.KeyframeReduction),
                                                                  updateFunc: (bool toggle) => { playerConfig.KeyframeReduction = toggle; }
                                                                  );

                if (playerConfig.KeyframeReduction)
                {
                    EditorGUI.indentLevel++;

                    changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Threshold",
                                                                      guiFunc: () => EditorGUILayout.FloatField("Threshold", playerConfig.ReductionThreshold),
                                                                      updateFunc: (float val) => { playerConfig.ReductionThreshold = val; }
                                                                      );

                    changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Erase Flat Curves",
                                                                      guiFunc: () => EditorGUILayout.Toggle("Erase Flat Curves", playerConfig.ReductionEraseFlatCurves),
                                                                      updateFunc: (bool toggle) => { playerConfig.ReductionEraseFlatCurves = toggle; }
                                                                      );
                    EditorGUI.indentLevel--;
                }

                changed |= EditorGUIDrawerUtility.DrawUndoableGUI(t, "MeshSync: Z-Up Correction",
                                                                  guiFunc: () => EditorGUILayout.Popup(new GUIContent("Z-Up Correction"), playerConfig.ZUpCorrection,
                                                                                                       MeshSyncEditorConstants.Z_UP_CORRECTION_ENUMS),
                                                                  updateFunc: (int val) => { playerConfig.ZUpCorrection = val; }
                                                                  );

                EditorGUILayout.Space();
            }

            return(changed);
        }
//----------------------------------------------------------------------------------------------------------------------
        internal void Setup(VisualElement parent)
        {
            bool isSceneCachePlayerConfig           = (m_playerType == MeshSyncPlayerType.CACHE_PLAYER);
            MeshSyncProjectSettings projectSettings = MeshSyncProjectSettings.GetOrCreateInstance();
            MeshSyncPlayerConfig    config          = null;

            config = isSceneCachePlayerConfig
            ? (MeshSyncPlayerConfig)projectSettings.GetDefaultSceneCachePlayerConfig()
            : projectSettings.GetDefaultServerConfig();


            TemplateContainer containerInstance = InstantiateContainer(m_playerType);

            parent.Add(containerInstance);

            //Add server port
            Foldout syncSettingsFoldout = containerInstance.Query <Foldout>("SyncSettingsFoldout").First();

            //Sync
            AddPlayerConfigField <Toggle, bool>(syncSettingsFoldout, Contents.UpdateTransform, config.SyncTransform,
                                                (bool newValue) => { config.SyncTransform = newValue; }
                                                );

            {
                int i = MeshSyncPlayerConfig.SYNC_CAMERA;
                ComponentSyncSettings componentSyncSettings = config.GetComponentSyncSettings(i);
                AddComponentSyncSettingFields(syncSettingsFoldout, Contents.ComponentSyncs[i], componentSyncSettings);
            }

            AddPlayerConfigField <Toggle, bool>(syncSettingsFoldout, Contents.UsePhysicalCameraParams, config.IsPhysicalCameraParamsUsed(),
                                                (bool newValue) => { config.UsePhysicalCameraParams(newValue); },
                                                "inner-field-container"
                                                );

            {
                int i = MeshSyncPlayerConfig.SYNC_LIGHTS;
                ComponentSyncSettings componentSyncSettings = config.GetComponentSyncSettings(i);
                AddComponentSyncSettingFields(syncSettingsFoldout, Contents.ComponentSyncs[i], componentSyncSettings);
            }


            AddPlayerConfigField <Toggle, bool>(syncSettingsFoldout, Contents.Meshes, config.SyncMeshes,
                                                (bool newValue) => { config.SyncMeshes = newValue; }
                                                );
            AddPlayerConfigField <Toggle, bool>(syncSettingsFoldout, Contents.UpdateMeshColliders, config.UpdateMeshColliders,
                                                (bool newValue) => { config.UpdateMeshColliders = newValue; },
                                                "inner-field-container"
                                                );

            AddPlayerConfigField <Toggle, bool>(syncSettingsFoldout, Contents.Visibility, config.SyncVisibility,
                                                (bool newValue) => { config.SyncVisibility = newValue; }
                                                );

            //import
            Foldout importSettingsFoldout = containerInstance.Query <Foldout>("ImportSettingsFoldout").First();
            ModelImporterSettings modelImporterSettings = config.GetModelImporterSettings();

            AddPlayerConfigField <Toggle, bool>(importSettingsFoldout,
                                                Contents.CreateMaterials, modelImporterSettings.CreateMaterials,
                                                (bool newValue) => { modelImporterSettings.CreateMaterials = newValue; }
                                                );
            AddPlayerConfigPopupField(importSettingsFoldout, Contents.MaterialSearchMode, m_assetSearchModeEnums,
                                      m_assetSearchModeEnums[(int)modelImporterSettings.MaterialSearchMode],
                                      (int newValue) => { modelImporterSettings.MaterialSearchMode = (AssetSearchMode)newValue; },
                                      "inner-field-container"
                                      );

            AddPlayerConfigPopupField(importSettingsFoldout, Contents.AnimationInterpolation, m_animationInterpolationEnums,
                                      m_animationInterpolationEnums[config.AnimationInterpolation],
                                      (int newValue) => { config.AnimationInterpolation = newValue; }
                                      );
            AddPlayerConfigField <Toggle, bool>(importSettingsFoldout, Contents.KeyframeReduction, config.KeyframeReduction,
                                                (bool newValue) => { config.KeyframeReduction = newValue; }
                                                );
            AddPlayerConfigField <FloatField, float>(importSettingsFoldout,
                                                     Contents.ReductionThreshold, config.ReductionThreshold,
                                                     (float newValue) => { config.ReductionThreshold = newValue; }
                                                     );
            AddPlayerConfigField <Toggle, bool>(importSettingsFoldout,
                                                Contents.ReductionEraseFlatCurves, config.ReductionEraseFlatCurves,
                                                (bool newValue) => { config.ReductionEraseFlatCurves = newValue; }
                                                );
            AddPlayerConfigPopupField(importSettingsFoldout,
                                      Contents.ZUpCorrection, m_zUpCorrectionEnums, m_zUpCorrectionEnums[config.ZUpCorrection],
                                      (int newValue) => { config.ZUpCorrection = newValue; }
                                      );

            //Misc
            Foldout miscSettingsFoldout = containerInstance.Query <Foldout>("MiscSettingsFoldout").First();

            AddPlayerConfigField <Toggle, bool>(miscSettingsFoldout,
                                                Contents.SyncMaterialList, config.SyncMaterialList,
                                                (bool newValue) => { config.SyncMaterialList = newValue; }
                                                );
            AddPlayerConfigField <Toggle, bool>(miscSettingsFoldout, Contents.ProgressiveDisplay, config.ProgressiveDisplay,
                                                (bool newValue) => { config.ProgressiveDisplay = newValue; }
                                                );
            AddPlayerConfigField <Toggle, bool>(miscSettingsFoldout, Contents.Logging, config.Logging,
                                                (bool newValue) => { config.Logging = newValue; }
                                                );
            AddPlayerConfigField <Toggle, bool>(miscSettingsFoldout, Contents.Profiling, config.Profiling,
                                                (bool newValue) => { config.Profiling = newValue; }
                                                );


            if (!isSceneCachePlayerConfig)
            {
                return;
            }
        }
        public void DrawAnimationTweak(MeshSyncPlayer t)
        {
            var styleFold = EditorStyles.foldout;

            styleFold.fontStyle  = FontStyle.Bold;
            t.foldAnimationTweak = EditorGUILayout.Foldout(t.foldAnimationTweak, "Animation Tweak", true, styleFold);
            if (t.foldAnimationTweak)
            {
                MeshSyncPlayerConfig   config = m_asset.GetConfig();
                AnimationTweakSettings animationTweakSettings = config.GetAnimationTweakSettings();


                // Override Frame Rate
                GUILayout.BeginVertical("Box");
                EditorGUILayout.LabelField("Override Frame Rate", EditorStyles.boldLabel);
                EditorGUI.indentLevel++;
                m_animationFrameRate = EditorGUILayout.FloatField("Frame Rate", m_animationFrameRate);
                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Apply", GUILayout.Width(120.0f)))
                {
                    ApplyFrameRate(t.GetAnimationClips(), m_animationFrameRate);
                }
                GUILayout.EndHorizontal();
                EditorGUI.indentLevel--;
                GUILayout.EndVertical();

                // Time Scale
                GUILayout.BeginVertical("Box");
                EditorGUILayout.LabelField("Time Scale", EditorStyles.boldLabel);
                EditorGUI.indentLevel++;
                EditorGUIFloatField("Scale", ref animationTweakSettings.TimeScale);
                EditorGUIFloatField("Offset", ref animationTweakSettings.TimeOffset);
                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Apply", GUILayout.Width(120.0f)))
                {
                    ApplyTimeScale(t.GetAnimationClips(), animationTweakSettings.TimeScale,
                                   animationTweakSettings.TimeOffset
                                   );
                }
                GUILayout.EndHorizontal();
                EditorGUI.indentLevel--;
                GUILayout.EndVertical();

                // Drop Keyframes
                GUILayout.BeginVertical("Box");
                EditorGUILayout.LabelField("Drop Keyframes", EditorStyles.boldLabel);
                EditorGUI.indentLevel++;
                EditorGUIIntField("Step", ref animationTweakSettings.DropStep);
                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Apply", GUILayout.Width(120.0f)))
                {
                    ApplyDropKeyframes(t.GetAnimationClips(), animationTweakSettings.DropStep);
                }
                GUILayout.EndHorizontal();
                EditorGUI.indentLevel--;
                GUILayout.EndVertical();

                // Keyframe Reduction
                GUILayout.BeginVertical("Box");
                EditorGUILayout.LabelField("Keyframe Reduction", EditorStyles.boldLabel);
                EditorGUI.indentLevel++;
                EditorGUIFloatField("Threshold", ref animationTweakSettings.ReductionThreshold);
                EditorGUIToggle("Erase Flat Curves", ref animationTweakSettings.EraseFlatCurves);
                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Apply", GUILayout.Width(120.0f)))
                {
                    ApplyKeyframeReduction(t.GetAnimationClips(), animationTweakSettings.ReductionThreshold,
                                           animationTweakSettings.EraseFlatCurves
                                           );
                }
                GUILayout.EndHorizontal();
                EditorGUI.indentLevel--;
                GUILayout.EndVertical();

                EditorGUILayout.Space();
            }
        }
Beispiel #14
0
//----------------------------------------------------------------------------------------------------------------------

        protected static bool DrawAnimationTweak(BaseMeshSync player)
        {
            bool changed = false;

            GUIStyle styleFold = EditorStyles.foldout;

            styleFold.fontStyle       = FontStyle.Bold;
            player.foldAnimationTweak = EditorGUILayout.Foldout(player.foldAnimationTweak, "Animation Tweak", true, styleFold);
            if (player.foldAnimationTweak)
            {
                MeshSyncPlayerConfig   config = player.GetConfigV();
                AnimationTweakSettings animationTweakSettings = config.GetAnimationTweakSettings();

                float frameRate            = 30.0f;
                List <AnimationClip> clips = player.GetAnimationClips();
                if (clips.Count > 0)
                {
                    frameRate = clips[0].frameRate;
                }

                {
                    // Override Frame Rate
                    GUILayout.BeginVertical("Box");
                    EditorGUILayout.LabelField("Override Frame Rate", EditorStyles.boldLabel);
                    EditorGUI.indentLevel++;

                    changed |= EditorGUIDrawerUtility.DrawUndoableGUI(player, "MeshSync: Frame Rate",
                                                                      guiFunc: () => EditorGUILayout.FloatField("Frame Rate", frameRate),
                                                                      updateFunc: (float val) => {
                        if (val > 0)
                        {
                            ApplyFrameRate(clips, val);
                        }
                    }
                                                                      );
                    EditorGUI.indentLevel--;
                    GUILayout.EndVertical();
                }



                // Time Scale
                {
                    GUILayout.BeginVertical("Box");
                    EditorGUILayout.LabelField("Time Scale", EditorStyles.boldLabel);
                    EditorGUI.indentLevel++;
                    float prevTimeScale  = animationTweakSettings.TimeScale;
                    float prevTimeOffset = animationTweakSettings.TimeOffset;

                    changed |= EditorGUIDrawerUtility.DrawUndoableGUI(player, "MeshSync: Scale",
                                                                      guiFunc: () => EditorGUILayout.FloatField("Scale", animationTweakSettings.TimeScale),
                                                                      updateFunc: (float val) => { animationTweakSettings.TimeScale = val; }
                                                                      );


                    changed |= EditorGUIDrawerUtility.DrawUndoableGUI(player, "MeshSync: Offset",
                                                                      guiFunc: () => EditorGUILayout.FloatField("Offset", animationTweakSettings.TimeOffset),
                                                                      updateFunc: (float val) => { animationTweakSettings.TimeOffset = val; }
                                                                      );
                    if (!Mathf.Approximately(prevTimeScale, animationTweakSettings.TimeScale) ||
                        !Mathf.Approximately(prevTimeOffset, animationTweakSettings.TimeOffset)
                        )
                    {
                        ApplyTimeScale(clips, animationTweakSettings.TimeScale,
                                       animationTweakSettings.TimeOffset
                                       );
                    }
                    EditorGUI.indentLevel--;
                    GUILayout.EndVertical();
                }

                // Drop Keyframes
                {
                    GUILayout.BeginVertical("Box");
                    EditorGUILayout.LabelField("Drop Keyframes", EditorStyles.boldLabel);
                    EditorGUI.indentLevel++;
                    int prevDropStep = animationTweakSettings.DropStep;

                    changed |= EditorGUIDrawerUtility.DrawUndoableGUI(player, "MeshSync: Step",
                                                                      guiFunc: () => EditorGUILayout.IntField("Step", animationTweakSettings.DropStep),
                                                                      updateFunc: (int val) => { animationTweakSettings.DropStep = val; }
                                                                      );

                    if (prevDropStep != animationTweakSettings.DropStep && animationTweakSettings.DropStep > 1)
                    {
                        ApplyDropKeyframes(clips, animationTweakSettings.DropStep);
                    }
                    EditorGUI.indentLevel--;
                    GUILayout.EndVertical();
                }

                // Keyframe Reduction
                {
                    GUILayout.BeginVertical("Box");
                    EditorGUILayout.LabelField("Keyframe Reduction", EditorStyles.boldLabel);
                    EditorGUI.indentLevel++;
                    float prevReductionThreshold = animationTweakSettings.ReductionThreshold;
                    bool  prevEraseFlatCurves    = animationTweakSettings.EraseFlatCurves;

                    changed |= EditorGUIDrawerUtility.DrawUndoableGUI(player, "MeshSync: Threshold",
                                                                      guiFunc: () => EditorGUILayout.FloatField("Threshold", animationTweakSettings.ReductionThreshold),
                                                                      updateFunc: (float val) => {
                        animationTweakSettings.ReductionThreshold = val;
                        ApplyKeyframeReduction(clips, val, animationTweakSettings.EraseFlatCurves);
                    }
                                                                      );

                    changed |= EditorGUIDrawerUtility.DrawUndoableGUI(player, "MeshSync: Erase Flat Curves",
                                                                      guiFunc: () => EditorGUILayout.Toggle("Erase Flat Curves", animationTweakSettings.EraseFlatCurves),
                                                                      updateFunc: (bool toggle) => {
                        animationTweakSettings.EraseFlatCurves = toggle;
                        ApplyKeyframeReduction(clips, animationTweakSettings.ReductionThreshold, toggle);
                    }
                                                                      );

                    EditorGUI.indentLevel--;
                    GUILayout.EndVertical();
                }

                EditorGUILayout.Space();
            }

            return(changed);
        }
//----------------------------------------------------------------------------------------------------------------------

        protected static void DrawAnimationTweak(MeshSyncPlayer player)
        {
            GUIStyle styleFold = EditorStyles.foldout;

            styleFold.fontStyle       = FontStyle.Bold;
            player.foldAnimationTweak = EditorGUILayout.Foldout(player.foldAnimationTweak, "Animation Tweak", true, styleFold);
            if (player.foldAnimationTweak)
            {
                MeshSyncPlayerConfig   config = player.GetConfig();
                AnimationTweakSettings animationTweakSettings = config.GetAnimationTweakSettings();

                float frameRate            = 30.0f;
                List <AnimationClip> clips = player.GetAnimationClips();
                if (clips.Count > 0)
                {
                    frameRate = clips[0].frameRate;
                }

                {
                    // Override Frame Rate
                    GUILayout.BeginVertical("Box");
                    EditorGUILayout.LabelField("Override Frame Rate", EditorStyles.boldLabel);
                    EditorGUI.indentLevel++;
                    float prevFrameRate = frameRate;
                    frameRate = EditorGUILayout.FloatField("Frame Rate", frameRate);
                    if (!Mathf.Approximately(prevFrameRate, frameRate) && frameRate > 0)
                    {
                        ApplyFrameRate(clips, frameRate);
                    }
                    EditorGUI.indentLevel--;
                    GUILayout.EndVertical();
                }



                // Time Scale
                {
                    GUILayout.BeginVertical("Box");
                    EditorGUILayout.LabelField("Time Scale", EditorStyles.boldLabel);
                    EditorGUI.indentLevel++;
                    float prevTimeScale  = animationTweakSettings.TimeScale;
                    float prevTimeOffset = animationTweakSettings.TimeOffset;
                    EditorGUIFloatField("Scale", ref animationTweakSettings.TimeScale);
                    EditorGUIFloatField("Offset", ref animationTweakSettings.TimeOffset);
                    if (!Mathf.Approximately(prevTimeScale, animationTweakSettings.TimeScale) ||
                        !Mathf.Approximately(prevTimeOffset, animationTweakSettings.TimeOffset)
                        )
                    {
                        ApplyTimeScale(clips, animationTweakSettings.TimeScale,
                                       animationTweakSettings.TimeOffset
                                       );
                    }
                    EditorGUI.indentLevel--;
                    GUILayout.EndVertical();
                }

                // Drop Keyframes
                {
                    GUILayout.BeginVertical("Box");
                    EditorGUILayout.LabelField("Drop Keyframes", EditorStyles.boldLabel);
                    EditorGUI.indentLevel++;
                    int prevDropStep = animationTweakSettings.DropStep;
                    EditorGUIIntField("Step", ref animationTweakSettings.DropStep);
                    if (prevDropStep != animationTweakSettings.DropStep && animationTweakSettings.DropStep > 1)
                    {
                        ApplyDropKeyframes(clips, animationTweakSettings.DropStep);
                    }
                    EditorGUI.indentLevel--;
                    GUILayout.EndVertical();
                }

                // Keyframe Reduction
                {
                    GUILayout.BeginVertical("Box");
                    EditorGUILayout.LabelField("Keyframe Reduction", EditorStyles.boldLabel);
                    EditorGUI.indentLevel++;
                    float prevReductionThreshold = animationTweakSettings.ReductionThreshold;
                    bool  prevEraseFlatCurves    = animationTweakSettings.EraseFlatCurves;
                    EditorGUIFloatField("Threshold", ref animationTweakSettings.ReductionThreshold);
                    EditorGUIToggle("Erase Flat Curves", ref animationTweakSettings.EraseFlatCurves);
                    if (!Mathf.Approximately(prevReductionThreshold, animationTweakSettings.ReductionThreshold) ||
                        prevEraseFlatCurves != animationTweakSettings.EraseFlatCurves)
                    {
                        ApplyKeyframeReduction(clips, animationTweakSettings.ReductionThreshold,
                                               animationTweakSettings.EraseFlatCurves
                                               );
                    }
                    EditorGUI.indentLevel--;
                    GUILayout.EndVertical();
                }

                EditorGUILayout.Space();
            }
        }
//----------------------------------------------------------------------------------------------------------------------

        protected void DrawPlayerSettings(MeshSyncPlayer t, SerializedObject so)
        {
            var styleFold = EditorStyles.foldout;

            styleFold.fontStyle = FontStyle.Bold;

            // Asset Sync Settings
            t.foldSyncSettings = EditorGUILayout.Foldout(t.foldSyncSettings, "Asset Sync Settings", true, styleFold);
            MeshSyncPlayerConfig playerConfig = m_asset.GetConfig();

            if (t.foldSyncSettings)
            {
                EditorGUIToggle("Visibility", ref playerConfig.SyncVisibility);
                EditorGUIToggle("Transform", ref playerConfig.SyncTransform);
                EditorGUIToggle("Cameras", ref playerConfig.SyncCameras);

                if (playerConfig.SyncCameras)
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(so.FindProperty("m_usePhysicalCameraParams"), new GUIContent("Physical Camera Params"));
                    //EditorGUILayout.PropertyField(so.FindProperty("m_useCustomCameraMatrices"), new GUIContent("Custom View/Proj Matrices"));
                    EditorGUI.indentLevel--;
                }
                EditorGUIToggle("Lights", ref playerConfig.SyncLights);
                EditorGUIToggle("Meshes", ref playerConfig.SyncMeshes);

                EditorGUI.indentLevel++;
                EditorGUIToggle("Update Mesh Colliders", ref playerConfig.UpdateMeshColliders);
                EditorGUI.indentLevel--;

                //EditorGUILayout.PropertyField(so.FindProperty("m_syncPoints"), new GUIContent("Points"));
                EditorGUIToggle("Materials", ref playerConfig.SyncMaterials);
                EditorGUI.indentLevel++;
                EditorGUIToggle("Find From AssetDatabase", ref playerConfig.FindMaterialFromAssets);
                EditorGUI.indentLevel--;

                EditorGUILayout.Space();
            }

            // Import Settings
            t.foldImportSettings = EditorGUILayout.Foldout(t.foldImportSettings, "Import Settings", true, styleFold);
            if (t.foldImportSettings)
            {
                EditorGUIPopup(new GUIContent("Animation Interpolation"),
                               m_animationInterpolationEnums, ref playerConfig.AnimationInterpolation
                               );
                EditorGUIToggle("Keyframe Reduction", ref playerConfig.KeyframeReduction);
                if (playerConfig.KeyframeReduction)
                {
                    EditorGUI.indentLevel++;
                    EditorGUIFloatField("Threshold", ref playerConfig.ReductionThreshold);
                    EditorGUIToggle("Erase Flat Curves", ref playerConfig.ReductionEraseFlatCurves);
                    EditorGUI.indentLevel--;
                }
                EditorGUIPopup(new GUIContent("Z-Up Correction"), m_zUpCorrectionEnums, ref playerConfig.ZUpCorrection);
                EditorGUILayout.Space();
            }

            // Misc
            t.foldMisc = EditorGUILayout.Foldout(t.foldMisc, "Misc", true, styleFold);
            if (t.foldMisc)
            {
                EditorGUIToggle("Sync Material List", ref playerConfig.SyncMaterialList);
                EditorGUIToggle("Progressive Display", ref playerConfig.ProgressiveDisplay);
                EditorGUIToggle("Logging", ref playerConfig.Logging);
                EditorGUIToggle("Profiling", ref playerConfig.Profiling);
                EditorGUILayout.Space();
            }
        }
Beispiel #17
0
//----------------------------------------------------------------------------------------------------------------------
        internal void Setup(VisualElement parent)
        {
            bool isSceneCachePlayerConfig = (m_playerType == MeshSyncPlayerType.CACHE_PLAYER);
            MeshSyncPlayerConfig config   = null;

            if (isSceneCachePlayerConfig)
            {
                config = MeshSyncProjectSettings.GetOrCreateSettings().GetDefaultSceneCachePlayerConfig();
            }
            else
            {
                config = MeshSyncProjectSettings.GetOrCreateSettings().GetDefaultServerConfig();
            }


            TemplateContainer containerInstance = InstantiateContainer(m_playerType);

            parent.Add(containerInstance);

            //Add server port
            Foldout syncSettingsFoldout = containerInstance.Query <Foldout>("SyncSettingsFoldout").First();

            //Sync
            AddPlayerConfigField <Toggle, bool>(syncSettingsFoldout, Contents.UpdateTransform, config.SyncTransform,
                                                (bool newValue) => { config.SyncTransform = newValue; }
                                                );

            {
                int i = MeshSyncPlayerConfig.SYNC_CAMERA;
                ComponentSyncSettings componentSyncSettings = config.GetComponentSyncSettings(i);
                AddComponentSyncSettingFields(syncSettingsFoldout, Contents.ComponentSyncs[i], componentSyncSettings);
            }

            AddPlayerConfigField <Toggle, bool>(syncSettingsFoldout, Contents.UsePhysicalCameraParams, config.IsPhysicalCameraParamsUsed(),
                                                (bool newValue) => { config.UsePhysicalCameraParams(newValue); },
                                                "inner-field-container"
                                                );

            {
                int i = MeshSyncPlayerConfig.SYNC_LIGHTS;
                ComponentSyncSettings componentSyncSettings = config.GetComponentSyncSettings(i);
                AddComponentSyncSettingFields(syncSettingsFoldout, Contents.ComponentSyncs[i], componentSyncSettings);
            }


            AddPlayerConfigField <Toggle, bool>(syncSettingsFoldout, Contents.Meshes, config.SyncMeshes,
                                                (bool newValue) => { config.SyncMeshes = newValue; }
                                                );
            AddPlayerConfigField <Toggle, bool>(syncSettingsFoldout, Contents.UpdateMeshColliders, config.UpdateMeshColliders,
                                                (bool newValue) => { config.UpdateMeshColliders = newValue; },
                                                "inner-field-container"
                                                );

            AddPlayerConfigField <Toggle, bool>(syncSettingsFoldout, Contents.Visibility, config.SyncVisibility,
                                                (bool newValue) => { config.SyncVisibility = newValue; }
                                                );

            //import
            Foldout importSettingsFoldout = containerInstance.Query <Foldout>("ImportSettingsFoldout").First();
            ModelImporterSettings modelImporterSettings = config.GetModelImporterSettings();

            AddPlayerConfigField <Toggle, bool>(importSettingsFoldout,
                                                Contents.CreateMaterials, modelImporterSettings.CreateMaterials,
                                                (bool newValue) => { modelImporterSettings.CreateMaterials = newValue; }
                                                );
            AddPlayerConfigPopupField(importSettingsFoldout, Contents.MaterialSearchMode, m_assetSearchModeEnums,
                                      m_assetSearchModeEnums[(int)modelImporterSettings.MaterialSearchMode],
                                      (int newValue) => { modelImporterSettings.MaterialSearchMode = (AssetSearchMode)newValue; },
                                      "inner-field-container"
                                      );

            AddPlayerConfigPopupField(importSettingsFoldout, Contents.AnimationInterpolation, m_animationInterpolationEnums,
                                      m_animationInterpolationEnums[config.AnimationInterpolation],
                                      (int newValue) => { config.AnimationInterpolation = newValue; }
                                      );
            AddPlayerConfigField <Toggle, bool>(importSettingsFoldout, Contents.KeyframeReduction, config.KeyframeReduction,
                                                (bool newValue) => { config.KeyframeReduction = newValue; }
                                                );
            AddPlayerConfigField <FloatField, float>(importSettingsFoldout,
                                                     Contents.ReductionThreshold, config.ReductionThreshold,
                                                     (float newValue) => { config.ReductionThreshold = newValue; }
                                                     );
            AddPlayerConfigField <Toggle, bool>(importSettingsFoldout,
                                                Contents.ReductionEraseFlatCurves, config.ReductionEraseFlatCurves,
                                                (bool newValue) => { config.ReductionEraseFlatCurves = newValue; }
                                                );
            AddPlayerConfigPopupField(importSettingsFoldout,
                                      Contents.ZUpCorrection, m_zUpCorrectionEnums, m_zUpCorrectionEnums[config.ZUpCorrection],
                                      (int newValue) => { config.ZUpCorrection = newValue; }
                                      );

            //Misc
            Foldout miscSettingsFoldout = containerInstance.Query <Foldout>("MiscSettingsFoldout").First();

            AddPlayerConfigField <Toggle, bool>(miscSettingsFoldout,
                                                Contents.SyncMaterialList, config.SyncMaterialList,
                                                (bool newValue) => { config.SyncMaterialList = newValue; }
                                                );
            AddPlayerConfigField <Toggle, bool>(miscSettingsFoldout, Contents.ProgressiveDisplay, config.ProgressiveDisplay,
                                                (bool newValue) => { config.ProgressiveDisplay = newValue; }
                                                );
            AddPlayerConfigField <Toggle, bool>(miscSettingsFoldout, Contents.Logging, config.Logging,
                                                (bool newValue) => { config.Logging = newValue; }
                                                );
            AddPlayerConfigField <Toggle, bool>(miscSettingsFoldout, Contents.Profiling, config.Profiling,
                                                (bool newValue) => { config.Profiling = newValue; }
                                                );

            //Animation Tweak
            Foldout atsFoldout         = containerInstance.Query <Foldout>("AnimationTweakSettingsFoldout").First();
            AnimationTweakSettings ats = config.GetAnimationTweakSettings();

            AddPlayerConfigField <FloatField, float>(atsFoldout, Contents.TweakTimeScale, ats.TimeScale,
                                                     (float newValue) => { ats.TimeScale = newValue; }
                                                     );
            AddPlayerConfigField <FloatField, float>(atsFoldout, Contents.TweakTimeOffset, ats.TimeOffset,
                                                     (float newValue) => { ats.TimeOffset = newValue; }
                                                     );
            AddPlayerConfigField <IntegerField, int>(atsFoldout, Contents.TweakDropStep, ats.DropStep,
                                                     (int newValue) => { ats.DropStep = newValue; }
                                                     );
            AddPlayerConfigField <FloatField, float>(atsFoldout, Contents.TweakReductionThreshold, ats.ReductionThreshold,
                                                     (float newValue) => { ats.ReductionThreshold = newValue; }
                                                     );
            AddPlayerConfigField <Toggle, bool>(atsFoldout, Contents.TweakEraseFlatCurves, ats.EraseFlatCurves,
                                                (bool newValue) => { ats.EraseFlatCurves = newValue; }
                                                );

            if (!isSceneCachePlayerConfig)
            {
                return;
            }

            //Additional UI for SceneCache
            SceneCachePlayerConfig scPlayerConfig = config as SceneCachePlayerConfig;

            Assert.IsNotNull(scPlayerConfig);
            Foldout timelineSettingsFoldout = containerInstance.Query <Foldout>("TimelineSettingsFoldout").First();

            AddPlayerConfigPopupField(timelineSettingsFoldout,
                                      Contents.TimelineSnapToFrame, m_snapToFrameEnums, m_snapToFrameEnums[scPlayerConfig.TimelineSnapToFrame],
                                      (int newValue) => { scPlayerConfig.TimelineSnapToFrame = newValue; }
                                      );
        }