~ubuntu-branches/ubuntu/maverick/blender/maverick

« back to all changes in this revision

Viewing changes to release/scripts/DirectX8Exporter.py

  • Committer: Bazaar Package Importer
  • Author(s): Khashayar Naderehvandi, Khashayar Naderehvandi, Alessio Treglia
  • Date: 2009-01-22 16:53:59 UTC
  • mfrom: (14.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20090122165359-v0996tn7fbit64ni
Tags: 2.48a+dfsg-1ubuntu1
[ Khashayar Naderehvandi ]
* Merge from debian experimental (LP: #320045), Ubuntu remaining changes:
  - Add patch correcting header file locations.
  - Add libvorbis-dev and libgsm1-dev to Build-Depends.
  - Use avcodec_decode_audio2() in source/blender/src/hddaudio.c

[ Alessio Treglia ]
* Add missing previous changelog entries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
# Group: 'Export'
7
7
# Tooltip: 'Export to DirectX text file format format for XNA Animation Component Library.'
8
8
"""
9
 
__author__ = "minahito (original:Arben (Ben) Omari)"
10
 
__url__ = ("blender", "blenderartists.org", "Adjuster's site http://sunday-lab.blogspot.com/, Author's site http://www.omariben.too.it")
11
 
__version__ = "3.0"
 
9
__author__ = "vertex color exporting feature is added by mnemoto (original:minahito (original:Arben (Ben) Omari))"
 
10
__url__ = ("blender.org", "blenderartists.org", "Adjuster's site http://sunday-lab.blogspot.com/, Author's site http://www.omariben.too.it","Adjuster's site http://ex.homeunix.net/")
 
11
__version__ = "3.1"
12
12
 
13
13
__bpydoc__ = """\
14
14
This script exports a Blender mesh with armature to DirectX 8's text file
444
444
                self.writeMeshMaterialList(obj, mesh, tex)
445
445
                self.writeMeshNormals(obj, mesh)
446
446
                self.writeMeshTextureCoords(obj, mesh)
 
447
                self.writeMeshVertexColors(obj, mesh)
447
448
                self.file.write("  }  // End of the Mesh %s \n" % (obj.name))
448
449
                
449
450
                                        
464
465
                                self.writeMeshMaterialList(obj, mesh, tex)
465
466
                                self.writeMeshNormals(obj, mesh)
466
467
                                self.writeMeshTextureCoords(obj, mesh)
 
468
                                self.writeMeshVertexColors(obj, mesh)
467
469
                                self.file.write(" }\n")
468
470
                                self.file.write("}\n")
469
471
                                ind = objs.index(obj)
1047
1049
                                                self.file.write(",\n")
1048
1050
 
1049
1051
                        self.file.write("}  //End of MeshTextureCoords\n")
 
1052
 
 
1053
        #***********************************************
 
1054
        #MESH VORTEX COLORS
 
1055
        #***********************************************
 
1056
        def writeMeshVertexColors(self, name, mesh):
 
1057
                if mesh.hasVertexColours():
 
1058
                        self.file.write("MeshVertexColors {\n")
 
1059
                        #VERTICES NUMBER
 
1060
                        numvert = reduce( lambda i,f: len(f)+i, mesh.faces, 0)
 
1061
                        self.file.write("%d;\n" % (numvert))
 
1062
                        #VERTEX COLORS
 
1063
                        
 
1064
                        vcounter =0
 
1065
                        for f in mesh.faces:
 
1066
                                col = f.col
 
1067
                                for i,c in enumerate(col):
 
1068
                                        # Note vcol alpha has no meaning
 
1069
                                        self.file.write("%d;%f;%f;%f;%f;" % (vcounter,c.r/255.0, c.g/255.0, c.b/255.0, 1.0)) # c.a/255.0))
 
1070
                                        vcounter+=1
 
1071
                                        if vcounter == numvert :
 
1072
                                                self.file.write(";\n")
 
1073
                                        else :
 
1074
                                                self.file.write(",\n")
 
1075
 
 
1076
                        self.file.write("}  //End of MeshVertexColors\n")
 
1077
 
1050
1078
#***********************************************#***********************************************#***********************************************
1051
1079
        #***********************************************
1052
1080
        #FRAMES