88public class ObjectHierarchyDiff : EditorWindow
99{
1010 private static string LOG_TAG = "[ObjectHierarchyDiff]:" ;
11+
1112 private enum ExtractDiffType
1213 {
1314 BASE ,
@@ -17,8 +18,8 @@ private enum ExtractDiffType
1718 private GameObject baseObject = null ;
1819 private GameObject targetObject = null ;
1920 private ExtractDiffType extractDiffType = ExtractDiffType . BASE ;
20- private string additionPrefix = "__added" ;
21- private string deletionPrefix = "__deleted" ;
21+ private string additionSuffix = "__added" ;
22+ private string deletionSuffix = "__deleted" ;
2223
2324 [ MenuItem ( "ObjectHierarchyDiff/ObjectHierarchyDiff" ) ]
2425 public static void ShowWindow ( )
@@ -46,10 +47,10 @@ void OnGUI()
4647 switch ( extractDiffType )
4748 {
4849 case ExtractDiffType . BASE :
49- deletionPrefix = EditorGUILayout . TextField ( "Deletion Prefix " , deletionPrefix ) ;
50+ deletionSuffix = EditorGUILayout . TextField ( "Deletion Suffix " , deletionSuffix ) ;
5051 break ;
5152 case ExtractDiffType . TARGET :
52- additionPrefix = EditorGUILayout . TextField ( "Addition Prefix " , additionPrefix ) ;
53+ additionSuffix = EditorGUILayout . TextField ( "Addition Suffix " , additionSuffix ) ;
5354 break ;
5455 default :
5556 throw new Exception ( "invariant: unexpected `ExtractDiffType`" ) ;
@@ -81,13 +82,13 @@ void OnGUI()
8182 {
8283 return ( false , "`Target Object` must be specified." ) ;
8384 }
84- if ( extractDiffType == ExtractDiffType . BASE && deletionPrefix . Trim ( ) . Equals ( "" ) )
85+ if ( extractDiffType == ExtractDiffType . BASE && deletionSuffix . Trim ( ) . Equals ( "" ) )
8586 {
86- return ( false , "`Deletion Prefix ` must be specified." ) ;
87+ return ( false , "`Deletion Suffix ` must be specified." ) ;
8788 }
88- if ( extractDiffType == ExtractDiffType . TARGET && additionPrefix . Trim ( ) . Equals ( "" ) )
89+ if ( extractDiffType == ExtractDiffType . TARGET && additionSuffix . Trim ( ) . Equals ( "" ) )
8990 {
90- return ( false , "`Addition Prefix ` must be specified." ) ;
91+ return ( false , "`Addition Suffix ` must be specified." ) ;
9192 }
9293 return ( true , "" ) ;
9394 }
@@ -104,20 +105,20 @@ private void Run()
104105 }
105106 DiffHelper . Node < GameObject > extractTo ;
106107 List < DiffHelper . Record < GameObject > > subsetDiff ;
107- string prefix ;
108+ string suffix ;
108109 switch ( extractDiffType )
109110 {
110111 case ExtractDiffType . BASE :
111112 Debug . Log ( $ "{ LOG_TAG } Extracting Diffs on Base Object...") ;
112113 extractTo = leftNode ;
113114 subsetDiff = diff . Where ( ( e ) => e . Type == DiffHelper . Type . DELETE ) . ToList ( ) ;
114- prefix = deletionPrefix ;
115+ suffix = deletionSuffix ;
115116 break ;
116117 case ExtractDiffType . TARGET :
117118 Debug . Log ( $ "{ LOG_TAG } Extracting Diffs on Target Object...") ;
118119 extractTo = rightNode ;
119120 subsetDiff = diff . Where ( ( e ) => e . Type == DiffHelper . Type . INSERT ) . ToList ( ) ;
120- prefix = additionPrefix ;
121+ suffix = additionSuffix ;
121122 break ;
122123 default :
123124 throw new Exception ( "invariant: unexpected `ExtractDiffType`" ) ;
@@ -133,7 +134,7 @@ void traverse(DiffHelper.Node<GameObject> node, List<string> path)
133134 var diffPath = d . Path . Skip ( 1 ) ;
134135 if ( Enumerable . SequenceEqual ( pathWithoutRoot , diffPath ) )
135136 {
136- node . Value . name = $ "{ node . Value . name } { prefix } ";
137+ node . Value . name = $ "{ node . Value . name } { suffix } ";
137138 }
138139 }
139140 foreach ( var obj in node . Children )
0 commit comments