MenuEntryAttribute.cs
1.02 KB
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
34
35
36
37
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace UnityEditor.Timeline
{
/// <summary>
/// Used to indicate path and priority of classes that are auto added to the menu
/// </summary>
[AttributeUsage(AttributeTargets.Class)]
internal class MenuEntryAttribute : Attribute
{
public readonly int priority;
public readonly string name;
public readonly string subMenuPath;
public MenuEntryAttribute(string path, int priority)
{
path = path ?? string.Empty;
path = L10n.Tr(path);
this.priority = priority;
int index = path.LastIndexOf('/');
if (index >= 0)
{
name = (index == path.Length - 1) ? string.Empty : path.Substring(index + 1);
subMenuPath = path.Substring(0, index + 1);
}
else
{
name = path;
subMenuPath = string.Empty;
}
}
}
}