[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16056] branches/soc-2008-jaguarandi: svn merge -r 15988:16055 https://svn.blender.org/svnroot/bf-blender/trunk/ blender
André Pinto
andresusanopinto at gmail.com
Mon Aug 11 15:29:38 CEST 2008
Revision: 16056
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16056
Author: jaguarandi
Date: 2008-08-11 15:29:38 +0200 (Mon, 11 Aug 2008)
Log Message:
-----------
svn merge -r 15988:16055 https://svn.blender.org/svnroot/bf-blender/trunk/blender
Modified Paths:
--------------
branches/soc-2008-jaguarandi/CMakeLists.txt
branches/soc-2008-jaguarandi/config/linux2-config.py
branches/soc-2008-jaguarandi/projectfiles_vc7/blender/blenkernel/BKE_blenkernel.vcproj
branches/soc-2008-jaguarandi/release/scripts/flt_export.py
branches/soc-2008-jaguarandi/release/scripts/flt_palettemanager.py
branches/soc-2008-jaguarandi/release/scripts/import_dxf.py
branches/soc-2008-jaguarandi/release/scripts/ply_export.py
branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/anim.c
branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/particle_system.c
branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/texture.c
branches/soc-2008-jaguarandi/source/blender/blenlib/BLI_kdopbvh.h
branches/soc-2008-jaguarandi/source/blender/blenlib/intern/BLI_kdopbvh.c
branches/soc-2008-jaguarandi/source/blender/include/BIF_editarmature.h
branches/soc-2008-jaguarandi/source/blender/include/BIF_editmesh.h
branches/soc-2008-jaguarandi/source/blender/include/butspace.h
branches/soc-2008-jaguarandi/source/blender/python/api2_2x/doc/Render.py
branches/soc-2008-jaguarandi/source/blender/render/intern/source/rayshade.c
branches/soc-2008-jaguarandi/source/blender/src/buttons_editing.c
branches/soc-2008-jaguarandi/source/blender/src/editarmature.c
branches/soc-2008-jaguarandi/source/blender/src/editmesh_mods.c
branches/soc-2008-jaguarandi/source/blender/src/editobject.c
branches/soc-2008-jaguarandi/source/blender/src/poselib.c
branches/soc-2008-jaguarandi/source/blender/src/transform_conversions.c
branches/soc-2008-jaguarandi/source/gameengine/Converter/BL_BlenderDataConversion.cpp
branches/soc-2008-jaguarandi/source/gameengine/Ketsji/CMakeLists.txt
branches/soc-2008-jaguarandi/source/gameengine/Ketsji/KX_GameObject.cpp
branches/soc-2008-jaguarandi/source/gameengine/Ketsji/KX_RadarSensor.cpp
branches/soc-2008-jaguarandi/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
branches/soc-2008-jaguarandi/tools/btools.py
Added Paths:
-----------
branches/soc-2008-jaguarandi/intern/bmfont/intern/BDF2BMF.py
branches/soc-2008-jaguarandi/source/blender/blenkernel/BKE_bvhutils.h
branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/bvhutils.c
Modified: branches/soc-2008-jaguarandi/CMakeLists.txt
===================================================================
--- branches/soc-2008-jaguarandi/CMakeLists.txt 2008-08-11 13:16:06 UTC (rev 16055)
+++ branches/soc-2008-jaguarandi/CMakeLists.txt 2008-08-11 13:29:38 UTC (rev 16056)
@@ -183,9 +183,9 @@
SET(LLIBS "-lXi -lutil -lc -lm -lpthread -lstdc++")
IF(WITH_OPENMP)
- SET(LLIBS "${LLIBS} -lgomp ")
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp ")
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp ")
+ SET(LLIBS "${LLIBS} -lgomp")
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
ENDIF(WITH_OPENMP)
Modified: branches/soc-2008-jaguarandi/config/linux2-config.py
===================================================================
--- branches/soc-2008-jaguarandi/config/linux2-config.py 2008-08-11 13:16:06 UTC (rev 16055)
+++ branches/soc-2008-jaguarandi/config/linux2-config.py 2008-08-11 13:29:38 UTC (rev 16056)
@@ -139,7 +139,7 @@
BF_OPENJPEG_INC = '${BF_OPENJPEG}/include'
BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
-WITH_BF_REDCODE = 'true'
+WITH_BF_REDCODE = 'false'
BF_REDCODE = '#extern/libredcode'
BF_REDCODE_LIB = ''
# Uncomment the following two lines to use system's ffmpeg
Copied: branches/soc-2008-jaguarandi/intern/bmfont/intern/BDF2BMF.py (from rev 16055, trunk/blender/intern/bmfont/intern/BDF2BMF.py)
===================================================================
--- branches/soc-2008-jaguarandi/intern/bmfont/intern/BDF2BMF.py (rev 0)
+++ branches/soc-2008-jaguarandi/intern/bmfont/intern/BDF2BMF.py 2008-08-11 13:29:38 UTC (rev 16056)
@@ -0,0 +1,177 @@
+#!/usr/bin/python
+
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# ***** END GPL LICENCE BLOCK *****
+# --------------------------------------------------------------------------
+
+HELP_TXT = \
+'''
+Convert BDF pixmap fonts into C++ files Blender can read.
+Use to replace bitmap fonts or add new ones.
+
+Usage
+ python bdf2bmf.py -name=SomeName myfile.bdf
+
+Blender currently supports fonts with a maximum width of 8 pixels.
+'''
+
+# -------- Simple BDF parser
+import sys
+def parse_bdf(f, MAX_CHARS=256):
+ lines = [l.strip().upper().split() for l in f.readlines()]
+
+ is_bitmap = False
+ dummy = {'BITMAP':[]}
+ char_data = [dummy.copy() for i in xrange(MAX_CHARS)]
+ context_bitmap = []
+
+ for l in lines:
+ if l[0]=='ENCODING': enc = int(l[1])
+ elif l[0]=='BBX': bbx = [int(c) for c in l[1:]]
+ elif l[0]=='DWIDTH': dwidth = int(l[1])
+ elif l[0]=='BITMAP': is_bitmap = True
+ elif l[0]=='ENDCHAR':
+ if enc < MAX_CHARS:
+ char_data[enc]['BBX'] = bbx
+ char_data[enc]['DWIDTH'] = dwidth
+ char_data[enc]['BITMAP'] = context_bitmap
+
+ context_bitmap = []
+ enc = bbx = None
+ is_bitmap = False
+ else:
+ # None of the above, Ok, were reading a bitmap
+ if is_bitmap and enc < MAX_CHARS:
+ context_bitmap.append( int(l[0], 16) )
+
+ return char_data
+# -------- end simple BDF parser
+
+def bdf2cpp_name(path):
+ return path.split('.')[0] + '.cpp'
+
+def convert_to_blender(bdf_dict, font_name, origfilename, MAX_CHARS=256):
+
+ # first get a global width/height, also set the offsets
+ xmin = ymin = 10000000
+ xmax = ymax = -10000000
+
+ bitmap_offsets = [-1] * MAX_CHARS
+ bitmap_tot = 0
+ for i, c in enumerate(bdf_dict):
+ if c.has_key('BBX'):
+ bbx = c['BBX']
+ xmax = max(bbx[0], xmax)
+ ymax = max(bbx[1], ymax)
+ xmin = min(bbx[2], xmin)
+ ymin = min(bbx[3], ymin)
+
+ bitmap_offsets[i] = bitmap_tot
+ bitmap_tot += len(c['BITMAP'])
+
+ c['BITMAP'].reverse()
+
+ # Now we can write. Ok if we have no .'s in the path.
+ f = open(bdf2cpp_name(origfilename), 'w')
+
+ f.write('''
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "BMF_FontData.h"
+
+#include "BMF_Settings.h"
+''')
+
+ f.write('#if BMF_INCLUDE_%s\n\n' % font_name.upper())
+ f.write('static unsigned char bitmap_data[]= {')
+ newline = 8
+
+ for i, c in enumerate(bdf_dict):
+
+ for cdata in c['BITMAP']:
+ # Just formatting
+ newline+=1
+ if newline >= 8:
+ newline = 0
+ f.write('\n\t')
+ # End formatting
+
+ f.write('0x%.2hx,' % cdata) # 0x80 <- format
+
+ f.write("\n};\n")
+
+ f.write("BMF_FontData BMF_font_%s = {\n" % font_name)
+ f.write('\t%d, %d,\n' % (xmin, ymin))
+ f.write('\t%d, %d,\n' % (xmax, ymax))
+
+ f.write('\t{\n')
+
+
+ for i, c in enumerate(bdf_dict):
+ if bitmap_offsets[i] == -1 or c.has_key('BBX') == False:
+ f.write('\t\t{0,0,0,0,0, -1},\n')
+ else:
+ bbx = c['BBX']
+ f.write('\t\t{%d,%d,%d,%d,%d, %d},\n' % (bbx[0], bbx[1], -bbx[2], -bbx[3], c['DWIDTH'], bitmap_offsets[i]))
+
+ f.write('''
+ },
+ bitmap_data
+};
+
+#endif
+''')
+
+def main():
+ # replace "[-name=foo]" with "[-name] [foo]"
+ args = []
+ for arg in sys.argv:
+ for a in arg.replace('=', ' ').split():
+ args.append(a)
+
+ name = 'untitled'
+ done_anything = False
+ for i, arg in enumerate(args):
+ if arg == '-name':
+ if i==len(args)-1:
+ print 'no arg given for -name, aborting'
+ return
+ else:
+ name = args[i+1]
+
+ elif arg.lower().endswith('.bdf'):
+ try:
+ f = open(arg)
+ print '...Writing to:', bdf2cpp_name(arg)
+ except:
+ print 'could not open "%s", aborting' % arg
+
+
+ bdf_dict = parse_bdf(f)
+ convert_to_blender(bdf_dict, name, arg)
+ done_anything = True
+
+ if not done_anything:
+ print HELP_TXT
+ print '...nothing to do'
+
+if __name__ == '__main__':
+ main()
+
Modified: branches/soc-2008-jaguarandi/projectfiles_vc7/blender/blenkernel/BKE_blenkernel.vcproj
===================================================================
--- branches/soc-2008-jaguarandi/projectfiles_vc7/blender/blenkernel/BKE_blenkernel.vcproj 2008-08-11 13:16:06 UTC (rev 16055)
+++ branches/soc-2008-jaguarandi/projectfiles_vc7/blender/blenkernel/BKE_blenkernel.vcproj 2008-08-11 13:29:38 UTC (rev 16056)
@@ -366,6 +366,9 @@
RelativePath="..\..\..\source\blender\blenkernel\intern\brush.c">
</File>
<File
+ RelativePath="..\..\..\source\blender\blenkernel\intern\bvhutils.c">
+ </File>
+ <File
RelativePath="..\..\..\source\blender\blenkernel\intern\CCGSubSurf.c">
</File>
<File
@@ -577,6 +580,9 @@
RelativePath="..\..\..\source\blender\blenkernel\BKE_brush.h">
</File>
<File
+ RelativePath="..\..\..\source\blender\blenkernel\BKE_bvhutils.h">
+ </File>
+ <File
RelativePath="..\..\..\source\blender\blenkernel\BKE_cdderivedmesh.h">
</File>
<File
Modified: branches/soc-2008-jaguarandi/release/scripts/flt_export.py
===================================================================
--- branches/soc-2008-jaguarandi/release/scripts/flt_export.py 2008-08-11 13:16:06 UTC (rev 16055)
+++ branches/soc-2008-jaguarandi/release/scripts/flt_export.py 2008-08-11 13:29:38 UTC (rev 16056)
@@ -525,8 +525,8 @@
def __init__(self):
self.vertex_index_lst = []
self.mface = None
- self.texture_index = -1
- self.material_index = -1
+ self.texture_index = 65535
+ self.material_index = 65535
self.color_index = 127
self.renderstyle = 0
self.twoside = 0
@@ -979,8 +979,14 @@
self.header.fw.write_char(0) # Reserved
self.header.fw.write_char(alpha) # Template
self.header.fw.write_short(-1) # Detail tex pat index
- self.header.fw.write_short(face_desc.texture_index) # Tex pattern index
- self.header.fw.write_short(face_desc.material_index) # material index
+ if face_desc.texture_index == -1:
+ self.header.fw.write_ushort(65535)
+ else:
+ self.header.fw.write_ushort(face_desc.texture_index) # Tex pattern index
+ if face_desc.material_index == -1:
+ self.header.fw.write_ushort(65535)
+ else:
+ self.header.fw.write_ushort(face_desc.material_index) # material index
self.header.fw.write_short(0) # SMC code
self.header.fw.write_short(0) # Feature code
self.header.fw.write_int(0) # IR material code
@@ -1015,7 +1021,10 @@
self.header.fw.write_ushort(8 + (mtex * 8)) # Length
self.header.fw.write_uint(uvmask) # UV mask
for i in xrange(mtex):
- self.header.fw.write_ushort(face_desc.images[i]) # Tex pattern index
+ if face_desc.images[i] == -1:
+ self.header.fw.write_ushort(65535)
+ else:
+ self.header.fw.write_ushort(face_desc.images[i]) # Tex pattern index
self.header.fw.write_ushort(0) # Tex effect
self.header.fw.write_ushort(0) # Tex Mapping index
self.header.fw.write_ushort(0) # Tex data. User defined
@@ -1070,7 +1079,7 @@
if self.opcode == 63 and options.state['externalspath']:
try:
- exportdict['3t200!filename'] = os.path.join(options.state['externalspath'],self.object.DupGroup.name+'.flt')
+ exportdict['3t200!filename'] = os.path.join(options.state['externalspath'],self.object.DupGroup.name+'.flt').replace("\\", "/")
self.header.xrefnames.append(self.object.DupGroup.name)
except:
pass
@@ -1092,7 +1101,7 @@
write_prop(self.header.fw,ftype,self.object.properties['FLT']['EXT'][propname],length)
#write extension data
for i in xrange(datalen):
- self.header.fw.write_char(self.object.properties['FLT']['EXT']['data'][i])
+ self.header.fw.write_uchar(struct.unpack('>B', struct.pack('>B', self.object.properties['FLT']['EXT']['data'][i]))[0])
self.write_pop_extension()
@@ -1180,8 +1189,8 @@
desc = self.GRR.request_vertex_desc(i)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list