Browse Source

Fixed Blender scene exporter Euler angles (thanks to @WestLangley).

See #2803
alteredq 12 năm trước cách đây
mục cha
commit
eb72b5458d

+ 23 - 23
examples/obj/blenderscene/scene.js

@@ -22,7 +22,7 @@
 		"groups"    : [  ],
 		"material"  : "Material",
 		"position"  : [ 10.6237, 3.37078, -0.321692 ],
-		"rotation"  : [ 0.0902071, 1.62731, 1.6556 ],
+		"rotation"  : [ -1.62708, 0.00553477, 1.56601 ],
 		"quaternion": [ -0.513755, 0.513985, 0.483143, 0.488311 ],
 		"scale"     : [ 8.31, 0.12, 4.93 ],
 		"visible"       : true,
@@ -36,7 +36,7 @@
 		"groups"    : [  ],
 		"material"  : "Material.002",
 		"position"  : [ 1.70266, 0.680277, 5.86042 ],
-		"rotation"  : [ -0.152186, -3.07921, -0.0815374 ],
+		"rotation"  : [ 0.156946, -3.09251, 0.0901553 ],
 		"quaternion": [ -0.0429884, -0.995697, -0.0771868, 0.0279714 ],
 		"scale"     : [ 0.435837, 0.435837, 0.435837 ],
 		"visible"       : true,
@@ -50,7 +50,7 @@
 		"groups"    : [  ],
 		"material"  : "Material.002",
 		"position"  : [ 0.0812951, 0.639505, 5.80878 ],
-		"rotation"  : [ -0.152186, -3.07921, -0.0815374 ],
+		"rotation"  : [ 0.156946, -3.09251, 0.0901553 ],
 		"quaternion": [ -0.0429884, -0.995697, -0.0771868, 0.0279714 ],
 		"scale"     : [ 0.435837, 0.435837, 0.435837 ],
 		"visible"       : true,
@@ -64,7 +64,7 @@
 		"groups"    : [  ],
 		"material"  : "Material.002",
 		"position"  : [ -1.56903, 0.619385, 5.74724 ],
-		"rotation"  : [ -0.152186, -3.07921, -0.0815374 ],
+		"rotation"  : [ 0.156946, -3.09251, 0.0901553 ],
 		"quaternion": [ -0.0429884, -0.995697, -0.0771868, 0.0279714 ],
 		"scale"     : [ 0.435837, 0.435837, 0.435837 ],
 		"visible"       : true,
@@ -78,7 +78,7 @@
 		"groups"    : [  ],
 		"material"  : "Material.002",
 		"position"  : [ -3.12912, 0.552266, 5.70927 ],
-		"rotation"  : [ -0.152186, -3.07921, -0.0815374 ],
+		"rotation"  : [ 0.156946, -3.09251, 0.0901553 ],
 		"quaternion": [ -0.0429884, -0.995697, -0.0771868, 0.0279714 ],
 		"scale"     : [ 0.435837, 0.435837, 0.435837 ],
 		"visible"       : true,
@@ -92,7 +92,7 @@
 		"groups"    : [  ],
 		"material"  : "Material.002",
 		"position"  : [ -6.38633, 0.382167, 3.0044 ],
-		"rotation"  : [ 0.603388, 1.68639, 0.530866 ],
+		"rotation"  : [ -0.670006, 1.69226, 0.607818 ],
 		"quaternion": [ 0.00364945, 0.739913, -0.0475347, 0.671011 ],
 		"scale"     : [ 0.435837, 0.435837, 0.435837 ],
 		"visible"       : true,
@@ -106,7 +106,7 @@
 		"groups"    : [  ],
 		"material"  : "Material.002",
 		"position"  : [ -6.49933, 0.47164, 1.59307 ],
-		"rotation"  : [ 0.603388, 1.68639, 0.530866 ],
+		"rotation"  : [ -0.670006, 1.69226, 0.607818 ],
 		"quaternion": [ 0.00364945, 0.739913, -0.0475347, 0.671011 ],
 		"scale"     : [ 0.435837, 0.435837, 0.435837 ],
 		"visible"       : true,
@@ -120,7 +120,7 @@
 		"groups"    : [  ],
 		"material"  : "Material.002",
 		"position"  : [ -6.62979, 0.53384, 0.234131 ],
-		"rotation"  : [ 0.603388, 1.68639, 0.530866 ],
+		"rotation"  : [ -0.670006, 1.69226, 0.607818 ],
 		"quaternion": [ 0.00364945, 0.739913, -0.0475347, 0.671011 ],
 		"scale"     : [ 0.435837, 0.435837, 0.435837 ],
 		"visible"       : true,
@@ -134,7 +134,7 @@
 		"groups"    : [  ],
 		"material"  : "Material.002",
 		"position"  : [ -6.71367, 0.629835, -1.00815 ],
-		"rotation"  : [ 0.603388, 1.68639, 0.530866 ],
+		"rotation"  : [ -0.670006, 1.69226, 0.607818 ],
 		"quaternion": [ 0.00364945, 0.739913, -0.0475347, 0.671011 ],
 		"scale"     : [ 0.435837, 0.435837, 0.435837 ],
 		"visible"       : true,
@@ -148,7 +148,7 @@
 		"groups"    : [  ],
 		"material"  : "Material.002",
 		"position"  : [ -2.01044, 1.38733, 24.3436 ],
-		"rotation"  : [ -0.076585, 3.00715, -0.193494 ],
+		"rotation"  : [ 0.0499381, 2.9952, 0.184673 ],
 		"quaternion": [ 0.0937477, 0.992596, 0.0315343, 0.0704984 ],
 		"scale"     : [ 9.16001, 9.16001, 9.16001 ],
 		"visible"       : true,
@@ -162,7 +162,7 @@
 		"groups"    : [  ],
 		"material"  : "Material.002",
 		"position"  : [ -4.29219, 1.82628, -7.9754 ],
-		"rotation"  : [ 0.0415421, 0.213278, 0.0825887 ],
+		"rotation"  : [ 0.0245137, 0.21586, 0.075485 ],
 		"quaternion": [ 0.0162409, 0.107176, 0.0388305, 0.993349 ],
 		"scale"     : [ 1, 1, 1 ],
 		"visible"       : true,
@@ -176,7 +176,7 @@
 		"groups"    : [  ],
 		"material"  : "Material.002",
 		"position"  : [ 2.15176, 1.89188, -8.06532 ],
-		"rotation"  : [ 0.0415421, 0.213278, 0.0825887 ],
+		"rotation"  : [ 0.0245137, 0.21586, 0.075485 ],
 		"quaternion": [ 0.0162409, 0.107176, 0.0388305, 0.993349 ],
 		"scale"     : [ 1, 1, 1 ],
 		"visible"       : true,
@@ -190,7 +190,7 @@
 		"groups"    : [  ],
 		"material"  : "Material.002",
 		"position"  : [ -0.712512, 2.115, -8.09784 ],
-		"rotation"  : [ 0.0415421, 0.213278, 0.0825887 ],
+		"rotation"  : [ 0.0245137, 0.21586, 0.075485 ],
 		"quaternion": [ 0.0162409, 0.107176, 0.0388305, 0.993349 ],
 		"scale"     : [ 1, 1, 1 ],
 		"visible"       : true,
@@ -218,7 +218,7 @@
 		"groups"    : [  ],
 		"material"  : "Material",
 		"position"  : [ 2.48452, 2.72485, 7.48693 ],
-		"rotation"  : [ -1.33663, -0.180512, -0.0764693 ],
+		"rotation"  : [ -1.34037, 0.0327791, -0.193151 ],
 		"quaternion": [ -0.619393, -0.0471007, -0.0856912, 0.778968 ],
 		"scale"     : [ 0.35, 0.89, 3.31 ],
 		"visible"       : true,
@@ -232,7 +232,7 @@
 		"groups"    : [  ],
 		"material"  : "Material.002",
 		"position"  : [ 7.72494, 1.69488, -7.1231 ],
-		"rotation"  : [ 0.105857, 2.05554, -0.179216 ],
+		"rotation"  : [ -0.512649, 2.13144, 0.530967 ],
 		"quaternion": [ 0.103735, 0.849073, -0.0912881, 0.509882 ],
 		"scale"     : [ 1, 1, 1 ],
 		"visible"       : true,
@@ -246,7 +246,7 @@
 		"groups"    : [  ],
 		"material"  : "Material.002",
 		"position"  : [ -6.33464, 0.566791, -6.63615 ],
-		"rotation"  : [ -0.293692, -2.1481, 0.0596867 ],
+		"rotation"  : [ 0.432442, -2.18384, 0.327431 ],
 		"quaternion": [ -0.0437495, -0.87137, -0.11451, 0.475067 ],
 		"scale"     : [ 1, 1, 1 ],
 		"visible"       : true,
@@ -260,7 +260,7 @@
 		"groups"    : [  ],
 		"material"  : "Material.002",
 		"position"  : [ -5.38404, 0.444915, 6.19409 ],
-		"rotation"  : [ -0.875957, -1.00995, 0.346096 ],
+		"rotation"  : [ -1.00704, -0.879796, -0.667908 ],
 		"quaternion": [ -0.290193, -0.495489, -0.0656431, 0.81607 ],
 		"scale"     : [ 1, 1, 1 ],
 		"visible"       : true,
@@ -274,7 +274,7 @@
 		"groups"    : [  ],
 		"material"  : "Material.002",
 		"position"  : [ 3.14775, 1.01484, 4.23088 ],
-		"rotation"  : [ 0.0829842, -2.93793, 0.313742 ],
+		"rotation"  : [ -0.14353, -2.97468, -0.334254 ],
 		"quaternion": [ 0.15945, -0.9811, 0.0566266, 0.0938749 ],
 		"scale"     : [ 1, 1, 1 ],
 		"visible"       : true,
@@ -288,7 +288,7 @@
 		"groups"    : [  ],
 		"material"  : "Material.002",
 		"position"  : [ -2.66804, 3.00888, 2.15339 ],
-		"rotation"  : [ -0.218899, 2.34338, -0.685818 ],
+		"rotation"  : [ -0.38317, 2.39587, 0.744646 ],
 		"quaternion": [ 0.267974, 0.876844, -0.0350883, 0.397623 ],
 		"scale"     : [ 1, 1, 1 ],
 		"visible"       : true,
@@ -302,7 +302,7 @@
 		"groups"    : [  ],
 		"material"  : "Material",
 		"position"  : [ -3.03125, 0.702044, 1.94366 ],
-		"rotation"  : [ 0.407177, 0.0335041, -1.80895 ],
+		"rotation"  : [ -0.0691183, -0.402911, -1.82999 ],
 		"quaternion": [ 0.137849, -0.148775, -0.771851, 0.602586 ],
 		"scale"     : [ 1.78114, 0.361142, 0.231142 ],
 		"visible"       : true,
@@ -316,7 +316,7 @@
 		"groups"    : [  ],
 		"material"  : "Material.002",
 		"position"  : [ 1.24531, 0.620196, -0.137285 ],
-		"rotation"  : [ -0.239212, 1.23621, -1.0337 ],
+		"rotation"  : [ 1.12478, 0.738376, -1.34162 ],
 		"quaternion": [ 0.199764, 0.548252, -0.339724, 0.737632 ],
 		"scale"     : [ 1, 1, 1 ],
 		"visible"       : true,
@@ -330,7 +330,7 @@
 		"groups"    : [  ],
 		"material"  : "Material.002",
 		"position"  : [ -0.2825, 1.81361, -4.27293 ],
-		"rotation"  : [ -0.927034, 0.0103158, -0.219361 ],
+		"rotation"  : [ -0.914542, 0.181082, -0.124918 ],
 		"quaternion": [ -0.443899, 0.0535249, -0.0956176, 0.889351 ],
 		"scale"     : [ 1, 1, 1 ],
 		"visible"       : true,
@@ -386,7 +386,7 @@
 		"groups"    : [  ],
 		"material"  : "Material",
 		"position"  : [ 3.65198, 1.07114, 5.15649e-08 ],
-		"rotation"  : [ -1.33663, -0.180512, -0.0764693 ],
+		"rotation"  : [ -1.34037, 0.0327791, -0.193151 ],
 		"quaternion": [ -0.619393, -0.0471007, -0.0856911, 0.778968 ],
 		"scale"     : [ 1, 1, 1 ],
 		"visible"       : true,

+ 2 - 2
utils/exporters/blender/2.65/scripts/addons/io_mesh_threejs/export_threejs.py

@@ -1645,7 +1645,7 @@ def generate_objects(data):
                 matrix_world = obj.matrix_world
 
             position, quaternion, scale = matrix_world.decompose()
-            rotation = quaternion.to_euler("XYZ")
+            rotation = quaternion.to_euler("ZYX")
 
             # use empty material string for multi-material objects
             # this will trigger use of MeshFaceMaterial in SceneLoader
@@ -1695,7 +1695,7 @@ def generate_objects(data):
                 matrix_world = obj.matrix_world
 
             position, quaternion, scale = matrix_world.decompose()
-            rotation = quaternion.to_euler("XYZ")
+            rotation = quaternion.to_euler("ZYX")
 
             group_string = ""
             if len(group_ids) > 0: