-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathParameter.cs
More file actions
53 lines (44 loc) · 1.37 KB
/
Parameter.cs
File metadata and controls
53 lines (44 loc) · 1.37 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using UnityEngine;
using System.Reflection;
namespace Forge {
public class Parameter : Operator {
[Input]
public string Label = "Parameter";
private MemberInfo _parameterInput = null;
public IOOutlet ParameterInput {
get {
if (_parameterInput == null) {
System.Type type = GetType();
MemberInfo[] members = type.GetMembers();
foreach (MemberInfo member in members) {
if (System.Attribute.IsDefined(member, typeof(ParameterInputAttribute))) {
_parameterInput = member;
break;
}
}
if (_parameterInput == null) {
Debug.LogErrorFormat("Operator.ParameterInput error: Operator {0} is not an Input Operator", GetType().Name);
}
}
return new IOOutlet(_parameterInput, IOOutletType.Input);
}
}
private MethodInfo _parameterGUI = null;
public MethodInfo ParameterGUI {
get {
if (_parameterGUI == null) {
System.Type type = GetType();
MemberInfo[] members = type.GetMembers();
foreach (MemberInfo member in members) {
if (System.Attribute.IsDefined(member, typeof(ParameterGUIAttribute)) && member is MethodInfo) {
_parameterGUI = (MethodInfo)member;
break;
}
Debug.LogErrorFormat("Operator.ParameterGUI error: Operator {0} does not have a method with the ParameterGUI attribute", GetType().Name);
}
}
return _parameterGUI;
}
}
}
}