66using System . Collections . Generic ;
77using UnityEditor ;
88using UnityEngine ;
9+ using ShaderPropertyType = UnityEngine . Rendering . ShaderPropertyType ;
910using Object = UnityEngine . Object ;
1011
1112namespace UnityEditorInternal
@@ -81,21 +82,21 @@ static public bool OverridePropertyColor(MaterialProperty materialProp, Renderer
8182 var propertyPaths = new List < string > ( ) ;
8283 string basePropertyPath = kMaterialPrefix + materialProp . name ;
8384
84- if ( materialProp . type == MaterialProperty . PropType . Texture )
85+ if ( materialProp . propertyType == ShaderPropertyType . Texture )
8586 {
8687 propertyPaths . Add ( basePropertyPath + "_ST.x" ) ;
8788 propertyPaths . Add ( basePropertyPath + "_ST.y" ) ;
8889 propertyPaths . Add ( basePropertyPath + "_ST.z" ) ;
8990 propertyPaths . Add ( basePropertyPath + "_ST.w" ) ;
9091 }
91- else if ( materialProp . type == MaterialProperty . PropType . Color )
92+ else if ( materialProp . propertyType == ShaderPropertyType . Color )
9293 {
9394 propertyPaths . Add ( basePropertyPath + ".r" ) ;
9495 propertyPaths . Add ( basePropertyPath + ".g" ) ;
9596 propertyPaths . Add ( basePropertyPath + ".b" ) ;
9697 propertyPaths . Add ( basePropertyPath + ".a" ) ;
9798 }
98- else if ( materialProp . type == MaterialProperty . PropType . Vector )
99+ else if ( materialProp . propertyType == ShaderPropertyType . Vector )
99100 {
100101 propertyPaths . Add ( basePropertyPath + ".x" ) ;
101102 propertyPaths . Add ( basePropertyPath + ".y" ) ;
@@ -138,31 +139,31 @@ static public void TearDownMaterialPropertyBlock(Renderer target)
138139 static public bool ApplyMaterialModificationToAnimationRecording ( MaterialProperty materialProp , int changedMask , Renderer target , object oldValue )
139140 {
140141 bool applied = false ;
141- switch ( materialProp . type )
142+ switch ( materialProp . propertyType )
142143 {
143- case MaterialProperty . PropType . Color :
144+ case ShaderPropertyType . Color :
144145 SetupMaterialPropertyBlock ( materialProp , changedMask , target ) ;
145146 applied = ApplyMaterialModificationToAnimationRecording ( MaterialPropertyToPropertyModifications ( materialProp , target , ( Color ) oldValue ) , MaterialPropertyToPropertyModifications ( materialProp , target , materialProp . colorValue ) ) ;
146147 if ( ! applied )
147148 TearDownMaterialPropertyBlock ( target ) ;
148149 return applied ;
149150
150- case MaterialProperty . PropType . Vector :
151+ case ShaderPropertyType . Vector :
151152 SetupMaterialPropertyBlock ( materialProp , changedMask , target ) ;
152153 applied = ApplyMaterialModificationToAnimationRecording ( MaterialPropertyToPropertyModifications ( materialProp , target , ( Vector4 ) oldValue ) , MaterialPropertyToPropertyModifications ( materialProp , target , materialProp . vectorValue ) ) ;
153154 if ( ! applied )
154155 TearDownMaterialPropertyBlock ( target ) ;
155156 return applied ;
156157
157- case MaterialProperty . PropType . Float :
158- case MaterialProperty . PropType . Range :
158+ case ShaderPropertyType . Float :
159+ case ShaderPropertyType . Range :
159160 SetupMaterialPropertyBlock ( materialProp , changedMask , target ) ;
160161 applied = ApplyMaterialModificationToAnimationRecording ( MaterialPropertyToPropertyModifications ( materialProp , target , ( float ) oldValue ) , MaterialPropertyToPropertyModifications ( materialProp , target , materialProp . floatValue ) ) ;
161162 if ( ! applied )
162163 TearDownMaterialPropertyBlock ( target ) ;
163164 return applied ;
164165
165- case MaterialProperty . PropType . Texture :
166+ case ShaderPropertyType . Texture :
166167 {
167168 if ( MaterialProperty . IsTextureOffsetAndScaleChangedMask ( changedMask ) )
168169 {
@@ -183,17 +184,17 @@ static public bool ApplyMaterialModificationToAnimationRecording(MaterialPropert
183184
184185 static public PropertyModification [ ] MaterialPropertyToPropertyModifications ( MaterialProperty materialProp , Renderer target )
185186 {
186- switch ( materialProp . type )
187+ switch ( materialProp . propertyType )
187188 {
188- case MaterialProperty . PropType . Color :
189+ case ShaderPropertyType . Color :
189190 return MaterialPropertyToPropertyModifications ( materialProp , target , materialProp . colorValue ) ;
190- case MaterialProperty . PropType . Vector :
191+ case ShaderPropertyType . Vector :
191192 return MaterialPropertyToPropertyModifications ( materialProp , target , materialProp . vectorValue ) ;
192- case MaterialProperty . PropType . Float :
193- case MaterialProperty . PropType . Range :
193+ case ShaderPropertyType . Float :
194+ case ShaderPropertyType . Range :
194195 return MaterialPropertyToPropertyModifications ( materialProp , target , materialProp . floatValue ) ;
195196
196- case MaterialProperty . PropType . Texture :
197+ case ShaderPropertyType . Texture :
197198 {
198199 string name = materialProp . name + "_ST" ;
199200 return MaterialPropertyToPropertyModifications ( name , target , materialProp . vectorValue ) ;
0 commit comments