浏览代码

MeshBasicMaterials no longer get emissive and ambient values
Added a test scene for scenes with children

repsac 10 年之前
父节点
当前提交
8e328ff4bb

+ 1 - 1
utils/exporters/blender/addons/io_three/__init__.py

@@ -41,7 +41,7 @@ SETTINGS_FILE_EXPORT = 'three_settings_export.js'
 bl_info = {
     'name': 'Three.js Format',
     'author': 'repsac, mrdoob, yomotsu, mpk, jpweeks',
-    'version': (1, 1, 1),
+    'version': (1, 2, 1),
     'blender': (2, 7, 3),
     'location': 'File > Import-Export',
     'description': 'Export Three.js formatted JSON files.',

+ 0 - 1
utils/exporters/blender/addons/io_three/exporter/api/object.py

@@ -17,7 +17,6 @@ from .constants import (
     PERSP,
     ORTHO,
     RENDER,
-    ZYX,
     NO_SHADOW
 )
 

+ 6 - 5
utils/exporters/blender/addons/io_three/exporter/material.py

@@ -26,14 +26,15 @@ class Material(base_classes.BaseNode):
         shader_type = api.material.type(self.node)
         self[constants.TYPE] = dispatch[shader_type]
 
-        ambient = api.material.ambient_color(self.node)
-        self[constants.AMBIENT] = utilities.rgb2int(ambient)
-
         diffuse = api.material.diffuse_color(self.node)
         self[constants.COLOR] = utilities.rgb2int(diffuse)
     
-        emissive = api.material.emissive_color(self.node)
-        self[constants.EMISSIVE] = utilities.rgb2int(emissive)
+        if self[constants.TYPE] != constants.THREE_BASIC:
+            ambient = api.material.ambient_color(self.node)
+            self[constants.AMBIENT] = utilities.rgb2int(ambient)
+
+            emissive = api.material.emissive_color(self.node)
+            self[constants.EMISSIVE] = utilities.rgb2int(emissive)
 
         vertex_color = api.material.use_vertex_colors(self.node)
         self[constants.VERTEX_COLORS] = vertex_color

二进制
utils/exporters/blender/tests/blend/scene_children.blend


+ 4 - 0
utils/exporters/blender/tests/scripts/js/review.js

@@ -99,6 +99,10 @@ function loadObject( data ) {
 
             camera = scene.children[ i ];
             var container = document.getElementById( 'viewport' );
+
+            orbit = new THREE.OrbitControls( camera, container );
+            orbit.addEventListener( 'change', render );
+
             var aspect = container.offsetWidth / container.offsetHeight;
             camera.aspect = aspect;
             camera.updateProjectionMatrix();

+ 9 - 0
utils/exporters/blender/tests/scripts/test_scene_children.bash

@@ -0,0 +1,9 @@
+#!/bin/bash
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+source "$DIR/setup_test_env.bash"
+
+blender --background $BLEND/scene_children.blend \
+    --python $PYSCRIPT -- $JSON --vertices --faces --scene \
+    --cameras --materials --embedGeometry --lights --cameras
+makereview $@ --tag $(tagname)