forked from bartvdbraak/blender
More FBX exporter conversion.
Experimenting with cross-compiling my branch with MinGW on Linux: - tweaked config/linuxcross.py, source/blender/makesdna/intern/SConscript and tools/Blender.py So far linking fails.
This commit is contained in:
parent
fb150e12c5
commit
73ad2d320c
@ -2,13 +2,13 @@ LCGDIR = '#../lib/windows'
|
||||
LIBDIR = '${LCGDIR}'
|
||||
|
||||
BF_PYTHON = LIBDIR + '/python'
|
||||
BF_PYTHON_VERSION = '2.5'
|
||||
BF_PYTHON_VERSION = '2.6'
|
||||
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
|
||||
BF_PYTHON_BINARY = 'python'
|
||||
BF_PYTHON_LIB = 'python25'
|
||||
BF_PYTHON_LIB = 'python26'
|
||||
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
|
||||
|
||||
WITH_BF_OPENAL = True
|
||||
WITH_BF_OPENAL = False # XXX (Arystan)
|
||||
WITH_BF_STATICOPENAL = False
|
||||
BF_OPENAL = LIBDIR + '/openal'
|
||||
BF_OPENAL_INC = '${BF_OPENAL}/include'
|
||||
@ -17,6 +17,12 @@ BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
|
||||
# Warning, this static lib configuration is untested! users of this OS please confirm.
|
||||
BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
|
||||
|
||||
# copied from win32-mingw-config.py (Arystan)
|
||||
WITH_BF_FFMPEG = False
|
||||
BF_FFMPEG_LIB = 'avformat swscale avcodec avutil avdevice xvidcore x264'
|
||||
BF_FFMPEG_LIBPATH = LIBDIR + '/gcc/ffmpeg/lib'
|
||||
BF_FFMPEG_INC = LIBDIR + '/gcc/ffmpeg/include'
|
||||
|
||||
# Warning, this static lib configuration is untested! users of this OS please confirm.
|
||||
BF_CXX = '/usr'
|
||||
WITH_BF_STATICCXX = False
|
||||
@ -33,7 +39,7 @@ BF_PTHREADS_INC = '${BF_PTHREADS}/include'
|
||||
BF_PTHREADS_LIB = 'pthreadGC2'
|
||||
BF_PTHREADS_LIBPATH = '${BF_PTHREADS}/lib'
|
||||
|
||||
WITH_BF_OPENEXR = True
|
||||
WITH_BF_OPENEXR = False
|
||||
WITH_BF_STATICOPENEXR = False
|
||||
BF_OPENEXR = LIBDIR + '/gcc/openexr'
|
||||
BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR'
|
||||
@ -58,6 +64,8 @@ BF_PNG_LIBPATH = '${BF_PNG}/lib'
|
||||
|
||||
BF_TIFF = LIBDIR + '/tiff'
|
||||
BF_TIFF_INC = '${BF_TIFF}/include'
|
||||
BF_TIFF_LIB = 'libtiff'
|
||||
BF_TIFF_LIBPATH = '${BF_TIFF}/lib'
|
||||
|
||||
WITH_BF_ZLIB = True
|
||||
BF_ZLIB = LIBDIR + '/zlib'
|
||||
@ -69,16 +77,26 @@ WITH_BF_INTERNATIONAL = True
|
||||
|
||||
BF_GETTEXT = LIBDIR + '/gettext'
|
||||
BF_GETTEXT_INC = '${BF_GETTEXT}/include'
|
||||
BF_GETTEXT_LIB = 'gnu_gettext'
|
||||
BF_GETTEXT_LIB = 'gettextlib'
|
||||
# BF_GETTEXT_LIB = 'gnu_gettext'
|
||||
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
|
||||
|
||||
WITH_BF_GAMEENGINE = False
|
||||
|
||||
WITH_BF_ODE = True
|
||||
BF_ODE = LIBDIR + '/ode'
|
||||
BF_ODE_INC = BF_ODE + '/include'
|
||||
BF_ODE_LIB = BF_ODE + '/lib/libode.a'
|
||||
|
||||
WITH_BF_BULLET = True
|
||||
BF_BULLET = '#extern/bullet2/src'
|
||||
BF_BULLET_INC = '${BF_BULLET}'
|
||||
BF_BULLET_LIB = 'extern_bullet'
|
||||
|
||||
BF_SOLID = '#extern/solid'
|
||||
BF_SOLID_INC = '${BF_SOLID}'
|
||||
BF_SOLID_LIB = 'extern_solid'
|
||||
|
||||
BF_WINTAB = LIBDIR + '/wintab'
|
||||
BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE'
|
||||
|
||||
@ -100,9 +118,12 @@ BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
|
||||
|
||||
# Mesa Libs should go here if your using them as well....
|
||||
WITH_BF_STATICOPENGL = False
|
||||
BF_OPENGL = 'C:\\MingW'
|
||||
BF_OPENGL_INC = '${BF_OPENGL}/include'
|
||||
BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'
|
||||
BF_OPENGL = ''
|
||||
# BF_OPENGL = 'C:\\MingW'
|
||||
BF_OPENGL_INC = ''
|
||||
# BF_OPENGL_INC = '${BF_OPENGL}/include'
|
||||
BF_OPENGL_LIBINC = ''
|
||||
# BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'
|
||||
BF_OPENGL_LIB = 'opengl32 glu32'
|
||||
BF_OPENGL_LIB_STATIC = [ '${BF_OPENGL}/lib/libGL.a', '${BF_OPENGL}/lib/libGLU.a',
|
||||
'${BF_OPENGL}/lib/libXmu.a', '${BF_OPENGL}/lib/libXext.a',
|
||||
@ -111,9 +132,13 @@ BF_OPENGL_LIB_STATIC = [ '${BF_OPENGL}/lib/libGL.a', '${BF_OPENGL}/lib/libGLU.a'
|
||||
CC = 'i586-mingw32msvc-gcc'
|
||||
CXX = 'i586-mingw32msvc-g++'
|
||||
|
||||
# Custom built MinGW (Arystan)
|
||||
# CC = 'i586-pc-mingw32-gcc'
|
||||
# CXX = 'i586-pc-mingw32-g++'
|
||||
|
||||
CCFLAGS = [ '-pipe', '-funsigned-char', '-fno-strict-aliasing' ]
|
||||
|
||||
CPPFLAGS = [ '-DXP_UNIX', '-DWIN32', '-DFREE_WINDOWS' ]
|
||||
CPPFLAGS = [ '-DXP_UNIX', '-DWIN32', '-DFREE_WINDOWS', '-DLINUX_CROSS' ]
|
||||
CXXFLAGS = ['-pipe', '-mwindows', '-funsigned-char', '-fno-strict-aliasing' ]
|
||||
REL_CFLAGS = [ '-O2' ]
|
||||
REL_CCFLAGS = [ '-O2' ]
|
||||
@ -122,7 +147,7 @@ C_WARN = [ '-Wall' , '-Wno-char-subscripts', '-Wdeclaration-after-statement' ]
|
||||
CC_WARN = [ '-Wall' ]
|
||||
|
||||
|
||||
LLIBS = [ '-ldxguid', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz'] #'-lutil', '-lc', '-lm', '-ldl', '-lpthread' ]
|
||||
LLIBS = [ '-ldxguid', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++'] #'-lutil', '-lc', '-lm', '-ldl', '-lpthread' ]
|
||||
|
||||
BF_DEBUG = False
|
||||
BF_DEBUG_CCFLAGS= []
|
||||
@ -134,3 +159,5 @@ BF_PROFILE_LINKFLAGS = ['-pg']
|
||||
BF_BUILDDIR = '../build/linuxcross'
|
||||
BF_INSTALLDIR='../install/linuxcross'
|
||||
BF_DOCDIR='../install/doc'
|
||||
|
||||
# LINKFLAGS = ['-Wl,--start-group']
|
||||
|
@ -60,9 +60,10 @@ except:
|
||||
# except:
|
||||
# os = None
|
||||
|
||||
import Blender
|
||||
# import Blender
|
||||
import bpy
|
||||
from Blender.Mathutils import Matrix, Vector, RotationMatrix
|
||||
import Mathutils
|
||||
# from Blender.Mathutils import Matrix, Vector, RotationMatrix
|
||||
|
||||
import BPyObject
|
||||
import BPyMesh
|
||||
@ -258,9 +259,48 @@ def derived_paths(fname_orig, basepath, FORCE_CWD=False):
|
||||
def mat4x4str(mat):
|
||||
return '%.15f,%.15f,%.15f,%.15f,%.15f,%.15f,%.15f,%.15f,%.15f,%.15f,%.15f,%.15f,%.15f,%.15f,%.15f,%.15f' % tuple([ f for v in mat for f in v ])
|
||||
|
||||
# XXX not used
|
||||
# duplicated in OBJ exporter
|
||||
def getVertsFromGroup(me, group_index):
|
||||
ret = []
|
||||
|
||||
for i, v in enumerate(me.verts):
|
||||
for g in v.groups:
|
||||
if g.group == group_index:
|
||||
ret.append((i, g.weight))
|
||||
|
||||
return ret
|
||||
|
||||
# ob must be OB_MESH
|
||||
def BPyMesh_meshWeight2List(ob):
|
||||
''' Takes a mesh and return its group names and a list of lists, one list per vertex.
|
||||
aligning the each vert list with the group names, each list contains float value for the weight.
|
||||
These 2 lists can be modified and then used with list2MeshWeight to apply the changes.
|
||||
'''
|
||||
|
||||
me = ob.data
|
||||
|
||||
# Clear the vert group.
|
||||
groupNames= [g.name for g in ob.vertex_groups]
|
||||
len_groupNames= len(groupNames)
|
||||
|
||||
if not len_groupNames:
|
||||
# no verts? return a vert aligned empty list
|
||||
return [[] for i in xrange(len(me.verts))], []
|
||||
else:
|
||||
vWeightList= [[0.0]*len_groupNames for i in xrange(len(me.verts))]
|
||||
|
||||
for i, v in enumerate(me.verts):
|
||||
for g in v.groups:
|
||||
vWeightList[i][g.group] = g.weight
|
||||
|
||||
return groupNames, vWeightList
|
||||
|
||||
|
||||
def meshNormalizedWeights(me):
|
||||
try: # account for old bad BPyMesh
|
||||
groupNames, vWeightList = BPyMesh.meshWeight2List(me)
|
||||
groupNames, vWeightList = BPyMesh_meshWeight2List(me)
|
||||
# groupNames, vWeightList = BPyMesh.meshWeight2List(me)
|
||||
except:
|
||||
return [],[]
|
||||
|
||||
@ -564,7 +604,7 @@ def write(filename, batch_objects = None, \
|
||||
matrix_rot = mtx_x90 * matrix_rot
|
||||
elif type =='CAMERA':
|
||||
# elif ob and type =='Camera':
|
||||
y = Vector(0,1,0) * matrix_rot
|
||||
y = Mathutils.Vector(0,1,0) * matrix_rot
|
||||
matrix_rot = matrix_rot * Mathutils.RotationMatrix(math.pi/2, 3, 'r', y)
|
||||
|
||||
return matrix_rot
|
||||
@ -666,7 +706,7 @@ def write(filename, batch_objects = None, \
|
||||
matrix_rot = mtx_x90 * matrix_rot
|
||||
rot = tuple(matrix_rot.toEuler())
|
||||
elif ob and ob.type =='Camera':
|
||||
y = Vector(0,1,0) * matrix_rot
|
||||
y = Mathutils.Vector(0,1,0) * matrix_rot
|
||||
matrix_rot = matrix_rot * Mathutils.RotationMatrix(math.pi/2, 3, 'r', y)
|
||||
rot = tuple(matrix_rot.toEuler())
|
||||
else:
|
||||
@ -1052,8 +1092,8 @@ def write(filename, batch_objects = None, \
|
||||
file.write('\n\t\tTypeFlags: "Camera"')
|
||||
file.write('\n\t\tGeometryVersion: 124')
|
||||
file.write('\n\t\tPosition: %.6f,%.6f,%.6f' % loc)
|
||||
file.write('\n\t\tUp: %.6f,%.6f,%.6f' % tuple(Vector(0,1,0) * matrix_rot) )
|
||||
file.write('\n\t\tLookAt: %.6f,%.6f,%.6f' % tuple(Vector(0,0,-1)*matrix_rot) )
|
||||
file.write('\n\t\tUp: %.6f,%.6f,%.6f' % tuple(Mathutils.Vector(0,1,0) * matrix_rot) )
|
||||
file.write('\n\t\tLookAt: %.6f,%.6f,%.6f' % tuple(Mathutils.Vector(0,0,-1)*matrix_rot) )
|
||||
|
||||
#file.write('\n\t\tUp: 0,0,0' )
|
||||
#file.write('\n\t\tLookAt: 0,0,0' )
|
||||
@ -1458,7 +1498,8 @@ def write(filename, batch_objects = None, \
|
||||
if my_mesh.blenTextures: do_textures = True
|
||||
else: do_textures = False
|
||||
|
||||
do_uvs = me.faceUV
|
||||
do_uvs = len(me.uv_layers) > 0
|
||||
# do_uvs = me.faceUV
|
||||
|
||||
|
||||
file.write('\n\tModel: "Model::%s", "Mesh" {' % my_mesh.fbxName)
|
||||
@ -1490,20 +1531,24 @@ def write(filename, batch_objects = None, \
|
||||
file.write('\n\t\tPolygonVertexIndex: ')
|
||||
i=-1
|
||||
for f in me.faces:
|
||||
fi = [v.index for v in f]
|
||||
fi = [v_index for j, v_index in enumerate(f.verts) if v_index != 0 or j != 3]
|
||||
# fi = [v.index for v in f]
|
||||
|
||||
# flip the last index, odd but it looks like
|
||||
# this is how fbx tells one face from another
|
||||
fi[-1] = -(fi[-1]+1)
|
||||
fi = tuple(fi)
|
||||
if i==-1:
|
||||
if len(f) == 3: file.write('%i,%i,%i' % fi )
|
||||
if len(fi) == 3: file.write('%i,%i,%i' % fi )
|
||||
# if len(f) == 3: file.write('%i,%i,%i' % fi )
|
||||
else: file.write('%i,%i,%i,%i' % fi )
|
||||
i=0
|
||||
else:
|
||||
if i==13:
|
||||
file.write('\n\t\t')
|
||||
i=0
|
||||
if len(f) == 3: file.write(',%i,%i,%i' % fi )
|
||||
if len(fi) == 3: file.write(',%i,%i,%i' % fi )
|
||||
# if len(f) == 3: file.write(',%i,%i,%i' % fi )
|
||||
else: file.write(',%i,%i,%i,%i' % fi )
|
||||
i+=1
|
||||
|
||||
@ -1511,13 +1556,15 @@ def write(filename, batch_objects = None, \
|
||||
i=-1
|
||||
for ed in me.edges:
|
||||
if i==-1:
|
||||
file.write('%i,%i' % (ed.v1.index, ed.v2.index))
|
||||
file.write('%i,%i' % (ed.verts[0], ed.verts[1]))
|
||||
# file.write('%i,%i' % (ed.v1.index, ed.v2.index))
|
||||
i=0
|
||||
else:
|
||||
if i==13:
|
||||
file.write('\n\t\t')
|
||||
i=0
|
||||
file.write(',%i,%i' % (ed.v1.index, ed.v2.index))
|
||||
file.write(',%i,%i' % (ed.verts[0], ed.verts[1]))
|
||||
# file.write(',%i,%i' % (ed.v1.index, ed.v2.index))
|
||||
i+=1
|
||||
|
||||
file.write('\n\t\tGeometryVersion: 124')
|
||||
@ -1533,11 +1580,13 @@ def write(filename, batch_objects = None, \
|
||||
i=-1
|
||||
for v in me.verts:
|
||||
if i==-1:
|
||||
file.write('%.15f,%.15f,%.15f' % tuple(v.no)); i=0
|
||||
file.write('%.15f,%.15f,%.15f' % tuple(v.normal)); i=0
|
||||
# file.write('%.15f,%.15f,%.15f' % tuple(v.no)); i=0
|
||||
else:
|
||||
if i==2:
|
||||
file.write('\n '); i=0
|
||||
file.write(',%.15f,%.15f,%.15f' % tuple(v.no))
|
||||
file.write(',%.15f,%.15f,%.15f' % tuple(v.normal))
|
||||
# file.write(',%.15f,%.15f,%.15f' % tuple(v.no))
|
||||
i+=1
|
||||
file.write('\n\t\t}')
|
||||
|
||||
@ -1571,32 +1620,49 @@ def write(filename, batch_objects = None, \
|
||||
ReferenceInformationType: "Direct"
|
||||
Smoothing: ''')
|
||||
|
||||
SHARP = Blender.Mesh.EdgeFlags.SHARP
|
||||
# SHARP = Blender.Mesh.EdgeFlags.SHARP
|
||||
i=-1
|
||||
for ed in me.edges:
|
||||
if i==-1:
|
||||
file.write('%i' % ((ed.flag&SHARP)!=0)); i=0
|
||||
file.write('%i' % (ed.sharp)); i=0
|
||||
# file.write('%i' % ((ed.flag&SHARP)!=0)); i=0
|
||||
else:
|
||||
if i==54:
|
||||
file.write('\n '); i=0
|
||||
file.write(',%i' % ((ed.flag&SHARP)!=0))
|
||||
file.write(',%i' % (ed.sharp))
|
||||
# file.write(',%i' % ((ed.flag&SHARP)!=0))
|
||||
i+=1
|
||||
|
||||
file.write('\n\t\t}')
|
||||
del SHARP
|
||||
|
||||
# del SHARP
|
||||
|
||||
# small utility function
|
||||
# returns a slice of data depending on number of face verts
|
||||
# data is either a MeshTextureFace or MeshColor
|
||||
def face_data(data, face):
|
||||
if f.verts[3] == 0:
|
||||
totvert = 3
|
||||
else:
|
||||
totvert = 4
|
||||
|
||||
return data[:totvert]
|
||||
|
||||
|
||||
# Write VertexColor Layers
|
||||
# note, no programs seem to use this info :/
|
||||
collayers = []
|
||||
if me.vertexColors:
|
||||
collayers = me.getColorLayerNames()
|
||||
collayer_orig = me.activeColorLayer
|
||||
if len(me.vertex_colors):
|
||||
# if me.vertexColors:
|
||||
collayers = me.vertex_colors
|
||||
# collayers = me.getColorLayerNames()
|
||||
collayer_orig = me.active_vertex_color
|
||||
# collayer_orig = me.activeColorLayer
|
||||
for colindex, collayer in enumerate(collayers):
|
||||
me.activeColorLayer = collayer
|
||||
# me.activeColorLayer = collayer
|
||||
file.write('\n\t\tLayerElementColor: %i {' % colindex)
|
||||
file.write('\n\t\t\tVersion: 101')
|
||||
file.write('\n\t\t\tName: "%s"' % collayer)
|
||||
file.write('\n\t\t\tName: "%s"' % collayer.name)
|
||||
# file.write('\n\t\t\tName: "%s"' % collayer)
|
||||
|
||||
file.write('''
|
||||
MappingInformationType: "ByPolygonVertex"
|
||||
@ -1605,19 +1671,37 @@ def write(filename, batch_objects = None, \
|
||||
|
||||
i = -1
|
||||
ii = 0 # Count how many Colors we write
|
||||
|
||||
for f in me.faces:
|
||||
for col in f.col:
|
||||
|
||||
for f, cf in zip(me.faces, collayer.data):
|
||||
colors = [cf.color1, cf.color2, cf.color3, cf.color4]
|
||||
|
||||
# determine number of verts
|
||||
colors = face_data(colors, f)
|
||||
|
||||
for col in colors:
|
||||
if i==-1:
|
||||
file.write('%.4f,%.4f,%.4f,1' % (col[0]/255.0, col[1]/255.0, col[2]/255.0))
|
||||
file.write('%.4f,%.4f,%.4f,1' % tuple(col))
|
||||
i=0
|
||||
else:
|
||||
if i==7:
|
||||
file.write('\n\t\t\t\t')
|
||||
i=0
|
||||
file.write(',%.4f,%.4f,%.4f,1' % (col[0]/255.0, col[1]/255.0, col[2]/255.0))
|
||||
file.write(',%.4f,%.4f,%.4f,1' % tuple(col))
|
||||
i+=1
|
||||
ii+=1 # One more Color
|
||||
|
||||
# for f in me.faces:
|
||||
# for col in f.col:
|
||||
# if i==-1:
|
||||
# file.write('%.4f,%.4f,%.4f,1' % (col[0]/255.0, col[1]/255.0, col[2]/255.0))
|
||||
# i=0
|
||||
# else:
|
||||
# if i==7:
|
||||
# file.write('\n\t\t\t\t')
|
||||
# i=0
|
||||
# file.write(',%.4f,%.4f,%.4f,1' % (col[0]/255.0, col[1]/255.0, col[2]/255.0))
|
||||
# i+=1
|
||||
# ii+=1 # One more Color
|
||||
|
||||
file.write('\n\t\t\tColorIndex: ')
|
||||
i = -1
|
||||
@ -1639,13 +1723,17 @@ def write(filename, batch_objects = None, \
|
||||
# Write UV and texture layers.
|
||||
uvlayers = []
|
||||
if do_uvs:
|
||||
uvlayers = me.getUVLayerNames()
|
||||
uvlayer_orig = me.activeUVLayer
|
||||
for uvindex, uvlayer in enumerate(uvlayers):
|
||||
me.activeUVLayer = uvlayer
|
||||
uvlayers = me.uv_textures
|
||||
# uvlayers = me.getUVLayerNames()
|
||||
uvlayer_orig = me.active_uv_texture
|
||||
# uvlayer_orig = me.activeUVLayer
|
||||
for uvindex, uvlayer in enumerate(me.uv_textures):
|
||||
# for uvindex, uvlayer in enumerate(uvlayers):
|
||||
# me.activeUVLayer = uvlayer
|
||||
file.write('\n\t\tLayerElementUV: %i {' % uvindex)
|
||||
file.write('\n\t\t\tVersion: 101')
|
||||
file.write('\n\t\t\tName: "%s"' % uvlayer)
|
||||
file.write('\n\t\t\tName: "%s"' % uvlayer.name)
|
||||
# file.write('\n\t\t\tName: "%s"' % uvlayer)
|
||||
|
||||
file.write('''
|
||||
MappingInformationType: "ByPolygonVertex"
|
||||
@ -1655,8 +1743,13 @@ def write(filename, batch_objects = None, \
|
||||
i = -1
|
||||
ii = 0 # Count how many UVs we write
|
||||
|
||||
for f in me.faces:
|
||||
for uv in f.uv:
|
||||
for f, uf in zip(me.faces, uvlayer.data):
|
||||
# for f in me.faces:
|
||||
uvs = [uf.uv1, uf.uv2, uf.uv3, uf.uv4]
|
||||
uvs = face_data(uvs, f)
|
||||
|
||||
for uv in uvs:
|
||||
# for uv in f.uv:
|
||||
if i==-1:
|
||||
file.write('%.6f,%.6f' % tuple(uv))
|
||||
i=0
|
||||
@ -1686,7 +1779,8 @@ def write(filename, batch_objects = None, \
|
||||
if do_textures:
|
||||
file.write('\n\t\tLayerElementTexture: %i {' % uvindex)
|
||||
file.write('\n\t\t\tVersion: 101')
|
||||
file.write('\n\t\t\tName: "%s"' % uvlayer)
|
||||
file.write('\n\t\t\tName: "%s"' % uvlayer.name)
|
||||
# file.write('\n\t\t\tName: "%s"' % uvlayer)
|
||||
|
||||
if len(my_mesh.blenTextures) == 1:
|
||||
file.write('\n\t\t\tMappingInformationType: "AllSame"')
|
||||
@ -1710,7 +1804,8 @@ def write(filename, batch_objects = None, \
|
||||
i+=1
|
||||
|
||||
i=-1
|
||||
for f in me.faces:
|
||||
for f in uvlayer.data:
|
||||
# for f in me.faces:
|
||||
img_key = f.image
|
||||
|
||||
if i==-1:
|
||||
@ -1736,7 +1831,7 @@ def write(filename, batch_objects = None, \
|
||||
TextureId: ''')
|
||||
file.write('\n\t\t}')
|
||||
|
||||
me.activeUVLayer = uvlayer_orig
|
||||
# me.activeUVLayer = uvlayer_orig
|
||||
|
||||
# Done with UV/textures.
|
||||
|
||||
@ -1765,13 +1860,21 @@ def write(filename, batch_objects = None, \
|
||||
len_material_mapping_local = len(material_mapping_local)
|
||||
|
||||
mats = my_mesh.blenMaterialList
|
||||
|
||||
if me.active_uv_texture:
|
||||
uv_faces = me.active_uv_texture.data
|
||||
else:
|
||||
uv_faces = [None] * len(me.faces)
|
||||
|
||||
i=-1
|
||||
for f in me.faces:
|
||||
try: mat = mats[f.mat]
|
||||
for f, uf in zip(me.faces, uv_faces)
|
||||
# for f in me.faces:
|
||||
try: mat = mats[f.material_index]
|
||||
# try: mat = mats[f.mat]
|
||||
except:mat = None
|
||||
|
||||
if do_uvs: tex = f.image # WARNING - MULTI UV LAYER IMAGES NOT SUPPORTED :/
|
||||
if do_uvs: tex = uf.image # WARNING - MULTI UV LAYER IMAGES NOT SUPPORTED :/
|
||||
# if do_uvs: tex = f.image # WARNING - MULTI UV LAYER IMAGES NOT SUPPORTED :/
|
||||
else: tex = None
|
||||
|
||||
if i==-1:
|
||||
@ -1810,7 +1913,8 @@ def write(filename, batch_objects = None, \
|
||||
TypedIndex: 0
|
||||
}''')
|
||||
|
||||
if me.vertexColors:
|
||||
if me.vertex_colors:
|
||||
# if me.vertexColors:
|
||||
file.write('''
|
||||
LayerElement: {
|
||||
Type: "LayerElementColor"
|
||||
@ -2331,7 +2435,8 @@ Objects: {''')
|
||||
if my_mesh.fbxBoneParent:
|
||||
weights = None
|
||||
else:
|
||||
weights = meshNormalizedWeights(my_mesh.blenData)
|
||||
weights = meshNormalizedWeights(my_mesh.blenObject)
|
||||
# weights = meshNormalizedWeights(my_mesh.blenData)
|
||||
|
||||
#for bonename, bone, obname, bone_mesh, armob in ob_bones:
|
||||
for my_bone in ob_bones:
|
||||
@ -3216,6 +3321,7 @@ if __name__ == '__main__':
|
||||
# - isinstance(inst, bpy.types.*) doesn't work on RNA objects: line 565
|
||||
# - get rid of BPyObject_getObjectArmature, move it in RNA?
|
||||
# - BATCH_ENABLE and BATCH_GROUP options: line 327
|
||||
# - implement all BPyMesh_* used here with RNA
|
||||
|
||||
# TODO
|
||||
|
||||
|
@ -434,7 +434,7 @@ def write(filename, objects, scene,
|
||||
# continue
|
||||
|
||||
if EXPORT_UV:
|
||||
faceuv = len(me.uv_layers) > 0
|
||||
faceuv = len(me.uv_textures) > 0
|
||||
else:
|
||||
faceuv = False
|
||||
|
||||
@ -508,7 +508,7 @@ def write(filename, objects, scene,
|
||||
pass
|
||||
elif faceuv:
|
||||
# XXX update
|
||||
tface = me.active_uv_layer.data
|
||||
tface = me.active_uv_texture.data
|
||||
|
||||
# exception only raised if Python 2.3 or lower...
|
||||
try:
|
||||
@ -570,7 +570,7 @@ def write(filename, objects, scene,
|
||||
uv_face_mapping = [[0,0,0,0] for f in faces] # a bit of a waste for tri's :/
|
||||
|
||||
uv_dict = {} # could use a set() here
|
||||
uv_layer = me.active_uv_layer
|
||||
uv_layer = me.active_uv_texture
|
||||
for f, f_index in face_index_pairs:
|
||||
|
||||
tface = uv_layer.data[f_index]
|
||||
@ -652,7 +652,7 @@ def write(filename, objects, scene,
|
||||
# f_mat = min(f.mat, len(materialNames)-1)
|
||||
if faceuv:
|
||||
|
||||
tface = me.active_uv_layer.data[face_index_pairs[f_index][1]]
|
||||
tface = me.active_uv_texture.data[face_index_pairs[f_index][1]]
|
||||
|
||||
f_image = tface.image
|
||||
f_uv= [tface.uv1, tface.uv2, tface.uv3]
|
||||
|
@ -61,6 +61,6 @@ if env['OURPLATFORM'] != 'linuxcross':
|
||||
else:
|
||||
dna.Command ('dna.c', '', root_build_dir+os.sep+"makesdna $TARGET")
|
||||
else:
|
||||
dna.Command ('dna.c', '', root_build_dir+os.sep+"makesdna.exe $TARGET")
|
||||
dna.Command ('dna.c', '', 'wine ' + root_build_dir+os.sep+"makesdna.exe $TARGET")
|
||||
obj = ['intern/dna.c', 'intern/dna_genfile.c']
|
||||
Return ('obj')
|
||||
|
@ -182,7 +182,7 @@ static void rna_def_pose_channel(BlenderRNA *brna)
|
||||
|
||||
/* kaito says this should be not user-editable; I disagree; power users should be able to force this in python; he's the boss. */
|
||||
prop= RNA_def_property(srna, "pose_matrix", PROP_FLOAT, PROP_MATRIX);
|
||||
RNA_def_property_float_sdna(prop, "pose_mat");
|
||||
RNA_def_property_float_sdna(prop, NULL, "pose_mat");
|
||||
RNA_def_property_array(prop, 16);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Pose Matrix", "Final 4x4 matrix for this channel.");
|
||||
|
@ -112,7 +112,6 @@ def setup_staticlibs(lenv):
|
||||
#here libs for static linking
|
||||
]
|
||||
libincs = [
|
||||
'/usr/lib',
|
||||
lenv['BF_OPENGL_LIBPATH'],
|
||||
lenv['BF_JPEG_LIBPATH'],
|
||||
lenv['BF_PNG_LIBPATH'],
|
||||
@ -120,6 +119,9 @@ def setup_staticlibs(lenv):
|
||||
lenv['BF_ICONV_LIBPATH']
|
||||
]
|
||||
|
||||
if lenv['OURPLATFORM'] != 'linuxcross':
|
||||
libincs = ['/usr/lib'] + libincs
|
||||
|
||||
libincs += Split(lenv['BF_FREETYPE_LIBPATH'])
|
||||
if lenv['WITH_BF_PYTHON']:
|
||||
libincs += Split(lenv['BF_PYTHON_LIBPATH'])
|
||||
@ -223,7 +225,7 @@ def buildinfo(lenv, build_type):
|
||||
|
||||
obj = []
|
||||
if lenv['BF_BUILDINFO']:
|
||||
if sys.platform=='win32':
|
||||
if sys.platform=='win32' or lenv['OURPLATFORM']=='linuxcross':
|
||||
build_info_file = open("source/creator/winbuildinfo.h", 'w')
|
||||
build_info_file.write("char *build_date=\"%s\";\n"%build_date)
|
||||
build_info_file.write("char *build_time=\"%s\";\n"%build_time)
|
||||
|
Loading…
Reference in New Issue
Block a user