@@ -19,7 +19,6 @@ let repoDisplayName = "";
1919let isGenerating = false ;
2020let workspacePreviewAssetFolder = "" ;
2121let workspacePreviewFileValid = false ;
22- let workspaceBackgroundValid = true ;
2322let workspacePreviewGameId = "" ;
2423let workspaceRepoRootHydrated = false ;
2524let workspaceRepoRootName = "" ;
@@ -195,17 +194,19 @@ function workspaceGameAssetPath(manifest, assetPath) {
195194}
196195
197196function workspaceBackgroundContext ( manifest ) {
198- const assetFolder = workspaceAssetFolder ( manifest ) ;
199- if ( ! assetFolder ) {
200- return { ok : false , message : "assetsPath must be inside gameRoot before hydrating the preview background." } ;
201- }
202197 const backgroundAsset = workspaceImageAssetByRole ( manifest , BACKGROUND_ROLE ) ;
198+ const color = workspacePaletteBackgroundColor ( manifest ) ;
203199 if ( ! backgroundAsset ) {
204- return { ok : false , message : "manifest must include an Asset Manager V2 image asset with role background." } ;
200+ return {
201+ ok : true ,
202+ backgroundAssetMissing : true ,
203+ colorHex : color ?. hex || "" ,
204+ colorName : color ?. name || ""
205+ } ;
205206 }
206- const color = workspacePaletteBackgroundColor ( manifest ) ;
207- if ( ! color ) {
208- return { ok : false , message : "manifest palette must include a background or black swatch for Preview Generator V2 background hydration ." } ;
207+ const assetFolder = workspaceAssetFolder ( manifest ) ;
208+ if ( ! assetFolder ) {
209+ return { ok : false , message : "assetsPath must be inside gameRoot before hydrating the preview background." } ;
209210 }
210211 const backgroundPath = workspaceGameAssetPath ( manifest , backgroundAsset . path ) ;
211212 if ( ! backgroundPath . pathFromGameRoot . startsWith ( `${ assetFolder } /` ) ) {
@@ -215,8 +216,8 @@ function workspaceBackgroundContext(manifest) {
215216 ok : true ,
216217 backgroundAssetId : backgroundAsset . id ,
217218 backgroundPath : backgroundPath . absolutePath ,
218- colorHex : color . hex ,
219- colorName : color . name
219+ colorHex : color ? .hex || "" ,
220+ colorName : color ? .name || ""
220221 } ;
221222}
222223
@@ -754,7 +755,6 @@ class PreviewGeneratorV2App {
754755 return true ;
755756 }
756757 return workspacePreviewFileValid
757- && workspaceBackgroundValid
758758 && ui . getSelectedTargetType ( ) === "games"
759759 && getAssetFolderRelativePath ( ) === workspacePreviewAssetFolder
760760 && parseInputList ( ui . pathsOrIds . getValue ( ) ) . includes ( workspacePreviewGameId ) ;
@@ -902,7 +902,6 @@ class PreviewGeneratorV2App {
902902 }
903903 logger . log ( "Workspace launch context hydration started." ) ;
904904 workspacePreviewFileValid = false ;
905- workspaceBackgroundValid = false ;
906905 workspaceRepoRootHydrated = false ;
907906 workspaceManifestPreviewPath = "" ;
908907 workspaceGeneratedPreviewPath = "" ;
@@ -930,7 +929,6 @@ class PreviewGeneratorV2App {
930929 workspaceManifestPreviewPath = previewTarget . manifestPreviewPath ;
931930 workspaceGeneratedPreviewPath = previewTarget . generatedPreviewPath ;
932931 ui . setRepoDestinationDisplayName ( repoDisplayName ) ;
933- ui . repoDestination . setWorkspaceContextLabel ( `Hydrated ${ manifest . gameId } workspace (${ normalizeWorkspacePath ( manifest . gameRoot ) } )` ) ;
934932 ui . targetSource . setSelectedTargetType ( "games" ) ;
935933 ui . targetSource . showWorkspaceGamesOnly ( ) ;
936934 ui . assetFolder . setValue ( workspacePreviewAssetFolder ) ;
@@ -947,17 +945,29 @@ class PreviewGeneratorV2App {
947945
948946 const backgroundContext = workspaceBackgroundContext ( manifest ) ;
949947 if ( backgroundContext . ok ) {
950- const backgroundValidation = await validateWorkspaceImagePath ( backgroundContext . backgroundPath , "Workspace background source" ) ;
951- if ( backgroundValidation . ok ) {
952- workspaceBackgroundValid = true ;
953- capture . setCaptureBackgroundColor ( backgroundContext . colorHex ) ;
954- logger . log ( `Workspace background source: ${ backgroundContext . backgroundAssetId } -> ${ backgroundContext . backgroundPath } ` ) ;
955- logger . log ( `Workspace background color: ${ backgroundContext . colorName } ${ backgroundContext . colorHex } from palette-manager-v2 swatch.` ) ;
948+ if ( backgroundContext . backgroundAssetMissing ) {
949+ if ( backgroundContext . colorHex ) {
950+ capture . setCaptureBackgroundColor ( backgroundContext . colorHex ) ;
951+ logger . log ( `WARN Workspace background image role is missing; using manifest palette background color ${ backgroundContext . colorName } ${ backgroundContext . colorHex } .` ) ;
952+ } else {
953+ logger . log ( "WARN Workspace background image role is missing and no manifest palette background or black swatch is available; preview generation remains enabled without an explicit workspace background color." ) ;
954+ }
956955 } else {
957- logger . log ( `FAIL Workspace background hydration: ${ backgroundValidation . message } ` ) ;
956+ const backgroundValidation = await validateWorkspaceImagePath ( backgroundContext . backgroundPath , "Workspace background source" ) ;
957+ if ( backgroundValidation . ok ) {
958+ logger . log ( `Workspace background source: ${ backgroundContext . backgroundAssetId } -> ${ backgroundContext . backgroundPath } ` ) ;
959+ } else {
960+ logger . log ( `WARN Workspace background source unavailable: ${ backgroundValidation . message } ` ) ;
961+ }
962+ if ( backgroundContext . colorHex ) {
963+ capture . setCaptureBackgroundColor ( backgroundContext . colorHex ) ;
964+ logger . log ( `Workspace background color: ${ backgroundContext . colorName } ${ backgroundContext . colorHex } from palette-manager-v2 swatch.` ) ;
965+ } else {
966+ logger . log ( "WARN Workspace background color is not available from a manifest palette background or black swatch; preview generation remains enabled without an explicit workspace background color." ) ;
967+ }
958968 }
959969 } else {
960- logger . log ( `FAIL Workspace background hydration: ${ backgroundContext . message } ` ) ;
970+ logger . log ( `WARN Workspace background hydration: ${ backgroundContext . message } ` ) ;
961971 }
962972
963973 const previewResult = await validateWorkspaceImagePath ( workspaceManifestPreviewPath , "Workspace manifest preview source" ) ;
0 commit comments