Skip to content

Commit

Permalink
Bugfix Collection: fix wrong UTF8 encoding, 3ds Max binary copied to …
Browse files Browse the repository at this point in the history
…output folder and other issues (#1126)

* fix log window not scrolling to the bottom (#1117)

* fix draco texture indexing problem (#1111)

* fix alpha weight problem (#1122)

* fix installer crashes to desktop when network is not available (#1124)

* disable copying of UiViewmodel.dll to output folder

* convert UTF8-BOM encoding to UTF8
NOTE: this fixes failing babylon menu creation in the 3ds Max 2025 build

* convert tabs to spaces

* fix another tab left
  • Loading branch information
FrogsInSpace authored Oct 31, 2024
1 parent 16ebba2 commit a1a1d82
Show file tree
Hide file tree
Showing 22 changed files with 205 additions and 183 deletions.
1 change: 1 addition & 0 deletions 3ds Max/Max2Babylon/2025/Max2Babylon2025.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
<Reference Include="UiViewModels">
<SpecificVersion>False</SpecificVersion>
<HintPath>Refs\UiViewModels.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion 3ds Max/Max2Babylon/2025/Scripts/CreateBabylonMenus.ms
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(
(
function createBabylonMenuCB =
(
local actionTableId=47368
Expand Down
2 changes: 1 addition & 1 deletion 3ds Max/Max2Babylon/BabylonLoadAnimations.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Autodesk.Max;
Expand Down
2 changes: 1 addition & 1 deletion 3ds Max/Max2Babylon/Descriptor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Autodesk.Max;
using Autodesk.Max;

namespace Max2Babylon
{
Expand Down
2 changes: 1 addition & 1 deletion 3ds Max/Max2Babylon/Exporter/BabylonExporter.Animation.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Autodesk.Max;
using Autodesk.Max;
using BabylonExport.Entities;
using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Autodesk.Max;
using Autodesk.Max;
using BabylonExport.Entities;
using System;
using System.Collections.Generic;
Expand Down
2 changes: 1 addition & 1 deletion 3ds Max/Max2Babylon/Exporter/BabylonExporter.Light.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using Autodesk.Max;
using BabylonExport.Entities;
Expand Down
2 changes: 1 addition & 1 deletion 3ds Max/Max2Babylon/Exporter/BabylonExporter.Logger.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Autodesk.Max;
using Autodesk.Max;
using System;
using System.Drawing;

Expand Down
2 changes: 1 addition & 1 deletion 3ds Max/Max2Babylon/Exporter/BabylonExporter.Material.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Linq;
using System.Collections.Generic;
using Autodesk.Max;
Expand Down
2 changes: 1 addition & 1 deletion 3ds Max/Max2Babylon/Exporter/BabylonExporter.Mesh.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Autodesk.Max;
using Autodesk.Max;
using BabylonExport.Entities;
using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using Autodesk.Max;
using BabylonExport.Entities;

Expand Down
5 changes: 4 additions & 1 deletion 3ds Max/Max2Babylon/Exporter/BabylonExporter.Texture.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.IO;
using Autodesk.Max;
Expand Down Expand Up @@ -409,6 +409,9 @@ private BabylonTexture ExportBaseColorAlphaTexture(ITexmap baseColorTexMap, ITex
name = nameText,
// used to keep trace of the base + apha merge sources
baseColorPath = baseColorSourcePath,

// GLTF export relies on this property
originalPath = baseColorSourcePath,
alphaPath = alphaSourcePath
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using Autodesk.Max;
using BabylonExport.Entities;
Expand Down
2 changes: 1 addition & 1 deletion 3ds Max/Max2Babylon/Exporter/BabylonExporter.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Autodesk.Max;
using Autodesk.Max;
using Babylon2GLTF;
using BabylonExport.Entities;
using Newtonsoft.Json;
Expand Down
280 changes: 139 additions & 141 deletions 3ds Max/Max2Babylon/Forms/ExporterForm.Designer.cs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion 3ds Max/Max2Babylon/GlobalUtility.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Autodesk.Max;
using Autodesk.Max;
using Autodesk.Max.Plugins;

#if MAX2025 || MAX2026
Expand Down
2 changes: 1 addition & 1 deletion 3ds Max/Max2Babylon/Tools/LayerUtilities.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down
2 changes: 1 addition & 1 deletion 3ds Max/Max2Babylon/Tools/Tools.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Autodesk.Max;
using Autodesk.Max;
using Max2Babylon.Extensions;
using SharpDX;
using System;
Expand Down
13 changes: 10 additions & 3 deletions BabylonJS_Installer/BabylonJS_Installer/Downloader.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.IO;
using System.IO.Compression;
using System.Net;
Expand Down Expand Up @@ -205,8 +205,15 @@ public async Task<string> GetJSONBodyRequest(string requestURI)
{
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Add("User-Agent", "BJS_Installer");
HttpResponseMessage response = await client.GetAsync(requestURI);
return await response.Content.ReadAsStringAsync();
try
{
HttpResponseMessage response = await client.GetAsync(requestURI);
return await response.Content.ReadAsStringAsync();
}
catch(Exception ex)
{
return string.Empty;
}
}

public string GetURLGitHubAPI()
Expand Down
2 changes: 1 addition & 1 deletion BabylonJS_Installer/BabylonJS_Installer/MainForm.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
Expand Down
55 changes: 34 additions & 21 deletions BabylonJS_Installer/BabylonJS_Installer/SoftwareChecker.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Microsoft.Win32;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Globalization;
Expand Down Expand Up @@ -190,6 +190,11 @@ public void setLatestVersionDate()
Task<string> jsonRequest = Task.Run(async () => { return await downloader.GetJSONBodyRequest(downloader.GetURLGitHubAPI()); });
//TO DO Find a better way to parse JSON aswell
string json = jsonRequest.Result;
if(string.IsNullOrEmpty(json) ) {
this.latestVersionDate = DateTime.Now.ToLongTimeString();
return;
}

string created_at = json.Substring(json.IndexOf("\"created_at\":"));
created_at = created_at.Remove(created_at.IndexOf("\","));
this.latestVersionDate = created_at.Remove(0, "\"created_at\":\"".Length);
Expand Down Expand Up @@ -229,33 +234,41 @@ public void checkNewInstallerVersion()

string assemblyVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();

System.Net.WebClient wc = new System.Net.WebClient();
string versionFile = wc.DownloadString(url_versionFile);
int avFrom = versionFile.IndexOf("<ApplicationVersion>") + "<ApplicationVersion>".Length;
int avTo = versionFile.LastIndexOf("</ApplicationVersion>");
String serverVersion = versionFile.Substring(avFrom, avTo - avFrom);
try
{
System.Net.WebClient wc = new System.Net.WebClient();
string versionFile = wc.DownloadString(url_versionFile);
int avFrom = versionFile.IndexOf("<ApplicationVersion>") + "<ApplicationVersion>".Length;
int avTo = versionFile.LastIndexOf("</ApplicationVersion>");
String serverVersion = versionFile.Substring(avFrom, avTo - avFrom);

String[] currVersion = assemblyVersion.Split('.');
String[] servVersion = serverVersion.Split('.');
String[] currVersion = assemblyVersion.Split('.');
String[] servVersion = serverVersion.Split('.');

this.form.log("Current app version : " + currVersion[0] + '.' + currVersion[1] + '.' + currVersion[2]);
this.form.log("Server last version : " + servVersion[0] + '.' + servVersion[1] + '.' + servVersion[2]);
this.form.log("Current app version : " + currVersion[0] + '.' + currVersion[1] + '.' + currVersion[2]);
this.form.log("Server last version : " + servVersion[0] + '.' + servVersion[1] + '.' + servVersion[2]);

bool isUpToDate = true;
if (int.Parse(servVersion[0]) > int.Parse(currVersion[0])) isUpToDate = false;
else if (int.Parse(servVersion[0]) == int.Parse(currVersion[0]))
{
if (int.Parse(servVersion[1]) > int.Parse(currVersion[1])) isUpToDate = false;
else if (int.Parse(servVersion[1]) == int.Parse(currVersion[1]))
bool isUpToDate = true;
if (int.Parse(servVersion[0]) > int.Parse(currVersion[0])) isUpToDate = false;
else if (int.Parse(servVersion[0]) == int.Parse(currVersion[0]))
{
if (int.Parse(servVersion[2]) > int.Parse(currVersion[2])) isUpToDate = false;
if (int.Parse(servVersion[1]) > int.Parse(currVersion[1])) isUpToDate = false;
else if (int.Parse(servVersion[1]) == int.Parse(currVersion[1]))
{
if (int.Parse(servVersion[2]) > int.Parse(currVersion[2])) isUpToDate = false;
}
}
}

if (isUpToDate) this.form.log("Application up to date !\n\n");
else
if (isUpToDate) this.form.log("Application up to date !\n\n");
else
{
this.form.warn("A new version is available here : https://github.com/BabylonJS/Exporters/releases \n\n");
this.form.goTab("Logs");
}
}
catch( Exception ex )
{
this.form.warn("A new version is available here : https://github.com/BabylonJS/Exporters/releases \n\n");
this.form.error($"Error : failed to check for new installer version\n{ex.Message}\n");
this.form.goTab("Logs");
}
}
Expand Down
2 changes: 1 addition & 1 deletion SharedProjects/Utilities/Draco/GLTFPipelineUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static void DoDracoCompression(ILoggingProvider logger, bool generateBina
else
{
string outputGltfFile = Path.ChangeExtension(outputFile, "gltf");
arg = $"/C gltf-pipeline -i {outputGltfFile} -o {outputGltfFile} -d -s";
arg = $"/C gltf-pipeline -i {outputGltfFile} -o {outputGltfFile} -d -s --keepUnusedElements";
}

gltfPipeline.StartInfo.FileName = "cmd.exe";
Expand Down

0 comments on commit a1a1d82

Please sign in to comment.