Skip to content

General Character Editor Improvements#2252

Merged
Timfa2112 merged 10 commits intoSimple-Station:masterfrom
DEATHB4DEFEAT:cooler-cooler-markings
Apr 24, 2025
Merged

General Character Editor Improvements#2252
Timfa2112 merged 10 commits intoSimple-Station:masterfrom
DEATHB4DEFEAT:cooler-cooler-markings

Conversation

@DEATHB4DEFEAT
Copy link
Member

@DEATHB4DEFEAT DEATHB4DEFEAT commented Apr 16, 2025

Description

This sucked, this sucks less now.


TODO

  • Use ABGC on Jobs
  • Use ABGC on Antags
  • Improve marking editor
    • Make it use real toggleable Buttons
    • Remove the enabled/sort order side
    • Make buttons bigger and improve previews
    • Move it to the Appearance tab Hair Markings #2241
    • Add a Clear button to the search
  • Display all 4 sprite directions at once instead of using the stupid rotation thing
  • Move import/export/save buttons
  • Move name somewhere within the tabs
  • Load markings after other stuff in the profile

Media

image

image

image

image

image

image


Changelog

🆑

  • tweak: Improved readability of many parts of the character editor with colored rows
  • tweak: Cleaned up some little bits of the character editor, most notably removing a tiny margin that was shrinking every tab
  • fix: Fixed the style of the Background tab of the character editor being very wonky due to misplaced UI elements
  • tweak: Made the Jobs tab use proper headers for the department titles
  • tweak: Improved the Marking editor
  • tweak: Improved the layout of the character editor
  • tweak: Improved some button names in the character editor
  • add: The character editor now shows all 4 directions of your character preview at once

@DEATHB4DEFEAT DEATHB4DEFEAT added Size: 3-Medium For medium issues/PRs Priority: 3-Medium Needs to be resolved at some point Type: Feature Creation of or significant changes to a feature Type: Rework Large changes to a system, like a mix between the Balancing, Codebase, and Respace labels labels Apr 16, 2025
@github-actions github-actions bot added Changes: C# Changes any cs files Changes: UI Changes any XAML files Changes: YML Changes any yml files labels Apr 16, 2025
@SimpleStation14 SimpleStation14 changed the title marking editor (and general character editor) improvements Marking Editor (and General Character Editor) Improvements Apr 16, 2025
@DEATHB4DEFEAT DEATHB4DEFEAT changed the title Marking Editor (and General Character Editor) Improvements General Character Editor Improvements Apr 18, 2025
@github-actions github-actions bot added the Changes: Localization Changes any ftl files label Apr 18, 2025
@DEATHB4DEFEAT DEATHB4DEFEAT requested a review from Copilot April 19, 2025 00:04
@DEATHB4DEFEAT DEATHB4DEFEAT marked this pull request as ready for review April 19, 2025 00:04
@github-actions github-actions bot added the Status: Needs Review Someone please review this label Apr 19, 2025

This comment was marked as spam.

@coderabbitai

This comment was marked as spam.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🔭 Outside diff range comments (3)
Content.Client/Humanoid/MarkingPicker.xaml.cs (3)

1-17: ⚠️ Potential issue

System.Collections.Generic import is missing

Just like the Sol‑bred slip‑up above, List<T> et al. are used everywhere but never imported, dooming the whole editor to fail at the first compile.

 using System.Linq;
 using System.Numerics;
+using System.Collections.Generic;

188-193: 🛠️ Refactor suggestion

Double‑localisation leads to garbled sort order

OrderBy(p => Loc.GetString(GetMarkingName(p))) calls Loc.GetString twice. GetMarkingName already returns the localised string, so the second call just re‑feeds an English sentence into the FTL lookup and probably returns the key. Sort will then be nonsense.

-        ).OrderBy(p => Loc.GetString(GetMarkingName(p)));
+        ).OrderBy(p => GetMarkingName(p));

315-345: ⚠️ Potential issue

continue; renders the local function unreachable – won’t compile

The continue; placed before the local function Changed makes that function unreachable, which C# forbids. Replace the pattern with an inline lambda.

-            colorSelector.OnColorChanged += Changed;
-            continue;
-
-            void Changed(Color _)
-            {
-                _currentMarkingColors[colorIndex] = colorSelector.Color;
-                ColorChanged(prototype, colorIndex);
-            }
+            colorSelector.OnColorChanged += _ =>
+            {
+                _currentMarkingColors[colorIndex] = colorSelector.Color;
+                ColorChanged(prototype, colorIndex);
+            };
🧹 Nitpick comments (6)
Content.Client/UserInterface/Controls/AlternatingBGContainer.xaml (1)

7-13: Consider enabling vertical expansion for the inner ScrollContainer

Right now ContentScrollContainer is scroll‑able but not set to VerticalExpand="True".
If the parent receives extra vertical space, the scroll area will stay its minimum height and the children will appear clipped until the user starts scrolling – not a great first impression for new recruits.

-        <ScrollContainer
+        <ScrollContainer
             Name="ContentScrollContainer"
             HorizontalExpand="True"
+            VerticalExpand="True"
             HScrollEnabled="False"
             VScrollEnabled="True"
             ReturnMeasure="True">
Content.Client/Lobby/UI/HumanoidProfileEditor.xaml (1)

256-266: Minor accessibility nit – hard‑coded dark panel colour

The preview panel background #2f2f2f is hard‑coded. Consider re‑using a colour from the shared palette (StyleBase.ColorDarkGrey etc.) so theme changes propagate automatically and contrast checks stay centralised.

Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs (2)

762-765: Give the Antag list container HorizontalExpand for consistent width

alt is an AlternatingBGContainer inserted into AntagList, but without HorizontalExpand = true the column can collapse and mis‑align with the jobs list beside it.

-            var alt = new AlternatingBGContainer { Orientation = LayoutOrientation.Vertical, };
+            var alt = new AlternatingBGContainer
+            {
+                Orientation = LayoutOrientation.Vertical,
+                HorizontalExpand = true,
+            };

1835-1839: Consolidate redundant InvalidateMeasure() calls

Calling InvalidateMeasure() four times in quick succession is overkill – the UI will already queue a full layout pass after the first call. A single call on the parent container (or on any one SpriteView) is enough.

-            SpriteViewS.InvalidateMeasure();
-            SpriteViewN.InvalidateMeasure();
-            SpriteViewE.InvalidateMeasure();
-            SpriteViewW.InvalidateMeasure();
+            SpriteViewS.Parent?.InvalidateMeasure(); // one pass is sufficient
Content.Client/UserInterface/Controls/AlternatingBGContainer.xaml.cs (1)

99-108: UpdateColors assumes each panel has at least one child

child.Children.First() will throw if an empty PanelContainer sneaks in. A defensive check avoids a potential crash from rogue code.

-            child.Visible = child.Children.First().Visible;
+            if (child.ChildCount > 0)
+                child.Visible = child.Children.First().Visible;
Content.Client/Humanoid/MarkingPicker.xaml.cs (1)

250-252: Ensure point display updates when filter changes

UpdatePoints() is called after adding/removing markings, but not after Populate if the filter merely changes. A stale points label misleads users.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dcc88d2 and cd087fe.

📒 Files selected for processing (10)
  • Content.Client/Humanoid/MarkingPicker.xaml (1 hunks)
  • Content.Client/Humanoid/MarkingPicker.xaml.cs (11 hunks)
  • Content.Client/Lobby/UI/HumanoidProfileEditor.xaml (8 hunks)
  • Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs (7 hunks)
  • Content.Client/Lobby/UI/RequirementsSelector.xaml (1 hunks)
  • Content.Client/UserInterface/Controls/AlternatingBGContainer.xaml (1 hunks)
  • Content.Client/UserInterface/Controls/AlternatingBGContainer.xaml.cs (1 hunks)
  • Content.Shared/Humanoid/Markings/MarkingPrototype.cs (1 hunks)
  • Resources/Locale/en-US/preferences/ui/humanoid-profile-editor.ftl (1 hunks)
  • Resources/Locale/en-US/preferences/ui/markings-picker.ftl (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: YAML Linter
  • GitHub Check: YAML map schema validator
  • GitHub Check: Test Packaging
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: Label
🔇 Additional comments (8)
Content.Shared/Humanoid/Markings/MarkingPrototype.cs (1)

41-43: Excellent addition of the PreviewDirection property, cadet!

This new property allows for proper orientation control in marking previews, ensuring our personnel know exactly how they'll look before deployment. A proper strategic enhancement to our crew customization systems.

Content.Client/Lobby/UI/RequirementsSelector.xaml (3)

5-5: Margins properly aligned, ensign!

This right-only margin of 5 units creates a more precise and orderly visual formation. The Biesel Republic's interfaces maintain proper spacing - unlike those sloppy Sol Alliance displays!


8-9: Strategic control insertion detected and approved!

Adding this horizontally expanding control pushes other elements rightward - a perfect tactical maneuver for proper element alignment. This is how we maintain order in our fleet interfaces!


14-14: BoxContainer adjusted to regulation width, lieutenant!

Setting a fixed width of 400 for the options container ensures consistent display across all viewports. The fleet demands precision in UI layouts!

Resources/Locale/en-US/preferences/ui/markings-picker.ftl (1)

29-29: Localization entry maintained at proper position, sailor!

The "Underwear" category remains properly labeled in the interface. Our crew deserves clear markings for all customization options!

Resources/Locale/en-US/preferences/ui/humanoid-profile-editor.ftl (1)

28-31: Button labels properly clarified, commander!

These more descriptive labels ("Import Character", "Export Character", "Save Changes", "Undo Changes") provide superior operational clarity compared to the previous vague designations. All crew members, regardless of rank, will now understand the exact function of each control!

The Biesel Republic demands clear communication in all interfaces - this update meets our high standards for UI design.

Content.Client/UserInterface/Controls/AlternatingBGContainer.xaml.cs (1)

64-79: FrameUpdate hack risks double‑adding controls

During the first frame every child not equal to Container is passed to AddControl, but if someone already called AddControl manually before the first frame you’ll end up wrapping the same control twice. Consider guarding with child is PanelContainer or tracking which children were already processed.

Content.Client/Humanoid/MarkingPicker.xaml.cs (1)

210-214: Null‑safe preview generation

Accessing marking.Sprites[0] without checking Sprites.Count risks IndexOutOfRangeException if a bad prototype sneaks through. A quick guard keeps the editor alive.

-                        Texture = marking.Sprites[0].DirFrame0().TextureFor(
+                        Texture = (marking.Sprites.Count > 0
+                            ? marking.Sprites[0].DirFrame0().TextureFor(
                                 Enum.TryParse<Direction>(marking.PreviewDirection, out var dir) ? dir : Direction.South)
+                            : null),

Comment on lines +47 to +56
public Thickness ItemMargins = new(4);

/// The list of colors to alternate between
public List<Color> Colors = new()
{
Color.FromHex("#25252A"),
// Color.FromHex("#202025"),
Color.FromHex("#1B1B1E"),
};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Expose collection changes safely or add documentation

public Thickness ItemMargins and public List<Color> Colors are mutable fields. A caller can mutate them at any time without updating existing children, desynchronising margins / colours. Either:

  1. Convert them to properties and invoke UpdateColors() / relayout in the setter, or
  2. Add XML‑doc telling maintainers they must call UpdateColors() after mutation.

@DEATHB4DEFEAT DEATHB4DEFEAT added the Type: Cleanup Like Rework but small label Apr 19, 2025
@@ -0,0 +1,110 @@
using System.Linq;
using System.Numerics;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
using System.Numerics;

using Robust.Client.UserInterface.XAML;
using Robust.Shared.Timing;


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Copy link
Member

@VMSolidus VMSolidus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also some new unused usings in HumanoidProfileEditor.xaml.cs that can be yeeyed in this PR before merging. Content.Client.Message and Direction = Robust.Shared.Maths.Direction can both be removed now that they're unused.

@Timfa2112 Timfa2112 merged commit 7e5b334 into Simple-Station:master Apr 24, 2025
12 checks passed
SimpleStation14 added a commit that referenced this pull request Apr 24, 2025
portfiend added a commit to TheDenSS14/TheDen that referenced this pull request Aug 12, 2025
## About the PR
this PR makes a lot of little visual and UX tweaks to the "appearance"
tab in the character editor, including:

- separating it into collapsible sections
- moving "show/hide loadout/job equipment" and the "spawn priority"
buttons out of the tab and to the top of the screen
- porting the "alternating color rows" control from
Simple-Station/Einstein-Engines#2252, courtesy of DEATHB4DEFEAT
- making a lot of things multiple columns rather than just one very
stretched out column
- adding a "scale" label to height/width sliders to show what size your
character is being multiplied by
- ~~merging the "background" tab into the appearance panel as a new
section~~ moved back
- rearranging controls in ways i think are more intuitive - putting
names at the top of details, making "skin" and "eyes" color display
side-by-side, etc

## Why / Balance
the "appearance" tab has had a lot of different fields tacked onto it
and has become, in my opinion, pretty cluttered and arranged
unintuitively. there is a LOT of horizontal space that is not being used
very well at all. certain controls being way too wide hurts visual
comprehension. it is a very complex tab in a way that is kind of
necessary for it to be that way so i wanted to make it a bit more
digestible

## Technical details
- i hit `HumanoidProfileEditor.xaml` with a hammer until it died and
then i kept going until it was reduced into shreds
- removed the "background" tab and added the "dimension" label to
`HumanoidProfileEditor.xaml.cs`
- ported that one control from EE, i can't get the commit for it
directly so i just manually added attribution for it

## Media

<details>
<summary><h1>WARNING: VERY LONG</h1></summary>

<img width="1538" height="922" alt="2025-08-11_22-24"
src="https://github.com/user-attachments/assets/7f502392-8b0b-45c4-b3bf-fae8d79a51d1"
/>

<img width="1542" height="922" alt="2025-08-11_22-26"
src="https://github.com/user-attachments/assets/9ea0a281-5b83-4c61-bd12-ba0fb122ab95"
/>


https://github.com/user-attachments/assets/ec3c1161-3114-4109-be67-447e5920fce2

</details>

after initial PRing the tabs have been rearranged a bit more, so
Background is back in its own tab. here is what the Appearance tab looks
like now:

<img width="1298" height="691" alt="image"
src="https://github.com/user-attachments/assets/3377f485-92fe-42d6-8ad5-8887a52c153f"
/>
<img width="1297" height="393" alt="image"
src="https://github.com/user-attachments/assets/94763111-c402-4127-ba5e-395254a0b7de"
/>


## Requirements
- [x] I have read and am following the [Pull Request and Changelog
Guidelines](https://docs.spacestation14.com/en/general-development/codebase-info/pull-request-guidelines.html).
- [x] I have added media to this PR or it does not require an ingame
showcase.
- [x] I can confirm this PR contains no AI-generated content, and did
not use any AI-generated content.

## Breaking changes
if you port anything that affects the "appearance" tab you might piss
and cry a little bit

**Changelog**
:cl:
- tweak: The "Appearance" tab of the character editor has been visually
overhauled, hopefully to make it more digestible.
- tweak: NO, I did not fucking touch Loadouts, Traits, Markings,
Records, or the character preview sprite. DOn't ask me
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Changes: C# Changes any cs files Changes: Localization Changes any ftl files Changes: UI Changes any XAML files Changes: YML Changes any yml files Priority: 3-Medium Needs to be resolved at some point Size: 3-Medium For medium issues/PRs Status: Needs Review Someone please review this Type: Cleanup Like Rework but small Type: Feature Creation of or significant changes to a feature Type: Rework Large changes to a system, like a mix between the Balancing, Codebase, and Respace labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants