internal void RecordChanges(TransformChanges transformChanges) { if (transformChanges == TransformChanges.None) { return; } if (changes == TransformChanges.None && WillChangesBeRecorded()) { Transform.transformsChanged.Enqueue(this); } changes |= transformChanges; if (childCount > 0) { TransformChanges childChanges = changes; // If we rotate, we can change the child position as well if ((changes & TransformChanges.Rotation) == TransformChanges.Rotation) { childChanges |= TransformChanges.Position; } for (int i = 0; i < children.Count; i++) { children[i].transform.RecordChanges(childChanges); } } hasDirtyWorld = true; }
public override void OnInspectorGUI() { if (ToggleButtonStyleNormal == null) { ToggleButtonStyleNormal = "Button"; ToggleButtonStyleToggled = new GUIStyle(ToggleButtonStyleNormal); ToggleButtonStyleToggled.normal.background = ToggleButtonStyleToggled.active.background; } myTarget = (TransformChanges)target; var minHeight = 30; if (myTarget.OriginalFoldout) { minHeight = 150; } if (myTarget.ToSecondFoldout) { minHeight = 200; } var componentHeight = ((topY + 30) < minHeight) ? minHeight : (topY + 30); EditorGUILayout.BeginHorizontal(GUILayout.Width(Screen.width), GUILayout.Height(componentHeight)); EditorGUILayout.Space(5); topY = 5; topX = 20; Rect buttonPos = new Rect(topX - 10, topY, Screen.width, 100); GUILayout.BeginArea(buttonPos); EditorGUILayout.BeginHorizontal(); myTarget.TransformAnchorPos = GUILayout.Toggle(myTarget.TransformAnchorPos, "Anchor Pos", "Button", GUILayout.Width(UsefullUtils.GetPercent(Screen.width, 20)), GUILayout.Height(height)); myTarget.TransformDelta = GUILayout.Toggle(myTarget.TransformDelta, "Delta", "Button", GUILayout.Width(UsefullUtils.GetPercent(Screen.width, 20)), GUILayout.Height(height)); myTarget.TransformRotation = GUILayout.Toggle(myTarget.TransformRotation, "Rotation", "Button", GUILayout.Width(UsefullUtils.GetPercent(Screen.width, 20)), GUILayout.Height(height)); EditorGUILayout.EndHorizontal(); GUILayout.EndArea(); // insideFoldWidth = Screen.width - 40; if (myTarget.TransformAnchorPos || myTarget.TransformDelta || myTarget.TransformRotation) { OriginalFold(); ToSecondFold(); topY += 25; Rect foldPos = new Rect(topX - 5, topY, Screen.width, 15); if (myTarget.MoreThenOne = EditorGUI.Foldout(foldPos, myTarget.MoreThenOne, "More")) { insideFoldSecondLevelWidth = Screen.width - 60; topXSecondLevel = topX + 20; ToThirdFold(); ToForthFold(); } } else { topY += 25; Rect textPos = new Rect(topX - 5, topY, Screen.width, 30); GUILayout.BeginArea(textPos); EditorGUILayout.LabelField("Nothing to change so you should remove it!"); GUILayout.EndArea(); } EditorGUILayout.Space(10); EditorGUILayout.EndVertical(); EditorUtility.SetDirty(myTarget); EditorSceneManager.MarkSceneDirty(myTarget.gameObject.scene); }