blob: 435e66e52f84faed5ebc543a70de0e812ac5d119 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
using System.Linq;
using UnityEditor;
using UnityEngine;
namespace Coffee.UIEffects.Editors
{
/// <summary>
/// Changes in this scope cause the graphic's material to be dirty.
/// When you change a property, it marks the material as dirty.
/// </summary>
internal class MaterialDirtyScope : EditorGUI.ChangeCheckScope
{
readonly Object[] targets;
public MaterialDirtyScope(Object[] targets)
{
this.targets = targets;
}
protected override void CloseScope()
{
if (changed)
{
foreach (var effect in targets.OfType<BaseMaterialEffect>())
{
effect.SetMaterialDirty();
}
}
base.CloseScope();
}
}
}
|