Преглед изворни кода

Merge pull request #1337 from Palmer-JC/master

Blender Exporter 5.0.5
David Catuhe пре 9 година
родитељ
комит
f4d7cbee04

BIN
Exporters/Blender/Blender2Babylon-5.0.zip


+ 1 - 1
Exporters/Blender/src/__init__.py

@@ -1,7 +1,7 @@
 bl_info = {
     'name': 'Babylon.js',
     'author': 'David Catuhe, Jeff Palmer',
-    'version': (5, 0, 4),
+    'version': (5, 0, 5),
     'blender': (2, 76, 0),
     'location': 'File > Export > Babylon.js (.babylon)',
     'description': 'Export Babylon.js scenes (.babylon)',

+ 7 - 8
Exporters/Blender/src/material.py

@@ -170,7 +170,7 @@ class BakingRecipe:
         self.bakeQuality = mesh.data.bakeQuality # for lossy compression formats
         self.forceBaking = mesh.data.forceBaking # in mesh, but not currently exposed
         self.usePNG      = mesh.data.usePNG      # in mesh, but not currently exposed
-        
+
         # initialize all members
         self.needsBaking      = self.forceBaking
         self.diffuseBaking    = self.forceBaking
@@ -410,7 +410,7 @@ class BakedMaterial(Material):
 
         # changes to cycles & smart_project occurred in 2.77; need to know what we are running
         bVersion = blenderMajorMinorVersion()
-        
+
         # any baking already took in the values. Do not want to apply them again, but want shadows to show.
         # These are the default values from StandardMaterials
         self.ambient = Color((0, 0, 0))
@@ -451,18 +451,17 @@ class BakedMaterial(Material):
                 bpy.ops.uv.smart_project(angle_limit = 66.0, island_margin = 0.0, user_area_weight = 1.0, use_aspect = True)
             else:
                 bpy.ops.uv.smart_project(angle_limit = 66.0, island_margin = 0.0, user_area_weight = 1.0, use_aspect = True, stretch_to_bounds = True)
-            
-            # syntax for using unwrap enstead of smar project    
-#            bpy.ops.uv.unwrap(margin = 1.0) # defaulting on all 
+
+            # syntax for using unwrap enstead of smart project
+#            bpy.ops.uv.unwrap(margin = 1.0) # defaulting on all
             uvName = 'BakingUV'  # issues with cycles when not done this way
         else:
             uvName = uv.name
 
         format = 'PNG' if recipe.usePNG else 'JPEG'
-        
+
         # create a temporary image & link it to the UV/Image Editor so bake_image works
-        bpy.data.images.new(name = mesh.name + '_BJS_BAKE', width = recipe.bakeSize, height = recipe.bakeSize, alpha = False, float_buffer = False)
-        image = bpy.data.images[mesh.name + '_BJS_BAKE']
+        image = bpy.data.images.new(name = mesh.name + '_BJS_BAKE', width = recipe.bakeSize, height = recipe.bakeSize, alpha = recipe.usePNG, float_buffer = False)
         image.file_format = format
         image.mapping = 'UV' # default value
 

+ 1 - 1
Exporters/Blender/src/mesh.py

@@ -728,7 +728,7 @@ bpy.types.Mesh.usePNG = bpy.props.BoolProperty(
 )
 bpy.types.Mesh.bakeSize = bpy.props.IntProperty(
     name='Texture Size',
-    description='',
+    description='Final dimensions of texture(s).  Not required to be a power of 2, but recommended.',
     default = 1024
 )
 bpy.types.Mesh.bakeQuality = bpy.props.IntProperty(

+ 1 - 1
Exporters/Blender/src/package_level.py

@@ -58,7 +58,7 @@ def getNameSpace(filepathMinusExtension):
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 def getLayer(obj):
     # empties / nodes do not have layers
-    if not hasattr(object, 'layers') : return -1;
+    if not hasattr(obj, 'layers') : return -1;
     for idx, layer in enumerate(obj.layers):
         if layer:
             return idx