Skip to content

feat: implement ColorPalette as a proper Stride asset (.sdpalette)#3103

Open
SmitBdangar wants to merge 3 commits intostride3d:masterfrom
SmitBdangar:feature/color-palette-asset
Open

feat: implement ColorPalette as a proper Stride asset (.sdpalette)#3103
SmitBdangar wants to merge 3 commits intostride3d:masterfrom
SmitBdangar:feature/color-palette-asset

Conversation

@SmitBdangar
Copy link
Copy Markdown

@SmitBdangar SmitBdangar commented Mar 24, 2026

PR Details

Reworks the color palette feature as a proper Stride asset (.sdpalette)
instead of a hardcoded file, addressing feedback from #3100.

Related Issue

Closes #3064

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Changes

  • Added ColorPalette.cs — runtime class with DataContract + ContentSerializer
  • Added ColorPaletteAsset.cs — design-time .sdpalette asset with AssetCompiler
  • Re-used GplPaletteParser.cs — parses .gpl files at compile time
  • Updated ColorPaletteViewModel.cs — uses SetPalette() instead of hardcoded file path
  • Added ColorPalette.sdtpl — makes Color Palette appear in GameStudio Add Asset menu
  • Fixed typo: Platimium → Platinum

How to use

  1. In GameStudio → Asset View → Add Asset → Rendering → Color Palette
  2. Set SourceFile to a .gpl file path, or manually define colors in the Colors dictionary
  3. The color picker will use the assigned palette automatically

Checklist

  • My change requires a change to the documentation.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have built the editor to try this change out.

Notes

Could not run GameStudio locally due to native C++ build tool limitations,
but Stride.Core.Assets.Editor builds successfully with 0 errors.
Supersedes #3100

- Add ColorPalette runtime class (DataContract + ContentSerializer)
- Add ColorPaletteAsset (.sdpalette) with AssetCompiler
- Re-use GplPaletteParser for .gpl file import support
- Update ColorPaletteViewModel to use SetPalette() instead of hardcoded file
- Add ColorPalette.sdtpl template for GameStudio Add Asset menu
- Fixed typo: Platimium -> Platinum

Closes stride3d#3064
- Add ColorPalette runtime class (DataContract + ContentSerializer)
- Add ColorPaletteAsset (.sdpalette) with AssetCompiler
- Re-use GplPaletteParser for .gpl file import support
- Update ColorPaletteViewModel to use SetPalette() instead of hardcoded file
- Add ColorPalette.sdtpl template for GameStudio Add Asset menu
- Fixed typo: Platimium -> Platinum

Closes stride3d#3064
@Kryptos-FR
Copy link
Copy Markdown
Member

Please follow the PR template

@SmitBdangar
Copy link
Copy Markdown
Author

@Kryptos-FR Updated the PR description to follow the template, sorry about that

@MsEpsilon
Copy link
Copy Markdown
Contributor

If this PR superseeds your previous, did you consider closing the previous PR?

{ "Nickel", new Color3(0.827766422f, 0.797984931f, 0.74652364f) },
{ "Titanium", new Color3(0.756946965f, 0.727607463f, 0.695207239f) },
{ "Cobalt", new Color3(0.829103572f, 0.824958926f, 0.812750243f) },
{ "Platinum", new Color3(0.834934076f, 0.814845027f, 0.783999116f) }, // Fixed typo: platimium
Copy link
Copy Markdown
Contributor

@MsEpsilon MsEpsilon Mar 24, 2026

Choose a reason for hiding this comment

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

Useless comment...

For an reader this wouldn't matter, but it is enough that you specified this change in your PR message.

var runtime = new ColorPalette { Colors = colors };
assetManager.Save(Url, runtime);

commandContext.Logger.Info($"ColorPaletteAsset compiled: {Url} ({colors.Count} colors)");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is logging here really necessary? Compared to other asset types, they don't use logging when they finish asset compilation. Only warnings or errors if it is the case.

That would uselessly fill the build output.

Copy link
Copy Markdown
Contributor

@MsEpsilon MsEpsilon left a comment

Choose a reason for hiding this comment

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

Nitpicks, mostly. Except the logging in DoCommandOverride that I consider that should be removed.

Also make sure you did compile, run the GameStudio, and ALSO create, save and reload a project with the asset of the type ColorPaletteAsset (assuming you didn't by not checking I have built the editor to try this change out.)

@SmitBdangar SmitBdangar requested a review from MsEpsilon March 25, 2026 02:19
Copy link
Copy Markdown
Contributor

@MsEpsilon MsEpsilon left a comment

Choose a reason for hiding this comment

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

Nothing I can comment on, wonder what other persons think about this.

LGTM when I try this out myself in the next hours.

@Kryptos-FR Kryptos-FR self-requested a review March 26, 2026 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Support palettes in color picker outside recompiling source

3 participants