/// <summary> /// Draw the row for this GameObject /// </summary> /// <param name="colWidth"></param> /// <param name="indent"></param> public void Draw(float colWidth, float indent = 0) { if (window.drawAbort) { return; } var draw = window.ScrollCheck(); if (draw) { //This object window.StartRow(Same); //Display mine GUILayout.BeginVertical(); GUILayout.Space(ObjectPadding); DrawObject(true, indent, colWidth); GUILayout.EndVertical(); var isRoot = window.root == this; //Swap buttons DrawMidButtons(mine, theirs, isRoot || parent != null && parent.mine, isRoot || parent != null && parent.theirs, // < button delegate { //NB: This still throws a SerializedProperty error (at least in Unity 3) gonna have to do a bit more poking. window.update = Copy(true); // > button }, delegate { window.update = Copy(false); // Left X button }, delegate { window.updateType = RefreshType.Deleting; window.update = Delete(true); // Right X button }, delegate { window.updateType = RefreshType.Deleting; window.update = Delete(false); }); //Display theirs GUILayout.BeginVertical(); GUILayout.Space(ObjectPadding); GUILayout.BeginHorizontal(); DrawObject(false, indent, colWidth); if (GUILayout.Button(showComponents ? "-" : "+", GUILayout.Width(19))) { //Positioning on this button is super screwy showComponents = !showComponents; if (Event.current.alt) { showAttrs = showComponents; foreach (var component in components) { component.showChildren = showComponents; } } } GUILayout.EndHorizontal(); GUILayout.EndVertical(); window.EndRow(); } if (showComponents) { DrawAttributes(indent + Util.tabSize * 2, colWidth); var tmp = new List <ComponentHelper>(components); foreach (var component in tmp) { component.Draw(indent + Util.tabSize * 2, colWidth); } if (draw) { GUILayout.Space(ComponentsMargin); } } //Children if (showChildren && children != null) { var tmp = new List <GameObjectHelper>(children); foreach (var helper in tmp) { helper.Draw(colWidth, indent + Util.tabSize); } } }
public void Draw(float indent, GUILayoutOption colWidth, GUILayoutOption indentOption) { if (window.drawAbort) { return; } if (window.ScrollCheck()) { window.StartRow(Same); //Store foldout state before doing GUI to check if it changed var foldoutState = showChildren; indentArg = indent; thisArg = this; DrawComponent(true, indentOption, colWidth); //Swap buttons var parentMine = parent.mine; var parentTheirs = parent.theirs; if (parentMine && parentTheirs) { DrawMidButtons(mine, theirs, parentMine, parentTheirs, LeftButton, RightButton, LeftDeleteButton, RightDeleteButton); } else { GUILayout.Space(UniMergeConfig.DoubleMidWidth); } //Display theirs DrawComponent(false, indentOption, colWidth); if (showChildren != foldoutState) { InvalidateDrawCount(); //If foldout state changed and user was holding alt, set all child foldout states to this state if (Event.current.alt) { foreach (var property in properties) { property.SetFoldoutRecursively(showChildren); } } } window.EndRow(Same); } if (showChildren) { var tmp = new List <PropertyHelper>(properties); var newWidth = indent + Util.TabSize; var newIndent = GUILayout.Width(newWidth); foreach (var property in tmp) { property.Draw(newWidth, colWidth, newIndent); } } if (mySO != null && mySO.targetObject != null) { if (mySO.ApplyModifiedProperties()) { window.update = BubbleRefresh(); } } if (theirSO != null && theirSO.targetObject != null) { if (theirSO.ApplyModifiedProperties()) { window.update = BubbleRefresh(); } } }