瀏覽代碼

Merge pull request #7259 from repsac/anim_fix

Blender Exporter: exported armatures are added to active selections
Mr.doob 9 年之前
父節點
當前提交
cf70776b04

+ 20 - 6
utils/exporters/blender/addons/io_three/exporter/api/animation.py

@@ -4,7 +4,7 @@ Module for handling the parsing of skeletal animation data.
 
 import math
 import mathutils
-from bpy import data, context
+from bpy import data, context, ops
 from .. import constants, logger
 
 
@@ -171,11 +171,25 @@ def _parse_pose_action(action, armature, options):
     :param options:
 
     """
-    # @TODO: this seems to fail in batch mode meaning the
-    #        user has to have th GUI open. need to improve
-    #        this logic to allow batch processing, if Blender
-    #        chooses to behave....
-    current_context = context.area.type
+    try:
+        current_context = context.area.type
+    except AttributeError:
+        for window in context.window_manager.windows:
+            screen = window.screen
+            for area in screen.areas:
+                if area.type != 'VIEW_3D':
+                    continue
+
+                override = {
+                    'window': window,
+                    'screen': screen,
+                    'area': area
+                }
+                ops.screen.screen_full_area(override)
+                break
+        current_context = context.area.type
+
+    context.scene.objects.active = armature
     context.area.type = 'DOPESHEET_EDITOR'
     context.space_data.mode = 'ACTION'
     context.area.spaces.active.action = action

+ 1 - 1
utils/exporters/blender/tests/scripts/js/review.js

@@ -122,7 +122,7 @@ function loadObject( data ) {
 function loadGeometry( data, url ) {
 
     var loader = new THREE.JSONLoader();
-    var texturePath = loader.extractUrlBase( url );
+    var texturePath = THREE.Loader.prototype.extractUrlBase( url );
     data = loader.parse( data, texturePath );
 
     if ( data.materials === undefined ) {

+ 1 - 1
utils/exporters/blender/tests/scripts/test_geometry_animation.bash

@@ -4,6 +4,6 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 source "$DIR/setup_test_env.bash"
 
 blender --background $BLEND/anim.blend --python $PYSCRIPT -- \
-    $JSON --vertices --faces --animation --bones --skinning \
+    $JSON --vertices --faces --animation rest --bones --skinning \
     --embedAnimation
 makereview $@ --tag $(tagname)