@@ -157,6 +157,50 @@ await ResoniteLiveSceneImportTargetTestSupport.ExecuteSceneAsync(
157157 Assert . Contains ( ImportedRgba32Textures ( client ) , static texture => IsSolidColorTexture ( texture , 0 , 255 , 0 ) ) ;
158158 }
159159
160+ [ Fact ]
161+ public async Task ExecuteAsyncKeepsPresentationCommonPayloadMaterialDedicated ( )
162+ {
163+ using TemporaryDirectory datasetDirectory = new ( ) ;
164+ ImportedSceneMetadata metadata = CreateMetadata ( datasetDirectory . Path ) ;
165+ using SceneSinkRecordingClient client = new ( ) ;
166+ ResoniteConstructionCityObject cityObject = CreatePayloadTriangleCityObject (
167+ "presentation-common-payload" ,
168+ ResoniteLiveSceneImportTargetTestSupport . CreateSolidColorPayload ( 255 , 0 , 0 , "textures/presentation-common.png" ) ) with
169+ {
170+ Materials =
171+ [
172+ CreatePayloadTriangleCityObject (
173+ "presentation-common-payload-source" ,
174+ ResoniteLiveSceneImportTargetTestSupport . CreateSolidColorPayload ( 255 , 0 , 0 , "textures/presentation-common.png" ) )
175+ . Materials [ 0 ] with
176+ {
177+ BaseColor = new ResoniteColor ( 0.8 , 0.7 , 0.6 , 1.0 ) ,
178+ AssetBinding = ResoniteMaterialAssetBinding . PresentationCommon ( CommonMaterialCatalog . Create ( ) . Generic . Uv ) ,
179+ } ,
180+ ] ,
181+ } ;
182+
183+ await ResoniteLiveSceneImportTargetTestSupport . ExecuteSceneAsync (
184+ metadata ,
185+ [ cityObject ] ,
186+ client ,
187+ enableMeshBake : false ) ;
188+
189+ string materialId = GetRendererMaterialReferenceTarget ( client , "CityObject presentation-common-payload" ) ;
190+ AddComponent materialComponent = Assert . Single (
191+ client . AddedComponents ,
192+ request => string . Equals ( request . Data . ID , materialId , StringComparison . Ordinal ) ) ;
193+
194+ Assert . DoesNotContain (
195+ "PLATEAU Shared Assets/Common Materials/" ,
196+ client . SlotPaths [ materialComponent . ContainerSlotId ] ,
197+ StringComparison . Ordinal ) ;
198+ Field_colorX albedo = Assert . IsType < Field_colorX > ( materialComponent . Data . Members [ "AlbedoColor" ] ) ;
199+ Assert . Equal ( 0.8f , albedo . Value . r , 6 ) ;
200+ Assert . Equal ( 0.7f , albedo . Value . g , 6 ) ;
201+ Assert . Equal ( 0.6f , albedo . Value . b , 6 ) ;
202+ }
203+
160204 [ Fact ]
161205 public async Task ExecuteAsyncReusesSharedCommonMaterialForPayloadAlbedoOverridesWithExplicitNoOpTransform ( )
162206 {
@@ -1542,7 +1586,7 @@ private static ResoniteConstructionCityObject CreatePayloadTriangleCityObject(
15421586 TextureScale : textureScale ,
15431587 Family : null ,
15441588 TextureOffset : textureOffset ,
1545- AssetBinding : ResoniteMaterialAssetBinding . PresentationCommon ( CommonMaterialCatalog . Create ( ) . Generic . Uv ) ) ,
1589+ AssetBinding : ResoniteMaterialAssetBinding . SharedCommon ( CommonMaterialCatalog . Create ( ) . Generic . Uv ) ) ,
15461590 ] ,
15471591 SourceFileRelativePath : sourceFileRelativePath ) ;
15481592 }
@@ -1572,7 +1616,7 @@ private static ResoniteConstructionCityObject CreateSameKeyPayloadOverrideCityOb
15721616 DepthOffset : null ,
15731617 SubmeshIndices : [ 0 ] ,
15741618 Family : null ,
1575- AssetBinding : ResoniteMaterialAssetBinding . PresentationCommon ( CommonMaterialCatalog . Create ( ) . Generic . Uv ) ) ,
1619+ AssetBinding : ResoniteMaterialAssetBinding . SharedCommon ( CommonMaterialCatalog . Create ( ) . Generic . Uv ) ) ,
15761620 new ResoniteMaterialBinding (
15771621 BaseColor : new ResoniteColor ( 1.0 , 1.0 , 1.0 , 1.0 ) ,
15781622 MaterialType : ResoniteMaterialType . Standard ,
@@ -1582,7 +1626,7 @@ private static ResoniteConstructionCityObject CreateSameKeyPayloadOverrideCityOb
15821626 DepthOffset : null ,
15831627 SubmeshIndices : [ 1 ] ,
15841628 Family : null ,
1585- AssetBinding : ResoniteMaterialAssetBinding . PresentationCommon ( CommonMaterialCatalog . Create ( ) . Generic . Uv ) ) ,
1629+ AssetBinding : ResoniteMaterialAssetBinding . SharedCommon ( CommonMaterialCatalog . Create ( ) . Generic . Uv ) ) ,
15861630 ] ,
15871631 SourceFileRelativePath : sourceFileRelativePath ) ;
15881632 }
@@ -1684,7 +1728,7 @@ private static ResoniteConstructionCityObject CreateMixedMaterialCityObject(
16841728 DepthOffset : null ,
16851729 SubmeshIndices : [ 1 ] ,
16861730 Family : null ,
1687- AssetBinding : ResoniteMaterialAssetBinding . PresentationCommon ( CommonMaterialCatalog . Create ( ) . Generic . Uv ) ) ,
1731+ AssetBinding : ResoniteMaterialAssetBinding . SharedCommon ( CommonMaterialCatalog . Create ( ) . Generic . Uv ) ) ,
16881732 ] ,
16891733 SourceFileRelativePath : sourceFileRelativePath ) ;
16901734 }
0 commit comments