private void DrawTilingRuleSettings() { if (!isVertical) // horizontal { EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(false)); { float buttonSize = position.height - (EditorGUIUtility.singleLineHeight + (EditorGUIUtility.standardVerticalSpacing * 3f)); float buttonSizeClamped = Mathf.Clamp(buttonSize, 0f, maxButtonSize); EditorGUILayout.BeginVertical(GUILayout.Width(buttonSizeClamped * 3f)); { EditorGUILayout.LabelField("Self", EditorStyles.boldLabel, GUILayout.Width(buttonSizeClamped * 3f)); EditorGUILayout.BeginHorizontal(); CustomEditors.EnumButton <RuleBehaviour?>(this, () => GUILayout.Button("Cycle", GUILayout.Width(buttonSizeClamped), GUILayout.Height(buttonSize)), null, ref TilingRulePropertyDrawer.brushType); CustomEditors.EnumButton <RuleBehaviour?>(this, () => GUILayout.Button("Eraser", GUILayout.Width(buttonSizeClamped), GUILayout.Height(buttonSize)), RuleBehaviour.DontCare, ref TilingRulePropertyDrawer.brushType); CustomEditors.EnumButton <RuleBehaviour?>(this, () => GUILayout.Button("This", GUILayout.Width(buttonSizeClamped), GUILayout.Height(buttonSize)), RuleBehaviour.This, ref TilingRulePropertyDrawer.brushType); CustomEditors.EnumButton <RuleBehaviour?>(this, () => GUILayout.Button("NotThis", GUILayout.Width(buttonSizeClamped), GUILayout.Height(buttonSize)), RuleBehaviour.NotThis, ref TilingRulePropertyDrawer.brushType); EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); //vertical line EditorGUILayout.BeginVertical(GUILayout.Width(1f)); EditorGUILayout.LabelField(GUIContent.none, GUILayout.Width(EditorGUIUtility.singleLineHeight / 2f)); EditorGUILayout.EndVertical(); EditorGUILayout.EndVertical(); } EditorGUILayout.EndHorizontal(); } else // vertical { float buttonSize = position.width - (EditorGUIUtility.standardVerticalSpacing * 2f); EditorGUILayout.LabelField("Self", EditorStyles.boldLabel, GUILayout.Width(buttonSize)); CustomEditors.EnumButton <RuleBehaviour?>(this, () => GUILayout.Button("Cycle", GUILayout.Width(buttonSize), GUILayout.Height(buttonSize), GUILayout.MaxHeight(maxButtonSize)), null, ref TilingRulePropertyDrawer.brushType); CustomEditors.EnumButton <RuleBehaviour?>(this, () => GUILayout.Button("Eraser", GUILayout.Width(buttonSize), GUILayout.Height(buttonSize), GUILayout.MaxHeight(maxButtonSize)), RuleBehaviour.DontCare, ref TilingRulePropertyDrawer.brushType); CustomEditors.EnumButton <RuleBehaviour?>(this, () => GUILayout.Button("This", GUILayout.Width(buttonSize), GUILayout.Height(buttonSize), GUILayout.MaxHeight(maxButtonSize)), RuleBehaviour.This, ref TilingRulePropertyDrawer.brushType); CustomEditors.EnumButton <RuleBehaviour?>(this, () => GUILayout.Button("NotThis", GUILayout.Width(buttonSize), GUILayout.Height(buttonSize), GUILayout.MaxHeight(maxButtonSize)), RuleBehaviour.NotThis, ref TilingRulePropertyDrawer.brushType); } }
private void DrawPositionHandles() { if (!isVertical) // horizontal { EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(false)); { float buttonSize = position.height - (EditorGUIUtility.singleLineHeight + (EditorGUIUtility.standardVerticalSpacing * 3f)); float buttonSizeClamped = Mathf.Clamp(buttonSize, 0f, maxButtonSize); GUILayout.Box(GUIContent.none, positionStyle, GUILayout.Height(position.height), GUILayout.Width(position.height)); EditorGUILayout.BeginVertical(GUILayout.Width(buttonSizeClamped * 3f)); { EditorGUILayout.LabelField("Self", EditorStyles.boldLabel, GUILayout.Width(buttonSizeClamped * 3f)); EditorGUILayout.BeginHorizontal(); CustomEditors.EnumButton(this, () => GUILayout.Button("Self", GUILayout.Width(buttonSizeClamped), GUILayout.Height(buttonSize)), LinkSpaceRotation.Self, ref CustomPositionEditor.selfHandleRot); CustomEditors.EnumButton(this, () => GUILayout.Button("Parent", GUILayout.Width(buttonSizeClamped), GUILayout.Height(buttonSize)), LinkSpaceRotation.Parent, ref CustomPositionEditor.selfHandleRot); CustomEditors.EnumButton(this, () => GUILayout.Button("World", GUILayout.Width(buttonSizeClamped), GUILayout.Height(buttonSize)), LinkSpaceRotation.World, ref CustomPositionEditor.selfHandleRot); EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); //vertical line EditorGUILayout.BeginVertical(GUILayout.Width(1f)); EditorGUILayout.LabelField(GUIContent.none, GUILayout.Width(EditorGUIUtility.singleLineHeight / 2f)); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(GUILayout.Width(buttonSizeClamped * 2f)); { EditorGUILayout.LabelField("World", EditorStyles.boldLabel, GUILayout.Width(buttonSizeClamped * 2f)); EditorGUILayout.BeginHorizontal(); CustomEditors.EnumButton(this, () => GUILayout.Button("Self", GUILayout.Width(buttonSizeClamped), GUILayout.Height(buttonSize)), Space.Self, ref CustomPositionEditor.worldHandleRot); CustomEditors.EnumButton(this, () => GUILayout.Button("World", GUILayout.Width(buttonSizeClamped), GUILayout.Height(buttonSize)), Space.World, ref CustomPositionEditor.worldHandleRot); EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndVertical(); //vertical line EditorGUILayout.BeginVertical(GUILayout.Width(1f)); EditorGUILayout.LabelField(GUIContent.none, GUILayout.Width(EditorGUIUtility.singleLineHeight / 2f)); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(); { EditorGUILayout.LabelField("Extra", EditorStyles.boldLabel); CustomPositionEditor.offsetHandleRaw = EditorGUILayout.Toggle("Use Raw Position", CustomPositionEditor.offsetHandleRaw); } EditorGUILayout.EndVertical(); } EditorGUILayout.EndHorizontal(); } else // vertical { GUILayout.Box(GUIContent.none, positionStyle, GUILayout.Height(position.width), GUILayout.Width(position.width)); float buttonSize = position.width - (EditorGUIUtility.standardVerticalSpacing * 2f); EditorGUILayout.LabelField("Self", EditorStyles.boldLabel, GUILayout.Width(buttonSize)); CustomEditors.EnumButton(this, () => GUILayout.Button("Self", GUILayout.Width(buttonSize), GUILayout.Height(buttonSize), GUILayout.MaxHeight(maxButtonSize)), LinkSpaceRotation.Self, ref CustomPositionEditor.selfHandleRot); CustomEditors.EnumButton(this, () => GUILayout.Button("Parent", GUILayout.Width(buttonSize), GUILayout.Height(buttonSize), GUILayout.MaxHeight(maxButtonSize)), LinkSpaceRotation.Parent, ref CustomPositionEditor.selfHandleRot); CustomEditors.EnumButton(this, () => GUILayout.Button("World", GUILayout.Width(buttonSize), GUILayout.Height(buttonSize), GUILayout.MaxHeight(maxButtonSize)), LinkSpaceRotation.World, ref CustomPositionEditor.selfHandleRot); EditorGUILayout.LabelField("World", EditorStyles.boldLabel, GUILayout.Width(buttonSize)); CustomEditors.EnumButton(this, () => GUILayout.Button("Self", GUILayout.Width(buttonSize), GUILayout.Height(buttonSize), GUILayout.MaxHeight(maxButtonSize)), Space.Self, ref CustomPositionEditor.worldHandleRot); CustomEditors.EnumButton(this, () => GUILayout.Button("World", GUILayout.Width(buttonSize), GUILayout.Height(buttonSize), GUILayout.MaxHeight(maxButtonSize)), Space.World, ref CustomPositionEditor.worldHandleRot); EditorGUILayout.LabelField("Extra", EditorStyles.boldLabel, GUILayout.Width(position.width)); CustomPositionEditor.offsetHandleRaw = EditorGUILayout.Toggle(new GUIContent(string.Empty, "Use Raw Position"), CustomPositionEditor.offsetHandleRaw, GUILayout.Width(buttonSize)); } }