-
Notifications
You must be signed in to change notification settings - Fork 8
/
uLoader.cs
1101 lines (968 loc) · 53.6 KB
/
uLoader.cs
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEngine;
using uSource.Formats.Source.VBSP;
using uSource.Formats.Source.MDL;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace uSource
{
#if UNITY_EDITOR
//TODO: Fix Window
public class uLoaderWindow : EditorWindow
{
Vector2 scrollPos;
[MenuItem("uSource/Importer")]
static void Init()
{
uLoaderWindow window = (uLoaderWindow)GetWindow(typeof(uLoaderWindow));
window.Show();
}
void OnGUI()
{
scrollPos = EditorGUILayout.BeginScrollView(scrollPos);
uLoaderEditor.DrawGUI();
EditorGUILayout.EndScrollView();
}
}
//TODO: Rework all this to serializable object?
[CustomEditor(typeof(uLoader))]
public class uLoaderEditor : Editor
{
public override void OnInspectorGUI()
{
//base.OnInspectorGUI();
DrawGUI();
}
static GUIStyle WindowContent;
static GUIStyle BoxContent;
static GUIStyle BoxContentLabel;
public static void DrawGUI()
{
#region Global Settings
if (!uLoader.PresetLoaded)
{
WindowContent = new GUIStyle(GUI.skin.window);
WindowContent.padding = new RectOffset(0, 0, WindowContent.padding.top, 0);
WindowContent.margin = new RectOffset(0, 0, 0, 0);
WindowContent.font = EditorStyles.boldLabel.font;
WindowContent.fontStyle = FontStyle.Bold;
BoxContent = new GUIStyle(GUI.skin.box);
BoxContent.padding = new RectOffset(0, 0, 0, 0);
BoxContent.margin = new RectOffset(0, 0, BoxContent.margin.top, 0);
BoxContent.contentOffset = new Vector2(0, 0);
BoxContentLabel = new GUIStyle(BoxContent);
BoxContentLabel.padding = WindowContent.padding;
BoxContentLabel.margin = GUI.skin.box.margin;
BoxContentLabel.contentOffset = WindowContent.contentOffset;
BoxContentLabel.alignment = WindowContent.alignment;
BoxContentLabel.normal.textColor = WindowContent.normal.textColor;
BoxContentLabel.wordWrap = WindowContent.wordWrap;
BoxContentLabel.font = EditorStyles.boldLabel.font;
BoxContentLabel.fontStyle = FontStyle.Bold;
uLoader.LoadPreset();
}
GUILayout.BeginVertical("box");
{
if (uLoader.GlobalSettingsFoldout = EditorGUILayout.Foldout(uLoader.GlobalSettingsFoldout, "Global Settings", true, EditorStyles.miniButtonLeft))
{
uLoader.RootPath = EditorGUILayout.TextField("Root path:", uLoader.RootPath);
#region Mod Settings
GUILayout.BeginVertical("box");
{
if (uLoader.ModSettingsFoldout = EditorGUILayout.Foldout(uLoader.ModSettingsFoldout, "Mod Settings", true, EditorStyles.miniButtonLeft))
{
Int32 ModSize = uLoader.ModFolders.Length;
for (Int32 ModID = 0; ModID < ModSize; ModID++)
{
GUILayout.BeginVertical("helpbox");
{
uLoader.ModFolders[ModID] = EditorGUILayout.TextField(ModID == 0 ? "Main Mod: " : "Dependent Mod: ", uLoader.ModFolders[ModID]);
GUILayout.Label("VPK Archives", EditorStyles.boldLabel);
Int32 DirSize = uLoader.DirPaks[ModID].Length;
for (Int32 PakID = 0; PakID < DirSize; PakID++)
{
if (uLoader.DirPaks[ModID] != null)
uLoader.DirPaks[ModID][PakID] = EditorGUILayout.TextField(uLoader.DirPaks[ModID][PakID]);
}
GUILayout.BeginHorizontal();
{
if (GUILayout.Button("Add VPK", EditorStyles.toolbarButton))
{
Int32 ArraySize = DirSize;
ArraySize++;
Array.Resize(ref uLoader.DirPaks[ModID], ArraySize);
}
if (GUILayout.Button("Remove VPK", EditorStyles.toolbarButton))
{
Int32 ArraySize = DirSize;
if (ArraySize > 0)
{
ArraySize--;
Array.Resize(ref uLoader.DirPaks[ModID], ArraySize);
}
}
}
GUILayout.EndHorizontal();
}
GUILayout.EndVertical();
}
GUILayout.BeginHorizontal();
{
if (GUILayout.Button("Add Mod", EditorStyles.toolbarButton))
{
Int32 ArraySize = uLoader.ModFolders.Length;
ArraySize++;
Array.Resize(ref uLoader.ModFolders, ArraySize);
Array.Resize(ref uLoader.DirPaks, ArraySize);
uLoader.DirPaks[ArraySize - 1] = new String[] { };
}
if (GUILayout.Button("Remove Mod", EditorStyles.toolbarButton))
{
Int32 ArraySize = uLoader.ModFolders.Length;
if (ArraySize > 0)
{
ArraySize--;
Array.Resize(ref uLoader.ModFolders, ArraySize);
Array.Resize(ref uLoader.DirPaks, ArraySize);
}
}
}
GUILayout.EndHorizontal();
}
}
GUILayout.EndVertical();
#endregion
#region LOD Settings
GUILayout.BeginVertical("box");
{
if (uLoader.LodSettingsFoldout = EditorGUILayout.Foldout(uLoader.LodSettingsFoldout, "Models LOD Settings", true, EditorStyles.miniButtonLeft))
{
uLoader.EnableLODParsing = EditorGUILayout.ToggleLeft("Enable LOD (Beta)", uLoader.EnableLODParsing);
if (uLoader.EnableLODParsing)
{
uLoader.DetailMode = (DetailMode)EditorGUILayout.EnumPopup("Model Detail: ", uLoader.DetailMode);
if (uLoader.DetailMode == DetailMode.None)
{
uLoader.NegativeAddLODPrecent = EditorGUILayout.Slider("Add percent difference (Last LOD)", uLoader.NegativeAddLODPrecent, 0.01f, 1f);
GUILayout.BeginVertical("helpbox");
GUILayout.Label("Used to avoid errors LODGroup", EditorStyles.boldLabel);
uLoader.ThresholdMaxSwitch = EditorGUILayout.Slider("Threshold max switch point", uLoader.ThresholdMaxSwitch, 0.01f, 10f);
GUILayout.EndVertical();
GUILayout.BeginVertical("helpbox");
GUILayout.Label("Low percent - Less distance between each LOD.\nHigh percent - Greater distance between each LOD.");
uLoader.SubstractLODPrecent = EditorGUILayout.Slider("Percent distance (Substract)", uLoader.SubstractLODPrecent, 0.01f, 1f);
GUILayout.EndVertical();
}
}
}
}
GUILayout.EndVertical();
#endregion
uLoader.LoadAnims = EditorGUILayout.ToggleLeft("Load animations (Beta)", uLoader.LoadAnims);
uLoader.ClearDirectoryCache = EditorGUILayout.ToggleLeft("Clear directory cache", uLoader.ClearDirectoryCache);
uLoader.ClearModelCache = EditorGUILayout.ToggleLeft("Clear model cache", uLoader.ClearModelCache);
uLoader.ClearMaterialCache = EditorGUILayout.ToggleLeft("Clear material cache", uLoader.ClearMaterialCache);
uLoader.ClearTextureCache = EditorGUILayout.ToggleLeft("Clear texture cache", uLoader.ClearTextureCache);
uLoader.UnitScale = EditorGUILayout.FloatField("Unit scale:", uLoader.UnitScale);
GUILayout.BeginVertical("helpbox");
{
uLoader.SaveAssetsToUnity = EditorGUILayout.ToggleLeft("(Save / Load) assets (to / from) project (Beta)", uLoader.SaveAssetsToUnity);
if (uLoader.SaveAssetsToUnity)
{
uLoader.OutputAssetsFolder = EditorGUILayout.TextField("Output path: ", uLoader.OutputAssetsFolder);
uLoader.ExportTextureAsPNG = EditorGUILayout.ToggleLeft("Convert textures as PNG (Editable format)", uLoader.ExportTextureAsPNG);
}
}
GUILayout.EndVertical();
}
#region Presets
GUILayout.BeginVertical("box");
{
GUILayout.BeginVertical("helpbox");
GUILayout.Label("Preset Settings", EditorStyles.largeLabel);
GUILayout.EndVertical();
#region Auto Save
GUILayout.BeginVertical();
{
uLoader.SaveAfterResetPreset = EditorGUILayout.ToggleLeft("Auto Save Preset (After Reset)", uLoader.SaveAfterResetPreset);
uLoader.AutoSavePreset = EditorGUILayout.ToggleLeft("Auto Save Presets", uLoader.AutoSavePreset);
}
GUILayout.EndVertical();
#endregion
GUILayout.BeginHorizontal();
{
if (GUILayout.Button("Load Preset", EditorStyles.toolbarButton))
uLoader.LoadPreset();
if (GUILayout.Button("Save Preset", EditorStyles.toolbarButton))
uLoader.SavePreset();
if (GUILayout.Button("Reset Preset", EditorStyles.toolbarButton))
uLoader.ResetPreset();
}
GUILayout.EndHorizontal();
}
GUILayout.EndVertical();
#endregion
if (GUILayout.Button("Clear Cache", EditorStyles.toolbarButton))
uLoader.Clear();
}
GUILayout.EndVertical();
#endregion
GUILayout.Space(2);
#region BSP
GUILayout.BeginVertical("box");
{
if (uLoader.BSPSettingsFoldout = EditorGUILayout.Foldout(uLoader.BSPSettingsFoldout, "BSP Import Settings", true, EditorStyles.miniButtonLeft))
{
uLoader.ParseBSPPhysics = EditorGUILayout.ToggleLeft("Parse physics (Unstable)", uLoader.ParseBSPPhysics);
uLoader.ParseStaticPropScale = EditorGUILayout.ToggleLeft("Parse static props scale (only for v11 & csgo)", uLoader.ParseStaticPropScale);
uLoader.Use3DSkybox = EditorGUILayout.ToggleLeft("Use 3D Skybox", uLoader.Use3DSkybox);
uLoader.ParseDecals = EditorGUILayout.ToggleLeft("Parse decals (Beta)", uLoader.ParseDecals);
uLoader.DebugEntities = EditorGUILayout.ToggleLeft("Debug entities", uLoader.DebugEntities);
#region Lightmap settings
GUILayout.BeginVertical("box");
if (uLoader.LightmapSettingsFoldout = EditorGUILayout.Foldout(uLoader.LightmapSettingsFoldout, "Lightmap Settings", true, EditorStyles.miniButtonLeft))
{
uLoader.ParseLightmaps = EditorGUILayout.ToggleLeft("Parse original lightmaps (BSP)", uLoader.ParseLightmaps);
if (uLoader.ParseLightmaps)
{
uLoader.UseGammaLighting = EditorGUILayout.ToggleLeft("Use gamma color space on lightmaps", uLoader.UseGammaLighting);
uLoader.UseLightmapsAsTextureShader = EditorGUILayout.ToggleLeft("Set lightmap texture on material", uLoader.UseLightmapsAsTextureShader);
}
GUILayout.Space(5);
uLoader.GenerateUV2StaticProps = EditorGUILayout.ToggleLeft("Generate UV2 (Lightmaps) for static props", uLoader.GenerateUV2StaticProps);
if (uLoader.GenerateUV2StaticProps)
{
GUILayout.BeginVertical("box");
GUILayout.Label("Static Props (Models)", EditorStyles.boldLabel);
GUILayout.BeginVertical("helpbox");
uLoader.ModelsLightmapSize = EditorGUILayout.FloatField("Lightmap scale factor", uLoader.ModelsLightmapSize);
GUILayout.Label("Used to scale lightmap on models (editor & rebake only)", EditorStyles.miniBoldLabel);
GUILayout.EndVertical();
uLoader.UV2HardAngleProps = EditorGUILayout.IntSlider("Hard Angle: ", uLoader.UV2HardAngleProps, 0, 180);
uLoader.UV2AngleErrorProps = EditorGUILayout.IntSlider("Angle Error: ", uLoader.UV2AngleErrorProps, 1, 100);
uLoader.UV2AreaErrorProps = EditorGUILayout.IntSlider("Area Error: ", uLoader.UV2AreaErrorProps, 1, 100);
uLoader.UV2PackMarginTexSize = EditorGUILayout.FloatField("Margin Size: ", uLoader.UV2PackMarginTexSize);
uLoader.UV2PackMarginProps = EditorGUILayout.IntSlider("Pack Margin: ", uLoader.UV2PackMarginProps, 1, 64);
GUILayout.EndVertical();
}
}
GUILayout.EndVertical();
#endregion
#region Lighting Settings
GUILayout.BeginVertical("box");
if (uLoader.LightingSettingsFoldout = EditorGUILayout.Foldout(uLoader.LightingSettingsFoldout, "Lighting Settings", true, EditorStyles.miniButtonLeft))
{
uLoader.ParseLights = EditorGUILayout.ToggleLeft("Parse lights", uLoader.ParseLights);
if (uLoader.ParseLights)
{
GUILayout.BeginVertical("Additional intensity scales (optional)", BoxContentLabel);
uLoader.AmbientIntensityScale = EditorGUILayout.FloatField(new GUIContent("Ambient", "Additional intensity scale for ambient color"), uLoader.AmbientIntensityScale);
uLoader.LightEnvironmentScale = EditorGUILayout.FloatField(new GUIContent("Directional", "Additional intensity scale for directional light"), uLoader.LightEnvironmentScale);
uLoader.PointIntensityScale = EditorGUILayout.FloatField(new GUIContent("Point", "Additional intensity scale for point light"), uLoader.PointIntensityScale);
uLoader.SpotIntensityScale = EditorGUILayout.FloatField(new GUIContent("Spot", "Additional intensity scale for spot light"), uLoader.SpotIntensityScale);
uLoader.SurfLightIntensityScale = EditorGUILayout.FloatField(new GUIContent("Surface", "Additional intensity scale for surface light"), uLoader.SurfLightIntensityScale);
GUILayout.EndVertical();
uLoader.CustomCascadedShadowResolution = EditorGUILayout.IntSlider("Directional Shadow Map Size:", uLoader.CustomCascadedShadowResolution, 64, 8192);
uLoader.LightAttenuationDistance = EditorGUILayout.FloatField(new GUIContent("Attenuation distance", "Distance from vertex position to light position (lower distance - brighter, higher distance - less bright)"), uLoader.LightAttenuationDistance);
uLoader.LightInfinityRadiusClamp = EditorGUILayout.FloatField(new GUIContent("Infinity radius", "Clamped radius light if equal infinity"), uLoader.LightInfinityRadiusClamp);
uLoader.LightMinValue = EditorGUILayout.FloatField(new GUIContent("Min Value", "This keeps the behavior of the cutoff radius consistent."), uLoader.LightMinValue);
uLoader.UseDynamicLight = EditorGUILayout.ToggleLeft("Dynamic shadows", uLoader.UseDynamicLight);
}
}
GUILayout.EndVertical();
#endregion
uLoader.MapName = EditorGUILayout.TextField("Map Name:", uLoader.MapName);
if (GUILayout.Button("Load BSP", EditorStyles.toolbarButton))
{
if (uLoader.AutoSavePreset)
uLoader.SavePreset();
uLoader.DebugTime = new System.Diagnostics.Stopwatch();
uLoader.DebugTimeOutput = new System.Text.StringBuilder();
uLoader.DebugTime.Start();
uLoader.Clear();
uResourceManager.LoadMap(uLoader.MapName);
uLoader.DebugTime = null;
}
if (GUILayout.Button("Show/Hide Brushes", EditorStyles.toolbarButton))
{
for (Int32 i = 0; i < VBSPFile.BSP_Brushes.Count; i++)
VBSPFile.BSP_Brushes[i].GetComponent<Renderer>().enabled = !VBSPFile.BSP_Brushes[i].GetComponent<Renderer>().enabled;
}
}
}
GUILayout.EndVertical();
#endregion
GUILayout.Space(2);
#region MDL
GUILayout.BeginVertical("box");
{
if (uLoader.MDLSettingsFoldout = EditorGUILayout.Foldout(uLoader.MDLSettingsFoldout, "MDL Import Settings", true, EditorStyles.miniButtonLeft))
{
uLoader.UseStaticPropFlag = EditorGUILayout.ToggleLeft("Load static bones", uLoader.UseStaticPropFlag);
uLoader.UseHitboxesOnModel = EditorGUILayout.ToggleLeft("Load hitboxes model", uLoader.UseHitboxesOnModel);
uLoader.DrawArmature = EditorGUILayout.ToggleLeft("Debug skeleton / bones", uLoader.DrawArmature);
uLoader.ModelPath = EditorGUILayout.TextField("Model:", uLoader.ModelPath);
if (GUILayout.Button("Load StudioModel", EditorStyles.toolbarButton))
{
if (uLoader.AutoSavePreset)
uLoader.SavePreset();
uLoader.Clear();
uResourceManager.Init();
uResourceManager.LoadModel(uLoader.ModelPath, uLoader.LoadAnims, uLoader.UseHitboxesOnModel);
uResourceManager.ExportFromCache();
uResourceManager.CloseStreams();
}
uLoader.SubModelPath = EditorGUILayout.TextField("Sub-Model: ", uLoader.SubModelPath);
if (GUILayout.Button("Load StudioModel + SubModel", EditorStyles.toolbarButton))
{
if (uLoader.AutoSavePreset)
uLoader.SavePreset();
uLoader.Clear();
uResourceManager.Init();
Transform mainMDL = uResourceManager.LoadModel(uLoader.ModelPath, uLoader.LoadAnims, uLoader.UseHitboxesOnModel);
Transform subMDL = uResourceManager.LoadModel(uLoader.SubModelPath, uLoader.LoadAnims, uLoader.UseHitboxesOnModel);
uResourceManager.ExportFromCache();
uResourceManager.CloseStreams();
foreach (SkinnedMeshRenderer SkinnedMesh in subMDL.GetComponentsInChildren<SkinnedMeshRenderer>())
mainMDL.CreateSubModel(SkinnedMesh);
UnityEngine.Object.DestroyImmediate(subMDL.gameObject, false);
}
}
}
GUILayout.EndVertical();
#endregion
GUILayout.Space(2);
#region VMT
GUILayout.BeginVertical("box");
{
if (uLoader.VMTSettingsFoldout = EditorGUILayout.Foldout(uLoader.VMTSettingsFoldout, "VMT Settings", true, EditorStyles.miniButtonLeft))
{
uLoader.DebugMaterials = EditorGUILayout.ToggleLeft("Debug materials (Print VMT KeyValue data)", uLoader.DebugMaterials);
GUILayout.BeginVertical("box");
GUILayout.Label("Global Shaders", EditorStyles.boldLabel);
uLoader.DefaultShader = EditorGUILayout.TextField("Default Shader: ", uLoader.DefaultShader);
uLoader.LightmappedGenericShader = EditorGUILayout.TextField("LightmappedGeneric Shader: ", uLoader.LightmappedGenericShader);
uLoader.VertexLitGenericShader = EditorGUILayout.TextField("VertexLitGeneric Shader: ", uLoader.VertexLitGenericShader);
uLoader.WorldVertexTransitionShader = EditorGUILayout.TextField("WorldVertexTransition Shader: ", uLoader.WorldVertexTransitionShader);
uLoader.WorldTwoTextureBlend = EditorGUILayout.TextField("WorldTwoTextureBlend Shader: ", uLoader.WorldTwoTextureBlend);
uLoader.UnlitGeneric = EditorGUILayout.TextField("Unlit Shader: ", uLoader.UnlitGeneric);
GUILayout.EndVertical();
GUILayout.BeginVertical("box");
GUILayout.Label("Additive Shaders", EditorStyles.boldLabel);
uLoader.AdditiveShader = EditorGUILayout.TextField("Additive Shader: ", uLoader.AdditiveShader);
GUILayout.EndVertical();
GUILayout.BeginVertical("box");
GUILayout.Label("Detail Shaders", EditorStyles.boldLabel);
uLoader.DetailShader = EditorGUILayout.TextField("Detail Shader: ", uLoader.DetailShader);
uLoader.DetailUnlitShader = EditorGUILayout.TextField("Unlit Shader: ", uLoader.DetailUnlitShader);
uLoader.DetailTranslucentShader = EditorGUILayout.TextField("Translucent Shader: ", uLoader.DetailTranslucentShader);
GUILayout.EndVertical();
GUILayout.BeginVertical("box");
GUILayout.Label("Translucent Shaders", EditorStyles.boldLabel);
uLoader.TranslucentShader = EditorGUILayout.TextField("Translucent Shader: ", uLoader.TranslucentShader);
uLoader.TranslucentUnlitShader = EditorGUILayout.TextField("Unlit Shader: ", uLoader.TranslucentUnlitShader);
GUILayout.EndVertical();
GUILayout.BeginVertical("box");
GUILayout.Label("AlphaTest (Cutout) Shaders", EditorStyles.boldLabel);
uLoader.AlphaTestShader = EditorGUILayout.TextField("AlphaTest Shader: ", uLoader.AlphaTestShader);
GUILayout.EndVertical();
GUILayout.BeginVertical("box");
GUILayout.Label("SelfIllum Shaders", EditorStyles.boldLabel);
uLoader.SelfIllumShader = EditorGUILayout.TextField("SelfIllum Shader: ", uLoader.SelfIllumShader);
GUILayout.EndVertical();
}
}
GUILayout.EndVertical();
#endregion
GUILayout.Space(2);
#region Info
GUILayout.BeginHorizontal("textfield");
GUILayout.FlexibleSpace();
GUILayout.Label("Version: " + uLoader.PluginVersion + "\n\nSpecial thanks:\n\n->REDxEYE and ShadelessFox (for SourceIO & some help)\n->ZeqMacaw (for Crowbar)\n->James King aka Metapyziks (for SourceUtils)\n->LogicAndTrick (for Sledge and Sledge-Formats)", EditorStyles.largeLabel);
GUILayout.FlexibleSpace();
//GUILayout.EndHorizontal();
GUILayout.Space(2);
GUILayout.BeginVertical();//"textarea");
GUILayout.Label("Helpful Links:");
if (GUILayout.Button("SourceIO"))
{
Application.OpenURL("https://github.com/REDxEYE/SourceIO");
}
if (GUILayout.Button("Crowbar"))
{
Application.OpenURL("https://github.com/ZeqMacaw/Crowbar");
}
if (GUILayout.Button("SourceUtils"))
{
Application.OpenURL("https://github.com/Metapyziks/SourceUtils");
}
if (GUILayout.Button("Sledge-Formats"))
{
Application.OpenURL("https://github.com/LogicAndTrick/sledge-formats");
}
if (GUILayout.Button("Sledge"))
{
Application.OpenURL("https://github.com/LogicAndTrick/sledge");
}
if (GUILayout.Button("ValveSoftware Wiki"))
{
Application.OpenURL("https://developer.valvesoftware.com/wiki/Main_Page");
}
GUILayout.EndVertical();
GUILayout.EndHorizontal();
#endregion
}
}
#endif
public class uLoader : MonoBehaviour
{
#region Editor Stuff
public static String PluginVersion = "1.1 Beta";
#if UNITY_EDITOR
public static Boolean GlobalSettingsFoldout = true;
public static Boolean ModSettingsFoldout = true;
public static Boolean LodSettingsFoldout = true;
public static Boolean BSPSettingsFoldout = true;
public static Boolean LightmapSettingsFoldout = true;
public static Boolean LightingSettingsFoldout = true;
public static Boolean MDLSettingsFoldout = true;
public static Boolean VMTSettingsFoldout = false;
#endif
#endregion
#region Global Settings
//Global settings
public static String RootPath = @"F:\Games\Source Engine\Counter-Strike Source";
public static String[] ModFolders = { "cstrike", "hl2" };
//"hl2_misc_dir", "hl2_textures_dir"
//"bms_maps_dir", "bms_textures_dir", "bms_materials_dir", "bms_models_dir", "bms_misc_dir"
//"hl2_misc_dir", "hl2_textures_dir", "hl2_materials_dir", "hl2_models_dir"
public static String[][] DirPaks = new String[][]
{
new String[] { "cstrike_pak_dir" },
new String[] { "hl2_misc_dir", "hl2_textures_dir" }
};
//Export Feature
public static Boolean SaveAssetsToUnity = false;
public static String OutputAssetsFolder = "uSource";
public static Boolean ExportTextureAsPNG = true;
#region Lightmap Settings
public static Boolean GenerateUV2StaticProps = true;
public static Boolean ParseLightmaps = false;
public static Single ModelsLightmapSize = 1f;
public static Int32 UV2HardAngleProps = 88;
public static Single UV2PackMarginTexSize = 256;
public static Int32 UV2PackMarginProps = 1;
public static Int32 UV2AngleErrorProps = 8;
public static Int32 UV2AreaErrorProps = 15;
#endregion
#region LOD Settings
public static Boolean EnableLODParsing = false;
public static DetailMode DetailMode = DetailMode.None;
public static Single NegativeAddLODPrecent = 0.2f;
public static Single ThresholdMaxSwitch = 0.1f;
public static Single SubstractLODPrecent = 0.25f;
#endregion
public const float inchesInMeters = 1f / 32;
public static Single UnitScale = inchesInMeters;
public static Boolean LoadAnims = false;
public static Boolean ClearDirectoryCache = false;
public static Boolean ClearModelCache = true;
public static Boolean ClearMaterialCache = true;
public static Boolean ClearTextureCache = true;
//Global settings
#endregion
#region BSP
//BSP
public static String MapName = "test_angles";
public static Boolean ParseBSPPhysics = false;
public static Boolean ParseStaticPropScale = false;
public static Boolean Use3DSkybox = true;
public static Boolean ParseDecals = false;
public static Boolean UseGammaLighting = true;
public static Boolean UseLightmapsAsTextureShader = false;
public static Boolean ParseLights = true;
public static Single LightMinValue = 0.03f;
public static Single LightInfinityRadiusClamp = 2000f;
public static Single LightAttenuationDistance = 10;
public static Single AmbientIntensityScale = 1f;
public static Single LightEnvironmentScale = 1.25f;
public static Single PointIntensityScale = 1;
public static Single SpotIntensityScale = 1;
public static Single SurfLightIntensityScale = 1;
public static Int32 CustomCascadedShadowResolution = 8192;
public static Boolean UseDynamicLight = true;
public static Boolean DebugEntities = true;
public static Boolean DebugMaterials = true;
//BSP
public static List<LightmapData> lightmapsData; //Base LightmapData
public static int CurrentLightmap = 0; //Lightmap Index Count
#endregion
#region MDL
//MDL
//weapons/v_rif_ak47
//deadzone/characters/counter-strike source/t_leet_face
//player/custom_player/legacy/tm_leet_varianta
//props_vehicles/mining_car
//player/ak_anims_t
//weapons/v_357
//weapons/v_pist_p228
//models/weapons/v_models/v_smg_sniper
//props_c17/door01_left
//survivors/survivor_gambler
public static String ModelPath = @"player/t_leet";
public static String SubModelPath = @"weapons/ct_arms";
public static Boolean UseStaticPropFlag = false;
public static Boolean UseHitboxesOnModel = false;
public static Boolean DrawArmature = false;
//MDL
#endregion
#region VMT
//Additive
public static String AdditiveShader = "USource/AdditiveGeneric";
//Detail
public static String DetailShader = "USource/DetailGeneric";
public static String DetailUnlitShader = "USource/UnlitGeneric";
public static String DetailTranslucentShader = "USource/TranslucentGeneric";
//Translucent
public static String TranslucentShader = "USource/TranslucentGeneric";
public static String TranslucentUnlitShader = "Unlit/Transparent";
//AlphaTest (Cutout)
public static String AlphaTestShader = "USource/CutoutGeneric";
//SelfIllum
public static String SelfIllumShader = "USource/IllumGeneric";
//Global
public static String DefaultShader = "Diffuse";
public static String LightmappedGenericShader = "Diffuse";
public static String VertexLitGenericShader = "Diffuse";
public static String WorldVertexTransitionShader = "USource/Lightmapped/WorldVertexTransition";
public static String WorldTwoTextureBlend = "USource/Lightmapped/WorldTwoTextureBlend";
public static String UnlitGeneric = "USource/UnlitGeneric";
#endregion
#region Save / Load Feature
#if UNITY_EDITOR
#region Prefs
public static String[] GetStringArray(String Key, String[] DefaultValue)
{
if (!PlayerPrefs.HasKey(Key))
return DefaultValue;
return PlayerPrefs.GetString(Key).Split('|');
}
public static void SetStringArray(String Key, String[] Value)
{
StringBuilder Builder = new StringBuilder();
Int32 DefSize = Value.Length;
for (Int32 i = 0; i < DefSize; i++)
{
Builder.Append(Value[i]);
if (i != DefSize - 1)
Builder.Append("|"); // Split char
}
PlayerPrefs.SetString(Key, Builder.ToString());
}
public static String[][] GetString2DArray(String Key, String[][] DefaultValue)
{
if (!PlayerPrefs.HasKey(Key))
return DefaultValue;
String[] SplitData = PlayerPrefs.GetString(Key).Split('|');
String[][] Array = new String[SplitData.Length][];
for (Int32 i = 0; i < Array.Length; i++)
{
String[] ArrayData = SplitData[i].Split(new[] { '!' }, StringSplitOptions.RemoveEmptyEntries);
if (ArrayData.Length <= 0)
Array[i] = new String[] { };
else
Array[i] = ArrayData;
}
return Array;
}
public static void SetString2DArray(String Key, String[][] Value)
{
StringBuilder Builder = new StringBuilder();
Int32 DefSize = Value.Length;
for (Int32 i = 0; i < DefSize; i++)
{
Int32 Def2Size = Value[i].Length;
for (Int32 j = 0; j < Def2Size; j++)
{
if (Value[i][j] != null)
{
Builder.Append(Value[i][j]);
if (j != Def2Size - 1)
Builder.Append("!"); // Split char
}
}
if (i != DefSize - 1)
Builder.Append("|"); // Split char
}
PlayerPrefs.SetString(Key, Builder.ToString());
}
public static Boolean GetBool(String Key, Boolean DefaultValue)
{
return PlayerPrefs.GetInt(Key, DefaultValue == false ? 0 : 1) == 0 ? false : true;
}
public static void SetBool(String Key, Boolean Value)
{
PlayerPrefs.SetInt(Key, Value == false ? 0 : 1);
}
public static T GetEnum<T>(String Key, T DefaultValue)
{
if (!PlayerPrefs.HasKey(Key))
return DefaultValue;
return (T)Enum.Parse(typeof(T), PlayerPrefs.GetString(Key));
}
public static void SetEnum<T>(String Key, T Value)
{
PlayerPrefs.SetString(Key, Value.ToString());
}
#endregion
public static Boolean PresetLoaded = false;
public static Boolean AutoSavePreset = true;
public static Boolean SaveAfterResetPreset = false;
public static void LoadPreset()
{
PresetLoaded = true;
#region Editor Stuff
AutoSavePreset = GetBool("uAutoSavePreset", AutoSavePreset);
SaveAfterResetPreset = GetBool("uSaveAfterResetPreset", SaveAfterResetPreset);
GlobalSettingsFoldout = GetBool("uGlobalSettingsFoldout", GlobalSettingsFoldout);
ModSettingsFoldout = GetBool("uModSettingsFoldout", ModSettingsFoldout);
LodSettingsFoldout = GetBool("uLodSettingsFoldout", LodSettingsFoldout);
BSPSettingsFoldout = GetBool("uBSPSettingsFoldout", BSPSettingsFoldout);
LightmapSettingsFoldout = GetBool("uLightmapSettingsFoldout", LightmapSettingsFoldout);
LightingSettingsFoldout = GetBool("uLightingSettingsFoldout", LightingSettingsFoldout);
MDLSettingsFoldout = GetBool("uMDLSettingsFoldout", MDLSettingsFoldout);
VMTSettingsFoldout = GetBool("uVMTSettingsFoldout", VMTSettingsFoldout);
#endregion
#region Global
RootPath = PlayerPrefs.GetString("uRootPath", RootPath);
ModFolders = GetStringArray("uModFolders", ModFolders);
DirPaks = GetString2DArray("uDirPaks", DirPaks);
SaveAssetsToUnity = GetBool("uSaveAssetsToUnity", SaveAssetsToUnity);
OutputAssetsFolder = PlayerPrefs.GetString("uOutputAssetsFolder", OutputAssetsFolder);
ExportTextureAsPNG = GetBool("uExportTextureAsPNG", ExportTextureAsPNG);
#region Lightmaps
GenerateUV2StaticProps = GetBool("uGenerateUV2", GenerateUV2StaticProps);
ParseLightmaps = GetBool("uParseLightmaps", ParseLightmaps);
ModelsLightmapSize = PlayerPrefs.GetFloat("uModelsLightmapSize", ModelsLightmapSize);
UV2HardAngleProps = PlayerPrefs.GetInt("uUV2HardAngleProps", UV2HardAngleProps);//88;
UV2PackMarginTexSize = PlayerPrefs.GetFloat("uUV2PackMarginTexSize", UV2PackMarginTexSize);//256;
UV2PackMarginProps = PlayerPrefs.GetInt("uUV2PackMarginProps", UV2PackMarginProps);//1;
UV2AngleErrorProps = PlayerPrefs.GetInt("uUV2AngleErrorProps", UV2AngleErrorProps);//8;
UV2AreaErrorProps = PlayerPrefs.GetInt("uUV2AreaErrorProps", UV2AreaErrorProps);//15;
#endregion
#region LOD
EnableLODParsing = GetBool("uEnableLODParsing", EnableLODParsing);
DetailMode = GetEnum("uDetailMode", DetailMode);//DetailMode.None;
NegativeAddLODPrecent = PlayerPrefs.GetFloat("uNegativeAddLODPrecent", NegativeAddLODPrecent);
ThresholdMaxSwitch = PlayerPrefs.GetFloat("uThresholdMaxSwitch", ThresholdMaxSwitch);
SubstractLODPrecent = PlayerPrefs.GetFloat("uSubstractLODPrecent", SubstractLODPrecent);
#endregion
UnitScale = PlayerPrefs.GetFloat("uUnitScale", UnitScale);//0.0254f;
LoadAnims = GetBool("uLoadAnims", LoadAnims);
ClearDirectoryCache = GetBool("uClearDirectoryCache", ClearDirectoryCache);
ClearModelCache = GetBool("uClearModelCache", ClearModelCache);
ClearMaterialCache = GetBool("uClearMaterialCache", ClearMaterialCache);
ClearTextureCache = GetBool("uClearTextureCache", ClearTextureCache);
#endregion
#region BSP
MapName = PlayerPrefs.GetString("uMapName", MapName);
ParseBSPPhysics = GetBool("uParseBSPPhysics", ParseBSPPhysics);
ParseStaticPropScale = GetBool("uParseStaticPropScale", ParseStaticPropScale);
Use3DSkybox = GetBool("uUse3DSkybox", Use3DSkybox);
ParseDecals = GetBool("uParseDecals", ParseDecals);
UseGammaLighting = GetBool("uUseGammaLighting", UseGammaLighting);
UseLightmapsAsTextureShader = GetBool("uUseLightmapsAsTextureShader", UseLightmapsAsTextureShader);
ParseLights = GetBool("uParseLights", ParseLights);
AmbientIntensityScale = PlayerPrefs.GetFloat("uAmbientIntensityScale", AmbientIntensityScale);
LightEnvironmentScale = PlayerPrefs.GetFloat("uLightEnvironmentScale", LightEnvironmentScale);
PointIntensityScale = PlayerPrefs.GetFloat("uPointIntensityScale", PointIntensityScale);
SpotIntensityScale = PlayerPrefs.GetFloat("uSpotIntensityScale", SpotIntensityScale);
SurfLightIntensityScale = PlayerPrefs.GetFloat("uSurfIntensityScale", SurfLightIntensityScale);
CustomCascadedShadowResolution = PlayerPrefs.GetInt("uCustomCascadedShadowResolution", CustomCascadedShadowResolution);
LightAttenuationDistance = PlayerPrefs.GetFloat("uLightAttenuationDistance", LightAttenuationDistance);
LightInfinityRadiusClamp = PlayerPrefs.GetFloat("uInfinityRadiusClamp", LightInfinityRadiusClamp);
LightMinValue = PlayerPrefs.GetFloat("uLDRMinLightValue", LightMinValue);
UseDynamicLight = GetBool("uUseDynamicLight", UseDynamicLight);
DebugEntities = GetBool("uDebugEntities", DebugEntities);
DebugMaterials = GetBool("uDebugMaterials", DebugMaterials);
#endregion
#region MDL
ModelPath = PlayerPrefs.GetString("uModelPath", ModelPath);
SubModelPath = PlayerPrefs.GetString("uSubModelPath", SubModelPath);
UseStaticPropFlag = GetBool("uUseStaticPropFlag", UseStaticPropFlag);
UseHitboxesOnModel = GetBool("uUseHitboxesOnModel", UseHitboxesOnModel);
DrawArmature = GetBool("uDrawArmature", DrawArmature);
#endregion
#region VMT
//Additive
AdditiveShader = PlayerPrefs.GetString("uAdditiveShader", AdditiveShader);
//Detail
DetailShader = PlayerPrefs.GetString("uDetailShader", DetailShader);
DetailUnlitShader = PlayerPrefs.GetString("uDetailUnlitShader", DetailUnlitShader);
DetailTranslucentShader = PlayerPrefs.GetString("uDetailTranslucentShader", DetailTranslucentShader);
//Translucent
TranslucentShader = PlayerPrefs.GetString("uTranslucentShader", TranslucentShader);
TranslucentUnlitShader = PlayerPrefs.GetString("uTranslucentUnlitShader", TranslucentUnlitShader);
//AlphaTest (Cutout)
AlphaTestShader = PlayerPrefs.GetString("uAlphaTestShader", AlphaTestShader);
//SelfIllum
SelfIllumShader = PlayerPrefs.GetString("uSelfIllumShader", SelfIllumShader);
//Global
DefaultShader = PlayerPrefs.GetString("uDefaultShader", DefaultShader);
LightmappedGenericShader = PlayerPrefs.GetString("uLightmappedGenericShader", LightmappedGenericShader);
VertexLitGenericShader = PlayerPrefs.GetString("uVertexLitGenericShader", VertexLitGenericShader);
WorldVertexTransitionShader = PlayerPrefs.GetString("uWorldVertexTransitionShader", WorldVertexTransitionShader);
WorldTwoTextureBlend = PlayerPrefs.GetString("uWorldTwoTextureBlend", WorldTwoTextureBlend);
UnlitGeneric = PlayerPrefs.GetString("uUnlitGeneric", UnlitGeneric);
#endregion
Debug.Log("Preset Loaded");
}
public static void SavePreset()
{
#region Editor Stuff
PlayerPrefs.SetString("uPluginVersion", PluginVersion);
SetBool("uAutoSavePreset", AutoSavePreset);
SetBool("uSaveAfterResetPreset", SaveAfterResetPreset);
SetBool("uGlobalSettingsFoldout", GlobalSettingsFoldout);
SetBool("uModSettingsFoldout", ModSettingsFoldout);
SetBool("uLodSettingsFoldout", LodSettingsFoldout);
SetBool("uBSPSettingsFoldout", BSPSettingsFoldout);
SetBool("uLightmapSettingsFoldout", LightmapSettingsFoldout);
SetBool("uLightingSettingsFoldout", LightingSettingsFoldout);
SetBool("uMDLSettingsFoldout", MDLSettingsFoldout);
SetBool("uVMTSettingsFoldout", VMTSettingsFoldout);
#endregion
#region Global
PlayerPrefs.SetString("uRootPath", RootPath);
SetStringArray("uModFolders", ModFolders);
SetString2DArray("uDirPaks", DirPaks);
SetBool("uSaveAssetsToUnity", SaveAssetsToUnity);
PlayerPrefs.SetString("uOutputAssetsFolder", OutputAssetsFolder);
SetBool("uExportTextureAsPNG", ExportTextureAsPNG);
#region Lightmaps
SetBool("uGenerateUV2", GenerateUV2StaticProps);
SetBool("uParseLightmaps", ParseLightmaps);
PlayerPrefs.SetFloat("uModelsLightmapSize", ModelsLightmapSize);
PlayerPrefs.SetInt("uUV2HardAngleProps", UV2HardAngleProps);
PlayerPrefs.SetFloat("uUV2PackMarginTexSize", UV2PackMarginTexSize);
PlayerPrefs.SetInt("uUV2PackMarginProps", UV2PackMarginProps);
PlayerPrefs.SetInt("uUV2AngleErrorProps", UV2AngleErrorProps);
PlayerPrefs.SetInt("uUV2AreaErrorProps", UV2AreaErrorProps);
#endregion
#region LOD
SetBool("uEnableLODParsing", EnableLODParsing);
SetEnum("uDetailMode", DetailMode);
PlayerPrefs.SetFloat("uNegativeAddLODPrecent", NegativeAddLODPrecent);
PlayerPrefs.SetFloat("uThresholdMaxSwitch", ThresholdMaxSwitch);
PlayerPrefs.SetFloat("uSubstractLODPrecent", SubstractLODPrecent);
#endregion
PlayerPrefs.SetFloat("uUnitScale", UnitScale);
SetBool("uLoadAnims", LoadAnims);
SetBool("uClearDirectoryCache", ClearDirectoryCache);
SetBool("uClearModelCache", ClearModelCache);
SetBool("uClearMaterialCache", ClearMaterialCache);
SetBool("uClearTextureCache", ClearTextureCache);
#endregion
#region BSP
PlayerPrefs.SetString("uMapName", MapName);
SetBool("uParseBSPPhysics", ParseBSPPhysics);
SetBool("uParseStaticPropScale", ParseStaticPropScale);
SetBool("uUse3DSkybox", Use3DSkybox);
SetBool("uParseDecals", ParseDecals);
SetBool("uUseGammaLighting", UseGammaLighting);
SetBool("uUseLightmapsAsTextureShader", UseLightmapsAsTextureShader);
SetBool("uParseLights", ParseLights);
PlayerPrefs.SetFloat("uAmbientIntensityScale", AmbientIntensityScale);
PlayerPrefs.SetFloat("uLightEnvironmentScale", LightEnvironmentScale);
PlayerPrefs.SetFloat("uPointIntensityScale", PointIntensityScale);
PlayerPrefs.SetFloat("uSpotIntensityScale", SpotIntensityScale);
PlayerPrefs.SetFloat("uSurfIntensityScale", SurfLightIntensityScale);
PlayerPrefs.SetInt("uCustomCascadedShadowResolution", CustomCascadedShadowResolution);
PlayerPrefs.SetFloat("uLightAttenuationDistance", LightAttenuationDistance);
PlayerPrefs.SetFloat("uInfinityRadiusClamp", LightInfinityRadiusClamp);
PlayerPrefs.SetFloat("uLDRMinLightValue", LightMinValue);
SetBool("uUseDynamicLight", UseDynamicLight);
SetBool("uDebugEntities", DebugEntities);
SetBool("uDebugMaterials", DebugMaterials);
#endregion
#region MDL
PlayerPrefs.SetString("uModelPath", ModelPath);
PlayerPrefs.SetString("uSubModelPath", SubModelPath);
SetBool("uUseStaticPropFlag", UseStaticPropFlag);
SetBool("uUseHitboxesOnModel", UseHitboxesOnModel);
SetBool("uDrawArmature", DrawArmature);
#endregion
#region VMT
//Additive
PlayerPrefs.SetString("uAdditiveShader", AdditiveShader);
//Detail
PlayerPrefs.SetString("uDetailShader", DetailShader);
PlayerPrefs.SetString("uDetailUnlitShader", DetailUnlitShader);
PlayerPrefs.SetString("uDetailTranslucentShader", DetailTranslucentShader);
//Translucent
PlayerPrefs.SetString("uTranslucentShader", TranslucentShader);
PlayerPrefs.SetString("uTranslucentUnlitShader", TranslucentUnlitShader);
//AlphaTest (Cutout)
PlayerPrefs.SetString("uAlphaTestShader", AlphaTestShader);
//SelfIllum
PlayerPrefs.SetString("uSelfIllumShader", SelfIllumShader);
//Global
PlayerPrefs.SetString("uDefaultShader", DefaultShader);
PlayerPrefs.SetString("uLightmappedGenericShader", LightmappedGenericShader);
PlayerPrefs.SetString("uVertexLitGenericShader", VertexLitGenericShader);
PlayerPrefs.SetString("uWorldVertexTransitionShader", WorldVertexTransitionShader);
PlayerPrefs.SetString("uWorldTwoTextureBlend", WorldTwoTextureBlend);
PlayerPrefs.SetString("uUnlitGeneric", UnlitGeneric);
#endregion
Debug.Log("Preset Saved");
}
public static void ResetPreset()
{
#region Editor Stuff
/*GlobalSettingsFoldout = true;
ModSettingsFoldout = true;
LodSettingsFoldout = true;
BSPSettingsFoldout = true;
LightmapSettingsFoldout = true;
LightingSettingsFoldout = true;
MDLSettingsFoldout = true;
VMTSettingsFoldout = false;*/
#endregion
#region Global
RootPath = @"F:\Games\Source Engine\Counter-Strike Source";
ModFolders = new[] { "cstrike", "hl2" };
DirPaks = new String[][]
{
new String[] { "cstrike_pak_dir" },
new String[] { "hl2_misc_dir", "hl2_textures_dir" }
};
SaveAssetsToUnity = false;
OutputAssetsFolder = "uSource";
ExportTextureAsPNG = true;
#region Lightmap Settings
GenerateUV2StaticProps = true;
ParseLightmaps = false;
ModelsLightmapSize = 1f;
UV2HardAngleProps = 88;
UV2PackMarginTexSize = 256;
UV2PackMarginProps = 1;
UV2AngleErrorProps = 8;
UV2AreaErrorProps = 15;
#endregion
#region LOD
EnableLODParsing = false;
DetailMode = DetailMode.None;
NegativeAddLODPrecent = 0.2f;
ThresholdMaxSwitch = 0.1f;
SubstractLODPrecent = 0.25f;
#endregion
UnitScale = inchesInMeters;
LoadAnims = false;
ClearDirectoryCache = false;
ClearModelCache = true;
ClearMaterialCache = true;
ClearTextureCache = true;
#endregion
#region BSP
MapName = "test_angles";
ParseBSPPhysics = false;
ParseStaticPropScale = false;
Use3DSkybox = true;
ParseDecals = false;
UseGammaLighting = true;
UseLightmapsAsTextureShader = false;
ParseLights = true;
AmbientIntensityScale = 1f;
LightEnvironmentScale = 1.25f;
PointIntensityScale = 1;
SpotIntensityScale = 1;