Ejemplo n.º 1
0
        void ApplyShot(int index)
        {
            if (index > Storage.shots.Count)
            {
                return;
            }

            ShotManager.ApplyShot(Storage.shots[index - 1], Storage);
        }
Ejemplo n.º 2
0
        public static void PreWarm(ShotObject shotObj)
        {
            if (shotObj == null || shotObj.shots.Count <= 0)
            {
                return;
            }

            var shots = shotObj.shots;

            for (int i = shots.Count - 1; i >= 0; i--)
            {
                ShotManager.ApplyShot(shots[i], shotObj);

                var selections = shots[i].selectedObjs;
                for (int j = selections.Count - 1; j >= 0; j--)
                {
                    ShotManager.ApplySelection(selections[j].SelectedObj);
                }
            }
        }
Ejemplo n.º 3
0
        void OnGUI()
        {
            if (Storage != null)
            {
                RenderShotInspector();
            }

            GUILayout.BeginHorizontal();
            Storage = (ShotObject)EditorGUILayout.ObjectField(Storage, typeof(ShotObject), allowSceneObjects: false);
            if (GUILayout.Button("PreWarm", GUILayout.Width(70)))
            {
                ShotManager.PreWarm(Storage);
            }
            GUILayout.EndHorizontal();

            if (Storage != null)
            {
                EditorUtility.SetDirty(Storage);
            }
        }
Ejemplo n.º 4
0
        void OnGUI()
        {
            if (Storage != null)
            {
                RenderShotInspector();

                //Render new shot buttons
                GUILayout.BeginHorizontal();

                if (GUILayout.Button("New Shot"))
                {
                    Storage.shots.Add(new Shot("New Shot"));
                }

                if (GUILayout.Button("Capture Shot"))
                {
                    Shot shot = new Shot("New Shot");
                    RecordSceneCamera(shot);
                    RecordSelection(shot);
                    RecordTimeStamp(shot);
                    Storage.shots.Add(shot);
                }

                GUILayout.EndHorizontal();
            }

            GUILayout.BeginHorizontal();
            Storage = (ShotObject)EditorGUILayout.ObjectField(Storage, typeof(ShotObject), allowSceneObjects: false);

            if (GUILayout.Button("PreWarm", GUILayout.Width(70)))
            {
                ShotManager.PreWarm(Storage);
            }
            GUILayout.EndHorizontal();

            if (Storage != null)
            {
                EditorUtility.SetDirty(Storage);
            }
        }
Ejemplo n.º 5
0
        public static void ApplyShot(Shot shot, ShotObject shotObj)
        {
            SceneView.lastActiveSceneView.pivot    = shot.position;
            SceneView.lastActiveSceneView.rotation = shot.rotation;
            SceneView.lastActiveSceneView.size     = shot.size;
            SceneView.lastActiveSceneView.Repaint();

            if (shot.selectedObjs.Count > 0)
            {
                ShotManager.ApplySelection(shot.selectedObjs[0].SelectedObj);
            }
            else
            {
                ShotManager.ApplySelection(null);
            }

            if (shotObj != null && shotObj.Director != null)
            {
                shotObj.Director.time = shot.playableTimestamp;
                shotObj.Director.Evaluate();
            }
        }
Ejemplo n.º 6
0
        void RenderShotInspector()
        {
            _v = EditorGUILayout.BeginScrollView(_v);
            foreach (var shot in Storage.shots)
            {
                if (GUILayout.Button(shot.name))
                {
                    ShotManager.ApplyShot(shot, Storage);
                }

                //Render selection buttons
                if (shot.selectedObjs.Count > 0)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Label("Selections: ", GUILayout.Width(80));
                    GUILayout.BeginVertical();
                    GUILayout.BeginHorizontal();
                    for (int i = 0; i < shot.selectedObjs.Count; i++)
                    {
                        if (i != 0 && i % 2 == 0)
                        {
                            GUILayout.EndHorizontal();
                            GUILayout.BeginHorizontal();
                        }

                        if (GUILayout.Button(shot.selectedObjs[i].name, GUILayout.Width(105)))
                        {
                            ShotManager.ApplySelection(shot.selectedObjs[i].SelectedObj);
                        }
                    }
                    GUILayout.EndHorizontal();
                    GUILayout.EndVertical();
                    GUILayout.EndHorizontal();
                }
                GUILayout.Space(10);
            }
            EditorGUILayout.EndScrollView();
        }