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
                GameObjectBookmark bookmark = this.target.GetComponent <GameObjectBookmark>();
                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 GameObjectInformation(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();
        }
        public static List <MemberInspectorTreeElement> GenerateInspectorTree(GameObjectInformation target)
        {
            var treeBuilder = new TreeBuilder <MemberInspectorTreeElement, ComponentInformation.MemberReference>();

            treeBuilder.AddChildren(target.members, 0);
            return(treeBuilder.ToTree());
        }
 protected override void OnStratusEditorBehaviourEnable()
 {
     if (this._information == null)
     {
         this._information = new GameObjectInformation(gameObject);
     }
     GameObjectBookmark.UpdateAvailable();
 }
        //------------------------------------------------------------------------/
        // Methods: Target Selection
        //------------------------------------------------------------------------/
        private void SelectTarget()
        {
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Target", StratusGUIStyles.header);
            bool changed = StratusEditorUtility.CheckControlChange(() =>
            {
                this.target = (GameObject)EditorGUILayout.ObjectField(this.target, this.gameObjectType, true);
                StratusEditorUtility.OnLastControlMouseClick(null, () =>
                {
                    bool hasBookmark     = this.target.HasComponent <GameObjectBookmark>();
                    string bookmarkLabel = hasBookmark ? "Remove Bookmark" : "Bookmark";
                    GenericMenu menu     = new GenericMenu();

                    // 1. Bookmark
                    if (hasBookmark)
                    {
                        menu.AddItem(new GUIContent(bookmarkLabel), false, () =>
                        {
                            RemoveBookmark(target);
                        });
                    }
                    else
                    {
                        menu.AddItem(new GUIContent(bookmarkLabel), false, () =>
                        {
                            SetBookmark(target);
                        });
                    }

                    // 2. Clear Favorites
                    menu.AddItem(new GUIContent("Clear Watch List"), false, () =>
                    {
                        this.currentTargetInformation.ClearWatchList();
                    });

                    menu.ShowAsContext();
                });
            });

            if (changed)
            {
                if (this.target)
                {
                    this.OnTargetSelected();
                }
                else
                {
                    this.currentTargetInformation = null;

                    if (this.informationMode == InformationMode.Temporary)
                    {
                        this.targetTemporaryInformation = null;
                    }
                }
            }
        }
 private void CheckTarget()
 {
     if (this.target)
     {
         this.OnTargetSelected();
     }
     else
     {
         this.currentTargetInformation = this.targetTemporaryInformation = null;
     }
 }
        public void SetInformation(GameObjectInformation information)
        {
            if (information.target != this.gameObject)
            {
                return;
            }

            this._information = (GameObjectInformation)information.CloneJSON();
            this._information.CacheReferences();
            GameObjectBookmark.UpdateAvailable();
        }
        private void OnGameObjectInformationChanged(GameObjectInformation information, GameObjectInformation.Change change)
        {
            //Trace.Script($"Information changed for {information.target.name}, change = {change}");

            if (change == GameObjectInformation.Change.ComponentsAndWatchList)
            {
                GameObjectBookmark.UpdateWatchList();
            }

            this.SetTreeView();
            //this.OnBookmarkUpdate();
        }
 //------------------------------------------------------------------------/
 // Messages
 //------------------------------------------------------------------------/
 protected override void OnReset()
 {
     this._information = new GameObjectInformation(this.gameObject);
 }