private void drawSectionRecoloringArea() { if (sectionData == null) { return; } bool updated = false; GUILayout.BeginHorizontal(); GUILayout.Label("Editing: ", GUILayout.Width(60)); GUILayout.Label(sectionData.sectionName); GUILayout.Label(getSectionLabel(colorIndex) + " Color"); GUILayout.FlexibleSpace();//to force everything to the left instead of randomly spaced out, while still allowing dynamic length adjustments GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (drawColorInputLine("Red", ref editingColor.color.r, ref rStr, sectionData.colorSupported())) { updated = true; } if (GUILayout.Button("Load Pattern", GUILayout.Width(120))) { sectionData.colors[0] = storedPattern[0]; sectionData.colors[1] = storedPattern[1]; sectionData.colors[2] = storedPattern[2]; editingColor = sectionData.colors[colorIndex]; updated = true; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (drawColorInputLine("Green", ref editingColor.color.g, ref gStr, sectionData.colorSupported())) { updated = true; } if (GUILayout.Button("Store Pattern", GUILayout.Width(120))) { storedPattern = new RecoloringData[3]; storedPattern[0] = sectionData.colors[0]; storedPattern[1] = sectionData.colors[1]; storedPattern[2] = sectionData.colors[2]; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (drawColorInputLine("Blue", ref editingColor.color.b, ref bStr, sectionData.colorSupported())) { updated = true; } if (GUILayout.Button("Load Color", GUILayout.Width(120))) { editingColor = storedColor; updated = true; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (drawColorInputLine("Specular", ref editingColor.specular, ref aStr, sectionData.specularSupported())) { updated = true; } if (GUILayout.Button("Store Color", GUILayout.Width(120))) { storedColor = editingColor; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (sectionData.metallicSupported()) { if (drawColorInputLine("Metallic", ref editingColor.metallic, ref mStr, true)) { updated = true; } } else if (sectionData.hardnessSupported()) { if (drawColorInputLine("Hardness", ref editingColor.metallic, ref mStr, true)) { updated = true; } } else { if (drawColorInputLine("Metallic", ref editingColor.metallic, ref mStr, false)) { updated = true; } } GUILayout.EndHorizontal(); if (updated) { sectionData.colors[colorIndex] = editingColor; sectionData.updateColors(); } }
private void drawSectionRecoloringArea() { if (sectionData == null) { return; } bool updated = false; GUILayout.BeginHorizontal(); GUILayout.Label("Editing: ", GUILayout.Width(60)); GUILayout.Label(sectionData.sectionName); GUILayout.Label(getSectionLabel(colorIndex) + " Color"); GUILayout.FlexibleSpace();//to force everything to the left instead of randomly spaced out, while still allowing dynamic length adjustments GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (drawColorInputLine("Red", ref editingColor.color.r, ref rStr, sectionData.colorSupported(), 255, 1)) { updated = true; } if (GUILayout.Button("Load Pattern", GUILayout.Width(120))) { sectionData.colors[0] = storedPattern[0]; sectionData.colors[1] = storedPattern[1]; sectionData.colors[2] = storedPattern[2]; editingColor = sectionData.colors[colorIndex]; updated = true; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (drawColorInputLine("Green", ref editingColor.color.g, ref gStr, sectionData.colorSupported(), 255, 1)) { updated = true; } if (GUILayout.Button("Store Pattern", GUILayout.Width(120))) { storedPattern = new RecoloringData[3]; storedPattern[0] = sectionData.colors[0]; storedPattern[1] = sectionData.colors[1]; storedPattern[2] = sectionData.colors[2]; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (drawColorInputLine("Blue", ref editingColor.color.b, ref bStr, sectionData.colorSupported(), 255, 1)) { updated = true; } if (GUILayout.Button("Load Color", GUILayout.Width(120))) { editingColor = storedColor; updated = true; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (drawColorInputLine("Specular", ref editingColor.specular, ref aStr, sectionData.specularSupported(), 255, 1)) { updated = true; } if (GUILayout.Button("Store Color", GUILayout.Width(120))) { storedColor = editingColor; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (sectionData.metallicSupported()) { if (drawColorInputLine("Metallic", ref editingColor.metallic, ref mStr, true, 255, 1)) { updated = true; } } else if (sectionData.hardnessSupported()) { if (drawColorInputLine("Hardness", ref editingColor.metallic, ref mStr, true, 255, 1)) { updated = true; } } else { if (drawColorInputLine("Metallic", ref editingColor.metallic, ref mStr, false, 255, 1)) { updated = true; } } if (GUILayout.Button("<", GUILayout.Width(20))) { groupIndex--; List <RecoloringDataPresetGroup> gs = PresetColor.getGroupList(); if (groupIndex < 0) { groupIndex = gs.Count - 1; } groupName = gs[groupIndex].name; } GUILayout.Label("Palette", GUILayout.Width(70)); if (GUILayout.Button(">", GUILayout.Width(20))) { groupIndex++; List <RecoloringDataPresetGroup> gs = PresetColor.getGroupList(); if (groupIndex >= gs.Count) { groupIndex = 0; } groupName = gs[groupIndex].name; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (drawColorInputLine("Detail %", ref editingColor.detail, ref dStr, true, 100, 5)) { updated = true; } GUILayout.Label(groupName, GUILayout.Width(120)); GUILayout.EndHorizontal(); if (updated) { sectionData.colors[colorIndex] = editingColor; sectionData.updateColors(); } }