@@ -17,12 +17,30 @@ public partial class GLTFSceneExporter
1717 internal readonly List < IJsonPointerResolver > pointerResolvers = new List < IJsonPointerResolver > ( ) ;
1818 private readonly KHR_animation_pointer_Resolver animationPointerResolver = new KHR_animation_pointer_Resolver ( ) ;
1919
20+ private readonly List < Material > _ignorePropertyRemapping = new List < Material > ( ) ;
21+
2022 public void RegisterResolver ( IJsonPointerResolver resolver )
2123 {
2224 if ( ! pointerResolvers . Contains ( resolver ) )
2325 pointerResolvers . Add ( resolver ) ;
2426 }
2527
28+ /// <summary>
29+ /// Skipping remapping of material properties for this material, to keep the original shader properties
30+ /// </summary>
31+ /// <param name="material"></param>
32+ public void MarkMaterialAsCustomShaderExport ( Material material )
33+ {
34+ if ( material == null ) return ;
35+ _ignorePropertyRemapping . Add ( material ) ;
36+ }
37+
38+ public bool ShouldMaterialPropertiesRemapped ( Material material )
39+ {
40+ if ( material == null ) return true ;
41+ return ! _ignorePropertyRemapping . Contains ( material ) ;
42+ }
43+
2644 /// <summary>
2745 /// AddAnimationData should be called within the <see cref="ExportContext.AfterSceneExport"/> event.
2846 /// <remarks>
@@ -92,11 +110,12 @@ public void AddAnimationData(Object animatedObject, string propertyName, GLTFAni
92110 Debug . Log ( LogType . Error , "No MaterialPropertiesRemapper found in AnimationPointerExportContext. Skipping animation" ) ;
93111 return ;
94112 }
113+
114+ if ( ! ShouldMaterialPropertiesRemapped ( material ) )
115+ break ;
95116
96117 if ( ! animationPointerExportContext . materialPropertiesRemapper . GetMapFromUnityMaterial ( material , propertyName , out MaterialPointerPropertyMap map ) )
97- {
98118 break ;
99- }
100119
101120 secondPropertyName = map . GltfSecondaryPropertyName ;
102121 propertyName = map . GltfPropertyName ;
0 commit comments