6
6
using System . Collections . Generic ;
7
7
using UnityEditor ;
8
8
using UnityEngine ;
9
+ using ShaderPropertyType = UnityEngine . Rendering . ShaderPropertyType ;
9
10
using Object = UnityEngine . Object ;
10
11
11
12
namespace UnityEditorInternal
@@ -81,21 +82,21 @@ static public bool OverridePropertyColor(MaterialProperty materialProp, Renderer
81
82
var propertyPaths = new List < string > ( ) ;
82
83
string basePropertyPath = kMaterialPrefix + materialProp . name ;
83
84
84
- if ( materialProp . type == MaterialProperty . PropType . Texture )
85
+ if ( materialProp . propertyType == ShaderPropertyType . Texture )
85
86
{
86
87
propertyPaths . Add ( basePropertyPath + "_ST.x" ) ;
87
88
propertyPaths . Add ( basePropertyPath + "_ST.y" ) ;
88
89
propertyPaths . Add ( basePropertyPath + "_ST.z" ) ;
89
90
propertyPaths . Add ( basePropertyPath + "_ST.w" ) ;
90
91
}
91
- else if ( materialProp . type == MaterialProperty . PropType . Color )
92
+ else if ( materialProp . propertyType == ShaderPropertyType . Color )
92
93
{
93
94
propertyPaths . Add ( basePropertyPath + ".r" ) ;
94
95
propertyPaths . Add ( basePropertyPath + ".g" ) ;
95
96
propertyPaths . Add ( basePropertyPath + ".b" ) ;
96
97
propertyPaths . Add ( basePropertyPath + ".a" ) ;
97
98
}
98
- else if ( materialProp . type == MaterialProperty . PropType . Vector )
99
+ else if ( materialProp . propertyType == ShaderPropertyType . Vector )
99
100
{
100
101
propertyPaths . Add ( basePropertyPath + ".x" ) ;
101
102
propertyPaths . Add ( basePropertyPath + ".y" ) ;
@@ -138,31 +139,31 @@ static public void TearDownMaterialPropertyBlock(Renderer target)
138
139
static public bool ApplyMaterialModificationToAnimationRecording ( MaterialProperty materialProp , int changedMask , Renderer target , object oldValue )
139
140
{
140
141
bool applied = false ;
141
- switch ( materialProp . type )
142
+ switch ( materialProp . propertyType )
142
143
{
143
- case MaterialProperty . PropType . Color :
144
+ case ShaderPropertyType . Color :
144
145
SetupMaterialPropertyBlock ( materialProp , changedMask , target ) ;
145
146
applied = ApplyMaterialModificationToAnimationRecording ( MaterialPropertyToPropertyModifications ( materialProp , target , ( Color ) oldValue ) , MaterialPropertyToPropertyModifications ( materialProp , target , materialProp . colorValue ) ) ;
146
147
if ( ! applied )
147
148
TearDownMaterialPropertyBlock ( target ) ;
148
149
return applied ;
149
150
150
- case MaterialProperty . PropType . Vector :
151
+ case ShaderPropertyType . Vector :
151
152
SetupMaterialPropertyBlock ( materialProp , changedMask , target ) ;
152
153
applied = ApplyMaterialModificationToAnimationRecording ( MaterialPropertyToPropertyModifications ( materialProp , target , ( Vector4 ) oldValue ) , MaterialPropertyToPropertyModifications ( materialProp , target , materialProp . vectorValue ) ) ;
153
154
if ( ! applied )
154
155
TearDownMaterialPropertyBlock ( target ) ;
155
156
return applied ;
156
157
157
- case MaterialProperty . PropType . Float :
158
- case MaterialProperty . PropType . Range :
158
+ case ShaderPropertyType . Float :
159
+ case ShaderPropertyType . Range :
159
160
SetupMaterialPropertyBlock ( materialProp , changedMask , target ) ;
160
161
applied = ApplyMaterialModificationToAnimationRecording ( MaterialPropertyToPropertyModifications ( materialProp , target , ( float ) oldValue ) , MaterialPropertyToPropertyModifications ( materialProp , target , materialProp . floatValue ) ) ;
161
162
if ( ! applied )
162
163
TearDownMaterialPropertyBlock ( target ) ;
163
164
return applied ;
164
165
165
- case MaterialProperty . PropType . Texture :
166
+ case ShaderPropertyType . Texture :
166
167
{
167
168
if ( MaterialProperty . IsTextureOffsetAndScaleChangedMask ( changedMask ) )
168
169
{
@@ -183,17 +184,17 @@ static public bool ApplyMaterialModificationToAnimationRecording(MaterialPropert
183
184
184
185
static public PropertyModification [ ] MaterialPropertyToPropertyModifications ( MaterialProperty materialProp , Renderer target )
185
186
{
186
- switch ( materialProp . type )
187
+ switch ( materialProp . propertyType )
187
188
{
188
- case MaterialProperty . PropType . Color :
189
+ case ShaderPropertyType . Color :
189
190
return MaterialPropertyToPropertyModifications ( materialProp , target , materialProp . colorValue ) ;
190
- case MaterialProperty . PropType . Vector :
191
+ case ShaderPropertyType . Vector :
191
192
return MaterialPropertyToPropertyModifications ( materialProp , target , materialProp . vectorValue ) ;
192
- case MaterialProperty . PropType . Float :
193
- case MaterialProperty . PropType . Range :
193
+ case ShaderPropertyType . Float :
194
+ case ShaderPropertyType . Range :
194
195
return MaterialPropertyToPropertyModifications ( materialProp , target , materialProp . floatValue ) ;
195
196
196
- case MaterialProperty . PropType . Texture :
197
+ case ShaderPropertyType . Texture :
197
198
{
198
199
string name = materialProp . name + "_ST" ;
199
200
return MaterialPropertyToPropertyModifications ( name , target , materialProp . vectorValue ) ;
0 commit comments