diff --git a/3ds Max/Max2Babylon/Exporter/BabylonExporter.CustomAttributes.cs b/3ds Max/Max2Babylon/Exporter/BabylonExporter.CustomAttributes.cs index f769f593..d66ec6ba 100644 --- a/3ds Max/Max2Babylon/Exporter/BabylonExporter.CustomAttributes.cs +++ b/3ds Max/Max2Babylon/Exporter/BabylonExporter.CustomAttributes.cs @@ -37,7 +37,7 @@ partial class BabylonExporter #if MAX2022 || MAX2023 ManagedServices.MaxscriptSDK.ExecuteMaxscriptCommand("obj = maxOps.getNodeByHandle " + gameNode.MaxNode.Handle + ";", ManagedServices.MaxscriptSDK.ScriptSource.NotSpecified); #else - ManagedServices.MaxscriptSDK.ExecuteMaxscriptCommand("obj = maxOps.getNodeByHandle " + gameNode.MaxNode.Handle + ";"); + ManagedServices.MaxscriptSDK.ExecuteMaxscriptCommand("obj = maxOps.getNodeByHandle " + gameNode.MaxNode.Handle + ";"); #endif return _ExportExtraAttributes(gameNode.IGameObject.IPropertyContainer, babylonScene, excludeAttributes); diff --git a/3ds Max/Max2Babylon/Exporter/BabylonExporter.ExportItem.cs b/3ds Max/Max2Babylon/Exporter/BabylonExporter.ExportItem.cs index 2dc8c2fe..179351c3 100644 --- a/3ds Max/Max2Babylon/Exporter/BabylonExporter.ExportItem.cs +++ b/3ds Max/Max2Babylon/Exporter/BabylonExporter.ExportItem.cs @@ -113,7 +113,7 @@ public bool KeepPosition } } - const char s_PropertySeparator = ';'; + const char s_PropertySeparator = ';'; private const char s_ProperyLayerSeparator = '~'; const string s_PropertyFormat = "{0};{1};{2};{3};{4}"; const string s_PropertyNamePrefix = "babylonjs_ExportItem"; @@ -282,11 +282,9 @@ public void LoadFromData(string propertyName) { throw new Exception("Invalid property name, can't deserialize."); } - string itemGuidStr = propertyName.Remove(0, s_PropertyNamePrefix.Length); - if (!Guid.TryParse(itemGuidStr, out itemGuid)) { Loader.Core.PushPrompt("Error: Invalid ID, can't deserialize."); diff --git a/3ds Max/Max2Babylon/Exporter/BabylonExporter.Material.Pbr.cs b/3ds Max/Max2Babylon/Exporter/BabylonExporter.Material.Pbr.cs index 9418f19f..2a8688cc 100644 --- a/3ds Max/Max2Babylon/Exporter/BabylonExporter.Material.Pbr.cs +++ b/3ds Max/Max2Babylon/Exporter/BabylonExporter.Material.Pbr.cs @@ -45,7 +45,7 @@ public PbrMetalRoughDecorator(IIGameMaterial node) : base(node) public ITexmap MetalnessMap => _getTexMap(_node, "metalness_map"); public float Roughness => Properties?.GetFloatProperty("roughness", 0) ?? 0; public ITexmap RoughnessMap => _getTexMap(_node, "roughness_map"); - } + } public class PbrSpecGlossDecorator : PbrGameMaterialDecorator { @@ -290,14 +290,14 @@ private void ExportPbrSpecGlossMaterial(IIGameMaterial materialNode, BabylonScen // the target material var babylonMaterial = new BabylonPBRSpecularGlossinessMaterial(maxDecorator.Id) { - maxGameMaterial = materialNode, - name = maxDecorator.Name, - backFaceCulling = babylonDecorator.BackFaceCulling, - doubleSided = !babylonDecorator.BackFaceCulling, - separateCullingPass = babylonDecorator.SeparateCullingPass, - isUnlit = babylonDecorator.IsUnlit, - baseColor = maxDecorator.BaseColor.ToArray(), - }; + maxGameMaterial = materialNode, + name = maxDecorator.Name, + backFaceCulling = babylonDecorator.BackFaceCulling, + doubleSided = !babylonDecorator.BackFaceCulling, + separateCullingPass = babylonDecorator.SeparateCullingPass, + isUnlit = babylonDecorator.IsUnlit, + baseColor = maxDecorator.BaseColor.ToArray(), + }; // --- Global --- if (babylonMaterial.isUnlit) diff --git a/3ds Max/Max2Babylon/Exporter/BabylonExporter.Material.cs b/3ds Max/Max2Babylon/Exporter/BabylonExporter.Material.cs index 0836ca2c..3db91fb8 100644 --- a/3ds Max/Max2Babylon/Exporter/BabylonExporter.Material.cs +++ b/3ds Max/Max2Babylon/Exporter/BabylonExporter.Material.cs @@ -406,7 +406,7 @@ private void ExportStandardMaterial(IIGameMaterial materialNode, IIPropertyConta { babylonMaterial.opacityFresnelParameters = fresnelParameters; if (babylonMaterial.alpha == 1 && - babylonMaterial.opacityTexture == null) + babylonMaterial.opacityTexture == null) { babylonMaterial.alpha = 0; } @@ -589,7 +589,6 @@ private void ExportPhysicalMaterial(IIGameMaterial materialNode, IIPropertyConta babylonMaterial.roughness = 1 - babylonMaterial.roughness; } - // Self illumination is computed from emission color, luminance, temperature and weight babylonMaterial.emissive = materialNode.MaxMaterial.GetSelfIllumColorOn(0, false) ? materialNode.MaxMaterial.GetSelfIllumColor(0, false).Scale(selfIllumScale).ToArray() diff --git a/3ds Max/Max2Babylon/Exporter/BabylonExporter.Mesh.cs b/3ds Max/Max2Babylon/Exporter/BabylonExporter.Mesh.cs index ee267f9a..513cbcf7 100644 --- a/3ds Max/Max2Babylon/Exporter/BabylonExporter.Mesh.cs +++ b/3ds Max/Max2Babylon/Exporter/BabylonExporter.Mesh.cs @@ -1021,11 +1021,6 @@ private void ExtractFace(IIGameSkin skin, IIGameMesh unskinnedMesh, BabylonAbstr { int a, b, c; // parity is TRUE, if determinant negative ( counter-intuitive convention of 3ds max, see docs... :/ ) - - // fix for cesium: currently, cesium does not expect a reversed winding order for negative scales - //if (false) - - // for threejs and babylonjs (handle negative scales correctly (reversed winding order expected) if (invertedWorldMatrix.Parity) { // flipped case: reverse winding order @@ -1380,7 +1375,7 @@ private float GetW(IPoint3 normal, IPoint3 tangent, IPoint3 bitangent) { return 1; } - + float nx = MathUtilities.RoundToIfAlmostEqualTo(normal.X, 0, Tools.Epsilon); float ny = MathUtilities.RoundToIfAlmostEqualTo(normal.Y, 0, Tools.Epsilon); float nz = MathUtilities.RoundToIfAlmostEqualTo(normal.Z, 0, Tools.Epsilon); @@ -1393,7 +1388,7 @@ private float GetW(IPoint3 normal, IPoint3 tangent, IPoint3 bitangent) // theorical bittangent MathUtilities.CrossProduct(nx, ny, nz, tx, ty, tz, out float x, out float y, out float z); - + // Speaking in broadest terms, if the dot product of two non-zero vectors is positive, // then the two vectors point in the same general direction, meaning less than 90 degrees. // If the dot product is negative, then the two vectors point in opposite directions, diff --git a/3ds Max/Max2Babylon/Exporter/BabylonExporter.Texture.cs b/3ds Max/Max2Babylon/Exporter/BabylonExporter.Texture.cs index 6de9a5b4..9de65447 100644 --- a/3ds Max/Max2Babylon/Exporter/BabylonExporter.Texture.cs +++ b/3ds Max/Max2Babylon/Exporter/BabylonExporter.Texture.cs @@ -546,7 +546,7 @@ private BabylonTexture ExportSpecularGlossinessTexture(float[] specularColor, IT { var specularTexture = _getBitmapTex(specularTexMap); var glossinessTexture = _getBitmapTex(glossinessTexMap); - + // we are trying to get the best output format, function of source and policy. var paths = new IBitmapTex[] { specularTexture, glossinessTexture}.Where(t => t != null).Select(t => t.Map.FileName); var policy = exportParameters.textureFormatExportPolicy; @@ -1217,8 +1217,6 @@ private IStdUVGen _exportUV(IStdUVGen uvGen, BabylonTexture babylonTexture) RaiseMessage(MaxTextureTransformToString(uvGen)); #endif - - var offset = new BabylonVector3(uvGen.GetUOffs(0), uvGen.GetVOffs(0), 0); var scale = new BabylonVector3(uvGen.GetUScl(0), uvGen.GetVScl(0), 1); //max rotation is horlogic, here we move using trigonometric, so anti - horlogic @@ -1257,7 +1255,7 @@ private IStdUVGen _exportUV(IStdUVGen uvGen, BabylonTexture babylonTexture) var translateBack = BabylonMatrix.Translation(center); var t = translateToOrigin * scaling * rotate * translateBack ; offset = origin * t; - } + } babylonTexture.uOffset = offset.X%1; babylonTexture.vOffset = (1 - offset.Y) % 1; diff --git a/3ds Max/Max2Babylon/Exporter/BabylonExporter.cs b/3ds Max/Max2Babylon/Exporter/BabylonExporter.cs index f3bf4b8a..79067879 100644 --- a/3ds Max/Max2Babylon/Exporter/BabylonExporter.cs +++ b/3ds Max/Max2Babylon/Exporter/BabylonExporter.cs @@ -175,8 +175,8 @@ public void BakeAnimationsFrame(IINode node,BakeAnimationType bakeAnimationType) tmp = Point() --store anim to a point for t = animationRange.start to animationRange.end do ( - with animate on at time t tmp.transform = obj.transform - ) + with animate on at time t tmp.transform = obj.transform + ) --remove constraint on original object obj.pos.controller = Position_XYZ () @@ -186,11 +186,11 @@ public void BakeAnimationsFrame(IINode node,BakeAnimationType bakeAnimationType) --copy back anim from point for t = animationRange.start to animationRange.end do ( - with animate on at time t obj.transform = tmp.transform - ) + with animate on at time t obj.transform = tmp.transform + ) delete tmp ) - "); + "); } public void ExportClosedContainers() @@ -333,7 +333,7 @@ public void Export(MaxExportParameters exportParameters) var rawScene = Loader.Core.RootNode; - string outputFormat = exportParameters.outputFormat; + string outputFormat = exportParameters.outputFormat; isBabylonExported = outputFormat == "babylon" || outputFormat == "binary babylon"; isGltfExported = outputFormat == "gltf" || outputFormat == "glb"; diff --git a/3ds Max/Max2Babylon/Exporter/GlobalVertex.cs b/3ds Max/Max2Babylon/Exporter/GlobalVertex.cs index 20a18b1c..11e936d7 100644 --- a/3ds Max/Max2Babylon/Exporter/GlobalVertex.cs +++ b/3ds Max/Max2Babylon/Exporter/GlobalVertex.cs @@ -37,7 +37,6 @@ public GlobalVertex(GlobalVertex other) public override int GetHashCode() { - //return string.Format("{0}-{1}-{2}-{3}-{4}-{5}-{6}-{7}-{8}-{9}", // BaseIndex, // CurrentIndex,