public override void draw(GameObject gameObject, QObjectList objectList, Rect selectionRect) { #if UNITY_2018_3_OR_NEWER PrefabInstanceStatus prefabStatus = PrefabUtility.GetPrefabInstanceStatus(gameObject); if (prefabStatus == PrefabInstanceStatus.MissingAsset || prefabStatus == PrefabInstanceStatus.Disconnected) { QColorUtils.setColor(inactiveColor); GUI.DrawTexture(rect, prefabTexture); QColorUtils.clearColor(); } else if (!showPrefabConnectedIcon && prefabStatus != PrefabInstanceStatus.NotAPrefab) { QColorUtils.setColor(activeColor); GUI.DrawTexture(rect, prefabTexture); QColorUtils.clearColor(); } #else PrefabType prefabType = PrefabUtility.GetPrefabType(gameObject); if (prefabType == PrefabType.MissingPrefabInstance || prefabType == PrefabType.DisconnectedPrefabInstance || prefabType == PrefabType.DisconnectedModelPrefabInstance) { QColorUtils.setColor(inactiveColor); GUI.DrawTexture(rect, prefabTexture); QColorUtils.clearColor(); } else if (!showPrefabConnectedIcon && prefabType != PrefabType.None) { QColorUtils.setColor(activeColor); GUI.DrawTexture(rect, prefabTexture); QColorUtils.clearColor(); } #endif }
public override void draw(GameObject gameObject, QObjectList objectList, Rect selectionRect) { Renderer renderer = gameObject.GetComponent <Renderer>(); if (renderer != null) { bool wireframeHiddenObjectsContains = isWireframeHidden(gameObject, objectList); if (wireframeHiddenObjectsContains) { QColorUtils.setColor(specialColor); GUI.DrawTexture(rect, rendererButtonTexture); QColorUtils.clearColor(); } else if (renderer.enabled) { QColorUtils.setColor(activeColor); GUI.DrawTexture(rect, rendererButtonTexture); QColorUtils.clearColor(); } else { QColorUtils.setColor(inactiveColor); GUI.DrawTexture(rect, rendererButtonTexture); QColorUtils.clearColor(); } } }
public override void draw(GameObject gameObject, QObjectList objectList, Rect selectionRect) { bool foundCustomComponent = false; if (ignoreUnityMonobehaviour) { Component[] components = gameObject.GetComponents <MonoBehaviour>(); for (int i = components.Length - 1; i >= 0; i--) { if (components[i] != null && !components[i].GetType().FullName.Contains("UnityEngine")) { foundCustomComponent = true; break; } } } else { foundCustomComponent = gameObject.GetComponent <MonoBehaviour>() != null; } if (foundCustomComponent) { int ident = Mathf.FloorToInt(selectionRect.x / TREE_STEP_WIDTH) - 1; rect.x = ident * TREE_STEP_WIDTH; rect.y = selectionRect.y; rect.width = 16; #if UNITY_2018_3_OR_NEWER rect.x += TREE_STEP_WIDTH + 1; rect.width += 1; #elif UNITY_5_6_OR_NEWER #elif UNITY_5_3_OR_NEWER rect.x += TREE_STEP_WIDTH; #endif QColorUtils.setColor(iconColor); GUI.DrawTexture(rect, monoBehaviourIconTexture); QColorUtils.clearColor(); if (!showTreeMap && gameObject.transform.childCount == 0) { rect.width = 14; GUI.DrawTexture(rect, monoBehaviourIconObjectTexture); } } }
// DRAW public override void draw(GameObject gameObject, QObjectList objectList, Rect selectionRect) { if (objectList != null) { Color newColor; if (objectList.gameObjectColor.TryGetValue(gameObject, out newColor)) { colorRect.Set(rect.x + 1, rect.y + 1, 5, rect.height - 1); EditorGUI.DrawRect(colorRect, newColor); return; } } QColorUtils.setColor(inactiveColor); GUI.DrawTexture(rect, colorTexture, ScaleMode.StretchToFill, true, 1); QColorUtils.clearColor(); }
public override void draw(GameObject gameObject, QObjectList objectList, Rect selectionRect) { PrefabType prefabType = PrefabUtility.GetPrefabType(gameObject); if (prefabType == PrefabType.MissingPrefabInstance || prefabType == PrefabType.DisconnectedPrefabInstance || prefabType == PrefabType.DisconnectedModelPrefabInstance) { QColorUtils.setColor(inactiveColor); GUI.DrawTexture(rect, prefabTexture); QColorUtils.clearColor(); } else if (!showPrefabConnectedIcon && prefabType != PrefabType.None) { QColorUtils.setColor(activeColor); GUI.DrawTexture(rect, prefabTexture); QColorUtils.clearColor(); } }
public override void draw(GameObject gameObject, QObjectList objectList, Rect selectionRect) { bool isLock = isGameObjectLock(gameObject, objectList); if (isLock == true && (gameObject.hideFlags & HideFlags.NotEditable) != HideFlags.NotEditable) { gameObject.hideFlags |= HideFlags.NotEditable; EditorUtility.SetDirty(gameObject); } else if (isLock == false && (gameObject.hideFlags & HideFlags.NotEditable) == HideFlags.NotEditable) { gameObject.hideFlags ^= HideFlags.NotEditable; EditorUtility.SetDirty(gameObject); } QColorUtils.setColor(isLock ? activeColor : inactiveColor); GUI.DrawTexture(rect, lockButtonTexture); QColorUtils.clearColor(); }
public override void draw(GameObject gameObject, QObjectList objectList, Rect selectionRect) { bool errorFound = findError(gameObject, gameObject.GetComponents <MonoBehaviour>()); if (errorFound) { QColorUtils.setColor(activeColor); GUI.DrawTexture(rect, errorIconTexture); QColorUtils.clearColor(); } else if (showErrorOfChildren) { errorFound = findError(gameObject, gameObject.GetComponentsInChildren <MonoBehaviour>(true)); if (errorFound) { QColorUtils.setColor(inactiveColor); GUI.DrawTexture(rect, errorIconTexture); QColorUtils.clearColor(); } } }
public override void draw(GameObject gameObject, QObjectList objectList, Rect selectionRect) { int visibility = gameObject.activeSelf ? 1 : 0; bool editModeVisibleObjectsContains = isEditModeVisibile(gameObject, objectList); bool editModeInvisibleObjectsContains = isEditModeInvisibile(gameObject, objectList); if (!EditorApplication.isPlayingOrWillChangePlaymode && ((!gameObject.activeSelf && editModeVisibleObjectsContains) || (gameObject.activeSelf && editModeInvisibleObjectsContains))) { gameObject.SetActive(!gameObject.activeSelf); } Transform transform = gameObject.transform; while (transform.parent != null) { transform = transform.parent; if (!transform.gameObject.activeSelf) { visibility = 2; break; } } if (!EditorApplication.isPlayingOrWillChangePlaymode && (editModeVisibleObjectsContains || editModeInvisibleObjectsContains)) { if (visibility == 0) { QColorUtils.setColor(specialColor); GUI.DrawTexture(rect, visibilityOffButtonTexture); } else if (visibility == 1) { QColorUtils.setColor(specialColor); GUI.DrawTexture(rect, visibilityButtonTexture); } else { QColorUtils.setColor(specialColor, 1.0f, 0.4f); GUI.DrawTexture(rect, editModeVisibleObjectsContains ? visibilityButtonTexture : visibilityOffButtonTexture); } } else { if (visibility == 0) { QColorUtils.setColor(inactiveColor); //GUI.DrawTexture(rect, visibilityOffButtonTexture); GUI.Toggle(rect, gameObject.activeSelf, ""); } else if (visibility == 1) { QColorUtils.setColor(activeColor); //GUI.DrawTexture(rect, visibilityButtonTexture); GUI.Toggle(rect, gameObject.activeSelf, ""); } else { if (gameObject.activeSelf) { QColorUtils.setColor(activeColor, 0.65f, 0.65f); //GUI.DrawTexture(rect, visibilityButtonTexture); GUI.Toggle(rect, gameObject.activeSelf, ""); } else { QColorUtils.setColor(inactiveColor, 0.85f, 0.85f); //GUI.DrawTexture(rect, visibilityOffButtonTexture); GUI.Toggle(rect, gameObject.activeSelf, ""); } } } QColorUtils.clearColor(); }
private void drawComponents(List <QBaseComponent> components, Rect selectionRect, ref Rect rect, GameObject gameObject, QObjectList objectList, bool drawBackground = false, float minX = 50) { if (Event.current.type == EventType.Repaint) { int toComponent = components.Count; QLayoutStatus layoutStatus = QLayoutStatus.Success; for (int i = 0, n = toComponent; i < n; i++) { QBaseComponent component = components[i]; if (component.isEnabled()) { layoutStatus = component.layout(gameObject, objectList, selectionRect, ref rect, rect.x - minX); if (layoutStatus != QLayoutStatus.Success) { toComponent = layoutStatus == QLayoutStatus.Failed ? i : i + 1; rect.x -= 7; break; } } else { component.disabledHandler(gameObject, objectList); } } if (drawBackground) { if (backgroundColor.a != 0) { rect.width = selectionRect.x + selectionRect.width - rect.x /*- indentation*/; EditorGUI.DrawRect(rect, backgroundColor); } drawComponents(preComponents, selectionRect, ref rect, gameObject, objectList); } for (int i = 0, n = toComponent; i < n; i++) { QBaseComponent component = components[i]; if (component is QLockComponent && gameObject.tag == "Visual Break") { } else if (component is QVisibilityComponent && gameObject.tag == "Visual Break") { } else { if (component.isEnabled()) { component.draw(gameObject, objectList, selectionRect); } } } if (layoutStatus != QLayoutStatus.Success) { rect.width = 7; QColorUtils.setColor(inactiveColor); GUI.DrawTexture(rect, trimIcon); QColorUtils.clearColor(); } } else if (Event.current.isMouse) { if (gameObject.tag == "Visual Break") { return; } for (int i = 0, n = components.Count; i < n; i++) { QBaseComponent component = components[i]; if (component.isEnabled()) { if (component.layout(gameObject, objectList, selectionRect, ref rect, rect.x - minX) != QLayoutStatus.Failed) { component.eventHandler(gameObject, objectList, Event.current); } } } } }
public override void draw(GameObject gameObject, QObjectList objectList, Rect selectionRect) { int childCount = gameObject.transform.childCount; int level = Mathf.RoundToInt(selectionRect.x / 14.0f); if (enhanced) { Transform gameObjectTransform = gameObject.transform; Transform parentTransform = null; for (int i = 0, j = level - 1; j >= 0; i++, j--) { rect.x = 14 * j; if (i == 0) { if (childCount == 0) { GUI.DrawTexture(rect, treeMapObjectTexture); } gameObjectTransform = gameObject.transform; } else if (i == 1) { QColorUtils.setColor(treeMapColor); if (parentTransform == null) { GUI.DrawTexture(rect, treeMapCurrentTexture); } else if (gameObjectTransform.GetSiblingIndex() == parentTransform.childCount - 1) { GUI.DrawTexture(rect, treeMapLastTexture); } else { GUI.DrawTexture(rect, treeMapCurrentTexture); } gameObjectTransform = parentTransform; } else { if (parentTransform == null) { GUI.DrawTexture(rect, treeMapLevelTexture); } else if (gameObjectTransform.GetSiblingIndex() != parentTransform.childCount - 1) { GUI.DrawTexture(rect, treeMapLevelTexture); } gameObjectTransform = parentTransform; } if (gameObjectTransform != null) { parentTransform = gameObjectTransform.parent; } } QColorUtils.clearColor(); } else { for (int i = 0, j = level - 1; j >= 0; i++, j--) { rect.x = 14 * j; if (i == 0) { if (childCount > 0) { continue; } else { GUI.DrawTexture(rect, treeMapObjectTexture); } } else if (i == 1) { QColorUtils.setColor(treeMapColor); GUI.DrawTexture(rect, treeMapCurrentTexture); } else { rect.width = 14 * 4; rect.x -= 14 * 3; j -= 3; GUI.DrawTexture(rect, treeMapLevel4Texture); rect.width = 14; } } QColorUtils.clearColor(); } }