Skip to content

Commit 9607065

Browse files
authored
Merge pull request #3 from Adjerry91/Format-Update
Formatting and multi FBX in same folder fail bug fix
2 parents 8d0a96f + dc65a68 commit 9607065

4 files changed

Lines changed: 27 additions & 22 deletions

File tree

DemoProject/Assets/Hash's_Things/EditDistributor/Editor/CommunFonctions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public static void CheckAndCopyFileIfExists(string OGPath, string DestPath)
7474

7575
public static void PrintMissingFileError(string PathToFile)
7676
{
77-
UnityEngine.Debug.Log("please make sure you have " + Path.GetFileName(PathToFile) + " in: " + PathToFile);
77+
UnityEngine.Debug.Log("Please make sure you have " + Path.GetFileName(PathToFile) + " in: " + PathToFile);
7878
}
7979

8080

DemoProject/Assets/Hash's_Things/EditDistributor/Editor/EditDistributorBuilder.cs

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -131,18 +131,18 @@ void OnGUI()
131131
}
132132
else
133133
{
134-
outputDirectory = Path.Combine(CommunFonctions.GoUpNDirs(CustomfbxPath, 2), "patcher", "data", "DiffFiles");
134+
outputDirectory = Path.Combine(CommunFonctions.GoUpNDirs(CustomfbxPath, 2), "Patcher", "Data", "DiffFiles");
135135
if (NameOverwriteTickBox)
136136
{
137137
if (!string.IsNullOrEmpty(DistributionNameOverwriteText))
138138
{
139-
patcherFolder = Path.Combine(CommunFonctions.GoUpNDirs(CustomfbxPath, 3), DistributionNameOverwriteText, "patcher");
139+
patcherFolder = Path.Combine(CommunFonctions.GoUpNDirs(CustomfbxPath, 3), DistributionNameOverwriteText, "Patcher");
140140
PatcherScriptDestDir = Path.Combine(CommunFonctions.GoUpNDirs(outputDirectory, 2), "Editor", DistributionNameOverwriteText.Replace(" ", "_") + "_Patcher.cs");
141141
}
142142
}
143143
else
144144
{
145-
patcherFolder = Path.Combine(CommunFonctions.GoUpNDirs(CustomfbxPath, 2), "patcher");
145+
patcherFolder = Path.Combine(CommunFonctions.GoUpNDirs(CustomfbxPath, 2), "Patcher");
146146
PatcherScriptDestDir = Path.Combine(CommunFonctions.GoUpNDirs(outputDirectory, 2), "Editor", Path.GetFileNameWithoutExtension(CustomfbxPath).Replace(" ", "_") + "_Patcher.cs");
147147
}
148148
}
@@ -174,9 +174,9 @@ void OnGUI()
174174
UserEditorWindowName = EditorGUILayout.TextField(new GUIContent("Your Name: ", "Will be used to organize your patchers in the menu bar"), UserEditorWindowName);
175175
if (NameOverwriteTickBox)
176176
{
177-
if (! string.IsNullOrEmpty(DistributionNameOverwriteText)) EditorWindowPath = "Tools/" + UserEditorWindowName + "/" + DistributionNameOverwriteText.Replace(" ", "_") + "_Patcher";
177+
if (! string.IsNullOrEmpty(DistributionNameOverwriteText)) EditorWindowPath = "Tools/" + UserEditorWindowName + "/" + DistributionNameOverwriteText + " Patcher";
178178
}
179-
else EditorWindowPath = "Tools/" + UserEditorWindowName + "/" + Path.GetFileNameWithoutExtension(OGfbxPath) + "Patcher";
179+
else EditorWindowPath = "Tools/" + UserEditorWindowName + "/" + Path.GetFileNameWithoutExtension(OGfbxPath) + " Patcher";
180180
if (string.IsNullOrEmpty(UserEditorWindowName))
181181
{
182182

@@ -395,8 +395,10 @@ void OnGUI()
395395

396396
private void BuildPatcher()
397397
{
398-
399-
Directory.CreateDirectory(outputDirectory);
398+
//Check if output directory already exists
399+
if (!Directory.Exists(outputDirectory)){
400+
Directory.CreateDirectory(outputDirectory);
401+
}
400402

401403
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)){
402404
hdiffz = Path.Combine(Environment.CurrentDirectory, "Assets", "Hash's_Things", "EditDistributor", "hdiff", "hdiffz", "Windows", "hdiffz.exe");
@@ -444,9 +446,12 @@ private void BuildPatcher()
444446
}
445447
else PatcherScriptDestDir = Path.Combine(CommunFonctions.GoUpNDirs(outputDirectory, 2), "Editor", Path.GetFileNameWithoutExtension(CustomfbxPath).Replace(" ", "_") + "_Patcher.cs");
446448

449+
//Check if patcher script destination director already exists
450+
if (!Directory.Exists(CommunFonctions.GoUpNDirs(PatcherScriptDestDir, 1))){
451+
Directory.CreateDirectory(CommunFonctions.GoUpNDirs(PatcherScriptDestDir, 1));
452+
CommunFonctions.CopyFolder(hdiffzFolder, hpatchzDestDir);
453+
}
447454

448-
Directory.CreateDirectory(CommunFonctions.GoUpNDirs(PatcherScriptDestDir, 1));
449-
CommunFonctions.CopyFolder(hdiffzFolder, hpatchzDestDir);
450455
CommunFonctions.CheckAndCopyFileIfExists(PatcherTemplateScript, PatcherScriptDestDir);
451456

452457

@@ -459,7 +464,7 @@ private void BuildPatcher()
459464
UnityEngine.Debug.Log(EditorWindowPath);
460465
CommunFonctions.ReplaceStringsInFile(PatcherScriptDestDir, originalStrings, remplacementStrings);
461466

462-
UnityEngine.Debug.Log("patcher created yippie :D");
467+
UnityEngine.Debug.Log("Patcher created yippie :D");
463468
AssetDatabase.Refresh();
464469
}
465470

@@ -469,7 +474,7 @@ private void BuildPatcher()
469474

470475
private void AddDebugInfo()
471476
{
472-
string outputDirectory = Path.Combine(CommunFonctions.GoUpNDirs(CustomfbxPath, 2), "patcher", "data", "DiffFiles");
477+
string outputDirectory = Path.Combine(CommunFonctions.GoUpNDirs(CustomfbxPath, 2), "Patcher", "Data", "DiffFiles");
473478
//some debug things that helped tracing back issues
474479
GUILayout.Label("outputDirectory: " + outputDirectory);
475480
GUILayout.Label("hdiff: " + Path.Combine(Environment.CurrentDirectory, "Assets", "Hash's_Things", "EditDistributor", "pythonscripts", "hdiff", "hdiffz.exe"));

DemoProject/Assets/Hash's_Things/EditDistributor/Editor/EditDistributorUpdater.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ void OnGUI()
116116
}
117117
else
118118
{
119-
patcherToUpdate = Path.Combine(CommunFonctions.GoUpNDirs(CustomfbxPath, 2), "patcher", "Editor", Path.GetFileNameWithoutExtension(CustomfbxPath) + "_Patcher.cs");
119+
patcherToUpdate = Path.Combine(CommunFonctions.GoUpNDirs(CustomfbxPath, 2), "Patcher", "Editor", Path.GetFileNameWithoutExtension(CustomfbxPath) + "_Patcher.cs");
120120
}
121121
}
122122
else
@@ -168,8 +168,8 @@ void OnGUI()
168168
{
169169
DestinationDir = EditorUtility.OpenFolderPanel("Select Folder", "", "");
170170
}
171-
EditorGUILayout.LabelField("custom desc source: ", DescriptionDir);
172-
EditorGUILayout.LabelField("custom desc dest: ", DestinationDir);
171+
EditorGUILayout.LabelField("Custom desc source: ", DescriptionDir);
172+
EditorGUILayout.LabelField("Custom desc dest: ", DestinationDir);
173173

174174
CreatorName = EditorGUILayout.TextField("CreatorName ", CreatorName);
175175

@@ -181,7 +181,7 @@ void OnGUI()
181181

182182
}
183183
}
184-
UnityEngine.Debug.Log("patcher to update: " + patcherToUpdate);
184+
UnityEngine.Debug.Log("Patcher to update: " + patcherToUpdate);
185185
UnityEngine.Debug.Log("Does the patcher to update exists" + File.Exists(patcherToUpdate));
186186

187187

@@ -284,13 +284,13 @@ void OnGUI()
284284
}
285285
if (debugMessage == 4)
286286
{
287-
CommunFonctions.AddBoldCenteredLabel("patcher updated!");
287+
CommunFonctions.AddBoldCenteredLabel("Patcher updated!");
288288
}
289289
}
290290

291291
private void Updating()
292292
{
293-
string outputDirectory = Path.Combine(CommunFonctions.GoUpNDirs(CustomfbxPath, 2), "patcher", "data", "DiffFiles");
293+
string outputDirectory = Path.Combine(CommunFonctions.GoUpNDirs(CustomfbxPath, 2), "Patcher", "Data", "DiffFiles");
294294

295295

296296
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) hdiffz = Path.Combine(Environment.CurrentDirectory, "Assets", "Hash's_Things", "EditDistributor", "hdiff", "hdiffz", "Windows", "hdiffz.exe");

DemoProject/Assets/Hash's_Things/EditDistributor/Editor/PatcherTemplate.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void OnGUI()
6565
}
6666
else if (File.Exists(currentCustomfbxPath))
6767
{
68-
AddBoldCenteredLabel("Edited moddel is already in the folder Enjoy :)");
68+
AddBoldCenteredLabel("Edited model is already in the folder Enjoy :)");
6969
debugMessage = 2;
7070
}
7171
else if (!(File.Exists(FBXDiffFile) && File.Exists(MetaDiffFile)))
@@ -151,7 +151,7 @@ void OnGUI()
151151
{
152152
case 0:
153153
//please click the button
154-
AddBoldCenteredLabel("Please click the button above to patch your moddel :)");
154+
AddBoldCenteredLabel("Please click the button above to patch your model :)");
155155
EditorGUILayout.Space(10);
156156
AddBoldCenteredLabel("Please double check that you used " + AvatarVersion);
157157
AddBoldCenteredLabel("to import the original avatar in your project");
@@ -183,7 +183,7 @@ void OnGUI()
183183
{
184184
EditorGUILayout.BeginHorizontal();
185185
GUILayout.FlexibleSpace();
186-
if (GUILayout.Button("this package is using Hash's edit Distributor", EditorStyles.linkLabel))
186+
if (GUILayout.Button("This package is using Hash's Edit Distributor", EditorStyles.linkLabel))
187187
{
188188
Application.OpenURL("https://github.com/HashEdits/Face-Tracking-Patcher");
189189
}
@@ -260,7 +260,7 @@ private static bool SaveStringToFile(string inputString, string searchString, st
260260
// Write the input string to the file
261261
File.WriteAllText(filePath, inputString);
262262

263-
if (Debug) UnityEngine.Debug.Log("something went wrong, please get in contact and provide: " + filePath + "/" + fileName);
263+
if (Debug) UnityEngine.Debug.Log("Something went wrong, please get in contact and provide: " + filePath + "/" + fileName);
264264
return true;
265265
}
266266
catch (Exception e)

0 commit comments

Comments
 (0)