private void OnTargetSelected()
        {
            // If there's no target information or if the target is different from the previous
            //if (this.currentTargetInformation == null || this.currentTargetInformation.target != this.target)
            {
                // If the target has as bookmark, use that information instead
                StratusGameObjectBookmark bookmark = this.target.GetComponent <StratusGameObjectBookmark>();
                if (bookmark != null)
                {
                    this.informationMode          = InformationMode.Bookmark;
                    this.currentTargetInformation = bookmark.information;
                }
                // Otherwise recreate the current target information
                else if (this.currentTargetInformation == null || this.currentTargetInformation.target != this.target)
                {
                    this.informationMode            = InformationMode.Temporary;
                    this.targetTemporaryInformation = new StratusGameObjectInformation(this.target);
                    this.currentTargetInformation   = this.targetTemporaryInformation;
                }

                //Trace.Script($"Setting target information for {this.target.name}");
            }

            //this.showComponent = this.GenerateAnimBools(this.currentTargetInformation.numberofComponents, false);
            //this.componentList = new DropdownList<ComponentInformation>(this.currentTargetInformation.components, (ComponentInformation component) => component.name, this.lastComponentIndex);
            this.SetTreeView();
        }
        private void ShowSceneObjects()
        {
            for (int b = 0; b < sceneBookmarks.Count; ++b)
            {
                StratusGameObjectBookmark bookmark = sceneBookmarks[b];

                EditorGUILayout.ObjectField(bookmark, bookmark.GetType(), true);
                StratusEditorUtility.OnLastControlMouseClick(
                    // Left
                    () =>
                {
                    this.SelectBookmark(bookmark);
                },

                    // Right
                    () =>
                {
                    GenericMenu menu = new GenericMenu();
                    menu.AddItem(new GUIContent("Inspect"), false, () =>
                    {
                        MemberInspectorWindow.Inspect(bookmark.gameObject);
                    });
                    menu.AddItem(new GUIContent("Remove"), false,
                                 () =>
                    {
                        DestroyImmediate(bookmark);
                    }
                                 );
                    menu.ShowAsContext();
                },

                    null);
            }
        }
 public static void RemoveBookmark(GameObject target)
 {
     instance.targetTemporaryInformation = (StratusGameObjectInformation)instance.currentTargetInformation.CloneJSON();
     instance.targetTemporaryInformation.ClearWatchList();
     instance.currentTargetInformation = instance.targetTemporaryInformation;
     StratusGameObjectBookmark.Remove(target);
     instance.informationMode = InformationMode.Temporary;
 }
        public static void SetBookmark(GameObject target)
        {
            StratusGameObjectBookmark bookmark = StratusGameObjectBookmark.Add(target);

            bookmark.SetInformation(instance.currentTargetInformation);
            instance.currentTargetInformation = bookmark.information;
            instance.informationMode          = InformationMode.Bookmark;
        }
示例#5
0
        //------------------------------------------------------------------------/
        // Methods: Watch
        //------------------------------------------------------------------------/
        /// <summary>
        /// Clears the watchlist for every component
        /// </summary>
        public void ClearWatchList()
        {
            foreach (var component in this.components)
            {
                component.ClearWatchList(false);
            }

            StratusGameObjectBookmark.UpdateWatchList();
        }
示例#6
0
 /// <summary>
 /// Removes a member from the watch list
 /// </summary>
 /// <param name="memberReference"></param>
 public void RemoveWatch(StratusComponentInformation.MemberReference memberReference)
 {
     memberReference.isWatched = false;
     if (this.AssertMemberIndex(memberReference))
     {
         this.watchList.RemoveAll(x => x.name == memberReference.name && x.memberIndex == memberReference.memberIndex);
         StratusGameObjectBookmark.UpdateWatchList(true);
     }
 }
示例#7
0
 /// <summary>
 /// Adds a member to the watch list
 /// </summary>
 /// <param name="member"></param>
 /// <param name="componentInfo"></param>
 /// <param name="memberIndex"></param>
 public void Watch(StratusComponentInformation.MemberReference memberReference)
 {
     memberReference.isWatched = true;
     if (this.AssertMemberIndex(memberReference))
     {
         this.watchList.Add(memberReference);
         StratusGameObjectBookmark.UpdateWatchList(true);
     }
 }
示例#8
0
 public static void OnPostProcessScene()
 {
     if (UnityEditor.BuildPipeline.isBuildingPlayer)
     {
         StratusDebug.Log($"Removing all instances of:");
         StratusGameObjectBookmark.RemoveAll();
     }
     else
     {
         //Trace.Script($"In Editor. Not removing!");
     }
 }
        private void OnGameObjectInformationChanged(StratusGameObjectInformation information, StratusGameObjectInformation.Change change)
        {
            //Trace.Script($"Information changed for {information.target.name}, change = {change}");

            if (change == StratusGameObjectInformation.Change.ComponentsAndWatchList)
            {
                StratusGameObjectBookmark.UpdateWatchList();
            }

            this.SetTreeView();
            //this.OnBookmarkUpdate();
        }
示例#10
0
        /// <summary>
        /// Clears the watchlist
        /// </summary>
        public void ClearWatchList(bool updateBookmark = true)
        {
            // Clear the watch list
            foreach (var member in this.watchList)
            {
                member.isWatched = false;
            }
            this.watchList.Clear();

            // Optionally, let the bookmarks know
            if (updateBookmark)
            {
                StratusGameObjectBookmark.UpdateWatchList();
            }
        }