void DisplayVec3Field(MaterialEditor materialEditor, string displayName, CSProperty _xProp, CSProperty _yProp, CSProperty _zProp) { MaterialProperty xProp = _xProp.prop; MaterialProperty yProp = _yProp.prop; MaterialProperty zProp = _zProp.prop; materialEditor.BeginAnimatedCheck(xProp); materialEditor.BeginAnimatedCheck(yProp); materialEditor.BeginAnimatedCheck(zProp); EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = xProp.hasMixedValue || yProp.hasMixedValue || zProp.hasMixedValue; var oldLabelWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 0f; Vector3 v = EditorGUILayout.Vector3Field(displayName, new Vector3(xProp.floatValue, yProp.floatValue, zProp.floatValue)); EditorGUIUtility.labelWidth = oldLabelWidth; EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { xProp.floatValue = v.x; yProp.floatValue = v.y; zProp.floatValue = v.z; } materialEditor.EndAnimatedCheck(); materialEditor.EndAnimatedCheck(); materialEditor.EndAnimatedCheck(); }
MaterialProperty BeginProperty(string name) { MaterialProperty property = FindProperty(name, m_Properties); EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = property.hasMixedValue; m_Editor.BeginAnimatedCheck(Rect.zero, property); return(property); }
protected void BeginMaterialProperty(MaterialProperty property) { #if UNITY_2017_1_OR_NEWER MatEditor.BeginAnimatedCheck(Rect.zero, Property); #else MatEditor.BeginAnimatedCheck(Property); #endif EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = Property.hasMixedValue; }
MaterialProperty BeginProperty(string name) { MaterialProperty property = FindProperty(name, properties); EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = property.hasMixedValue; #if UNITY_2017_1_OR_NEWER editor.BeginAnimatedCheck(Rect.zero, property); #else editor.BeginAnimatedCheck(property); #endif return(property); }
public static void TextureScaleOffsetVector4Property(MaterialEditor matEditor, MaterialProperty scaleOffsetProp) { //matEditor.BeginAnimatedCheck(GetControlRectForSingleLine(), scaleOffsetProp); matEditor.BeginAnimatedCheck(scaleOffsetProp); EditorGUI.showMixedValue = scaleOffsetProp.hasMixedValue; EditorGUI.BeginChangeCheck(); Vector4 scaleOffsetVector = scaleOffsetProp.vectorValue; var textureScale = new Vector2(scaleOffsetVector.x, scaleOffsetVector.y); textureScale = EditorGUILayout.Vector2Field(Styles.scale, textureScale); var textureOffset = new Vector2(scaleOffsetVector.z, scaleOffsetVector.w); textureOffset = EditorGUILayout.Vector2Field(Styles.offset, textureOffset); if (EditorGUI.EndChangeCheck()) { scaleOffsetProp.vectorValue = new Vector4(textureScale.x, textureScale.y, textureOffset.x, textureOffset.y); } EditorGUI.showMixedValue = false; matEditor.EndAnimatedCheck(); }
public static void TextureScaleOffsetVector4Property(MaterialEditor matEditor, GUIContent label, MaterialProperty scaleOffsetProp) { matEditor.BeginAnimatedCheck(new Rect(), scaleOffsetProp); EditorGUI.showMixedValue = scaleOffsetProp.hasMixedValue; EditorGUI.BeginChangeCheck(); Vector4 scaleOffsetVector = scaleOffsetProp.vectorValue; Vector2 textureScale = new Vector2(scaleOffsetVector.x, scaleOffsetVector.y); textureScale = EditorGUILayout.Vector2Field(Styles.scale, textureScale, new GUILayoutOption[0]); Vector2 textureOffset = new Vector2(scaleOffsetVector.z, scaleOffsetVector.w); textureOffset = EditorGUILayout.Vector2Field(Styles.offset, textureOffset, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { scaleOffsetProp.vectorValue = new Vector4(textureScale.x, textureScale.y, textureOffset.x, textureOffset.y); } EditorGUI.showMixedValue = false; matEditor.EndAnimatedCheck(); }
private MaterialProperty BeginProperty(string name) { MaterialProperty materialProperty = ShaderGUI.FindProperty(name, properties); EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = materialProperty.hasMixedValue; editor.BeginAnimatedCheck(materialProperty); return(materialProperty); }
MaterialProperty BeginProperty(string name) { MaterialProperty property = FindProperty(name, properties); EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = property.hasMixedValue; Rect TotalPosition = new Rect(0, 0, 100, 100); editor.BeginAnimatedCheck(TotalPosition, property); return(property); }