فهرست منبع

Blender exporter: added custom property for selecting material type.

For the moment it handles Basic, Lambert and Phong.

As with other custom properties, this should be persistent, saved into blend file.
alteredq 14 سال پیش
والد
کامیت
ac6e6e7fbd

+ 10 - 1
utils/exporters/blender/2.56/scripts/op/io_mesh_threejs/__init__.py

@@ -43,6 +43,9 @@ bpy.types.Object.THREE_meshCollider = bpy.props.BoolProperty()
 
 bpy.types.Material.THREE_useVertexColors = bpy.props.BoolProperty()
 
+THREE_material_types = [("Basic", "Basic", "Basic"), ("Phong", "Phong", "Phong"), ("Lambert", "Lambert", "Lambert")]
+bpy.types.Material.THREE_materialType = EnumProperty(name = "Material type", description = "Material type", items = THREE_material_types, default = "Lambert")
+
 class OBJECT_PT_hello( bpy.types.Panel ):
 
     bl_label = "THREE"
@@ -78,9 +81,13 @@ class MATERIAL_PT_hello( bpy.types.Panel ):
         row = layout.row()
         row.label(text="Selected material: " + mat.name )
 
+        row = layout.row()
+        row.prop( mat, "THREE_materialType", text="Material type" )
+
         row = layout.row()
         row.prop( mat, "THREE_useVertexColors", text="Use vertex colors" )
 
+
 # ################################################################
 # Importer
 # ################################################################
@@ -152,8 +159,10 @@ def save_settings_export(properties):
     "option_colors"          : properties.option_colors,
     "option_uv_coords"       : properties.option_uv_coords,
     "option_edges"           : properties.option_edges,
+    "option_faces"           : properties.option_faces,
+    "option_vertices"        : properties.option_vertices,
 
-    "option_vertices_truncate"     : properties.option_vertices_truncate,
+    "option_vertices_truncate" : properties.option_vertices_truncate,
     "option_scale"        : properties.option_scale,
 
     "align_model"         : properties.align_model

+ 4 - 0
utils/exporters/blender/2.56/scripts/op/io_mesh_threejs/export_threejs.py

@@ -751,6 +751,8 @@ def extract_materials(mesh, scene, option_colors):
             #    material['shading'] = "Phong"
             #else:
             #    material['shading'] = "Lambert"
+            
+            material['shading'] = m.THREE_materialType
 
     return materials
 
@@ -1167,6 +1169,8 @@ def extract_material_data(m, option_colors):
     #else:
     #    material['shading'] = "Lambert"
 
+    material['shading'] = m.THREE_materialType
+
     return material
 
 def generate_material_string(material):