private void setLock(List <GameObject> gameObjects, QObjectList objectList, bool targetLock) { if (gameObjects.Count == 0) { return; } if (objectList == null) { objectList = QObjectListManager.getInstance().getObjectList(gameObjects[0], true); } Undo.RecordObject(objectList, targetLock ? "Lock" : "Unlock"); for (int i = gameObjects.Count - 1; i >= 0; i--) { GameObject curGameObject = gameObjects[i]; Undo.RecordObject(curGameObject, targetLock ? "Lock" : "Unlock"); if (targetLock) { curGameObject.hideFlags |= HideFlags.NotEditable; if (!objectList.lockedObjects.Contains(curGameObject)) { objectList.lockedObjects.Add(curGameObject); } } else { curGameObject.hideFlags &= ~HideFlags.NotEditable; objectList.lockedObjects.Remove(curGameObject); } EditorUtility.SetDirty(curGameObject); } }
public void hierarchyWindowItemOnGUIHandler(int instanceId, Rect selectionRect) { try { QColorUtils.setDefaultColor(GUI.color); GameObject gameObject = (GameObject)EditorUtility.InstanceIDToObject(instanceId); if (gameObject == null) { return; } Rect curRect = new Rect(selectionRect); curRect.width = 16; curRect.x += selectionRect.width - indentation; float gameObjectNameWidth = hideIconsIfThereIsNoFreeSpace ? GUI.skin.label.CalcSize(new GUIContent(gameObject.name)).x : 0; QObjectList objectList = QObjectListManager.getInstance().getObjectList(gameObject, false); drawComponents(orderedComponents, selectionRect, ref curRect, gameObject, objectList, true, hideIconsIfThereIsNoFreeSpace ? selectionRect.x + gameObjectNameWidth + 7 : 0); errorHandled.Remove(instanceId); } catch (Exception exception) { if (errorHandled.Add(instanceId)) { Debug.LogError(exception.ToString()); } } }
static void hierarchyWindowChanged() { if (hierarchy == null) { init(); } QObjectListManager.getInstance().validate(); }
static void update() { if (hierarchy == null) { init(); } QObjectListManager.getInstance().update(); }
private void setVisibility(List <GameObject> gameObjects, QObjectList objectList, bool targetVisibility, bool editMode) { if (gameObjects.Count == 0) { return; } if (objectList == null && editMode) { objectList = QObjectListManager.getInstance().getObjectList(gameObjects[0], true); } if (objectList != null) { Undo.RecordObject(objectList, "visibility change"); } for (int i = gameObjects.Count - 1; i >= 0; i--) { GameObject curGameObject = gameObjects[i]; Undo.RecordObject(curGameObject, "visibility change"); if (editMode) { if (!targetVisibility) { objectList.editModeVisibileObjects.Remove(curGameObject); if (!objectList.editModeInvisibleObjects.Contains(curGameObject)) { objectList.editModeInvisibleObjects.Add(curGameObject); } } else { objectList.editModeInvisibleObjects.Remove(curGameObject); if (!objectList.editModeVisibileObjects.Contains(curGameObject)) { objectList.editModeVisibileObjects.Add(curGameObject); } } } else if (objectList != null) { objectList.editModeVisibileObjects.Remove(curGameObject); objectList.editModeInvisibleObjects.Remove(curGameObject); } curGameObject.SetActive(targetVisibility); EditorUtility.SetDirty(curGameObject); } }
private void colorRemovedHandler(GameObject[] gameObjects) { for (int i = gameObjects.Length - 1; i >= 0; i--) { GameObject gameObject = gameObjects[i]; QObjectList objectList = QObjectListManager.getInstance().getObjectList(gameObjects[i], true); if (objectList.gameObjectColor.ContainsKey(gameObject)) { Undo.RecordObject(objectList, "Color Changed"); objectList.gameObjectColor.Remove(gameObject); } } EditorApplication.RepaintHierarchyWindow(); }
public static void SetVisibility(List <GameObject> gameObjects, bool visible, bool editmode) { //GameObject gameObject = (GameObject)EditorUtility.InstanceIDToObject(instanceId); GameObject gameObject = gameObjects[0]; // this is only used to get the instance of the scene if (gameObject == null) { return; } QObjectList objectList = QObjectListManager.getInstance().getObjectList(gameObject, false); var vc = (hierarchy.componentDictionary[(int)QHierarchyComponentEnum.VisibilityComponent] as QVisibilityComponent); vc.setVisibility(gameObjects, objectList, visible, editmode); }
// PRIVATE private void colorSelectedHandler(GameObject[] gameObjects, Color color) { for (int i = gameObjects.Length - 1; i >= 0; i--) { GameObject gameObject = gameObjects[i]; QObjectList objectList = QObjectListManager.getInstance().getObjectList(gameObjects[i], true); Undo.RecordObject(objectList, "Color Changed"); if (objectList.gameObjectColor.ContainsKey(gameObject)) { objectList.gameObjectColor[gameObject] = color; } else { objectList.gameObjectColor.Add(gameObject, color); } } EditorApplication.RepaintHierarchyWindow(); }
public void setWireframeMode(GameObject gameObject, QObjectList objectList, bool targetWireframe) { if (objectList == null && targetWireframe) { objectList = QObjectListManager.getInstance().getObjectList(gameObject, true); } if (objectList != null) { Undo.RecordObject(objectList, "Renderer Visibility Change"); if (targetWireframe) { objectList.wireframeHiddenObjects.Add(gameObject); } else { objectList.wireframeHiddenObjects.Remove(gameObject); } EditorUtility.SetDirty(objectList); } }