Browse Source

fixed context awareness which again allows for batch animation exports
exported armatures are added to active selections
fixed the review script usage of extractUrlBase
fixed the syntax of the batch animation test shell script

repsac 10 năm trước cách đây
mục cha
commit
a4a0265285

+ 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 math
 import mathutils
 import mathutils
-from bpy import data, context
+from bpy import data, context, ops
 from .. import constants, logger
 from .. import constants, logger
 
 
 
 
@@ -171,11 +171,25 @@ def _parse_pose_action(action, armature, options):
     :param 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.area.type = 'DOPESHEET_EDITOR'
     context.space_data.mode = 'ACTION'
     context.space_data.mode = 'ACTION'
     context.area.spaces.active.action = 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 ) {
 function loadGeometry( data, url ) {
 
 
     var loader = new THREE.JSONLoader();
     var loader = new THREE.JSONLoader();
-    var texturePath = loader.extractUrlBase( url );
+    var texturePath = THREE.Loader.prototype.extractUrlBase( url );
     data = loader.parse( data, texturePath );
     data = loader.parse( data, texturePath );
 
 
     if ( data.materials === undefined ) {
     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"
 source "$DIR/setup_test_env.bash"
 
 
 blender --background $BLEND/anim.blend --python $PYSCRIPT -- \
 blender --background $BLEND/anim.blend --python $PYSCRIPT -- \
-    $JSON --vertices --faces --animation --bones --skinning \
+    $JSON --vertices --faces --animation rest --bones --skinning \
     --embedAnimation
     --embedAnimation
 makereview $@ --tag $(tagname)
 makereview $@ --tag $(tagname)