Forráskód Böngészése

Merge pull request #6535 from tschw/Blender_misc_fixes

Blender misc fixes
Ricardo Cabello 10 éve
szülő
commit
c72e0c2713

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

@@ -604,7 +604,7 @@ class ExportThree(bpy.types.Operator, ExportHelper):
         name="Type",
         description="Geometry type",
         items=_geometry_types()[1:],
-        default=constants.GEOMETRY)
+        default=constants.EXPORT_OPTIONS[constants.GEOMETRY_TYPE])
 
     option_export_scene = BoolProperty(
         name="Scene",

+ 4 - 1
utils/exporters/blender/addons/io_three/exporter/api/material.py

@@ -384,7 +384,10 @@ def _valid_textures(material, strict_use=True):
             in_use = texture.use
         else:
             in_use = True
-        if texture.texture.type != IMAGE or not in_use:
+        if not in_use:
+            continue
+        if not texture.texture or texture.texture.type != IMAGE:
+            logger.warning("Unable to export non-image texture %s", texture)
             continue
         logger.debug("Valid texture found %s", texture)
         yield texture

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

@@ -330,6 +330,8 @@ def extract_mesh(obj, options, recalculate=False):
     """
     logger.debug('object.extract_mesh(%s, %s)', obj, options)
     apply_modifiers = options.get(constants.APPLY_MODIFIERS, True)
+    if apply_modifiers:
+        bpy.ops.object.mode_set(mode='OBJECT')
     mesh_node = obj.to_mesh(context.scene, apply_modifiers, RENDER)
 
     # transfer the geometry type to the extracted mesh
@@ -350,6 +352,7 @@ def extract_mesh(obj, options, recalculate=False):
                      original_mesh.name,
                      mesh_node.name)
 
+        bpy.ops.object.mode_set(mode='OBJECT')
         obj.select = True
         bpy.context.scene.objects.active = obj
         logger.info('Applying triangulation to %s', obj.data.name)

+ 1 - 1
utils/exporters/blender/addons/io_three/exporter/geometry.py

@@ -299,7 +299,7 @@ class Geometry(base_classes.BaseNode):
             metadata[key] = len(array)/size
 
     def _geometry_metadata(self, metadata):
-        """Three.Geometry metadat
+        """Three.Geometry metadata
 
         :rtype: dict