Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
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);
        }