Bladeren bron

Camera type can be exported from 3ds max

David Catuhe 10 jaren geleden
bovenliggende
commit
6d33205ee3

+ 2 - 0
Babylon/Loading/Plugins/babylon.babylonFileLoader.js

@@ -407,6 +407,8 @@
                 camera = new BABYLON.GamepadCamera(parsedCamera.name, position, scene);
             } else if (parsedCamera.type === "OculusCamera") {
                 camera = new BABYLON.OculusCamera(parsedCamera.name, position, scene);
+            } else if (parsedCamera.type === "OculusGamepadCamera") {
+                camera = new BABYLON.OculusGamepadCamera(parsedCamera.name, position, scene);
             } else if (parsedCamera.type === "TouchCamera") {
                 camera = new BABYLON.TouchCamera(parsedCamera.name, position, scene);
             } else if (parsedCamera.type === "VirtualJoysticksCamera") {

+ 3 - 0
Babylon/Loading/Plugins/babylon.babylonFileLoader.ts

@@ -412,6 +412,9 @@
         } else if (parsedCamera.type === "OculusCamera") {
             camera = new OculusCamera(parsedCamera.name, position, scene);
 
+        } else if (parsedCamera.type === "OculusGamepadCamera") {
+            camera = new OculusGamepadCamera(parsedCamera.name, position, scene);
+
         } else if (parsedCamera.type === "TouchCamera") {
             camera = new TouchCamera(parsedCamera.name, position, scene);
 

+ 3 - 0
Exporters/3ds Max/BabylonExport.Entities/BabylonCamera.cs

@@ -18,6 +18,9 @@ namespace BabylonExport.Entities
         public string lockedTargetId { get; set; }
 
         [DataMember]
+        public string type { get; set; }
+
+        [DataMember]
         public float[] position { get; set; }
 
         [DataMember]

BIN
Exporters/3ds Max/Max2Babylon-0.10.0.zip


BIN
Exporters/3ds Max/Max2Babylon-0.11.0.zip


+ 24 - 25
Exporters/3ds Max/Max2Babylon/Exporter/BabylonExporter.Camera.cs

@@ -8,7 +8,6 @@ namespace Max2Babylon
     {
         private void ExportCamera(IIGameNode cameraNode, BabylonScene babylonScene)
         {
-
             if (cameraNode.MaxNode.GetBoolProperty("babylonjs_noexport"))
             {
                 return;
@@ -35,8 +34,8 @@ namespace Max2Babylon
             }
             else
             {
-                 babylonCamera.minZ = 0.1f;
-                 babylonCamera.maxZ = 10000.0f;
+                babylonCamera.minZ = 0.1f;
+                babylonCamera.maxZ = 10000.0f;
             }
 
             if (babylonCamera.minZ == 0.0f)
@@ -44,6 +43,9 @@ namespace Max2Babylon
                 babylonCamera.minZ = 0.1f;
             }
 
+            // Type
+            babylonCamera.type = cameraNode.MaxNode.GetStringProperty("babylonjs_type", "FreeCamera");
+
             // Control
             babylonCamera.speed = cameraNode.MaxNode.GetFloatProperty("babylonjs_speed", 1.0f);
             babylonCamera.inertia = cameraNode.MaxNode.GetFloatProperty("babylonjs_inertia", 0.9f);
@@ -54,43 +56,40 @@ namespace Max2Babylon
             babylonCamera.ellipsoid = cameraNode.MaxNode.GetVector3Property("babylonjs_ellipsoid");
 
             // Position
-            {
-                var wm = cameraNode.GetLocalTM(0);
-                var position = wm.Translation;
-                babylonCamera.position = new float[] { position.X, position.Y, position.Z };
+            var wm = cameraNode.GetLocalTM(0);
+            var position = wm.Translation;
+            babylonCamera.position = new float[] { position.X, position.Y, position.Z };
 
             // Target
-                var target = gameCamera.CameraTarget;
+            var target = gameCamera.CameraTarget;
             if (target != null)
             {
-                    babylonCamera.lockedTargetId = target.MaxNode.GetGuid().ToString();
+                babylonCamera.lockedTargetId = target.MaxNode.GetGuid().ToString();
             }
             else
             {
-                    var dir = wm.GetRow(3);
-                    babylonCamera.target = new float[] { position.X - dir.X, position.Y - dir.Y, position.Z - dir.Z };
-                }
+                var dir = wm.GetRow(3);
+                babylonCamera.target = new float[] { position.X - dir.X, position.Y - dir.Y, position.Z - dir.Z };
             }
 
             // Animations
             var animations = new List<BabylonAnimation>();
-            //if (!ExportVector3Controller(cameraNode.TMController.PositionController, "position", animations))
-            //{
-                ExportVector3Animation("position", animations, key =>
-                {
-                    var wm = cameraNode.GetLocalTM(key);
-                    var position = wm.Translation;
-                    return  new float[] { position.X, position.Y, position.Z };
-                });
-            //}
+
+            ExportVector3Animation("position", animations, key =>
+            {
+                var tm = cameraNode.GetLocalTM(key);
+                var translation = tm.Translation;
+                return new float[] { translation.X, translation.Y, translation.Z };
+            });
+
             if (gameCamera.CameraTarget == null)
             {
                 ExportVector3Animation("target", animations, key =>
                 {
-                    var wm = cameraNode.GetLocalTM(key);
-                    var position = wm.Translation;
-                    var dir = wm.GetRow(3);
-                    return new float[] { position.X - dir.X, position.Y - dir.Y, position.Z - dir.Z };
+                    var tm = cameraNode.GetLocalTM(key);
+                    var translation = tm.Translation;
+                    var dir = tm.GetRow(3);
+                    return new float[] { translation.X - dir.X, translation.Y - dir.Y, translation.Z - dir.Z };
                 });
             }
 

+ 33 - 90
Exporters/3ds Max/Max2Babylon/Exporter/BabylonExporter.Mesh.cs

@@ -9,58 +9,6 @@ namespace Max2Babylon
 {
     partial class BabylonExporter
     {
-        Dictionary<IIGameSkin, List<int>> skinSortedBones = new Dictionary<IIGameSkin, List<int>>();
-        List<int> SortBones(IIGameSkin skin)
-        {
-            List<int> boneIds = new List<int>();
-            Dictionary<int, IIGameNode> boneIndex = new Dictionary<int, IIGameNode>();
-            for (var index = 0; index < skin.TotalSkinBoneCount; index++)
-            {
-                var bone = skin.GetIGameBone(index, false);
-                if (bone == null)
-                {
-                    // non bone in skeletton
-                    boneIds.Add(-2);
-
-                }
-                else
-                {
-                    boneIds.Add(bone.NodeID);
-                    boneIndex[bone.NodeID] = bone;
-                }
-            }
-            while (true)
-            {
-                bool foundMisMatch = false;
-                for (int i = 0; i < boneIds.Count; ++i)
-                {
-                    var id = boneIds[i];
-                    if(id == -2)
-                    {
-                        continue;
-                    }
-                    var parent = boneIndex[id].NodeParent;
-                    if(parent != null)
-                    {
-                        var parentId = parent.NodeID;
-                        if (boneIds.IndexOf(parentId) > i)
-                        {
-                            boneIds.RemoveAt(i);
-                            boneIds.Insert(boneIds.IndexOf(parentId) + 1, id);
-                            foundMisMatch = true;
-                            break;
-                        }
-                    }
-                }
-                if(!foundMisMatch)
-                {
-                    break;
-                }
-            }
-            return boneIds;
-
-        }
-
         private int bonesCount;
         private void ExportMesh(IIGameScene scene, IIGameNode meshNode, BabylonScene babylonScene)
         {
@@ -108,17 +56,13 @@ namespace Max2Babylon
             var skin = gameMesh.IGameSkin;
             var unskinnedMesh = gameMesh;
             IGMatrix skinInitPoseMatrix = Loader.Global.GMatrix.Create(Loader.Global.Matrix3.Create(true));
-            List<int> boneIds = null;
             if (isSkinned)
             {
                 bonesCount = skin.TotalSkinBoneCount;
                 skins.Add(skin);
-
                 skinnedNodes.Add(meshNode);
                 babylonMesh.skeletonId = skins.IndexOf(skin);
                 skin.GetInitSkinTM(skinInitPoseMatrix);
-                boneIds = SortBones(skin);
-                skinSortedBones[skin] = boneIds;
             }
 
             // Position / rotation / scaling
@@ -181,13 +125,13 @@ namespace Max2Babylon
                     IntPtr indexer = new IntPtr(i);
                     var channelNum = mappingChannels[indexer];
                     if (channelNum == 1)
-                {
+                    {
                         hasUV = true;
-                }
+                    }
                     else if (channelNum == 2)
-                {
+                    {
                         hasUV2 = true;
-                }
+                    }
                 }
                 var hasColor = unskinnedMesh.NumberOfColorVerts > 0;
                 var hasAlpha = unskinnedMesh.GetNumberOfMapVerts(-2) > 0;
@@ -207,7 +151,7 @@ namespace Max2Babylon
                 var subMeshes = new List<BabylonSubMesh>();
                 var indexStart = 0;
 
-                
+
                 for (int i = 0; i < multiMatsCount; ++i)
                 {
                     if (meshNode.NodeMaterial == null)
@@ -229,7 +173,7 @@ namespace Max2Babylon
                         for (int j = 0; j < unskinnedMesh.NumberOfFaces; ++j)
                         {
                             var face = unskinnedMesh.GetFace(j);
-                            ExtractFace(skin, unskinnedMesh, vertices, indices, hasUV, hasUV2, hasColor, hasAlpha, verticesAlreadyExported, ref indexCount, ref minVertexIndex, ref maxVertexIndex, face, boneIds);
+                            ExtractFace(skin, unskinnedMesh, vertices, indices, hasUV, hasUV2, hasColor, hasAlpha, verticesAlreadyExported, ref indexCount, ref minVertexIndex, ref maxVertexIndex, face);
                         }
                     }
                     else
@@ -241,10 +185,10 @@ namespace Max2Babylon
                             var face = materialFaces[faceIndexer];
 
                             Marshal.FreeHGlobal(faceIndexer);
-                            ExtractFace(skin, unskinnedMesh, vertices, indices, hasUV, hasUV2, hasColor, hasAlpha, verticesAlreadyExported, ref indexCount, ref minVertexIndex, ref maxVertexIndex, face, boneIds);
+                            ExtractFace(skin, unskinnedMesh, vertices, indices, hasUV, hasUV2, hasColor, hasAlpha, verticesAlreadyExported, ref indexCount, ref minVertexIndex, ref maxVertexIndex, face);
                         }
                     }
-                    
+
                     if (indexCount != 0)
                     {
 
@@ -354,7 +298,7 @@ namespace Max2Babylon
             // Animations
             var animations = new List<BabylonAnimation>();
             GenerateCoordinatesAnimations(meshNode, animations);
-            
+
 
             if (!ExportFloatController(meshNode.MaxNode.VisController, "visibility", animations))
             {
@@ -374,11 +318,11 @@ namespace Max2Babylon
             babylonScene.MeshesList.Add(babylonMesh);
         }
 
-        private void ExtractFace(IIGameSkin skin, IIGameMesh unskinnedMesh, List<GlobalVertex> vertices, List<int> indices, bool hasUV, bool hasUV2, bool hasColor, bool hasAlpha, List<GlobalVertex>[] verticesAlreadyExported, ref int indexCount, ref int minVertexIndex, ref int maxVertexIndex, IFaceEx face, List<int> boneIds)
+        private void ExtractFace(IIGameSkin skin, IIGameMesh unskinnedMesh, List<GlobalVertex> vertices, List<int> indices, bool hasUV, bool hasUV2, bool hasColor, bool hasAlpha, List<GlobalVertex>[] verticesAlreadyExported, ref int indexCount, ref int minVertexIndex, ref int maxVertexIndex, IFaceEx face)
         {
-            var a = CreateGlobalVertex(unskinnedMesh, face, 0, vertices, hasUV, hasUV2, hasColor, hasAlpha, verticesAlreadyExported, skin, boneIds);
-            var b = CreateGlobalVertex(unskinnedMesh, face, 2, vertices, hasUV, hasUV2, hasColor, hasAlpha, verticesAlreadyExported, skin, boneIds);
-            var c = CreateGlobalVertex(unskinnedMesh, face, 1, vertices, hasUV, hasUV2, hasColor, hasAlpha, verticesAlreadyExported, skin, boneIds);
+            var a = CreateGlobalVertex(unskinnedMesh, face, 0, vertices, hasUV, hasUV2, hasColor, hasAlpha, verticesAlreadyExported, skin);
+            var b = CreateGlobalVertex(unskinnedMesh, face, 2, vertices, hasUV, hasUV2, hasColor, hasAlpha, verticesAlreadyExported, skin);
+            var c = CreateGlobalVertex(unskinnedMesh, face, 1, vertices, hasUV, hasUV2, hasColor, hasAlpha, verticesAlreadyExported, skin);
             indices.Add(a);
             indices.Add(b);
             indices.Add(c);
@@ -419,35 +363,34 @@ namespace Max2Babylon
         }
 
         public static void GenerateCoordinatesAnimations(IIGameNode meshNode, List<BabylonAnimation> animations)
+        {
+            ExportVector3Animation("position", animations, key =>
             {
-                ExportVector3Animation("position", animations, key =>
-                {
                 var worldMatrix = meshNode.GetObjectTM(key);
                 var trans = worldMatrix.Translation;
                 return new float[] { trans.X, trans.Y, trans.Z };
-                });
+            });
 
-                ExportQuaternionAnimation("rotationQuaternion", animations, key =>
-                {
-                    var worldMatrix = meshNode.GetObjectTM(key);
+            ExportQuaternionAnimation("rotationQuaternion", animations, key =>
+            {
+                var worldMatrix = meshNode.GetObjectTM(key);
 
 
 
-                    var rot = worldMatrix.Rotation;
-                    return new float[] { rot.X, rot.Y, rot.Z, -rot.W };
-                });
+                var rot = worldMatrix.Rotation;
+                return new float[] { rot.X, rot.Y, rot.Z, -rot.W };
+            });
 
-                ExportVector3Animation("scaling", animations, key =>
-                {
-                    var worldMatrix = meshNode.GetObjectTM(key);
-                    var scale = worldMatrix.Scaling;
+            ExportVector3Animation("scaling", animations, key =>
+            {
+                var worldMatrix = meshNode.GetObjectTM(key);
+                var scale = worldMatrix.Scaling;
 
-                    return new float[] { scale.X, scale.Y, scale.Z };
-                });
+                return new float[] { scale.X, scale.Y, scale.Z };
+            });
         }
 
-
-        int CreateGlobalVertex(IIGameMesh mesh, IFaceEx face, int facePart, List<GlobalVertex> vertices, bool hasUV, bool hasUV2, bool hasColor, bool hasAlpha, List<GlobalVertex>[] verticesAlreadyExported, IIGameSkin skin, List<int> boneIds)
+        int CreateGlobalVertex(IIGameMesh mesh, IFaceEx face, int facePart, List<GlobalVertex> vertices, bool hasUV, bool hasUV2, bool hasColor, bool hasAlpha, List<GlobalVertex>[] verticesAlreadyExported, IIGameSkin skin)
         {
             var vertexIndex = (int)face.Vert[facePart];
 
@@ -514,25 +457,25 @@ namespace Max2Babylon
 
                 if (nbBones > 0)
                 {
-                    bone0 = boneIds.IndexOf(skin.GetIGameBone(vertexIndex, 0).NodeID);
+                    bone0 = skin.GetBoneIndex(skin.GetBone(vertexIndex, 0), false);
                     weight0 = skin.GetWeight(vertexIndex, 0);
                 }
 
                 if (nbBones > 1)
                 {
-                    bone1 = boneIds.IndexOf(skin.GetIGameBone(vertexIndex, 1).NodeID);
+                    bone1 = skin.GetBoneIndex(skin.GetBone(vertexIndex, 1), false);
                     weight1 = skin.GetWeight(vertexIndex, 1);
                 }
 
                 if (nbBones > 2)
                 {
-                    bone2 = boneIds.IndexOf(skin.GetIGameBone(vertexIndex, 2).NodeID);
+                    bone2 = skin.GetBoneIndex(skin.GetBone(vertexIndex, 2), false);
                     weight2 = skin.GetWeight(vertexIndex, 2);
                 }
 
                 if (nbBones > 3)
                 {
-                    bone3 = boneIds.IndexOf(skin.GetIGameBone(vertexIndex, 3).NodeID);
+                    bone3 = skin.GetBoneIndex(skin.GetBone(vertexIndex, 3), false);
                 }
 
                 if (nbBones == 0)

+ 15 - 39
Exporters/3ds Max/Max2Babylon/Exporter/BabylonExporter.Skeleton.cs

@@ -22,58 +22,37 @@ namespace Max2Babylon
             mat3.NoScale();
             return Loader.Global.GMatrix.Create(mat3);
         }
-        private void ExportSkin( IIGameSkin skin, BabylonScene babylonScene)
+        private void ExportSkin(IIGameSkin skin, BabylonScene babylonScene)
         {
             var babylonSkeleton = new BabylonSkeleton { id = skins.IndexOf(skin) };
             babylonSkeleton.name = "skeleton #" + babylonSkeleton.id;
 
             RaiseMessage(babylonSkeleton.name, 1);
-            IGMatrix skinInitMatrix = Loader.Global.GMatrix.Create(Loader.Global.Matrix3.Create(true));
-            skin.GetInitSkinTM(skinInitMatrix);
+
             var skinIndex = skins.IndexOf(skin);
             var meshNode = skinnedNodes[skinIndex];
-            var meshInitMatrix = meshNode.GetObjectTM(0);
-            var boneIds = skinSortedBones[skin];
+            var skinInitMatrix = meshNode.GetObjectTM(0);
 
-            var bones = new BabylonBone[boneIds.Count];
-            var gameBones = new IIGameNode[boneIds.Count];
-            var bindPoseInfos = new BonePoseInfo[boneIds.Count];
-            for (var unsortedIndex = 0; unsortedIndex < skin.TotalSkinBoneCount; unsortedIndex++)
+            var bones = new List<BabylonBone>();
+            var gameBones = new List<IIGameNode>();
+            var boneIds = new List<int>();
+            var bindPoseInfos = new List<BonePoseInfo>();
+            for (var index = 0; index < skin.TotalSkinBoneCount; index++)
             {
-                var gameBone = skin.GetIGameBone(unsortedIndex, false);
-                int index = gameBone == null ? boneIds.IndexOf(-2) : boneIds.IndexOf(gameBone.NodeID);
-                if (gameBone == null)
-                {
-
-                    gameBones[index]=null;
-                    bones[index] = new BabylonBone { index = index, name = "null-bone" };
+                var gameBone = skin.GetIGameBone(index, false);
 
-                    bindPoseInfos[index] = new BonePoseInfo {  };
-                }
-                else
-                {
-                    gameBones[index] = gameBone;
-                    bones[index] = new BabylonBone { index = index, name = gameBone.Name };
-                    //IGMatrix boneInitMatrix = Loader.Global.GMatrix.Create(Loader.Global.Matrix3.Create(true));
+                gameBones.Add(gameBone);
+                boneIds.Add(gameBone.NodeID);
+                bones.Add(new BabylonBone { index = index, name = gameBone.Name });
 
                 var boneInitMatrix = gameBone.GetObjectTM(0);
-                    bindPoseInfos[index] = new BonePoseInfo { AbsoluteTransform = boneInitMatrix };
-                }
+                bindPoseInfos.Add(new BonePoseInfo { AbsoluteTransform = boneInitMatrix });
             }
 
             // fix hierarchy an generate animation keys
             for (var index = 0; index < skin.TotalSkinBoneCount; index++)
             {
                 var gameBone = gameBones[index];
-                if (gameBone == null)
-                {
-
-                    var babBone = bones[index];
-                    bindPoseInfos[index].LocalTransform = Loader.Global.GMatrix.Create(Loader.Global.Matrix3.Create(true));
-                    babBone.matrix = bindPoseInfos[index].LocalTransform.ToArray();
-                }
-                else
-                {
                 var parent = gameBone.NodeParent;
                 var babBone = bones[index];
                 if (parent != null)
@@ -82,7 +61,7 @@ namespace Max2Babylon
                 }
                 if (babBone.parentBoneIndex == -1)
                 {
-                        bindPoseInfos[index].LocalTransform = bindPoseInfos[index].AbsoluteTransform.Multiply(meshInitMatrix.Inverse);
+                    bindPoseInfos[index].LocalTransform = bindPoseInfos[index].AbsoluteTransform.Multiply(skinInitMatrix.Inverse);
                 }
                 else
                 {
@@ -134,12 +113,9 @@ namespace Max2Babylon
 
                 babylonAnimation.keys = keys.ToArray();
                 babBone.animation = babylonAnimation;
-                }
-
             }
 
-
-            babylonSkeleton.bones = bones;
+            babylonSkeleton.bones = bones.ToArray();
 
             babylonScene.SkeletonsList.Add(babylonSkeleton);
         }

+ 57 - 18
Exporters/3ds Max/Max2Babylon/Forms/CameraPropertiesForm.Designer.cs

@@ -29,7 +29,6 @@
         private void InitializeComponent()
         {
             this.groupBox1 = new System.Windows.Forms.GroupBox();
-            this.ellipsoidControl = new Max2Babylon.Vector3Control();
             this.label3 = new System.Windows.Forms.Label();
             this.chkGravity = new System.Windows.Forms.CheckBox();
             this.chkCollisions = new System.Windows.Forms.CheckBox();
@@ -50,6 +49,9 @@
             this.chkAutoAnimate = new System.Windows.Forms.CheckBox();
             this.groupBox4 = new System.Windows.Forms.GroupBox();
             this.chkNoExport = new System.Windows.Forms.CheckBox();
+            this.cbCameraType = new System.Windows.Forms.ComboBox();
+            this.label6 = new System.Windows.Forms.Label();
+            this.ellipsoidControl = new Max2Babylon.Vector3Control();
             this.groupBox1.SuspendLayout();
             this.groupBox2.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.nupInertia)).BeginInit();
@@ -68,23 +70,13 @@
             this.groupBox1.Controls.Add(this.chkGravity);
             this.groupBox1.Controls.Add(this.chkCollisions);
             this.groupBox1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
-            this.groupBox1.Location = new System.Drawing.Point(12, 77);
+            this.groupBox1.Location = new System.Drawing.Point(12, 119);
             this.groupBox1.Name = "groupBox1";
             this.groupBox1.Size = new System.Drawing.Size(319, 138);
             this.groupBox1.TabIndex = 0;
             this.groupBox1.TabStop = false;
             this.groupBox1.Text = "Collisions";
             // 
-            // ellipsoidControl
-            // 
-            this.ellipsoidControl.Location = new System.Drawing.Point(21, 95);
-            this.ellipsoidControl.Name = "ellipsoidControl";
-            this.ellipsoidControl.Size = new System.Drawing.Size(294, 28);
-            this.ellipsoidControl.TabIndex = 3;
-            this.ellipsoidControl.X = 0F;
-            this.ellipsoidControl.Y = 0F;
-            this.ellipsoidControl.Z = 0F;
-            // 
             // label3
             // 
             this.label3.AutoSize = true;
@@ -121,7 +113,7 @@
             this.butOK.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
             this.butOK.DialogResult = System.Windows.Forms.DialogResult.OK;
             this.butOK.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
-            this.butOK.Location = new System.Drawing.Point(93, 538);
+            this.butOK.Location = new System.Drawing.Point(93, 578);
             this.butOK.Name = "butOK";
             this.butOK.Size = new System.Drawing.Size(75, 23);
             this.butOK.TabIndex = 1;
@@ -134,7 +126,7 @@
             this.butCancel.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
             this.butCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
             this.butCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
-            this.butCancel.Location = new System.Drawing.Point(174, 538);
+            this.butCancel.Location = new System.Drawing.Point(174, 578);
             this.butCancel.Name = "butCancel";
             this.butCancel.Size = new System.Drawing.Size(75, 23);
             this.butCancel.TabIndex = 2;
@@ -148,7 +140,7 @@
             this.groupBox2.Controls.Add(this.label1);
             this.groupBox2.Controls.Add(this.nupSpeed);
             this.groupBox2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
-            this.groupBox2.Location = new System.Drawing.Point(12, 221);
+            this.groupBox2.Location = new System.Drawing.Point(12, 263);
             this.groupBox2.Name = "groupBox2";
             this.groupBox2.Size = new System.Drawing.Size(319, 140);
             this.groupBox2.TabIndex = 3;
@@ -204,7 +196,7 @@
             this.groupBox3.Controls.Add(this.grpAutoAnimate);
             this.groupBox3.Controls.Add(this.chkAutoAnimate);
             this.groupBox3.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
-            this.groupBox3.Location = new System.Drawing.Point(12, 367);
+            this.groupBox3.Location = new System.Drawing.Point(12, 409);
             this.groupBox3.Name = "groupBox3";
             this.groupBox3.Size = new System.Drawing.Size(319, 156);
             this.groupBox3.TabIndex = 5;
@@ -294,11 +286,13 @@
             // 
             // groupBox4
             // 
+            this.groupBox4.Controls.Add(this.label6);
+            this.groupBox4.Controls.Add(this.cbCameraType);
             this.groupBox4.Controls.Add(this.chkNoExport);
             this.groupBox4.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
             this.groupBox4.Location = new System.Drawing.Point(12, 12);
             this.groupBox4.Name = "groupBox4";
-            this.groupBox4.Size = new System.Drawing.Size(319, 59);
+            this.groupBox4.Size = new System.Drawing.Size(319, 101);
             this.groupBox4.TabIndex = 6;
             this.groupBox4.TabStop = false;
             this.groupBox4.Text = "Misc.";
@@ -315,13 +309,56 @@
             this.chkNoExport.ThreeState = true;
             this.chkNoExport.UseVisualStyleBackColor = true;
             // 
+            // cbCameraType
+            // 
+            this.cbCameraType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.cbCameraType.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+            this.cbCameraType.FormattingEnabled = true;
+            this.cbCameraType.Items.AddRange(new object[] {
+            "AnaglyphArcRotateCamera",
+            "AnaglyphFreeCamera",
+            "ArcRotateCamera",
+            "DeviceOrientationCamera",
+            "FollowCamera",
+            "FreeCamera",
+            "GamepadCamera",
+            "OculusCamera",
+            "OculusGamepadCamera",
+            "TouchCamera",
+            "VirtualJoysticksCamera",
+            "WebVRCamera",
+            "VRDeviceOrientationCamera"});
+            this.cbCameraType.Location = new System.Drawing.Point(23, 74);
+            this.cbCameraType.Name = "cbCameraType";
+            this.cbCameraType.Size = new System.Drawing.Size(290, 21);
+            this.cbCameraType.TabIndex = 5;
+            // 
+            // label6
+            // 
+            this.label6.AutoSize = true;
+            this.label6.Location = new System.Drawing.Point(16, 58);
+            this.label6.Name = "label6";
+            this.label6.Size = new System.Drawing.Size(34, 13);
+            this.label6.TabIndex = 6;
+            this.label6.Text = "Type:";
+            // 
+            // ellipsoidControl
+            // 
+            this.ellipsoidControl.Location = new System.Drawing.Point(21, 95);
+            this.ellipsoidControl.Name = "ellipsoidControl";
+            this.ellipsoidControl.Size = new System.Drawing.Size(294, 28);
+            this.ellipsoidControl.TabIndex = 3;
+            this.ellipsoidControl.X = 0F;
+            this.ellipsoidControl.Y = 0F;
+            this.ellipsoidControl.Z = 0F;
+            // 
             // CameraPropertiesForm
             // 
             this.AcceptButton = this.butOK;
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.CancelButton = this.butCancel;
-            this.ClientSize = new System.Drawing.Size(343, 573);
+            this.ClientSize = new System.Drawing.Size(343, 613);
             this.Controls.Add(this.groupBox4);
             this.Controls.Add(this.groupBox3);
             this.Controls.Add(this.groupBox2);
@@ -375,5 +412,7 @@
         private System.Windows.Forms.CheckBox chkAutoAnimate;
         private System.Windows.Forms.GroupBox groupBox4;
         private System.Windows.Forms.CheckBox chkNoExport;
+        private System.Windows.Forms.Label label6;
+        private System.Windows.Forms.ComboBox cbCameraType;
     }
 }

+ 5 - 0
Exporters/3ds Max/Max2Babylon/Forms/CameraPropertiesForm.cs

@@ -35,6 +35,8 @@ namespace Max2Babylon
 
             Tools.PrepareVector3Control(ellipsoidControl, cameras[0], "babylonjs_ellipsoid", 0.5f, 1.0f, 0.5f);
 
+            Tools.PrepareComboBox(cbCameraType, cameras[0], "babylonjs_type", "FreeCamera");
+
             Tools.PrepareCheckBox(chkAutoAnimate, cameras, "babylonjs_autoanimate");
             Tools.PrepareCheckBox(chkLoop, cameras, "babylonjs_autoanimateloop");
             Tools.PrepareNumericUpDown(nupFrom, cameras, "babylonjs_autoanimate_from");
@@ -52,6 +54,8 @@ namespace Max2Babylon
 
             Tools.UpdateVector3Control(ellipsoidControl, cameras, "babylonjs_ellipsoid");
 
+            Tools.UpdateComboBox(cbCameraType, cameras, "babylonjs_type");
+
             Tools.UpdateCheckBox(chkAutoAnimate, cameras, "babylonjs_autoanimate");
             Tools.UpdateCheckBox(chkLoop, cameras, "babylonjs_autoanimateloop");
             Tools.UpdateNumericUpDown(nupFrom, cameras, "babylonjs_autoanimate_from");
@@ -62,5 +66,6 @@ namespace Max2Babylon
         {
             grpAutoAnimate.Enabled = chkAutoAnimate.Checked;
         }
+
     }
 }

+ 35 - 0
Exporters/3ds Max/Max2Babylon/Tools/Tools.cs

@@ -571,6 +571,18 @@ namespace Max2Babylon
             return state == 1;
         }
 
+        public static string GetStringProperty(this IINode node, string propertyName, string defaultState)
+        {
+            string state = defaultState;
+#if MAX2015
+            node.GetUserPropString(propertyName, ref state);
+#else
+            node.GetUserPropString(ref propertyName, ref state);
+#endif
+
+            return state;
+        }
+
         public static float GetFloatProperty(this IINode node, string propertyName, float defaultState = 0)
         {
             float state = defaultState;
@@ -654,6 +666,11 @@ namespace Max2Babylon
             }
         }
 
+        public static void PrepareComboBox(ComboBox comboBox, IINode node, string propertyName, string defaultValue)
+        {
+            comboBox.SelectedItem = node.GetStringProperty(propertyName, defaultValue);
+        }
+
         public static void UpdateCheckBox(CheckBox checkBox, IINode node, string propertyName)
         {
             if (checkBox.CheckState != CheckState.Indeterminate)
@@ -730,6 +747,24 @@ namespace Max2Babylon
             }
         }
 
+        public static void UpdateComboBox(ComboBox comboBox, IINode node, string propertyName)
+        {
+            var value = comboBox.SelectedItem.ToString();
+#if MAX2015
+            node.SetUserPropString(propertyName, value);
+#else
+            node.SetUserPropString(ref propertyName, ref value);
+#endif
+        }
+
+        public static void UpdateComboBox(ComboBox comboBox, List<IINode> nodes, string propertyName)
+        {
+            foreach (var node in nodes)
+            {
+                UpdateComboBox(comboBox, node, propertyName);
+            }
+        }
+
         public static IMatrix3 ExtractCoordinates(IINode meshNode, BabylonAbstractMesh babylonMesh, bool exportQuaternionsInsteadOfEulers)
         {
             var wm = meshNode.GetWorldMatrix(0, meshNode.HasParent());