@@ -12,7 +12,45 @@ public abstract partial class Dialog
1212 {
1313 public class TaeAnimPropertiesEdit : Dialog
1414 {
15- public long TaeAnimID ;
15+ string GetAnimIDString ( long id )
16+ {
17+ if ( id < 0 )
18+ return "" ;
19+
20+ var animID_Lower = GameDataManager . GameTypeHasLongAnimIDs
21+ ? ( id % 1_000000 ) : ( id % 1_0000 ) ;
22+
23+ var animID_Upper = GameDataManager . GameTypeHasLongAnimIDs
24+ ? ( id / 1_000000 ) : ( id / 1_0000 ) ;
25+
26+ string curIDText ;
27+ if ( GameDataManager . GameTypeHasLongAnimIDs )
28+ {
29+ bool ds2Meme = GameDataManager . CurrentAnimIDFormatType == GameDataManager . AnimIDFormattingType . aXX_YY_ZZZZ ;
30+ if ( ds2Meme )
31+ {
32+ curIDText = $ "a{ ( animID_Upper ) : D2} _{ animID_Lower : D6} ";
33+ curIDText = curIDText . Insert ( curIDText . Length - 4 , "_" ) ;
34+ }
35+ else
36+ {
37+ curIDText = $ "a{ ( animID_Upper ) : D3} _{ animID_Lower : D6} ";
38+ }
39+ }
40+ else
41+ {
42+ curIDText = $ "a{ ( animID_Upper ) : D2} _{ animID_Lower : D4} ";
43+ }
44+
45+ return curIDText ;
46+ }
47+
48+ public string TaeAnimID_String ;
49+ public long ? TaeAnimID_Value ;
50+
51+ public string ImportFromAnimID_String ;
52+ public int ? ImportFromAnimID_Value ;
53+
1654 public string TaeAnimName ;
1755 public TAE . Animation . AnimMiniHeader TaeAnimHeader ;
1856 public bool WasAnimDeleted = false ;
@@ -21,7 +59,9 @@ public TaeAnimPropertiesEdit(TAE.Animation anim)
2159 {
2260 Title = "Edit Animation Properties" ;
2361
24- TaeAnimID = anim . ID ;
62+ TaeAnimID_String = GetAnimIDString ( anim . ID ) ;
63+ TaeAnimID_Value = anim . ID ;
64+
2565 TaeAnimName = anim . AnimFileName ;
2666 if ( anim . MiniHeader is TAE . Animation . AnimMiniHeader . ImportOtherAnim asImportOtherAnim )
2767 {
@@ -30,6 +70,8 @@ public TaeAnimPropertiesEdit(TAE.Animation anim)
3070 ImportFromAnimID = asImportOtherAnim . ImportFromAnimID ,
3171 Unknown = asImportOtherAnim . Unknown ,
3272 } ;
73+ ImportFromAnimID_String = GetAnimIDString ( asImportOtherAnim . ImportFromAnimID ) ;
74+ ImportFromAnimID_Value = asImportOtherAnim . ImportFromAnimID ;
3375 }
3476 else if ( anim . MiniHeader is TAE . Animation . AnimMiniHeader . Standard asStandard )
3577 {
@@ -40,6 +82,8 @@ public TaeAnimPropertiesEdit(TAE.Animation anim)
4082 ImportsHKX = asStandard . ImportsHKX ,
4183 IsLoopByDefault = asStandard . IsLoopByDefault ,
4284 } ;
85+ ImportFromAnimID_String = GetAnimIDString ( asStandard . ImportHKXSourceAnimID ) ;
86+ ImportFromAnimID_Value = asStandard . ImportHKXSourceAnimID ;
4387 }
4488 }
4589
@@ -48,7 +92,23 @@ protected override void BuildInsideOfWindow()
4892 bool isCurrentlyStandard = TaeAnimHeader . Type == TAE . Animation . MiniHeaderType . Standard ;
4993 bool isCurrentlyImportOther = TaeAnimHeader . Type == TAE . Animation . MiniHeaderType . ImportOtherAnim ;
5094
51- TaeAnimID = MenuBar . IntItem ( "Animation ID" , ( int ) TaeAnimID ) ;
95+ if ( TaeAnimID_Value == null )
96+ ImGui . PushStyleColor ( ImGuiCol . Text , new System . Numerics . Vector4 ( 1 , 0 , 0 , 1 ) ) ;
97+ ImGui . InputText ( "Animation ID" , ref TaeAnimID_String , 256 ) ;
98+ if ( TaeAnimID_Value == null )
99+ ImGui . PopStyleColor ( ) ;
100+ if ( string . IsNullOrWhiteSpace ( TaeAnimID_String ) )
101+ {
102+ TaeAnimID_Value = null ;
103+ }
104+ else if ( long . TryParse ( TaeAnimID_String . Replace ( "a" , "" ) . Replace ( "A" , "" ) . Replace ( "_" , "" ) , out long animIdParsed ) )
105+ {
106+ TaeAnimID_Value = animIdParsed ;
107+ }
108+ else
109+ {
110+ TaeAnimID_Value = null ;
111+ }
52112
53113 ImGui . Separator ( ) ;
54114
@@ -104,7 +164,24 @@ protected override void BuildInsideOfWindow()
104164 ImGui . Text ( "Properties - Duplicate of Other Anim Entry:" ) ;
105165 ImGui . Indent ( ) ;
106166 {
107- asImportOtherAnim . ImportFromAnimID = MenuBar . TaeAnimIDItem ( "Import From Anim ID" , asImportOtherAnim . ImportFromAnimID ) ;
167+ if ( ImportFromAnimID_Value == null )
168+ ImGui . PushStyleColor ( ImGuiCol . Text , new System . Numerics . Vector4 ( 1 , 0 , 0 , 1 ) ) ;
169+ ImGui . InputText ( "Duplicate of Animation ID" , ref ImportFromAnimID_String , 256 ) ;
170+ if ( ImportFromAnimID_Value == null )
171+ ImGui . PopStyleColor ( ) ;
172+ if ( string . IsNullOrWhiteSpace ( ImportFromAnimID_String ) )
173+ {
174+ ImportFromAnimID_Value = asImportOtherAnim . ImportFromAnimID = - 1 ;
175+ }
176+ else if ( int . TryParse ( ImportFromAnimID_String . Replace ( "a" , "" ) . Replace ( "A" , "" ) . Replace ( "_" , "" ) , out int importFromIdParsed ) )
177+ {
178+ ImportFromAnimID_Value = asImportOtherAnim . ImportFromAnimID = importFromIdParsed ;
179+ }
180+ else
181+ {
182+ ImportFromAnimID_Value = null ;
183+ }
184+
108185 asImportOtherAnim . Unknown = MenuBar . IntItem ( "Unknown Value" , asImportOtherAnim . Unknown ) ;
109186 }
110187 ImGui . Unindent ( ) ;
@@ -114,11 +191,26 @@ protected override void BuildInsideOfWindow()
114191 ImGui . Text ( "Properties - Standard Animation:" ) ;
115192 ImGui . Indent ( ) ;
116193 {
117- asStandard . ImportsHKX = MenuBar . CheckboxBig ( "Imports HKX From Elsewhere" , asStandard . ImportsHKX ) ;
118- if ( asStandard . ImportsHKX )
119- asStandard . ImportHKXSourceAnimID = MenuBar . IntItem ( "Import HKX From ID" , asStandard . ImportHKXSourceAnimID ) ;
194+ asStandard . ImportsHKX = MenuBar . CheckboxBig ( "Import Other HKX" , asStandard . ImportsHKX ) ;
195+
196+ if ( ImportFromAnimID_Value == null )
197+ ImGui . PushStyleColor ( ImGuiCol . Text , new System . Numerics . Vector4 ( 1 , 0 , 0 , 1 ) ) ;
198+ ImGui . InputText ( "Import HKX ID" , ref ImportFromAnimID_String , 256 ) ;
199+ if ( ImportFromAnimID_Value == null )
200+ ImGui . PopStyleColor ( ) ;
201+ if ( string . IsNullOrWhiteSpace ( ImportFromAnimID_String ) )
202+ {
203+ ImportFromAnimID_Value = asStandard . ImportHKXSourceAnimID = - 1 ;
204+ }
205+ else if ( int . TryParse ( ImportFromAnimID_String . Replace ( "a" , "" ) . Replace ( "A" , "" ) . Replace ( "_" , "" ) , out int importFromIdParsed ) )
206+ {
207+ ImportFromAnimID_Value = asStandard . ImportHKXSourceAnimID = importFromIdParsed ;
208+ }
120209 else
121- asStandard . ImportHKXSourceAnimID = - 1 ;
210+ {
211+ ImportFromAnimID_Value = null ;
212+ }
213+
122214 asStandard . AllowDelayLoad = MenuBar . CheckboxBig ( "Allow loading from DelayLoad ANIBNDs" , asStandard . AllowDelayLoad ) ;
123215 asStandard . IsLoopByDefault = MenuBar . CheckboxBig ( "Enable Looping" , asStandard . IsLoopByDefault ) ;
124216 }
@@ -151,11 +243,21 @@ protected override void BuildInsideOfWindow()
151243 Dismiss ( ) ;
152244 }
153245
246+ bool invalidState = ( ImportFromAnimID_Value == null || TaeAnimID_Value == null ) ;
247+
154248 ImGui . Button ( "Apply & Save Changes" ) ;
155249 if ( ImGui . IsItemClicked ( ) )
156250 {
157- CancelType = CancelTypes . ClickedAcceptButton ;
158- Dismiss ( ) ;
251+ if ( invalidState )
252+ {
253+ DialogManager . DialogOK ( "Errors Present" , "Cannot accept changes until the animation ID formatting errors (shown in red) are fixed." ) ;
254+ }
255+ else
256+ {
257+ CancelType = CancelTypes . ClickedAcceptButton ;
258+ Dismiss ( ) ;
259+ }
260+
159261 }
160262
161263 //throw new NotImplementedException();
0 commit comments