diff --git a/Client/origin-client/scenes/game/game_screen.gd b/Client/origin-client/scenes/game/game_screen.gd index 6c3ba8b..d9f933e 100644 --- a/Client/origin-client/scenes/game/game_screen.gd +++ b/Client/origin-client/scenes/game/game_screen.gd @@ -674,10 +674,11 @@ func _add_unit_mesh(unit: Dictionary, team_color: Color, is_enemy: bool = false) if model_url.is_empty(): return - # Read per-model config from the asset. - var facing_dir : String = str(model_asset.get("modelFacingDirection", "north")) - var model_scale : float = float(model_asset.get("modelScale", 1.0)) - var tint_str : String = str(model_asset.get("modelTintColor", "")) + # Asset-level config (model-file specific). + var facing_dir : String = str(model_asset.get("modelFacingDirection", "north")) + # Card-level config (visual identity of this card, not the shared mesh file). + var model_scale : float = float(def.get("modelScale", 1.0)) + var tint_str : String = str(def.get("modelTintColor", "")) var model_tint : Color = Color.WHITE if not tint_str.is_empty() and tint_str != "null": model_tint = Color(tint_str) diff --git a/Server/src/SOR.Admin/Components/Pages/Cards/CardEditor.razor b/Server/src/SOR.Admin/Components/Pages/Cards/CardEditor.razor index 75db9aa..f24634b 100644 --- a/Server/src/SOR.Admin/Components/Pages/Cards/CardEditor.razor +++ b/Server/src/SOR.Admin/Components/Pages/Cards/CardEditor.razor @@ -112,6 +112,26 @@ else + +
3D Model
+
+ + +
Null = 1.0 (no change)
+
+
+ +
+ + @if (!string.IsNullOrWhiteSpace(_card.ModelTintColor)) + { + + } +
+
Multiplicative hex tint over the model. Null = white (no tint).
+
} @@ -283,6 +303,23 @@ else + @if (asset.AssetType == CardAssetType.Model3D) + { +
+
+ + +
+
+ + }
diff --git a/Server/src/SOR.Content/ContentMessages.cs b/Server/src/SOR.Content/ContentMessages.cs index c98551c..3780496 100644 --- a/Server/src/SOR.Content/ContentMessages.cs +++ b/Server/src/SOR.Content/ContentMessages.cs @@ -92,6 +92,9 @@ public sealed record CardDefinitionDto( DateTimeOffset? RetiredAt, DateTimeOffset UpdatedAt, long DefinitionVersion, + // Visual / 3D model (card-level) + float? ModelScale, + string? ModelTintColor, // Assets IEnumerable Assets, IEnumerable AnimationBindings); @@ -102,10 +105,8 @@ public sealed record CardAssetDto( string CdnUrl, string? MimeType, bool IsAiGenerated, - // Model3D config + // Model3D config (asset/file-level) string? ModelFacingDirection, - float? ModelScale, - string? ModelTintColor, string? ModelTintMaskUrl); public sealed record CardAnimationBindingDto( diff --git a/Server/src/SOR.Content/Handlers/ContentDtoMapper.cs b/Server/src/SOR.Content/Handlers/ContentDtoMapper.cs index b188890..593af41 100644 --- a/Server/src/SOR.Content/Handlers/ContentDtoMapper.cs +++ b/Server/src/SOR.Content/Handlers/ContentDtoMapper.cs @@ -46,6 +46,8 @@ internal static class ContentDtoMapper RetiredAt: c.RetiredAt, UpdatedAt: c.UpdatedAt, DefinitionVersion: c.DefinitionVersion, + ModelScale: c.ModelScale, + ModelTintColor: c.ModelTintColor, Assets: c.Assets.Select(a => new CardAssetDto( a.Id, a.AssetType.ToString(), @@ -53,8 +55,6 @@ internal static class ContentDtoMapper a.MimeType, a.IsAiGenerated, a.ModelFacingDirection, - a.ModelScale, - a.ModelTintColor, a.ModelTintMaskUrl)), AnimationBindings: c.AnimationBindings.Select(b => new CardAnimationBindingDto( b.Id, diff --git a/Server/src/SOR.Database/Entities/Catalog/CardAsset.cs b/Server/src/SOR.Database/Entities/Catalog/CardAsset.cs index 7a3d483..2b42b61 100644 --- a/Server/src/SOR.Database/Entities/Catalog/CardAsset.cs +++ b/Server/src/SOR.Database/Entities/Catalog/CardAsset.cs @@ -29,19 +29,6 @@ public sealed class CardAsset /// public string? ModelFacingDirection { get; set; } - /// - /// Uniform scale multiplier applied to the model root node. - /// Null or 1.0 = no scaling. - /// - public float? ModelScale { get; set; } - - /// - /// CSS-style hex tint applied multiplicatively to all StandardMaterial3D - /// surfaces on the model (e.g. "#FF8800"). Null = no tint (white). - /// Lets one GLB be reused with different faction/team colours. - /// - public string? ModelTintColor { get; set; } - /// /// CDN URL of a greyscale mask texture whose red channel controls how /// strongly the ModelTintColor is applied per texel (0 = original, 1 = full tint). diff --git a/Server/src/SOR.Database/Entities/Catalog/CardDefinition.cs b/Server/src/SOR.Database/Entities/Catalog/CardDefinition.cs index e2da633..7cfe3a0 100644 --- a/Server/src/SOR.Database/Entities/Catalog/CardDefinition.cs +++ b/Server/src/SOR.Database/Entities/Catalog/CardDefinition.cs @@ -74,6 +74,21 @@ public sealed class CardDefinition // ── Terramorpha-only ──────────────────────────────────────────────────── public TerramorphaMode? TerramorphaMode { get; set; } + // ── Visual / 3D model overrides (card-level) ──────────────────────────── + /// + /// Uniform scale applied to the Model3D asset root. Null = 1.0 (no scaling). + /// Card-level so the same GLB can be reused at different sizes across cards. + /// + public float? ModelScale { get; set; } + + /// + /// CSS-style hex colour applied multiplicatively to all StandardMaterial3D + /// surfaces on the card's Model3D asset (e.g. "#FF8800"). Null = no tint. + /// Card-level because the tint is part of a card's visual identity, not the + /// shared mesh file. + /// + public string? ModelTintColor { get; set; } + // ── Ability / Effect data (JSONB) ──────────────────────────────────────── /// JSONB array of AbilityDefinition objects (ArchSpirit, Spirit, Ruin). public string? AbilitiesJson { get; set; } diff --git a/Server/src/SOR.Database/Migrations/Catalog/20260316112327_MoveModelScaleTintToCard.Designer.cs b/Server/src/SOR.Database/Migrations/Catalog/20260316112327_MoveModelScaleTintToCard.Designer.cs new file mode 100644 index 0000000..983bd90 --- /dev/null +++ b/Server/src/SOR.Database/Migrations/Catalog/20260316112327_MoveModelScaleTintToCard.Designer.cs @@ -0,0 +1,457 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using SOR.Database.Contexts; + +#nullable disable + +namespace SOR.Database.Migrations.Catalog +{ + [DbContext(typeof(CatalogDbContext))] + [Migration("20260316112327_MoveModelScaleTintToCard")] + partial class MoveModelScaleTintToCard + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("catalog") + .HasAnnotation("ProductVersion", "8.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("SOR.Database.Entities.Catalog.CardAnimationBinding", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ActionName") + .IsRequired() + .HasColumnType("text"); + + b.Property("AnimationCdnUrl") + .IsRequired() + .HasColumnType("text"); + + b.Property("AnimationTrackName") + .HasColumnType("text"); + + b.Property("CardDefinitionId") + .HasColumnType("uuid"); + + b.Property("CastSoundCdnUrl") + .HasColumnType("text"); + + b.Property("ImpactSoundCdnUrl") + .HasColumnType("text"); + + b.Property("IsAiGenerated") + .HasColumnType("boolean"); + + b.HasKey("Id"); + + b.HasIndex("CardDefinitionId", "ActionName") + .IsUnique(); + + b.ToTable("card_animation_bindings", "catalog"); + }); + + modelBuilder.Entity("SOR.Database.Entities.Catalog.CardAsset", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AssetType") + .IsRequired() + .HasColumnType("text"); + + b.Property("CardDefinitionId") + .HasColumnType("uuid"); + + b.Property("CdnUrl") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("IsAiGenerated") + .HasColumnType("boolean"); + + b.Property("MimeType") + .HasColumnType("text"); + + b.Property("ModelFacingDirection") + .HasColumnType("text"); + + b.Property("ModelTintMaskUrl") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CardDefinitionId", "AssetType"); + + b.ToTable("card_assets", "catalog"); + }); + + modelBuilder.Entity("SOR.Database.Entities.Catalog.CardDefinition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AbilitiesJson") + .HasColumnType("jsonb") + .HasColumnName("abilities"); + + b.Property("Affinity") + .IsRequired() + .HasColumnType("text"); + + b.Property("AttackType") + .HasColumnType("text"); + + b.Property("CanAttack") + .HasColumnType("boolean"); + + b.Property("CanBeAttacked") + .HasColumnType("boolean"); + + b.Property("CanBeBlocked") + .HasColumnType("boolean"); + + b.Property("CanBeObstructed") + .HasColumnType("boolean"); + + b.Property("CanBeSacrificed") + .HasColumnType("boolean"); + + b.Property("CanDefend") + .HasColumnType("boolean"); + + b.Property("CanMove") + .HasColumnType("boolean"); + + b.Property("CanUseAbility") + .HasColumnType("boolean"); + + b.Property("CardType") + .IsRequired() + .HasColumnType("text"); + + b.Property("CollectorNumber") + .HasColumnType("integer"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Damage") + .HasColumnType("integer"); + + b.Property("DefinitionVersion") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasDefaultValue(0L); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("EffectsJson") + .HasColumnType("jsonb") + .HasColumnName("effects"); + + b.Property("Genus") + .HasColumnType("text[]"); + + b.Property("IsPublished") + .HasColumnType("boolean"); + + b.Property("IsRetired") + .HasColumnType("boolean"); + + b.Property("MaxAttackRange") + .HasColumnType("integer"); + + b.Property("MaxChannelRange") + .HasColumnType("integer"); + + b.Property("MaxDefense") + .HasColumnType("integer"); + + b.Property("MaxHealth") + .HasColumnType("integer"); + + b.Property("MinAttackRange") + .HasColumnType("integer"); + + b.Property("MinChannelRange") + .HasColumnType("integer"); + + b.Property("ModelScale") + .HasColumnType("real"); + + b.Property("ModelTintColor") + .HasColumnType("text"); + + b.Property("MovementPoints") + .HasColumnType("integer"); + + b.Property("MovementType") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("OtherCostsJson") + .HasColumnType("jsonb") + .HasColumnName("other_costs"); + + b.Property("PreviousTierId") + .HasColumnType("uuid"); + + b.Property("Rarity") + .IsRequired() + .HasColumnType("text"); + + b.Property("RequiresLos") + .HasColumnType("boolean"); + + b.Property("RetiredAt") + .HasColumnType("timestamp with time zone"); + + b.Property("SetId") + .HasColumnType("uuid"); + + b.Property("SpCost") + .HasColumnType("integer"); + + b.Property("StCost") + .HasColumnType("integer"); + + b.Property("TerramorphaMode") + .HasColumnType("text"); + + b.Property("Tier") + .HasColumnType("integer"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("Affinity"); + + b.HasIndex("CardType"); + + b.HasIndex("DefinitionVersion"); + + b.HasIndex("Name"); + + b.HasIndex("PreviousTierId"); + + b.HasIndex("Rarity"); + + b.HasIndex("SetId"); + + b.HasIndex("IsPublished", "SetId"); + + b.ToTable("card_definitions", "catalog"); + }); + + modelBuilder.Entity("SOR.Database.Entities.Catalog.CardSet", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Code") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .HasColumnType("text"); + + b.Property("IsActive") + .HasColumnType("boolean"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("ReleaseDate") + .HasColumnType("date"); + + b.HasKey("Id"); + + b.HasIndex("Code") + .IsUnique(); + + b.ToTable("card_sets", "catalog"); + }); + + modelBuilder.Entity("SOR.Database.Entities.Catalog.CdnUploadRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ContentType") + .HasColumnType("text"); + + b.Property("IsAiGenerated") + .HasColumnType("boolean"); + + b.Property("ObjectKey") + .IsRequired() + .HasColumnType("text"); + + b.Property("Prefix") + .IsRequired() + .HasColumnType("text"); + + b.Property("PublicUrl") + .IsRequired() + .HasColumnType("text"); + + b.Property("UploadedAt") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("IsAiGenerated"); + + b.HasIndex("ObjectKey") + .IsUnique(); + + b.HasIndex("Prefix"); + + b.ToTable("cdn_upload_records", "catalog"); + }); + + modelBuilder.Entity("SOR.Database.Entities.Catalog.GameAudioConfig", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Context") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsActive") + .HasColumnType("boolean"); + + b.Property("TrackCdnUrl") + .IsRequired() + .HasColumnType("text"); + + b.Property("TrackName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("Context"); + + b.HasIndex("IsActive"); + + b.ToTable("game_audio_configs", "catalog"); + }); + + modelBuilder.Entity("SOR.Database.Entities.Catalog.TileModelBinding", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Affinity") + .IsRequired() + .HasColumnType("text"); + + b.Property("ModelCdnKey") + .IsRequired() + .HasColumnType("text"); + + b.Property("ModelPublicUrl") + .IsRequired() + .HasColumnType("text"); + + b.Property("Shape") + .IsRequired() + .HasColumnType("text"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("Affinity", "Shape") + .IsUnique(); + + b.ToTable("tile_model_bindings", "catalog"); + }); + + modelBuilder.Entity("SOR.Database.Entities.Catalog.CardAnimationBinding", b => + { + b.HasOne("SOR.Database.Entities.Catalog.CardDefinition", "CardDefinition") + .WithMany("AnimationBindings") + .HasForeignKey("CardDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CardDefinition"); + }); + + modelBuilder.Entity("SOR.Database.Entities.Catalog.CardAsset", b => + { + b.HasOne("SOR.Database.Entities.Catalog.CardDefinition", "CardDefinition") + .WithMany("Assets") + .HasForeignKey("CardDefinitionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CardDefinition"); + }); + + modelBuilder.Entity("SOR.Database.Entities.Catalog.CardDefinition", b => + { + b.HasOne("SOR.Database.Entities.Catalog.CardDefinition", "PreviousTier") + .WithMany() + .HasForeignKey("PreviousTierId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("SOR.Database.Entities.Catalog.CardSet", "Set") + .WithMany("Cards") + .HasForeignKey("SetId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("PreviousTier"); + + b.Navigation("Set"); + }); + + modelBuilder.Entity("SOR.Database.Entities.Catalog.CardDefinition", b => + { + b.Navigation("AnimationBindings"); + + b.Navigation("Assets"); + }); + + modelBuilder.Entity("SOR.Database.Entities.Catalog.CardSet", b => + { + b.Navigation("Cards"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Server/src/SOR.Database/Migrations/Catalog/20260316112327_MoveModelScaleTintToCard.cs b/Server/src/SOR.Database/Migrations/Catalog/20260316112327_MoveModelScaleTintToCard.cs new file mode 100644 index 0000000..4f4c693 --- /dev/null +++ b/Server/src/SOR.Database/Migrations/Catalog/20260316112327_MoveModelScaleTintToCard.cs @@ -0,0 +1,66 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace SOR.Database.Migrations.Catalog +{ + /// + public partial class MoveModelScaleTintToCard : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ModelScale", + schema: "catalog", + table: "card_assets"); + + migrationBuilder.DropColumn( + name: "ModelTintColor", + schema: "catalog", + table: "card_assets"); + + migrationBuilder.AddColumn( + name: "ModelScale", + schema: "catalog", + table: "card_definitions", + type: "real", + nullable: true); + + migrationBuilder.AddColumn( + name: "ModelTintColor", + schema: "catalog", + table: "card_definitions", + type: "text", + nullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ModelScale", + schema: "catalog", + table: "card_definitions"); + + migrationBuilder.DropColumn( + name: "ModelTintColor", + schema: "catalog", + table: "card_definitions"); + + migrationBuilder.AddColumn( + name: "ModelScale", + schema: "catalog", + table: "card_assets", + type: "real", + nullable: true); + + migrationBuilder.AddColumn( + name: "ModelTintColor", + schema: "catalog", + table: "card_assets", + type: "text", + nullable: true); + } + } +} diff --git a/Server/src/SOR.Database/Migrations/Catalog/CatalogDbContextModelSnapshot.cs b/Server/src/SOR.Database/Migrations/Catalog/CatalogDbContextModelSnapshot.cs index fa4818c..c34e3eb 100644 --- a/Server/src/SOR.Database/Migrations/Catalog/CatalogDbContextModelSnapshot.cs +++ b/Server/src/SOR.Database/Migrations/Catalog/CatalogDbContextModelSnapshot.cs @@ -89,12 +89,6 @@ namespace SOR.Database.Migrations.Catalog b.Property("ModelFacingDirection") .HasColumnType("text"); - b.Property("ModelScale") - .HasColumnType("real"); - - b.Property("ModelTintColor") - .HasColumnType("text"); - b.Property("ModelTintMaskUrl") .HasColumnType("text"); @@ -199,6 +193,12 @@ namespace SOR.Database.Migrations.Catalog b.Property("MinChannelRange") .HasColumnType("integer"); + b.Property("ModelScale") + .HasColumnType("real"); + + b.Property("ModelTintColor") + .HasColumnType("text"); + b.Property("MovementPoints") .HasColumnType("integer");