internal void OnGUI() { GrendelHierarchyLayerPreview.DrawPopup(GrendelHierarchyLayerPreview.CurrentPopupState); Repaint(); }
private static void OnHierarchyWindowItemOnGUI(int instanceID, Rect position) { sCurrentIndentAmount = (int)((position.x / kIndentWidth) - 1); GameObject gameObject = (GameObject)EditorUtility.InstanceIDToObject(instanceID); if (gameObject == null) { return; } sCurrentObjectData = GrendelHierarchy.EnsureObjectHasGrendelData(gameObject); if (sCurrentObjectData == null) { return; } sCurrentItemPosition = new Rect(position); sCurrentTransform = gameObject.transform; sCurrentParents = new List <Transform>(gameObject.GetComponentsInParent <Transform>(true)); if (sCurrentParents.Count > 0 && sCurrentParents.Contains(gameObject.transform)) { sCurrentParents.Remove(gameObject.transform); } sCurrentChildCount = gameObject.transform.childCount; sCurrentParentCount = sCurrentParents.Count; if (sPreviousItemPosition.y > position.y) { //we're back at the top of the hierarchy sTotalCurrentObjectCount = sCurrentObjectIndex; sCurrentObjectIndex = 0; RefreshLayerVisibility(); } GrendelFolderComponent folderComponent = gameObject.GetComponent <GrendelFolderComponent>(); if (folderComponent != null && !IsGameObjectBeingRenamed(gameObject)) { GrendelFolder.DrawFolder(position, folderComponent, CurrentRowColor); } ColorNextRow(position); //if (gameObject.transform.parent != null) //{ // GUI.Label(position, "------------------" + EditorWindow.GetWindowWithRect<EditorWindow>(sCurrentItemPosition).ToString()); //} if (GrendelPreferencesHierarchy.sTreeViewEnabled.BoolValue) { GrendelHierarchyTreeView.DrawTreeBranch(gameObject, position, sCurrentIndentAmount, sPreviousIndentAmount); } Rect previewPosition = new Rect(position); previewPosition.x -= kIconWidth; previewPosition.width = kIconWidth; GrendelHierarchyObjectPreview.DrawPreview(gameObject, previewPosition, position, folderComponent == null); Rect sideBarPosition = new Rect(position); sideBarPosition.width += (sCurrentIndentAmount + 1) * kIndentWidth; DrawSidebar(sideBarPosition); Rect iconPosition = new Rect(position); iconPosition.width = kIconWidth; iconPosition.x = (position.width - kIconWidth) + kIconRightMargin; iconPosition.x += (kIndentWidth * sCurrentIndentAmount); GrendelLockButton.DrawLockButton(sCurrentObjectData, iconPosition); iconPosition.x -= (kIconWidth + kIconBufferWidth); GrendelHideButton.DrawHideButton(sCurrentObjectData, iconPosition); Rect layerPreviewPosition = new Rect(iconPosition); if (GrendelPreferencesHierarchy.sLayerPreviewEnabled.BoolValue) { layerPreviewPosition.x -= (kIconWidth * 2) + (kIconBufferWidth * 2); layerPreviewPosition.width = kIconWidth * 2; GrendelHierarchyLayerPreview.DrawLayerPreview(sCurrentObjectData, layerPreviewPosition); } if (GrendelPreferencesHierarchy.sComponentPreviewEnabled.BoolValue) { iconPosition = new Rect(layerPreviewPosition); iconPosition.x -= (kIconWidth) + (kIconBufferWidth); iconPosition.width = kIconWidth; GrendelHierarchyObjectPreview.DrawTypeIcon(iconPosition, gameObject, folderComponent); } sPreviousIndentAmount = sCurrentIndentAmount; sPreviousItemPosition = new Rect(position); sCurrentObjectIndex++; }