88
99namespace HoudiniEngineUnity
1010{
11- [ Inspector ( typeof ( HEU_UnitButton ) ) ]
11+ [ Inspector ( typeof ( HEU_UnitButton ) ) ]
1212 public class HEU_UnitButtonInspector : Inspector
1313 {
14- public HEU_UnitButtonInspector ( Metadata metadata ) : base ( metadata ) { }
14+ public HEU_UnitButtonInspector ( Metadata metadata ) : base ( metadata )
15+ {
16+ }
1517
1618 protected override float GetHeight ( float width , GUIContent label )
1719 {
@@ -21,29 +23,29 @@ protected override float GetHeight(float width, GUIContent label)
2123 protected override void OnGUI ( Rect position , GUIContent label )
2224 {
2325 var attribute = metadata . GetAttribute < HEU_UnitButtonAttribute > ( true ) ;
24- if ( attribute != null )
25- {
26- string functionName = attribute . functionName ;
27- string btnLabel = attribute . buttonLabel ;
28- int btnWidth = attribute . buttonWidth ;
26+ if ( attribute != null )
27+ {
28+ string functionName = attribute . functionName ;
29+ string btnLabel = attribute . buttonLabel ;
30+ int btnWidth = attribute . buttonWidth ;
2931
30- var buttonPosition = new Rect (
31- position . x ,
32- position . y ,
33- position . width + btnWidth ,
34- 16
35- ) ;
32+ var buttonPosition = new Rect (
33+ position . x ,
34+ position . y ,
35+ position . width + btnWidth ,
36+ 16
37+ ) ;
3638
37- if ( GUI . Button ( buttonPosition , btnLabel , new GUIStyle ( UnityEditor . EditorStyles . miniButton ) ) )
38- {
39- if ( attribute != null )
40- {
41- object typeObject = metadata . parent . value ;
42- GraphReference reference = GraphWindow . activeReference ;
43- typeObject . GetType ( ) . GetMethod ( functionName ) . Invoke ( typeObject , new object [ 1 ] { reference } ) ;
44- }
45- }
46- }
39+ if ( GUI . Button ( buttonPosition , btnLabel , new GUIStyle ( UnityEditor . EditorStyles . miniButton ) ) )
40+ {
41+ if ( attribute != null )
42+ {
43+ object typeObject = metadata . parent . value ;
44+ GraphReference reference = GraphWindow . activeReference ;
45+ typeObject . GetType ( ) . GetMethod ( functionName ) . Invoke ( typeObject , new object [ 1 ] { reference } ) ;
46+ }
47+ }
48+ }
4749 }
4850 }
4951}
0 commit comments