soc-2008-mxcurioni: merged changes to revision 17246

This commit is contained in:
Maxime Curioni
2008-10-31 20:05:24 +00:00
456 changed files with 30443 additions and 9943 deletions

View File

@@ -61,10 +61,12 @@ OPTION(WITH_VERSE "Enable Verse (http://verse.blender.org)" OFF)
OPTION(WITH_ELBEEM "Enable Elbeem (Fluid Simulation)" ON)
OPTION(WITH_QUICKTIME "Enable Quicktime Support" OFF)
OPTION(WITH_OPENEXR "Enable OpenEXR Support (http://www.openexr.com)" ON)
OPTION(WITH_DDS "Enable DDS Support" ON)
OPTION(WITH_FFMPEG "Enable FFMPeg Support (http://ffmpeg.mplayerhq.hu/)" OFF)
OPTION(WITH_FFMPEG "Enable FFMPeg Support (http://ffmpeg.mplayerhq.hu/)" OFF)
OPTION(WITH_OPENAL "Enable OpenAL Support (http://www.openal.org)" ON)
OPTION(WITH_OPENMP "Enable OpenMP (has to be supported by the compiler)" OFF)
OPTION(WITH_WEBPLUGIN "Enable Web Plugin (Mozilla-Unix only)" OFF)
OPTION(WITH_WEBPLUGIN "Enable Web Plugin (Unix only)" OFF)
IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE")
@@ -327,7 +329,7 @@ IF(WIN32)
SET(WINTAB_INC ${LIBDIR}/wintab/include)
IF(CMAKE_CL_64)
SET(PLATFORM_LINKFLAGS "/MACHINE:X64 /NODEFAULTLIB:libc.lib;MSVCRT.lib ")
SET(PLATFORM_LINKFLAGS "/MANIFEST:NO /MANIFESTUAC:NO /MACHINE:X64 /NODEFAULTLIB:libc.lib;MSVCRT.lib ")
ELSE(CMAKE_CL_64)
SET(PLATFORM_LINKFLAGS "/NODEFAULTLIB:libc.lib ")
ENDIF(CMAKE_CL_64)
@@ -428,6 +430,17 @@ SET(FTGL_INC ${FTGL}/include)
SET(FTGL_LIB extern_ftgl)
#-----------------------------------------------------------------------------
# Blender WebPlugin
IF(WITH_WEBPLUGIN)
SET(GECKO_DIR "${CMAKE_SOURCE_DIR}/../gecko-sdk/" CACHE PATH "Gecko SDK path")
SET(WEBPLUGIN_SANDBOX_MODE "apparmor" CACHE STRING "WEB Plugin sandbox mode, can be apparmor, privsep, none")
SET(WITH_PLAYER ON)
ENDIF(WITH_WEBPLUGIN)
#-----------------------------------------------------------------------------
# Configure OpenGL.
INCLUDE(${CMAKE_ROOT}/Modules/FindOpenGL.cmake)
@@ -457,12 +470,6 @@ SUBDIRS(
# Blender Application
SUBDIRS(source/creator)
#-----------------------------------------------------------------------------
# Blender WebPlugin
IF(WITH_WEBPLUGIN)
SET(MOZILLA_DIR "${CMAKE_SOURCE_DIR}/../gecko-sdk/" CACHE PATH "Gecko SDK path")
SET(WITH_PLAYER ON)
ENDIF(WITH_WEBPLUGIN)
#-----------------------------------------------------------------------------
# Blender Player

View File

@@ -42,6 +42,8 @@ import tools.Blender
import tools.btools
import tools.bcolors
EnsureSConsVersion(1,0,0)
BlenderEnvironment = tools.Blender.BlenderEnvironment
btools = tools.btools
B = tools.Blender
@@ -172,6 +174,9 @@ opts.Update(env)
if not env['BF_FANCY']:
B.bc.disable()
SetOption('num_jobs', int(env['BF_NUMJOBS']))
print "Build with %d parallel jobs" % (GetOption('num_jobs'))
# disable elbeem (fluidsim) compilation?
if env['BF_NO_ELBEEM'] == 1:
env['CPPFLAGS'].append('-DDISABLE_ELBEEM')
@@ -277,15 +282,16 @@ if 'blenderlite' in B.targets:
env['WITH_BF_BINRELOC'] = False
env['BF_BUILDINFO'] = False
env['BF_NO_ELBEEM'] = True
env['WITH_BF_PYTHON'] = False
# lastly we check for root_build_dir ( we should not do before, otherwise we might do wrong builddir
#B.root_build_dir = B.arguments.get('BF_BUILDDIR', '..'+os.sep+'build'+os.sep+platform+os.sep)
B.root_build_dir = env['BF_BUILDDIR']
env['BUILDDIR'] = B.root_build_dir
B.doc_build_dir = env['BF_DOCDIR']
if not B.root_build_dir[-1]==os.sep:
B.root_build_dir += os.sep
if not B.doc_build_dir[-1]==os.sep:
B.doc_build_dir += os.sep
# We do a shortcut for clean when no quicklist is given: just delete
# builddir without reading in SConscripts
@@ -294,8 +300,18 @@ if 'clean' in B.targets:
do_clean = True
if not quickie and do_clean:
if os.path.exists(B.doc_build_dir):
print B.bc.HEADER+'Cleaning doc dir...'+B.bc.ENDC
dirs = os.listdir(B.doc_build_dir)
for entry in dirs:
if os.path.isdir(B.doc_build_dir + entry) == 1:
print "clean dir %s"%(B.doc_build_dir+entry)
shutil.rmtree(B.doc_build_dir+entry)
else: # remove file
print "remove file %s"%(B.doc_build_dir+entry)
os.remove(B.root_build_dir+entry)
if os.path.exists(B.root_build_dir):
print B.bc.HEADER+'Cleaning...'+B.bc.ENDC
print B.bc.HEADER+'Cleaning build dir...'+B.bc.ENDC
dirs = os.listdir(B.root_build_dir)
for dir in dirs:
if os.path.isdir(B.root_build_dir + dir) == 1:
@@ -326,6 +342,8 @@ if not os.path.isdir ( B.root_build_dir):
os.makedirs ( B.root_build_dir + 'extern' )
os.makedirs ( B.root_build_dir + 'lib' )
os.makedirs ( B.root_build_dir + 'bin' )
if not os.path.isdir(B.doc_build_dir):
os.makedirs ( B.doc_build_dir )
Help(opts.GenerateHelpText(env))
@@ -368,7 +386,8 @@ dobj = B.buildinfo(env, "dynamic") + B.resources
thestatlibs, thelibincs = B.setup_staticlibs(env)
thesyslibs = B.setup_syslibs(env)
env.BlenderProg(B.root_build_dir, "blender", dobj + mainlist + thestatlibs, [], thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender')
if 'blender' in B.targets or not env['WITH_BF_NOBLENDER']:
env.BlenderProg(B.root_build_dir, "blender", dobj + mainlist + thestatlibs, [], thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender')
if env['WITH_BF_PLAYER']:
playerlist = B.create_blender_liblist(env, 'player')
env.BlenderProg(B.root_build_dir, "blenderplayer", dobj + playerlist + thestatlibs, [], thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blenderplayer')
@@ -542,6 +561,10 @@ nsisaction = env.Action(btools.NSIS_Installer, btools.NSIS_print)
nsiscmd = env.Command('nsisinstaller', None, nsisaction)
nsisalias = env.Alias('nsis', nsiscmd)
if 'blender' in B.targets:
blenderexe= env.Alias('blender', B.program_list)
Depends(blenderexe,installtarget)
if env['WITH_BF_PLAYER']:
blenderplayer = env.Alias('blenderplayer', B.program_list)
Depends(blenderplayer,installtarget)
@@ -568,5 +591,7 @@ if not env['WITHOUT_BF_INSTALL']:
# TODO: build stubs and link into blenderplayer
#------------ EPYDOC
# TODO: run epydoc
if env['WITH_BF_DOCS']:
SConscript('source/blender/python/api2_2x/doc/SConscript')
SConscript('source/gameengine/PyDoc/SConscript')

View File

@@ -20,4 +20,4 @@ Romanian:ro
Arabic:ar
Bulgarian:bg
Greek:el
Korean:kr
Korean:ko

View File

@@ -104,6 +104,7 @@ IF(UNIX)
bf_blenlib
bf_cineon
bf_openexr
bf_dds
bf_ftfont
extern_ftgl
bf_readblenfile

View File

@@ -8,7 +8,7 @@
import commands
# IMPORTANT NOTE : OFFICIAL BUILDS SHOULD BE DONE WITH SDKs
USE_SDK='true'
USE_SDK=True
BF_PYTHON_VERSION = '2.3'
@@ -38,15 +38,15 @@ else:
# enable ffmpeg support
WITH_BF_FFMPEG = 'true' # -DWITH_FFMPEG
WITH_BF_FFMPEG = True # -DWITH_FFMPEG
BF_FFMPEG = "#extern/ffmpeg"
BF_FFMPEG_INC = '${BF_FFMPEG}/include'
if USE_SDK=='true':
if USE_SDK==True:
BF_FFMPEG_EXTRA = '-isysroot '+MACOSX_SDK+' -mmacosx-version-min='+MAC_MIN_VERS
#BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
#BF_FFMPEG_LIB = 'avformat.a avcodec.a avutil.a'
WITH_BF_VERSE = 'false'
WITH_BF_VERSE = False
BF_VERSE = "#extern/verse/dist"
BF_VERSE_LIBPATH = "${BF_BUILDDIR}/extern/verse/dist"
BF_VERSE_INCLUDE = BF_VERSE
@@ -76,9 +76,9 @@ WITH_BF_OPENMP = '0'
# Note : should be true, but openal simply dont work on intel
if MAC_PROC == 'i386':
WITH_BF_OPENAL = 'false'
WITH_BF_OPENAL = False
else:
WITH_BF_OPENAL = 'true'
WITH_BF_OPENAL = True
#different lib must be used following version of gcc
# for gcc 3.3
#BF_OPENAL = LIBDIR + '/openal'
@@ -88,7 +88,7 @@ if MAC_PROC == 'powerpc':
else :
BF_OPENAL = LIBDIR + '/openal'
WITH_BF_STATICOPENAL = 'false'
WITH_BF_STATICOPENAL = False
BF_OPENAL_INC = '${BF_OPENAL}/include'
BF_OPENAL_LIB = 'openal'
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
@@ -97,20 +97,20 @@ BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
# Warning, this static lib configuration is untested! users of this OS please confirm.
BF_CXX = '/usr'
WITH_BF_STATICCXX = 'false'
WITH_BF_STATICCXX = False
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
WITH_BF_SDL = 'true'
WITH_BF_SDL = True
BF_SDL = LIBDIR + '/sdl' #$(shell sdl-config --prefix)
BF_SDL_INC = '${BF_SDL}/include' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
BF_SDL_LIB = 'SDL' #BF_SDL #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer
BF_SDL_LIBPATH = '${BF_SDL}/lib'
WITH_BF_FMOD = 'false'
WITH_BF_FMOD = False
BF_FMOD = LIBDIR + '/fmod'
WITH_BF_OPENEXR = 'true'
WITH_BF_STATICOPENEXR = 'false'
WITH_BF_OPENEXR = True
WITH_BF_STATICOPENEXR = False
BF_OPENEXR = '${LCGDIR}/openexr'
BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR'
BF_OPENEXR_LIB = ' Iex Half IlmImf Imath IlmThread'
@@ -118,15 +118,15 @@ BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
# Warning, this static lib configuration is untested! users of this OS please confirm.
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
WITH_BF_DDS = 'true'
WITH_BF_DDS = True
WITH_BF_JPEG = 'true'
WITH_BF_JPEG = True
BF_JPEG = LIBDIR + '/jpeg'
BF_JPEG_INC = '${BF_JPEG}/include'
BF_JPEG_LIB = 'jpeg'
BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
WITH_BF_PNG = 'true'
WITH_BF_PNG = True
BF_PNG = LIBDIR + '/png'
BF_PNG_INC = '${BF_PNG}/include'
BF_PNG_LIB = 'png'
@@ -135,32 +135,32 @@ BF_PNG_LIBPATH = '${BF_PNG}/lib'
BF_TIFF = LIBDIR + '/tiff'
BF_TIFF_INC = '${BF_TIFF}/include'
WITH_BF_ZLIB = 'true'
WITH_BF_ZLIB = True
BF_ZLIB = '/usr'
BF_ZLIB_INC = '${BF_ZLIB}/include'
BF_ZLIB_LIB = 'z'
WITH_BF_INTERNATIONAL = 'true'
WITH_BF_INTERNATIONAL = True
BF_GETTEXT = LIBDIR + '/gettext'
BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'intl'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
WITH_BF_FTGL = 'true'
WITH_BF_FTGL = True
BF_FTGL = '#extern/bFTGL'
BF_FTGL_INC = '${BF_FTGL}/include'
BF_FTGL_LIB = 'extern_ftgl'
WITH_BF_GAMEENGINE='true'
WITH_BF_PLAYER='true'
WITH_BF_GAMEENGINE=True
WITH_BF_PLAYER=True
WITH_BF_ODE = 'false'
WITH_BF_ODE = False
BF_ODE = LIBDIR + '/ode'
BF_ODE_INC = '${BF_ODE}/include'
BF_ODE_LIB = '${BF_ODE}/lib/libode.a'
WITH_BF_BULLET = 'true'
WITH_BF_BULLET = True
BF_BULLET = '#extern/bullet2/src'
BF_BULLET_INC = '${BF_BULLET}'
BF_BULLET_LIB = 'extern_bullet'
@@ -169,19 +169,9 @@ BF_SOLID = '#extern/solid'
BF_SOLID_INC = '${BF_SOLID}'
BF_SOLID_LIB = 'extern_solid'
WITH_BF_YAFRAY = 'true'
WITH_BF_YAFRAY = True
WITH_BF_FREESTYLE = 'true'
# WITH_BF_OPENEXR = 'true'
# BF_OPENEXR = '${LCGDIR}/openexr'
# BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR'
# BF_OPENEXR_LIB = ' Iex Half IlmImf Imath IlmThread'
# BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
#WITH_BF_NSPR = 'true'
#WITH_BF_NSPR = True
#BF_NSPR = $(LIBDIR)/nspr
#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
#BF_NSPR_LIB =
@@ -196,7 +186,7 @@ WITH_BF_FREESTYLE = 'true'
# if this is not set.
#
# Be paranoid regarding library creation (do not update archives)
#BF_PARANOID = 'true'
#BF_PARANOID = True
# enable freetype2 support for text objects
BF_FREETYPE = LIBDIR + '/freetype'
@@ -204,16 +194,16 @@ BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
BF_FREETYPE_LIB = 'freetype'
BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
WITH_BF_QUICKTIME = 'true' # -DWITH_QUICKTIME
WITH_BF_QUICKTIME = True # -DWITH_QUICKTIME
WITH_BF_ICONV = 'true'
WITH_BF_ICONV = True
BF_ICONV = LIBDIR + "/iconv"
BF_ICONV_INC = '${BF_ICONV}/include'
BF_ICONV_LIB = 'iconv'
#BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
# Mesa Libs should go here if your using them as well....
WITH_BF_STATICOPENGL = 'true'
WITH_BF_STATICOPENGL = True
BF_OPENGL_LIB = 'GL GLU'
BF_OPENGL_LIBPATH = '/System/Library/Frameworks/OpenGL.framework/Libraries'
BF_OPENGL_LINKFLAGS = '-framework OpenGL'
@@ -235,7 +225,7 @@ if MAC_MIN_VERS == '10.3':
PLATFORM_LINKFLAGS = '-fuse-cxa-atexit '+PLATFORM_LINKFLAGS
LLIBS = LLIBS + ' crt3.o'
if USE_SDK=='true':
if USE_SDK==True:
SDK_FLAGS=['-isysroot', MACOSX_SDK,'-mmacosx-version-min='+MAC_MIN_VERS]
PLATFORM_LINKFLAGS = '-mmacosx-version-min='+MAC_MIN_VERS+ ' -Wl,-syslibroot,' + MACOSX_SDK+" "+PLATFORM_LINKFLAGS
CCFLAGS=SDK_FLAGS+CCFLAGS
@@ -253,7 +243,7 @@ else:
REL_CFLAGS = ['-O2']
REL_CCFLAGS = ['-O2']
##BF_DEPEND = 'true'
##BF_DEPEND = True
##
##AR = ar
##ARFLAGS = ruv
@@ -261,9 +251,9 @@ else:
##
CC = 'gcc'
CXX = 'g++'
C_WARN = ' -Wall -Wno-long-double -Wdeclaration-after-statement '
C_WARN = ['-Wdeclaration-after-statement']
CC_WARN = ' -Wall -Wno-long-double'
CC_WARN = ['-Wall', '-Wno-long-double']
##FIX_STUBS_WARNINGS = -Wno-unused
@@ -271,10 +261,11 @@ CC_WARN = ' -Wall -Wno-long-double'
##DYNLDFLAGS = -shared $(LDFLAGS)
BF_PROFILE_FLAGS = ' -pg -g '
BF_PROFILE = 'false'
BF_PROFILE = False
BF_DEBUG = 'false'
BF_DEBUG = False
BF_DEBUG_FLAGS = '-g'
BF_BUILDDIR='../build/darwin'
BF_INSTALLDIR='../install/darwin'
BF_DOCDIR='../install/doc'

View File

@@ -1,20 +1,20 @@
LCGDIR = '../lib/linux2'
LIBDIR = "${LCGDIR}"
WITH_BF_VERSE = 'false'
WITH_BF_VERSE = False
BF_VERSE_INCLUDE = "#extern/verse/dist"
BF_PYTHON = '/usr'
BF_PYTHON_VERSION = '2.5'
WITH_BF_STATICPYTHON = 'false'
WITH_BF_STATICPYTHON = False
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}' #BF_PYTHON+'/lib/python'+BF_PYTHON_VERSION+'/config/libpython'+BF_PYTHON_VERSION+'.a'
BF_PYTHON_LINKFLAGS = ['-Xlinker', '-export-dynamic']
BF_PYTHON_LIB_STATIC = '${BF_PYTHON}/lib/libpython${BF_PYTHON_VERSION}.a'
WITH_BF_OPENAL = 'true'
WITH_BF_STATICOPENAL = 'false'
WITH_BF_OPENAL = True
WITH_BF_STATICOPENAL = False
BF_OPENAL = '/usr'
BF_OPENAL_INC = '${BF_OPENAL}/include'
BF_OPENAL_LIB = 'openal'
@@ -26,19 +26,19 @@ BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
# BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a ${BF_OPENAL}/lib/libalut.a'
BF_CXX = '/usr'
WITH_BF_STATICCXX = 'false'
WITH_BF_STATICCXX = False
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
WITH_BF_SDL = 'true'
WITH_BF_SDL = True
BF_SDL = '/usr' #$(shell sdl-config --prefix)
BF_SDL_INC = '${BF_SDL}/include/SDL' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
BF_SDL_LIB = 'SDL' #BF_SDL #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer
WITH_BF_FMOD = 'false'
WITH_BF_FMOD = False
BF_FMOD = LIBDIR + '/fmod'
WITH_BF_OPENEXR = 'true'
WITH_BF_STATICOPENEXR = 'false'
WITH_BF_OPENEXR = True
WITH_BF_STATICOPENEXR = False
BF_OPENEXR = '/usr'
# when compiling with your own openexr lib you might need to set...
# BF_OPENEXR_INC = '${BF_OPENEXR}/include/OpenEXR ${BF_OPENEXR}/include'
@@ -49,14 +49,14 @@ BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf
# BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
WITH_BF_DDS = 'true'
WITH_BF_DDS = True
WITH_BF_JPEG = 'true'
WITH_BF_JPEG = True
BF_JPEG = '/usr'
BF_JPEG_INC = '${BF_JPEG}/include'
BF_JPEG_LIB = 'jpeg'
WITH_BF_PNG = 'true'
WITH_BF_PNG = True
BF_PNG = '/usr'
BF_PNG_INC = '${BF_PNG}/include'
BF_PNG_LIB = 'png'
@@ -64,31 +64,31 @@ BF_PNG_LIB = 'png'
BF_TIFF = '/usr'
BF_TIFF_INC = '${BF_TIFF}/include'
WITH_BF_ZLIB = 'true'
WITH_BF_ZLIB = True
BF_ZLIB = '/usr'
BF_ZLIB_INC = '${BF_ZLIB}/include'
BF_ZLIB_LIB = 'z'
WITH_BF_INTERNATIONAL = 'true'
WITH_BF_INTERNATIONAL = True
BF_GETTEXT = '/usr'
BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'gettextlib'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
WITH_BF_FTGL = 'true'
WITH_BF_FTGL = True
BF_FTGL = '#extern/bFTGL'
BF_FTGL_INC = '${BF_FTGL}/include'
BF_FTGL_LIB = 'extern_ftgl'
WITH_BF_GAMEENGINE='false'
WITH_BF_GAMEENGINE=False
WITH_BF_ODE = 'false'
WITH_BF_ODE = False
BF_ODE = LIBDIR + '/ode'
BF_ODE_INC = BF_ODE + '/include'
BF_ODE_LIB = BF_ODE + '/lib/libode.a'
WITH_BF_BULLET = 'true'
WITH_BF_BULLET = True
BF_BULLET = '#extern/bullet2/src'
BF_BULLET_INC = '${BF_BULLET}'
BF_BULLET_LIB = 'extern_bullet'
@@ -97,13 +97,9 @@ BF_SOLID = '#extern/solid'
BF_SOLID_INC = '${BF_SOLID}'
BF_SOLID_LIB = 'extern_solid'
WITH_BF_YAFRAY = 'true'
WITH_BF_YAFRAY = True
WITH_BF_FREESTYLE = 'true'
#WITH_BF_NSPR = 'true'
#WITH_BF_NSPR = True
#BF_NSPR = $(LIBDIR)/nspr
#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
#BF_NSPR_LIB =
@@ -118,27 +114,27 @@ WITH_BF_FREESTYLE = 'true'
# if this is not set.
#
# Be paranoid regarding library creation (do not update archives)
#BF_PARANOID = 'true'
#BF_PARANOID = True
# enable freetype2 support for text objects
BF_FREETYPE = '/usr'
BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
BF_FREETYPE_LIB = 'freetype'
WITH_BF_QUICKTIME = 'false' # -DWITH_QUICKTIME
WITH_BF_QUICKTIME = False # -DWITH_QUICKTIME
BF_QUICKTIME = '/usr/local'
BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
WITH_BF_ICONV = 'false'
WITH_BF_ICONV = False
BF_ICONV = LIBDIR + "/iconv"
BF_ICONV_INC = '${BF_ICONV}/include'
BF_ICONV_LIB = 'iconv'
BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
WITH_BF_BINRELOC = 'true'
WITH_BF_BINRELOC = True
# enable ffmpeg support
WITH_BF_FFMPEG = 'true' # -DWITH_FFMPEG
WITH_BF_FFMPEG = True # -DWITH_FFMPEG
BF_FFMPEG = '#extern/ffmpeg'
BF_FFMPEG_LIB = ''
# Uncomment the following two lines to use system's ffmpeg
@@ -147,31 +143,31 @@ BF_FFMPEG_LIB = ''
BF_FFMPEG_INC = '${BF_FFMPEG}/include'
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
WITH_BF_OPENJPEG = 'true'
# enable ogg, vorbis and theora in ffmpeg
WITH_BF_OGG = False # -DWITH_OGG
BF_OGG = '/usr'
BF_OGG_INC = '${BF_OGG}/include'
BF_OGG_LIB = 'ogg vorbis theoraenc theoradec'
WITH_BF_OPENJPEG = True
BF_OPENJPEG = '#extern/libopenjpeg'
BF_OPENJPEG_LIB = ''
# Uncomment the following two lines to use system's ffmpeg
# BF_FFMPEG = '/usr'
# BF_FFMPEG_LIB = 'avformat avcodec swscale avutil'
BF_OPENJPEG_INC = '${BF_OPENJPEG}/include'
BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
WITH_BF_REDCODE = 'false'
WITH_BF_REDCODE = False
BF_REDCODE = '#extern/libredcode'
BF_REDCODE_LIB = ''
# Uncomment the following two lines to use system's ffmpeg
# BF_FFMPEG = '/usr'
# BF_FFMPEG_LIB = 'avformat avcodec swscale avutil'
BF_REDCODE_INC = '${BF_REDCODE}/include'
BF_REDCODE_LIBPATH='${BF_REDCODE}/lib'
# Mesa Libs should go here if your using them as well....
WITH_BF_STATICOPENGL = 'false'
WITH_BF_STATICOPENGL = False
BF_OPENGL = '/usr'
BF_OPENGL_INC = '${BF_OPENGL}/include'
BF_OPENGL_LIB = 'GL GLU X11 Xi'
BF_OPENGL_LIBPATH = '/usr/X11R6/lib'
BF_OPENGL_LIB_STATIC = '${BF_OPENGL}/libGL.a ${BF_OPENGL}/libGLU.a ${BF_OPENGL}/libXxf86vm.a ${BF_OPENGL}/libX11.a ${BF_OPENGL}/libXi.a ${BF_OPENGL}/libXext.a ${BF_OPENGL}/libXxf86vm.a'
BF_OPENGL_LIB_STATIC = '${BF_OPENGL_LIBPATH}/libGL.a ${BF_OPENGL_LIBPATH}/libGLU.a ${BF_OPENGL_LIBPATH}/libXxf86vm.a ${BF_OPENGL_LIBPATH}/libX11.a ${BF_OPENGL_LIBPATH}/libXi.a ${BF_OPENGL_LIBPATH}/libXext.a ${BF_OPENGL_LIBPATH}/libXxf86vm.a'
##
CC = 'gcc'
@@ -185,15 +181,15 @@ CPPFLAGS = ['-DXP_UNIX']
CXXFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing']
REL_CFLAGS = ['-O2']
REL_CCFLAGS = ['-O2']
##BF_DEPEND = 'true'
##BF_DEPEND = True
##
##AR = ar
##ARFLAGS = ruv
##ARFLAGSQUIET = ru
##
C_WARN = '-Wall -Wno-char-subscripts -Wdeclaration-after-statement'
C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement']
CC_WARN = '-Wall'
CC_WARN = ['-Wall']
##FIX_STUBS_WARNINGS = -Wno-unused
@@ -202,13 +198,14 @@ LLIBS = 'util c m dl pthread stdc++'
##DYNLDFLAGS = -shared $(LDFLAGS)
BF_PROFILE_FLAGS = ['-pg','-g']
BF_PROFILE = 'false'
BF_PROFILE = False
BF_DEBUG = 'false'
BF_DEBUG = False
BF_DEBUG_FLAGS = '-g'
BF_BUILDDIR = '../build/linux2'
BF_INSTALLDIR='../install/linux2'
BF_DOCDIR='../install/doc'
#Link against pthread

View File

@@ -1,15 +1,10 @@
LCGDIR = '../lib/windows'
LIBDIR = '${LCGDIR}'
WITH_BF_VERSE = 'false'
WITH_BF_VERSE = False
BF_VERSE_INCLUDE = "#extern/verse/dist"
WITH_BF_YAFRAY = 'true'
WITH_BF_FREESTYLE = 'true'
###########################
WITH_BF_YAFRAY = True
BF_PYTHON = LIBDIR + '/python'
BF_PYTHON_VERSION = '2.5'
@@ -18,8 +13,8 @@ BF_PYTHON_BINARY = 'python'
BF_PYTHON_LIB = 'python25'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
WITH_BF_OPENAL = 'true'
WITH_BF_STATICOPENAL = 'false'
WITH_BF_OPENAL = True
WITH_BF_STATICOPENAL = False
BF_OPENAL = LIBDIR + '/openal'
BF_OPENAL_INC = '${BF_OPENAL}/include'
BF_OPENAL_LIB = 'openal_static'
@@ -29,10 +24,10 @@ BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
# Warning, this static lib configuration is untested! users of this OS please confirm.
BF_CXX = '/usr'
WITH_BF_STATICCXX = 'false'
WITH_BF_STATICCXX = False
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
WITH_BF_SDL = 'true'
WITH_BF_SDL = True
BF_SDL = LIBDIR + '/sdl'
BF_SDL_INC = '${BF_SDL}/include'
BF_SDL_LIB = 'SDL'
@@ -43,11 +38,11 @@ BF_PTHREADS_INC = '${BF_PTHREADS}/include'
BF_PTHREADS_LIB = 'pthreadGC2'
BF_PTHREADS_LIBPATH = '${BF_PTHREADS}/lib'
WITH_BF_FMOD = 'false'
WITH_BF_FMOD = False
BF_FMOD = LIBDIR + '/fmod'
WITH_BF_OPENEXR = 'true'
WITH_BF_STATICOPENEXR = 'false'
WITH_BF_OPENEXR = True
WITH_BF_STATICOPENEXR = False
BF_OPENEXR = LIBDIR + '/gcc/openexr'
BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR'
BF_OPENEXR_LIB = ' Half IlmImf Iex '
@@ -55,15 +50,15 @@ BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
# Warning, this static lib configuration is untested! users of this OS please confirm.
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
WITH_BF_DDS = 'true'
WITH_BF_DDS = True
WITH_BF_JPEG = 'true'
WITH_BF_JPEG = True
BF_JPEG = LIBDIR + '/jpeg'
BF_JPEG_INC = '${BF_JPEG}/include'
BF_JPEG_LIB = 'jpeg'
BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
WITH_BF_PNG = 'true'
WITH_BF_PNG = True
BF_PNG = LIBDIR + '/png'
BF_PNG_INC = '${BF_PNG}/include'
BF_PNG_LIB = 'png'
@@ -72,32 +67,32 @@ BF_PNG_LIBPATH = '${BF_PNG}/lib'
BF_TIFF = LIBDIR + '/tiff'
BF_TIFF_INC = '${BF_TIFF}/include'
WITH_BF_ZLIB = 'true'
WITH_BF_ZLIB = True
BF_ZLIB = LIBDIR + '/zlib'
BF_ZLIB_INC = '${BF_ZLIB}/include'
#BF_ZLIB_LIB = 'z'
BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
WITH_BF_INTERNATIONAL = 'true'
WITH_BF_INTERNATIONAL = True
BF_GETTEXT = LIBDIR + '/gettext'
BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'gnu_gettext'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
WITH_BF_FTGL = 'true'
WITH_BF_FTGL = True
BF_FTGL = LIBDIR + '/ftgl'
BF_FTGL_INC = '${BF_FTGL}/include'
BF_FTGL_LIB = 'extern_ftgl'
WITH_BF_GAMEENGINE = 'false'
WITH_BF_GAMEENGINE = False
WITH_BF_ODE = 'true'
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'
WITH_BF_BULLET = True
BF_BULLET = '#extern/bullet2/src'
BF_BULLET_INC = '${BF_BULLET}'
BF_BULLET_LIB = 'extern_bullet'
@@ -112,18 +107,18 @@ BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
BF_FREETYPE_LIB = 'freetype'
BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
WITH_BF_QUICKTIME = 'false' # -DWITH_QUICKTIME
WITH_BF_QUICKTIME = False # -DWITH_QUICKTIME
BF_QUICKTIME = '/usr/local'
BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
WITH_BF_ICONV = 'false'
WITH_BF_ICONV = False
BF_ICONV = LIBDIR + "/iconv"
BF_ICONV_INC = '${BF_ICONV}/include'
BF_ICONV_LIB = 'iconv'
BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
# Mesa Libs should go here if your using them as well....
WITH_BF_STATICOPENGL = 'false'
WITH_BF_STATICOPENGL = False
BF_OPENGL = 'C:\\MingW'
BF_OPENGL_INC = '${BF_OPENGL}/include'
BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'
@@ -148,8 +143,9 @@ CC_WARN = [ '-Wall' ]
LLIBS = [ '-ldxguid', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz'] #'-lutil', '-lc', '-lm', '-ldl', '-lpthread' ]
BF_DEBUG = 'false'
BF_DEBUG = False
BF_DEBUG_FLAGS= ''
BF_BUILDDIR = '../build/linuxcross'
BF_INSTALLDIR='../install/linuxcross'
BF_DOCDIR='../install/doc'

View File

@@ -8,40 +8,40 @@ BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/python${BF_PYTHON_VERSION}/config'
WITH_BF_OPENAL = 'false'
# WITH_BF_STATICOPENAL = 'false'
WITH_BF_OPENAL = False
# WITH_BF_STATICOPENAL = False
#BF_OPENAL = LIBDIR + '/openal'
#BF_OPENAL_INC = '${BF_OPENAL}/include'
#BF_OPENAL_LIB = 'openal'
#BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
#BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
WITH_BF_SDL = 'true'
WITH_BF_SDL = True
BF_SDL = '/usr/local' #$(shell sdl-config --prefix)
BF_SDL_INC = '${BF_SDL}/include/SDL' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
BF_SDL_LIB = 'SDL' #BF_SDL #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer
BF_SDL_LIBPATH = '${BF_SDL}/lib'
WITH_BF_FMOD = 'false'
WITH_BF_FMOD = False
BF_FMOD = LIBDIR + '/fmod'
WITH_BF_OPENEXR = 'false'
WITH_BF_STATICOPENEXR = 'false'
WITH_BF_OPENEXR = False
WITH_BF_STATICOPENEXR = False
BF_OPENEXR = '/usr/local'
BF_OPENEXR_INC = '${BF_OPENEXR}/include/OpenEXR'
BF_OPENEXR_LIB = 'Half IlmImf Iex Imath '
# Warning, this static lib configuration is untested! users of this OS please confirm.
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
WITH_BF_DDS = 'true'
WITH_BF_DDS = True
WITH_BF_JPEG = 'true'
WITH_BF_JPEG = True
BF_JPEG = '/usr/local'
BF_JPEG_INC = '${BF_JPEG}/include'
BF_JPEG_LIB = 'jpeg'
BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
WITH_BF_PNG = 'true'
WITH_BF_PNG = True
BF_PNG = '/usr/local'
BF_PNG_INC = '${BF_PNG}/include/libpng'
BF_PNG_LIB = 'png'
@@ -50,31 +50,31 @@ BF_PNG_LIBPATH = '${BF_PNG}/lib'
BF_TIFF = '/usr/local'
BF_TIFF_INC = '${BF_TIFF}/include'
WITH_BF_ZLIB = 'true'
WITH_BF_ZLIB = True
BF_ZLIB = '/usr/local'
BF_ZLIB_INC = '${BF_ZLIB}/include'
BF_ZLIB_LIB = 'z'
WITH_BF_INTERNATIONAL = 'true'
WITH_BF_INTERNATIONAL = True
BF_GETTEXT = '/usr/local'
BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'intl iconv'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
WITH_BF_FTGL = 'true'
WITH_BF_FTGL = True
BF_FTGL = '#extern/bFTGL'
BF_FTGL_INC = '${BF_FTGL}/include'
BF_FTGL_LIB = 'extern_ftgl'
WITH_BF_GAMEENGINE='false'
WITH_BF_GAMEENGINE=False
WITH_BF_ODE = 'false'
WITH_BF_ODE = False
BF_ODE = LIBDIR + '/ode'
BF_ODE_INC = '${BF_ODE}/include'
BF_ODE_LIB = '${BF_ODE}/lib/libode.a'
WITH_BF_BULLET = 'true'
WITH_BF_BULLET = True
BF_BULLET = '#extern/bullet2/src'
BF_BULLET_INC = '${BF_BULLET}'
BF_BULLET_LIB = 'extern_bullet'
@@ -83,13 +83,9 @@ BF_SOLID = '#extern/solid'
BF_SOLID_INC = '${BF_SOLID}'
BF_SOLID_LIB = 'extern_solid'
WITH_BF_YAFRAY = 'true'
WITH_BF_YAFRAY = True
WITH_BF_FREESTYLE = 'true'
#WITH_BF_NSPR = 'true'
#WITH_BF_NSPR = True
#BF_NSPR = $(LIBDIR)/nspr
#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
#BF_NSPR_LIB =
@@ -104,7 +100,7 @@ WITH_BF_FREESTYLE = 'true'
# if this is not set.
#
# Be paranoid regarding library creation (do not update archives)
#BF_PARANOID = 'true'
#BF_PARANOID = True
# enable freetype2 support for text objects
BF_FREETYPE = '/usr/X11R6'
@@ -112,16 +108,16 @@ BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
BF_FREETYPE_LIB = 'freetype'
BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
WITH_BF_QUICKTIME = 'false' # -DWITH_QUICKTIME
WITH_BF_QUICKTIME = False # -DWITH_QUICKTIME
WITH_BF_ICONV = 'false'
WITH_BF_ICONV = False
BF_ICONV = LIBDIR + "/iconv"
BF_ICONV_INC = '${BF_ICONV}/include'
BF_ICONV_LIB = 'iconv'
BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
# Mesa Libs should go here if your using them as well....
WITH_BF_STATICOPENGL = 'true'
WITH_BF_STATICOPENGL = True
BF_OPENGL = '/usr/X11R6'
BF_OPENGL_INC = '${BF_OPENGL}/include'
BF_OPENGL_LIB = 'GL GLU X11 Xi'
@@ -141,7 +137,7 @@ CCFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing']
CXXFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing']
REL_CFLAGS = ['-O2']
REL_CCFLAGS = ['-O2']
##BF_DEPEND = 'true'
##BF_DEPEND = True
##
##AR = ar
##ARFLAGS = ruv
@@ -149,9 +145,9 @@ REL_CCFLAGS = ['-O2']
##
CC = 'gcc'
CXX = 'g++'
C_WARN = '-Wall -Wdeclaration-after-statement'
C_WARN = ['-Wdeclaration-after-statement']
CC_WARN = '-Wall'
CC_WARN = ['-Wall']
##FIX_STUBS_WARNINGS = -Wno-unused
@@ -160,10 +156,11 @@ LLIBS = 'm stdc++ pthread util'
##DYNLDFLAGS = -shared $(LDFLAGS)
BF_PROFILE_FLAGS = ' -pg -g '
BF_PROFILE = 'false'
BF_PROFILE = False
BF_DEBUG = 'false'
BF_DEBUG = False
BF_DEBUG_FLAGS = '-g'
BF_BUILDDIR='../build/openbsd3'
BF_INSTALLDIR='../install/openbsd3'
BF_DOCDIR='../install/doc'

View File

@@ -8,8 +8,8 @@ BF_PYTHON_BINARY = '${BF_PYTHON}/bin/python${BF_PYTHON_VERSION}'
BF_PYTHON_LIB = 'python${BF_PYTHON_VERSION}' #BF_PYTHON+'/lib/python'+BF_PYTHON_VERSION+'/config/libpython'+BF_PYTHON_VERSION+'.a'
BF_PYTHON_LINKFLAGS = ['-Xlinker', '-export-dynamic']
WITH_BF_OPENAL = 'true'
WITH_BF_STATICOPENAL = 'false'
WITH_BF_OPENAL = True
WITH_BF_STATICOPENAL = False
BF_OPENAL = '/usr/local'
BF_OPENAL_INC = '${BF_OPENAL}/include'
BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
@@ -19,20 +19,20 @@ BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
# Warning, this static lib configuration is untested! users of this OS please confirm.
BF_CXX = '/usr'
WITH_BF_STATICCXX = 'false'
WITH_BF_STATICCXX = False
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
WITH_BF_SDL = 'true'
WITH_BF_SDL = True
BF_SDL = '/usr/local' #$(shell sdl-config --prefix)
BF_SDL_INC = '${BF_SDL}/include/SDL' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
BF_SDL_LIBPATH = '${BF_SDL}/lib'
BF_SDL_LIB = 'SDL' #BF_SDL #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer
WITH_BF_FMOD = 'false'
WITH_BF_FMOD = False
BF_FMOD = LIBDIR + '/fmod'
WITH_BF_OPENEXR = 'true'
WITH_BF_STATICOPENEXR = 'false'
WITH_BF_OPENEXR = True
WITH_BF_STATICOPENEXR = False
BF_OPENEXR = '/usr/local'
BF_OPENEXR_INC = ['${BF_OPENEXR}/include', '${BF_OPENEXR}/include/OpenEXR' ]
BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
@@ -40,15 +40,15 @@ BF_OPENEXR_LIB = 'Half IlmImf Iex Imath '
# Warning, this static lib configuration is untested! users of this OS please confirm.
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
WITH_BF_DDS = 'true'
WITH_BF_DDS = True
WITH_BF_JPEG = 'true'
WITH_BF_JPEG = True
BF_JPEG = '/usr/local'
BF_JPEG_INC = '${BF_JPEG}/include'
BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
BF_JPEG_LIB = 'jpeg'
WITH_BF_PNG = 'true'
WITH_BF_PNG = True
BF_PNG = '/usr/local'
BF_PNG_INC = '${BF_PNG}/include'
BF_PNG_LIBPATH = '${BF_PNG}/lib'
@@ -57,32 +57,32 @@ BF_PNG_LIB = 'png'
BF_TIFF = '/usr/local'
BF_TIFF_INC = '${BF_TIFF}/include'
WITH_BF_ZLIB = 'true'
WITH_BF_ZLIB = True
BF_ZLIB = '/usr'
BF_ZLIB_INC = '${BF_ZLIB}/include'
BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
BF_ZLIB_LIB = 'z'
WITH_BF_INTERNATIONAL = 'true'
WITH_BF_INTERNATIONAL = True
BF_GETTEXT = '/usr/local'
BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'gettextlib'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
WITH_BF_FTGL = 'true'
WITH_BF_FTGL = True
BF_FTGL = '#extern/bFTGL'
BF_FTGL_INC = '${BF_FTGL}/include'
BF_FTGL_LIB = 'extern_ftgl'
WITH_BF_GAMEENGINE='false'
WITH_BF_GAMEENGINE=False
WITH_BF_ODE = 'false'
WITH_BF_ODE = False
BF_ODE = LIBDIR + '/ode'
BF_ODE_INC = BF_ODE + '/include'
BF_ODE_LIB = BF_ODE + '/lib/libode.a'
WITH_BF_BULLET = 'true'
WITH_BF_BULLET = True
BF_BULLET = '#extern/bullet2/src'
BF_BULLET_INC = '${BF_BULLET}'
BF_BULLET_LIB = 'extern_bullet'
@@ -91,13 +91,9 @@ BF_SOLID = '#extern/solid'
BF_SOLID_INC = '${BF_SOLID}'
BF_SOLID_LIB = 'extern_solid'
WITH_BF_YAFRAY = 'true'
WITH_BF_YAFRAY = True
WITH_BF_FREESTYLE = 'true'
#WITH_BF_NSPR = 'true'
#WITH_BF_NSPR = True
#BF_NSPR = $(LIBDIR)/nspr
#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
#BF_NSPR_LIB =
@@ -112,7 +108,7 @@ WITH_BF_FREESTYLE = 'true'
# if this is not set.
#
# Be paranoid regarding library creation (do not update archives)
#BF_PARANOID = 'true'
#BF_PARANOID = True
# enable freetype2 support for text objects
BF_FREETYPE = '/usr/local'
@@ -120,25 +116,25 @@ BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
BF_FREETYPE_LIB = 'freetype'
WITH_BF_QUICKTIME = 'false' # -DWITH_QUICKTIME
WITH_BF_QUICKTIME = False # -DWITH_QUICKTIME
BF_QUICKTIME = '/usr/local'
BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
WITH_BF_ICONV = 'true'
WITH_BF_ICONV = True
BF_ICONV = "/usr"
BF_ICONV_INC = '${BF_ICONV}/include'
BF_ICONV_LIB = 'iconv'
BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
# enable ffmpeg support
WITH_BF_FFMPEG = 'false' # -DWITH_FFMPEG
WITH_BF_FFMPEG = False # -DWITH_FFMPEG
BF_FFMPEG = '/usr/local'
BF_FFMPEG_INC = '${BF_FFMPEG}/include'
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
BF_FFMPEG_LIB = 'avformat avcodec avutil'
# Mesa Libs should go here if your using them as well....
WITH_BF_STATICOPENGL = 'false'
WITH_BF_STATICOPENGL = False
BF_OPENGL = '/usr/openwin'
BF_OPENGL_INC = '${BF_OPENGL}/include'
BF_OPENGL_LIB = 'GL GLU X11 Xi'
@@ -157,15 +153,15 @@ CPPFLAGS = ['-DXP_UNIX', '-DSUN_OGL_NO_VERTEX_MACROS']
CXXFLAGS = ['-pipe','-fPIC','-funsigned-char','-fno-strict-aliasing']
REL_CFLAGS = ['-O2']
REL_CCFLAGS = ['-O2']
##BF_DEPEND = 'true'
##BF_DEPEND = True
##
##AR = ar
##ARFLAGS = ruv
##ARFLAGSQUIET = ru
##
C_WARN = '-Wall -Wno-char-subscripts -Wdeclaration-after-statement'
C_WARN = ['-Wno-char-subscripts', '-Wdeclaration-after-statement']
CC_WARN = '-Wall'
CC_WARN = ['-Wall']
##FIX_STUBS_WARNINGS = -Wno-unused
@@ -174,13 +170,14 @@ LLIBS = 'c m dl pthread stdc++'
##DYNLDFLAGS = -shared $(LDFLAGS)
BF_PROFILE_FLAGS = ['-pg','-g']
BF_PROFILE = 'false'
BF_PROFILE = False
BF_DEBUG = 'false'
BF_DEBUG = False
BF_DEBUG_FLAGS = ''
BF_BUILDDIR = '../build/sunos5'
BF_INSTALLDIR='../install/sunos5'
BF_DOCDIR='../install/doc'
PLATFORM_LINKFLAGS = ['']

View File

@@ -1,7 +1,7 @@
LCGDIR = '#../lib/windows'
LIBDIR = "${LCGDIR}"
WITH_BF_VERSE = 'false'
WITH_BF_VERSE = False
BF_VERSE_INCLUDE = "#extern/verse/dist"
BF_PYTHON = LIBDIR + '/python'
@@ -11,8 +11,8 @@ BF_PYTHON_BINARY = 'python'
BF_PYTHON_LIB = 'python25'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
WITH_BF_OPENAL = 'true'
WITH_BF_STATICOPENAL = 'false'
WITH_BF_OPENAL = True
WITH_BF_STATICOPENAL = False
BF_OPENAL = LIBDIR + '/openal'
BF_OPENAL_INC = '${BF_OPENAL}/include'
BF_OPENAL_LIB = 'dxguid openal_static'
@@ -20,12 +20,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'
WITH_BF_FFMPEG = 'false'
WITH_BF_FFMPEG = False
BF_FFMPEG_LIB = 'avformat swscale avcodec avutil xvidcore x264'
BF_FFMPEG_LIBPATH = LIBDIR + '/gcc/ffmpeg/lib'
BF_FFMPEG_INC = LIBDIR + '/gcc/ffmpeg/include'
WITH_BF_SDL = 'true'
WITH_BF_SDL = True
BF_SDL = LIBDIR + '/sdl'
BF_SDL_INC = '${BF_SDL}/include'
BF_SDL_LIB = 'SDL'
@@ -36,11 +36,11 @@ BF_PTHREADS_INC = '${BF_PTHREADS}/include'
BF_PTHREADS_LIB = 'pthreadGC2'
BF_PTHREADS_LIBPATH = '${BF_PTHREADS}/lib'
WITH_BF_FMOD = 'false'
WITH_BF_FMOD = False
BF_FMOD = LIBDIR + '/fmod'
WITH_BF_OPENEXR = 'true'
WITH_BF_STATICOPENEXR = 'false'
WITH_BF_OPENEXR = True
WITH_BF_STATICOPENEXR = False
BF_OPENEXR = LIBDIR + '/gcc/openexr'
BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/OpenEXR'
BF_OPENEXR_LIB = ' Half IlmImf Iex '
@@ -48,15 +48,15 @@ BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
# Warning, this static lib configuration is untested! users of this OS please confirm.
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
WITH_BF_DDS = 'true'
WITH_BF_DDS = True
WITH_BF_JPEG = 'true'
WITH_BF_JPEG = True
BF_JPEG = LIBDIR + '/jpeg'
BF_JPEG_INC = '${BF_JPEG}/include'
BF_JPEG_LIB = 'jpeg'
BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
WITH_BF_PNG = 'true'
WITH_BF_PNG = True
BF_PNG = LIBDIR + '/png'
BF_PNG_INC = '${BF_PNG}/include'
BF_PNG_LIB = 'png'
@@ -65,31 +65,31 @@ BF_PNG_LIBPATH = '${BF_PNG}/lib'
BF_TIFF = LIBDIR + '/tiff'
BF_TIFF_INC = '${BF_TIFF}/include'
WITH_BF_ZLIB = 'true'
WITH_BF_ZLIB = True
BF_ZLIB = LIBDIR + '/zlib'
BF_ZLIB_INC = '${BF_ZLIB}/include'
BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
WITH_BF_INTERNATIONAL = 'true'
WITH_BF_INTERNATIONAL = True
BF_GETTEXT = LIBDIR + '/gettext'
BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'gnu_gettext'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
WITH_BF_FTGL = 'true'
WITH_BF_FTGL = True
BF_FTGL = LIBDIR + '/ftgl'
BF_FTGL_INC = '${BF_FTGL}/include'
BF_FTGL_LIB = 'extern_ftgl'
WITH_BF_GAMEENGINE = 'false'
WITH_BF_GAMEENGINE = False
WITH_BF_ODE = 'true'
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'
WITH_BF_BULLET = True
BF_BULLET = '#extern/bullet2/src'
BF_BULLET_INC = '${BF_BULLET}'
BF_BULLET_LIB = 'extern_bullet'
@@ -101,13 +101,9 @@ BF_SOLID_LIB = 'extern_solid'
BF_WINTAB = LIBDIR + '/wintab'
BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE'
WITH_BF_YAFRAY = 'true'
WITH_BF_YAFRAY = True
WITH_BF_FREESTYLE = 'true'
#WITH_BF_NSPR = 'true'
#WITH_BF_NSPR = True
#BF_NSPR = $(LIBDIR)/nspr
#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
#BF_NSPR_LIB =
@@ -127,18 +123,18 @@ BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
BF_FREETYPE_LIB = 'freetype'
BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
WITH_BF_QUICKTIME = 'false' # -DWITH_QUICKTIME
WITH_BF_QUICKTIME = False # -DWITH_QUICKTIME
BF_QUICKTIME = '/usr/local'
BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
WITH_BF_ICONV = 'false'
WITH_BF_ICONV = False
BF_ICONV = LIBDIR + "/iconv"
BF_ICONV_INC = '${BF_ICONV}/include'
BF_ICONV_LIB = 'iconv'
BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
# Mesa Libs should go here if your using them as well....
WITH_BF_STATICOPENGL = 'false'
WITH_BF_STATICOPENGL = False
BF_OPENGL = 'C:\\MingW'
BF_OPENGL_INC = '${BF_OPENGL}/include'
BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'
@@ -157,17 +153,18 @@ CXXFLAGS = ['-pipe', '-mwindows', '-funsigned-char', '-fno-strict-aliasing' ]
REL_CFLAGS = [ '-O2' ]
REL_CCFLAGS = [ '-O2' ]
C_WARN = [ '-Wall' , '-Wno-char-subscripts', '-Wdeclaration-after-statement' ]
C_WARN = [ '-Wno-char-subscripts', '-Wdeclaration-after-statement' ]
CC_WARN = [ '-Wall' ]
LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++']
BF_DEBUG = 'false'
BF_DEBUG = False
BF_DEBUG_FLAGS= '-g'
BF_PROFILE_FLAGS = ['-pg','-g']
BF_PROFILE = 'false'
BF_PROFILE = False
BF_BUILDDIR = '..\\build\\win32-mingw'
BF_INSTALLDIR='..\\install\\win32-mingw'
BF_DOCDIR = '..\\install\\doc'

View File

@@ -1,11 +1,11 @@
LCGDIR = '#../lib/windows'
LIBDIR = '${LCGDIR}'
WITH_BF_VERSE = 'false'
WITH_BF_VERSE = False
BF_VERSE_INCLUDE = "#extern/verse/dist"
# enable ffmpeg support
WITH_BF_FFMPEG = 'false' # -DWITH_FFMPEG
WITH_BF_FFMPEG = True # -DWITH_FFMPEG
BF_FFMPEG = LIBDIR +'/ffmpeg'
BF_FFMPEG_INC = '${BF_FFMPEG}/include'
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
@@ -18,8 +18,8 @@ BF_PYTHON_BINARY = 'python'
BF_PYTHON_LIB = 'python25'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib'
WITH_BF_OPENAL = 'true'
WITH_BF_STATICOPENAL = 'false'
WITH_BF_OPENAL = True
WITH_BF_STATICOPENAL = False
BF_OPENAL = LIBDIR + '/openal'
BF_OPENAL_INC = '${BF_OPENAL}/include ${BF_OPENAL}/include/AL '
BF_OPENAL_LIB = 'dxguid openal_static'
@@ -29,16 +29,16 @@ BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
# TODO - are these useful on win32?
# BF_CXX = '/usr'
# WITH_BF_STATICCXX = 'false'
# WITH_BF_STATICCXX = False
# BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
WITH_BF_ICONV = 'true'
WITH_BF_ICONV = True
BF_ICONV = LIBDIR + '/iconv'
BF_ICONV_INC = '${BF_ICONV}/include'
BF_ICONV_LIB = 'iconv'
BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
WITH_BF_SDL = 'true'
WITH_BF_SDL = True
BF_SDL = LIBDIR + '/sdl'
BF_SDL_INC = '${BF_SDL}/include'
BF_SDL_LIB = 'SDL.lib'
@@ -49,27 +49,27 @@ BF_PTHREADS_INC = '${BF_PTHREADS}/include'
BF_PTHREADS_LIB = 'pthreadVC2'
BF_PTHREADS_LIBPATH = '${BF_PTHREADS}/lib'
WITH_BF_FMOD = 'false'
WITH_BF_FMOD = False
BF_FMOD = LIBDIR + '/fmod'
WITH_BF_OPENEXR = 'true'
WITH_BF_STATICOPENEXR = 'false'
WITH_BF_OPENEXR = True
WITH_BF_STATICOPENEXR = False
BF_OPENEXR = LIBDIR + '/openexr'
BF_OPENEXR_INC = '${BF_OPENEXR}/include ${BF_OPENEXR}/include/IlmImf ${BF_OPENEXR}/include/Iex ${BF_OPENEXR}/include/Imath '
BF_OPENEXR_LIB = ' Iex Half IlmImf Imath IlmThread '
BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib_msvc'
BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib_vs2008'
# Warning, this static lib configuration is untested! users of this OS please confirm.
BF_OPENEXR_LIB_STATIC = '${BF_OPENEXR}/lib/libHalf.a ${BF_OPENEXR}/lib/libIlmImf.a ${BF_OPENEXR}/lib/libIex.a ${BF_OPENEXR}/lib/libImath.a ${BF_OPENEXR}/lib/libIlmThread.a'
WITH_BF_DDS = 'true'
WITH_BF_DDS = True
WITH_BF_JPEG = 'true'
WITH_BF_JPEG = True
BF_JPEG = LIBDIR + '/jpeg'
BF_JPEG_INC = '${BF_JPEG}/include'
BF_JPEG_LIB = 'libjpeg'
BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
WITH_BF_PNG = 'true'
WITH_BF_PNG = True
BF_PNG = LIBDIR + '/png'
BF_PNG_INC = '${BF_PNG}/include'
BF_PNG_LIB = 'libpng_st'
@@ -78,32 +78,33 @@ BF_PNG_LIBPATH = '${BF_PNG}/lib'
BF_TIFF = LIBDIR + '/tiff'
BF_TIFF_INC = '${BF_TIFF}/include'
WITH_BF_ZLIB = 'true'
WITH_BF_ZLIB = True
BF_ZLIB = LIBDIR + '/zlib'
BF_ZLIB_INC = '${BF_ZLIB}/include'
BF_ZLIB_LIB = 'libz'
BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
WITH_BF_INTERNATIONAL = 'true'
WITH_BF_INTERNATIONAL = True
BF_GETTEXT = LIBDIR + '/gettext'
BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'gnu_gettext'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
WITH_BF_FTGL = 'true'
WITH_BF_FTGL = True
BF_FTGL = LIBDIR + '/ftgl'
BF_FTGL_INC = '${BF_FTGL}/include'
BF_FTGL_LIB = 'extern_ftgl'
WITH_BF_GAMEENGINE = 'false'
WITH_BF_GAMEENGINE = True
WITH_BF_PLAYER = True
WITH_BF_ODE = 'true'
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'
WITH_BF_BULLET = True
BF_BULLET = '#extern/bullet2/src'
BF_BULLET_INC = '${BF_BULLET}'
BF_BULLET_LIB = 'extern_bullet'
@@ -115,15 +116,11 @@ BF_SOLID_LIB = 'extern_solid'
BF_WINTAB = LIBDIR + '/wintab'
BF_WINTAB_INC = '${BF_WINTAB}/INCLUDE'
WITH_BF_YAFRAY = 'true'
WITH_BF_YAFRAY = True
WITH_BF_BINRELOC = 'false'
WITH_BF_BINRELOC = False
WITH_BF_FREESTYLE = 'true'
#WITH_BF_NSPR = 'true'
#WITH_BF_NSPR = True
#BF_NSPR = $(LIBDIR)/nspr
#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
#BF_NSPR_LIB =
@@ -138,21 +135,22 @@ WITH_BF_FREESTYLE = 'true'
# if this is not set.
#
# Be paranoid regarding library creation (do not update archives)
#BF_PARANOID = 'true'
#BF_PARANOID = True
# enable freetype2 support for text objects
BF_WITH_FREETYPE = True
BF_FREETYPE = LIBDIR + '/freetype'
BF_FREETYPE_INC = '${BF_FREETYPE}/include ${BF_FREETYPE}/include/freetype2'
BF_FREETYPE_LIB = 'freetype2ST'
BF_FREETYPE_LIBPATH = '${BF_FREETYPE}/lib'
WITH_BF_QUICKTIME = 'true' # -DWITH_QUICKTIME
WITH_BF_QUICKTIME = True # -DWITH_QUICKTIME
BF_QUICKTIME = LIBDIR + '/QTDevWin'
BF_QUICKTIME_INC = '${BF_QUICKTIME}/CIncludes'
BF_QUICKTIME_LIB = 'qtmlClient'
BF_QUICKTIME_LIBPATH = '${BF_QUICKTIME}/Libraries'
WITH_BF_STATICOPENGL = 'false'
WITH_BF_STATICOPENGL = False
BF_OPENGL_INC = '${BF_OPENGL}/include'
BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'
BF_OPENGL_LIB = 'opengl32 glu32'
@@ -162,15 +160,18 @@ BF_OPENGL_LIB_STATIC = [ '${BF_OPENGL}/lib/libGL.a', '${BF_OPENGL}/lib/libGLU.a'
CC = 'cl.exe'
CXX = 'cl.exe'
CCFLAGS = ['/nologo', '/Og', '/Ot', '/Ob1', '/Op', '/G6','/EHsc', '/J', '/W3', '/Gd', '/MT']
CCFLAGS = ['/nologo', '/Ob1', '/J', '/W3', '/Gd', '/MT']
BF_DEBUG_FLAGS = ['/Zi', '/FR${TARGET}.sbr']
BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr']
CPPFLAGS = ['-DWIN32','-D_CONSOLE', '-D_LIB', '-DFTGL_LIBRARY_STATIC', '-D_CRT_SECURE_NO_DEPRECATE']
REL_CFLAGS = ['-O2', '-DNDEBUG']
REL_CCFLAGS = ['-O2', '-DNDEBUG']
REL_CXXFLAGS = ['-O2', '-DNDEBUG']
C_WARN = []
CC_WARN = []
CXX_WARN = []
LLIBS = 'ws2_32 vfw32 winmm kernel32 user32 gdi32 comdlg32 advapi32 shfolder shell32 ole32 oleaut32 uuid'
@@ -185,7 +186,9 @@ PLATFORM_LINKFLAGS = '''
/NODEFAULTLIB:"libcd.lib"
/NODEFAULTLIB:"libcpd.lib"
/NODEFAULTLIB:"libcp.lib"
/LARGEADDRESSAWARE
'''
BF_BUILDDIR = '..\\build\\win32-vc'
BF_INSTALLDIR='..\\install\\win32-vc'
BF_DOCDIR='..\\install\\doc'

View File

@@ -1,9 +1,5 @@
$Id$
Note: The current official release of SCons is 0.98, but
our system still works for 0.97. However, this will be fixed
soon.
Blenders SCons build scripts
============================
@@ -31,7 +27,7 @@ $Id$
To build Blender with the SCons scripts you need a full Python
install, version 2.4 or later (http://www.python.org) and a SCons
installation, version v0.97 (http://www.scons.org).
installation, version v1.1.0 (http://www.scons.org).
Check from the page
http://www.blender.org/development/building-blender/getting-dependencies/
@@ -58,6 +54,13 @@ $Id$
$BLENDERHOME/config/(platform)-config.py. After the build successfully
completes, you can find everything you need in BF_INSTALLDIR.
If you want to create the installer package of Blender on Windows you'll
need to install nullsoft scriptable install system from http://nsis.sf.net.
As an extra dependency, you need the MoreInfo plugin too. The creation of
the installer is tied into the build process and can be triggered with:
% scons nsis
Configuring the build
---------------------
@@ -166,18 +169,6 @@ $Id$
debug symbols. Also note that BF_QUICKDEBUG and BF_DEBUG_LIBS are combined;
for example, setting BF_QUICKDEBUG won't overwrite the contents of BF_DEBUG_LIBS.
Not installing
--------------
If you dont want to install the build result, you can use the following option either
on the commandline or in your user-config.py :
WITHOUT_BF_INSTALL='true'
by default, this is set to 'false', and so the build is installed
Supported toolset
-----------------
@@ -194,7 +185,6 @@ $Id$
specify what toolset to use
% scons BF_TOOLSET=msvc
% scons BF_TOOLSET=mstoolkit
% scons BF_TOOLSET=mingw
If you have only the toolkit installed, you will also need to give

3
extern/SConscript vendored
View File

@@ -32,4 +32,5 @@ if env['WITH_BF_REDCODE'] and env['BF_REDCODE_LIB'] == '':
if env['OURPLATFORM'] == 'linux2':
SConscript(['binreloc/SConscript']);
SConscript(['fftw/SConscript'])
# FFTW not needed atm - dg
# SConscript(['fftw/SConscript'])

View File

@@ -4,24 +4,6 @@ import os
Import('env')
# Import the C flags set in the SConstruct file
#Import ('cflags')
#Import ('defines')
#Import ('user_options_dict')
#if sys.platform=='linux2' or sys.platform=='linux-i386':
# ftgl_env.Append (CCFLAGS = ['-O2', '-ansi'])
#elif sys.platform=='win32':
#ftgl_env.Append (CCFLAGS = ['/O2'])
#elif sys.platform=='sunos':
# ftgl_env.Append (CCFLAGS = ['Xc', '-v', '-fast'])
#elif sys.platform=='darwin':
# ftgl_env.Append (CCFLAGS = ['-O2', '-pipe', '-fPIC', '-funsigned-char', '-ffast-math'])
#else:
# ftgl_env.Append (CCFLAGS = cflags)
#ftgl_env.Append (CPPDEFINES = defines)
incs = 'include src ' + env['BF_FREETYPE_INC'] + ' ' + env['BF_OPENGL_INC']
defs = ''

View File

@@ -59,8 +59,10 @@ IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\C
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\Dynamics MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Dynamics
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\Vehicle MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Vehicle
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\LinearMath MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\LinearMath
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletSoftBody MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletSoftBody
XCOPY /Y ..\..\src\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include
XCOPY /Y ..\..\src\BulletSoftBody\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletSoftBody
XCOPY /Y ..\..\src\LinearMath\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\LinearMath
XCOPY /Y ..\..\src\BulletCollision\BroadphaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\BroadphaseCollision
XCOPY /Y ..\..\src\BulletCollision\NarrowPhaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\NarrowPhaseCollision
@@ -141,8 +143,10 @@ IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\C
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\Dynamics MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Dynamics
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\Vehicle MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Vehicle
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\LinearMath MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\LinearMath
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletSoftBody MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletSoftBody
XCOPY /Y ..\..\src\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include
XCOPY /Y ..\..\src\BulletSoftBody\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletSoftBody
XCOPY /Y ..\..\src\LinearMath\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\LinearMath
XCOPY /Y ..\..\src\BulletCollision\BroadphaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\BroadphaseCollision
XCOPY /Y ..\..\src\BulletCollision\NarrowPhaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\NarrowPhaseCollision
@@ -221,8 +225,10 @@ IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\C
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\Dynamics MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Dynamics
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\Vehicle MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Vehicle
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\LinearMath MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\LinearMath
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletSoftBody MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletSoftBody
XCOPY /Y ..\..\src\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include
XCOPY /Y ..\..\src\BulletSoftBody\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletSoftBody
XCOPY /Y ..\..\src\LinearMath\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\LinearMath
XCOPY /Y ..\..\src\BulletCollision\BroadphaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\BroadphaseCollision
XCOPY /Y ..\..\src\BulletCollision\NarrowPhaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\NarrowPhaseCollision
@@ -303,8 +309,10 @@ IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\C
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\Dynamics MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Dynamics
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletDynamics\Vehicle MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletDynamics\Vehicle
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\LinearMath MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\LinearMath
IF NOT EXIST ..\..\..\..\..\build\msvc_7\extern\bullet2\include\BulletSoftBody MKDIR ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletSoftBody
XCOPY /Y ..\..\src\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include
XCOPY /Y ..\..\src\BulletSoftBody\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletSoftBody
XCOPY /Y ..\..\src\LinearMath\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\LinearMath
XCOPY /Y ..\..\src\BulletCollision\BroadphaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\BroadphaseCollision
XCOPY /Y ..\..\src\BulletCollision\NarrowPhaseCollision\*.h ..\..\..\..\..\build\msvc_7\extern\bullet\include\BulletCollision\NarrowPhaseCollision

View File

@@ -17,7 +17,9 @@ subject to the following restrictions:
#include "btCollisionObject.h"
btCollisionObject::btCollisionObject()
: m_broadphaseHandle(0),
: m_anisotropicFriction(1.f,1.f,1.f),
m_hasAnisotropicFriction(false),
m_broadphaseHandle(0),
m_collisionShape(0),
m_rootCollisionShape(0),
m_collisionFlags(btCollisionObject::CF_STATIC_OBJECT),

View File

@@ -49,6 +49,9 @@ protected:
//without destroying the continuous interpolated motion (which uses this interpolation velocities)
btVector3 m_interpolationLinearVelocity;
btVector3 m_interpolationAngularVelocity;
btVector3 m_anisotropicFriction;
bool m_hasAnisotropicFriction;
btBroadphaseProxy* m_broadphaseHandle;
btCollisionShape* m_collisionShape;
@@ -119,6 +122,20 @@ public:
return ((m_collisionFlags & (CF_STATIC_OBJECT | CF_KINEMATIC_OBJECT | CF_NO_CONTACT_RESPONSE) )==0);
}
const btVector3& getAnisotropicFriction() const
{
return m_anisotropicFriction;
}
void setAnisotropicFriction(const btVector3& anisotropicFriction)
{
m_anisotropicFriction = anisotropicFriction;
m_hasAnisotropicFriction = (anisotropicFriction[0]!=1.f) || (anisotropicFriction[1]!=1.f) || (anisotropicFriction[2]!=1.f);
}
bool hasAnisotropicFriction() const
{
return m_hasAnisotropicFriction;
}
SIMD_FORCE_INLINE bool isStaticObject() const {
return (m_collisionFlags & CF_STATIC_OBJECT) != 0;

View File

@@ -44,6 +44,12 @@ public:
btScalar getRadius() const { return m_implicitShapeDimensions.getX() * m_localScaling.getX();}
void setUnscaledRadius(btScalar radius)
{
m_implicitShapeDimensions.setX(radius);
btConvexInternalShape::setMargin(radius);
}
//debugging
virtual const char* getName()const {return "SPHERE";}

View File

@@ -16,6 +16,7 @@ subject to the following restrictions:
#include "btTriangleIndexVertexArray.h"
btTriangleIndexVertexArray::btTriangleIndexVertexArray(int numTriangles,int* triangleIndexBase,int triangleIndexStride,int numVertices,btScalar* vertexBase,int vertexStride)
: m_hasAabb(0)
{
btIndexedMesh mesh;

View File

@@ -2,7 +2,7 @@
#define BT_BOX_COLLISION_H_INCLUDED
/*! \file gim_box_collision.h
\author Francisco Le<EFBFBD>n N<>jera
\author Francisco Len N<>jera
*/
/*
This source file is part of GIMPACT Library.

View File

@@ -2,7 +2,7 @@
#define BT_CLIP_POLYGON_H_INCLUDED
/*! \file btClipPolygon.h
\author Francisco Le<EFBFBD>n N<>jera
\author Francisco Len N<>jera
*/
/*
This source file is part of GIMPACT Library.

View File

@@ -2,7 +2,7 @@
#define BT_CONTACT_H_INCLUDED
/*! \file gim_contact.h
\author Francisco Le<EFBFBD>n N<>jera
\author Francisco Len N<>jera
*/
/*
This source file is part of GIMPACT Library.

View File

@@ -1,5 +1,5 @@
/*! \file gim_box_set.h
\author Francisco Le<EFBFBD>n N<>jera
\author Francisco Len N<>jera
*/
/*
This source file is part of GIMPACT Library.

View File

@@ -2,7 +2,7 @@
#define GIM_BOX_SET_H_INCLUDED
/*! \file gim_box_set.h
\author Francisco Le<EFBFBD>n N<>jera
\author Francisco Len N<>jera
*/
/*
This source file is part of GIMPACT Library.

View File

@@ -18,7 +18,7 @@ subject to the following restrictions:
3. This notice may not be removed or altered from any source distribution.
*/
/*
Author: Francisco Le<EFBFBD>n N<>jera
Author: Francisco Len N<>jera
Concave-Concave Collision
*/

View File

@@ -1,5 +1,5 @@
/*! \file btGImpactShape.h
\author Francisco Le<EFBFBD>n N<>jera
\author Francisco Len N<>jera
*/
/*
This source file is part of GIMPACT Library.

View File

@@ -1,5 +1,5 @@
/*! \file btGImpactMassUtil.h
\author Francisco Le<EFBFBD>n N<>jera
\author Francisco Len N<>jera
*/
/*
This source file is part of GIMPACT Library.

View File

@@ -1,5 +1,5 @@
/*! \file gim_box_set.h
\author Francisco Le<EFBFBD>n N<>jera
\author Francisco Len N<>jera
*/
/*
This source file is part of GIMPACT Library.

View File

@@ -2,7 +2,7 @@
#define GIM_QUANTIZED_SET_H_INCLUDED
/*! \file btGImpactQuantizedBvh.h
\author Francisco Le<EFBFBD>n N<>jera
\author Francisco Len N<>jera
*/
/*
This source file is part of GIMPACT Library.

View File

@@ -1,5 +1,5 @@
/*! \file btGImpactShape.h
\author Francisco Le<EFBFBD>n N<>jera
\author Francisco Len N<>jera
*/
/*
This source file is part of GIMPACT Library.

View File

@@ -1,5 +1,5 @@
/*! \file btGenericPoolAllocator.cpp
\author Francisco Le<EFBFBD>n N<>jera. email projectileman@yahoo.com
\author Francisco Len N<>jera. email projectileman@yahoo.com
General purpose allocator class
*/

View File

@@ -1,5 +1,5 @@
/*! \file btGenericPoolAllocator.h
\author Francisco Le<EFBFBD>n N<>jera. email projectileman@yahoo.com
\author Francisco Len N<>jera. email projectileman@yahoo.com
General purpose allocator class
*/

View File

@@ -2,7 +2,7 @@
#define BT_BASIC_GEOMETRY_OPERATIONS_H_INCLUDED
/*! \file btGeometryOperations.h
*\author Francisco Le<EFBFBD>n N<>jera
*\author Francisco Len N<>jera
*/
/*

View File

@@ -2,7 +2,7 @@
#define BT_QUANTIZATION_H_INCLUDED
/*! \file btQuantization.h
*\author Francisco Le<EFBFBD>n N<>jera
*\author Francisco Len N<>jera
*/
/*

View File

@@ -1,5 +1,5 @@
/*! \file btGImpactTriangleShape.h
\author Francisco Le<EFBFBD>n N<>jera
\author Francisco Len N<>jera
*/
/*
This source file is part of GIMPACT Library.

View File

@@ -1,5 +1,5 @@
/*! \file btGImpactShape.h
\author Francisco Le<EFBFBD>n N<>jera
\author Francisco Len N<>jera
*/
/*
This source file is part of GIMPACT Library.

View File

@@ -1,7 +1,7 @@
#ifndef GIM_ARRAY_H_INCLUDED
#define GIM_ARRAY_H_INCLUDED
/*! \file gim_array.h
\author Francisco Le<EFBFBD>n N<>jera
\author Francisco Len N<>jera
*/
/*
-----------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
#define GIM_BASIC_GEOMETRY_OPERATIONS_H_INCLUDED
/*! \file gim_basic_geometry_operations.h
*\author Francisco Le<EFBFBD>n N<>jera
*\author Francisco Len N<>jera
type independant geometry routines
*/

View File

@@ -1,7 +1,7 @@
#ifndef GIM_BITSET_H_INCLUDED
#define GIM_BITSET_H_INCLUDED
/*! \file gim_bitset.h
\author Francisco Le<EFBFBD>n N<>jera
\author Francisco Len N<>jera
*/
/*
-----------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
#define GIM_BOX_COLLISION_H_INCLUDED
/*! \file gim_box_collision.h
\author Francisco Le<EFBFBD>n N<>jera
\author Francisco Len N<>jera
*/
/*
-----------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
#define GIM_BOX_SET_H_INCLUDED
/*! \file gim_box_set.h
\author Francisco Le<EFBFBD>n N<>jera
\author Francisco Len N<>jera
*/
/*
-----------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
#define GIM_CLIP_POLYGON_H_INCLUDED
/*! \file gim_tri_collision.h
\author Francisco Le<EFBFBD>n N<>jera
\author Francisco Len N<>jera
*/
/*
-----------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
#define GIM_CONTACT_H_INCLUDED
/*! \file gim_contact.h
\author Francisco Le<EFBFBD>n N<>jera
\author Francisco Len N<>jera
*/
/*
-----------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
#define GIM_GEOM_TYPES_H_INCLUDED
/*! \file gim_geom_types.h
\author Francisco Le<EFBFBD>n N<>jera
\author Francisco Len N<>jera
*/
/*
-----------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
#define GIM_GEOMETRY_H_INCLUDED
/*! \file gim_geometry.h
\author Francisco Le<EFBFBD>n N<>jera
\author Francisco Len N<>jera
*/
/*
-----------------------------------------------------------------------------

View File

@@ -1,7 +1,7 @@
#ifndef GIM_HASH_TABLE_H_INCLUDED
#define GIM_HASH_TABLE_H_INCLUDED
/*! \file gim_trimesh_data.h
\author Francisco Le<EFBFBD>n N<>jera
\author Francisco Len N<>jera
*/
/*
-----------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
#define GIM_LINEAR_H_INCLUDED
/*! \file gim_linear_math.h
*\author Francisco Le<EFBFBD>n N<>jera
*\author Francisco Len N<>jera
Type Independant Vector and matrix operations.
*/
/*

View File

@@ -1,7 +1,7 @@
#ifndef GIM_MATH_H_INCLUDED
#define GIM_MATH_H_INCLUDED
/*! \file gim_math.h
\author Francisco Le<EFBFBD>n N<>jera
\author Francisco Len N<>jera
*/
/*
-----------------------------------------------------------------------------

View File

@@ -1,7 +1,7 @@
#ifndef GIM_MEMORY_H_INCLUDED
#define GIM_MEMORY_H_INCLUDED
/*! \file gim_memory.h
\author Francisco Le<EFBFBD>n N<>jera
\author Francisco Len N<>jera
*/
/*
-----------------------------------------------------------------------------

View File

@@ -1,7 +1,7 @@
#ifndef GIM_RADIXSORT_H_INCLUDED
#define GIM_RADIXSORT_H_INCLUDED
/*! \file gim_radixsort.h
\author Francisco Le<EFBFBD>n N<>jera.
\author Francisco Len N<>jera.
Based on the work of Michael Herf : "fast floating-point radix sort"
Avaliable on http://www.stereopsis.com/radix.html
*/

View File

@@ -1,6 +1,6 @@
/*! \file gim_tri_collision.h
\author Francisco Le<EFBFBD>n N<>jera
\author Francisco Len N<>jera
*/
/*
-----------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
#define GIM_TRI_COLLISION_H_INCLUDED
/*! \file gim_tri_collision.h
\author Francisco Le<EFBFBD>n N<>jera
\author Francisco Len N<>jera
*/
/*
-----------------------------------------------------------------------------

View File

@@ -149,6 +149,7 @@ void initSolverBody(btSolverBody* solverBody, btCollisionObject* collisionObject
solverBody->m_originalBody = 0;
solverBody->m_angularFactor = 1.f;
}
solverBody->m_pushVelocity.setValue(0.f,0.f,0.f);
solverBody->m_turnVelocity.setValue(0.f,0.f,0.f);
}
@@ -292,7 +293,7 @@ btScalar resolveSingleCollisionCombinedCacheFriendly(
return normalImpulse;
}
//#define NO_FRICTION_TANGENTIALS 1
#ifndef NO_FRICTION_TANGENTIALS
btScalar resolveSingleFrictionCacheFriendly(
@@ -396,7 +397,7 @@ btScalar resolveSingleFrictionCacheFriendly(
return 0.f;
body1.getVelocityInLocalPoint(contactConstraint.m_rel_posA,vel1);
body1.getVelocityInLocalPoint(contactConstraint.m_relpos1CrossNormal,vel1);
body2.getVelocityInLocalPoint(contactConstraint.m_rel_posB,vel2);
btVector3 vel = vel1 - vel2;
btScalar rel_vel;
@@ -421,9 +422,9 @@ btScalar resolveSingleFrictionCacheFriendly(
(body1.m_invMass + body2.m_invMass + lat_vel.dot(temp1.cross(rel_pos1) + temp2.cross(rel_pos2)));
btScalar normal_impulse = contactConstraint.m_appliedImpulse * combinedFriction;
GEN_set_min(friction_impulse, normal_impulse);
GEN_set_max(friction_impulse, -normal_impulse);
body1.applyImpulse(lat_vel * -friction_impulse, rel_pos1);
btSetMin(friction_impulse, normal_impulse);
btSetMin(friction_impulse, -normal_impulse);
body1.internalApplyImpulse(lat_vel * -friction_impulse, rel_pos1);
body2.applyImpulse(lat_vel * friction_impulse, rel_pos2);
}
}
@@ -495,6 +496,23 @@ void btSequentialImpulseConstraintSolver::addFrictionConstraint(const btVector3&
}
void applyAnisotropicFriction(btCollisionObject* colObj,btVector3& frictionDirection);
void applyAnisotropicFriction(btCollisionObject* colObj,btVector3& frictionDirection)
{
if (colObj && colObj->hasAnisotropicFriction())
{
// transform to local coordinates
btVector3 loc_lateral = frictionDirection * colObj->getWorldTransform().getBasis();
const btVector3& friction_scaling = colObj->getAnisotropicFriction();
//apply anisotropic friction
loc_lateral *= friction_scaling;
// ... and transform it back to global coordinates
frictionDirection = colObj->getWorldTransform().getBasis() * loc_lateral;
}
}
btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySetup(btCollisionObject** /*bodies */,int /*numBodies */,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc)
{
@@ -755,19 +773,31 @@ btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySetup(btCol
if (!cp.m_lateralFrictionInitialized)
{
cp.m_lateralFrictionDir1 = vel - cp.m_normalWorldOnB * rel_vel;
//scale anisotropic friction
applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir1);
applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir1);
btScalar lat_rel_vel = cp.m_lateralFrictionDir1.length2();
if (lat_rel_vel > SIMD_EPSILON)//0.0f)
{
cp.m_lateralFrictionDir1 /= btSqrt(lat_rel_vel);
addFrictionConstraint(cp.m_lateralFrictionDir1,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation);
cp.m_lateralFrictionDir2 = cp.m_lateralFrictionDir1.cross(cp.m_normalWorldOnB);
cp.m_lateralFrictionDir2.normalize();//??
cp.m_lateralFrictionDir2.normalize();
applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir2);
applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir2);
addFrictionConstraint(cp.m_lateralFrictionDir2,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation);
} else
{
//re-calculate friction direction every frame, todo: check if this is really needed
btPlaneSpace1(cp.m_normalWorldOnB,cp.m_lateralFrictionDir1,cp.m_lateralFrictionDir2);
applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir2);
applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir2);
addFrictionConstraint(cp.m_lateralFrictionDir1,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation);
addFrictionConstraint(cp.m_lateralFrictionDir2,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation);
}
@@ -985,7 +1015,7 @@ btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendly(btCollisio
btAssert(pt);
pt->m_appliedImpulse = solveManifold.m_appliedImpulse;
pt->m_appliedImpulseLateral1 = m_tmpSolverFrictionConstraintPool[solveManifold.m_frictionIndex].m_appliedImpulse;
pt->m_appliedImpulseLateral1 = m_tmpSolverFrictionConstraintPool[solveManifold.m_frictionIndex+1].m_appliedImpulse;
pt->m_appliedImpulseLateral2 = m_tmpSolverFrictionConstraintPool[solveManifold.m_frictionIndex+1].m_appliedImpulse;
//do a callback here?

View File

@@ -423,6 +423,13 @@ btVector3 btDiscreteDynamicsWorld::getGravity () const
void btDiscreteDynamicsWorld::removeRigidBody(btRigidBody* body)
{
//remove all constraints too
while (body->getNumConstraintRefs())
{
btTypedConstraint* constraint = body->getConstraintRef(0);
removeConstraint(constraint);
}
removeCollisionObject(body);
}

View File

@@ -45,6 +45,7 @@ void btRigidBody::setupRigidBody(const btRigidBody::btRigidBodyConstructionInfo&
m_linearVelocity.setValue(btScalar(0.0), btScalar(0.0), btScalar(0.0));
m_angularVelocity.setValue(btScalar(0.),btScalar(0.),btScalar(0.));
m_angularFactor = btScalar(1.);
m_anisotropicFriction.setValue(1.f,1.f,1.f);
m_gravity.setValue(btScalar(0.0), btScalar(0.0), btScalar(0.0));
m_totalForce.setValue(btScalar(0.0), btScalar(0.0), btScalar(0.0));
m_totalTorque.setValue(btScalar(0.0), btScalar(0.0), btScalar(0.0)),

View File

@@ -87,7 +87,7 @@ btSoftBody::btSoftBody(btSoftBodyWorldInfo* worldInfo,int node_count, const btV
}
updateBounds();
m_initialWorldTransform.setIdentity();
}
//
@@ -306,8 +306,16 @@ void btSoftBody::appendFace(int node0,int node1,int node2,Material* mat)
}
//
void btSoftBody::appendAnchor(int node,btRigidBody* body)
void btSoftBody::appendAnchor(int node,btRigidBody* body,bool disableCollisionWithBody=false)
{
if (disableCollisionWithBody)
{
if (m_collisionDisabledObjects.findLinearSearch(body)==m_collisionDisabledObjects.size())
{
m_collisionDisabledObjects.push_back(body);
}
}
Anchor a;
a.m_node = &m_nodes[node];
a.m_body = body;
@@ -497,6 +505,7 @@ void btSoftBody::transform(const btTransform& trs)
updateNormals();
updateBounds();
updateConstants();
m_initialWorldTransform = trs;
}
//
@@ -2438,6 +2447,10 @@ void btSoftBody::PSolve_RContacts(btSoftBody* psb,btScalar kst,btScalar ti)
for(int i=0,ni=psb->m_rcontacts.size();i<ni;++i)
{
const RContact& c=psb->m_rcontacts[i];
///skip object that don't have collision response
if (!psb->getWorldInfo()->m_dispatcher->needsResponse(psb,c.m_cti.m_body))
continue;
const sCti& cti=c.m_cti;
const btVector3 va=cti.m_body->getVelocityInLocalPoint(c.m_c1)*dt;
const btVector3 vb=c.m_node->m_x-c.m_node->m_q;

View File

@@ -49,6 +49,8 @@ struct btSoftBodyWorldInfo
class btSoftBody : public btCollisionObject
{
public:
btAlignedObjectArray<class btCollisionObject*> m_collisionDisabledObjects;
//
// Enumerations
//
@@ -595,6 +597,7 @@ public:
btDbvt m_cdbvt; // Clusters tree
tClusterArray m_clusters; // Clusters
btTransform m_initialWorldTransform; //used to attach constraints etc.
//
// Api
//
@@ -666,7 +669,7 @@ public:
Material* mat=0);
/* Append anchor */
void appendAnchor( int node,
btRigidBody* body);
btRigidBody* body,bool disableCollision);
/* Append linear joint */
void appendLinearJoint(const LJoint::Specs& specs,Cluster* body0,Body body1);
void appendLinearJoint(const LJoint::Specs& specs,Body body=Body());

View File

@@ -62,6 +62,7 @@ btSoftBodyRigidBodyCollisionConfiguration::btSoftBodyRigidBodyCollisionConfigura
collisionAlgorithmMaxElementSize = btMax(collisionAlgorithmMaxElementSize,maxSize2);
if (collisionAlgorithmMaxElementSize > curElemSize)
{
m_collisionAlgorithmPool->~btPoolAllocator();
btAlignedFree(m_collisionAlgorithmPool);
void* mem = btAlignedAlloc(sizeof(btPoolAllocator),16);
m_collisionAlgorithmPool = new(mem) btPoolAllocator(collisionAlgorithmMaxElementSize,constructionInfo.m_defaultMaxCollisionAlgorithmPoolSize);

View File

@@ -59,7 +59,10 @@ void btSoftRigidCollisionAlgorithm::processCollision (btCollisionObject* body0,b
btSoftBody* softBody = m_isSwapped? (btSoftBody*)body1 : (btSoftBody*)body0;
btCollisionObject* rigidCollisionObject = m_isSwapped? body0 : body1;
if (softBody->m_collisionDisabledObjects.findLinearSearch(rigidCollisionObject)==softBody->m_collisionDisabledObjects.size())
{
softBody->defaultCollisionHandler(rigidCollisionObject);
}
}

View File

@@ -141,6 +141,10 @@ inline int btGetVersion()
/// older compilers (gcc 3.x) and Sun needs double version of sqrt etc.
/// exclude Apple Intel (i's assumed to be a Macbook or new Intel Dual Core Processor)
#if defined (__sun) || defined (__sun__) || defined (__sparc) || (defined (__APPLE__) && ! defined (__i386__))
/* XXX Need to fix these... needed for SunOS 5.8 */
#define sinf(a) sin((double)(a))
#define cosf(a) cos((double)(a))
#define fabsf(a) fabs((double)(a))
//use slow double float precision operation on those platforms
#ifndef BT_USE_DOUBLE_PRECISION
#define BT_FORCE_DOUBLE_FUNCTIONS
@@ -194,7 +198,7 @@ SIMD_FORCE_INLINE btScalar btSqrt(btScalar y)
tempf = y;
*tfptr = (0xbfcdd90a - *tfptr)>>1; /* estimate of 1/sqrt(y) */
x = tempf;
z = y*btScalar(0.5); /* hoist out the <20>/2<> */
z = y*btScalar(0.5); /* hoist out the <20>/2<> */
x = (btScalar(1.5)*x)-(x*x)*(x*z); /* iteration formula */
x = (btScalar(1.5)*x)-(x*x)*(x*z);
x = (btScalar(1.5)*x)-(x*x)*(x*z);

View File

@@ -56,7 +56,7 @@ else:
platform_linkflags += ['/DEBUG','/PDB:verse.pdb']
verse_env = env.Copy()
verse_env = env.Clone()
cmd_gen_files = (['v_cmd_gen.c',
'v_cmd_def_a.c',
@@ -71,7 +71,7 @@ cmd_gen_files = (['v_cmd_gen.c',
cmd_gen_deps = (['v_gen_pack_init.c'])
proto_env = env.Copy()
proto_env = env.Clone()
proto_env.Append(CPPDEFINES=['V_GENERATE_FUNC_MODE'])
mkprot_tool = proto_env.Program(target = 'mkprot', source = cmd_gen_files)
@@ -130,10 +130,10 @@ server_source_files = (['vs_connection.c',
'vs_node_text.c'
])
verselib_env = verse_env.Copy()
verselib_env = verse_env.Clone()
verselib_env.Append(CPPDEFINES = defines)
verseserver_env = verse_env.Copy()
verseserver_env = verse_env.Clone()
verseserver_env.Append(CPPDEFINES = defines)
verseserver_env.Append (LIBPATH = ['.'])
verseserver_env.Append (LIBS= ['verse'])

View File

@@ -20,7 +20,7 @@ SConscript(['SoundSystem/SConscript',
# perhaps get rid of intern/csg?
NEW_CSG='false'
if env['BF_NO_ELBEEM'] == 0:
if not env['BF_NO_ELBEEM']:
SConscript(['elbeem/SConscript'])
if NEW_CSG=='false':

View File

@@ -97,8 +97,8 @@ extern unsigned int SND_GetSampleFormat(void* sample);
extern unsigned int SND_GetNumberOfChannels(void* sample);
extern unsigned int SND_GetSampleRate(void* sample);
extern unsigned int SND_GetBitRate(void* sample);
extern unsigned int SND_GetNumberOfSamples(void* sample);
extern unsigned int SND_GetHeaderSize(void* sample);
extern unsigned int SND_GetNumberOfSamples(void* sample, int sample_length);
extern unsigned int SND_GetHeaderSize(void* sample, int sample_length);
extern unsigned int SND_GetExtraChunk(void* sample);
extern void SND_GetSampleInfo(signed char* sample, SND_WaveSlot* waveslot);

View File

@@ -162,7 +162,7 @@ SND_WaveSlot* SND_FmodDevice::LoadSample(const STR_String& name,
int numberofchannels = SND_GetNumberOfChannels(memlocation);
int samplerate = SND_GetSampleRate(memlocation);
int bitrate = SND_GetBitRate(memlocation);
int numberofsamples = SND_GetNumberOfSamples(memlocation);
int numberofsamples = SND_GetNumberOfSamples(memlocation, size);
waveslot->SetFileSize(size);
waveslot->SetData(memlocation);

View File

@@ -388,11 +388,18 @@ void SND_Scene::UpdateActiveObects()
#endif
#ifdef USE_OPENAL
// ok, properties Set. now see if it must play
if (pObject->GetPlaystate() == SND_MUST_PLAY)
{
switch (pObject->GetPlaystate()){
case SND_MUST_PLAY:
m_audiodevice->PlayObject(id);
pObject->SetPlaystate(SND_PLAYING);
//break;
break;
case SND_MUST_STOP:
RemoveActiveObject(pObject);
break;
case SND_MUST_PAUSE:
m_audiodevice->PauseObject(id);
pObject->SetPlaystate(SND_PAUSED);
break;
}
#endif

View File

@@ -91,6 +91,7 @@ SND_SoundObject::~SND_SoundObject()
void SND_SoundObject::StartSound()
{
if (m_id >= 0)
m_playstate = SND_MUST_PLAY;
}
@@ -98,6 +99,7 @@ void SND_SoundObject::StartSound()
void SND_SoundObject::StopSound()
{
if (m_id >= 0)
m_playstate = SND_MUST_STOP;
}
@@ -105,6 +107,7 @@ void SND_SoundObject::StopSound()
void SND_SoundObject::PauseSound()
{
if (m_id >= 0)
m_playstate = SND_MUST_PAUSE;
}

View File

@@ -199,7 +199,7 @@ bool SND_IsSampleValid(const STR_String& name, void* memlocation)
/* checks if the passed pointer is a valid sample */
bool CheckSample(void* sample)
static bool CheckSample(void* sample)
{
bool valid = false;
char buffer[32];
@@ -285,26 +285,32 @@ unsigned int SND_GetBitRate(void* sample)
/* gets the length of the actual sample data (without the header) */
unsigned int SND_GetNumberOfSamples(void* sample)
unsigned int SND_GetNumberOfSamples(void* sample, int sample_length)
{
unsigned int chunklength, length = 0, offset = 16;
char data[4];
unsigned int chunklength, length = 0, offset;
unsigned short block_align;
if (CheckSample(sample))
{
memcpy(&chunklength, ((char*)sample) + offset, 4);
/* This was endian unsafe. See top of the file for the define. */
if (SND_fEndian == SND_endianBig) SWITCH_INT(chunklength);
memcpy(&chunklength, ((char*)sample) + 16, 4);
memcpy(&block_align, ((char*)sample) + 32, 2); /* always 2 or 4 it seems */
offset = offset + chunklength + 4;
memcpy(data, ((char*)sample) + offset, 4);
/* This was endian unsafe. See top of the file for the define. */
if (SND_fEndian == SND_endianBig)
{
SWITCH_INT(chunklength);
SWITCH_SHORT(block_align);
}
offset = 16 + chunklength + 4;
/* This seems very unsafe, what if data is never found (f.i. corrupt file)... */
// lets find "data"
while (memcmp(data, "data", 4))
while (memcmp(((char*)sample) + offset, "data", 4))
{
offset += 4;
memcpy(data, ((char*)sample) + offset, 4);
offset += block_align;
if (offset+block_align > sample_length) /* save us from crashing */
return 0;
}
offset += 4;
memcpy(&length, ((char*)sample) + offset, 4);
@@ -319,34 +325,38 @@ unsigned int SND_GetNumberOfSamples(void* sample)
/* gets the size of the entire header (file - sampledata) */
unsigned int SND_GetHeaderSize(void* sample)
unsigned int SND_GetHeaderSize(void* sample, int sample_length)
{
unsigned int chunklength, headersize = 0, offset = 16;
char data[4];
unsigned short block_align;
if (CheckSample(sample))
{
memcpy(&chunklength, ((char*)sample) + offset, 4);
memcpy(&block_align, ((char*)sample) + 32, 2); /* always 2 or 4 it seems */
/* This was endian unsafe. See top of the file for the define. */
if (SND_fEndian == SND_endianBig) SWITCH_INT(chunklength);
if (SND_fEndian == SND_endianBig)
{
SWITCH_INT(chunklength);
SWITCH_SHORT(block_align);
}
offset = offset + chunklength + 4;
memcpy(data, ((char*)sample) + offset, 4);
// lets find "data"
while (memcmp(data, "data", 4))
while (memcmp(((char*)sample) + offset, "data", 4))
{
offset += 4;
memcpy(data, ((char*)sample) + offset, 4);
offset += block_align;
if (offset+block_align > sample_length) /* save us from crashing */
return 0;
}
headersize = offset + 8;
}
return headersize;
}
unsigned int SND_GetExtraChunk(void* sample)
{
unsigned int extrachunk = 0, chunklength, offset = 16;
@@ -382,7 +392,8 @@ void SND_GetSampleInfo(signed char* sample, SND_WaveSlot* waveslot)
if (CheckSample(sample))
{
memcpy(&fileheader, sample, sizeof(WavFileHeader));
fileheader.size = SND_GetHeaderSize(sample);
fileheader.size = SND_GetHeaderSize(sample, waveslot->GetFileSize());
if (fileheader.size) { /* this may fail for corrupt files */
sample += sizeof(WavFileHeader);
fileheader.size = ((fileheader.size+1) & ~1) - 4;
@@ -436,4 +447,5 @@ void SND_GetSampleInfo(signed char* sample, SND_WaveSlot* waveslot)
fileheader.size -= (((chunkheader.size + 1) & ~1) + 8);
}
}
}
}

View File

@@ -41,7 +41,9 @@
#include "SND_SDLCDDevice.h"
#include "SoundDefines.h"
#ifndef DISABLE_SDL
#include <SDL.h>
#endif
SND_SDLCDDevice::SND_SDLCDDevice() :
m_cdrom(NULL),

View File

@@ -7,7 +7,7 @@ sources = env.Glob('intern/*.cpp')
defs = 'NOGUI ELBEEM_BLENDER=1'
if env['WITH_BF_OPENMP'] == 1:
if env['WITH_BF_OPENMP']:
defs += ' PARALLEL'
if env['OURPLATFORM']=='win32-vc':

View File

@@ -37,6 +37,10 @@ unexport NAN_QUIET
CCFLAGS += $(LEVEL_2_CPP_WARNINGS)
ifeq ($(WITH_BF_OPENMP),true)
CPPFLAGS += -DPARALLEL
endif
CPPFLAGS += -DNOGUI -DELBEEM_BLENDER
CPPFLAGS += -I.
CPPFLAGS += -I../extern

View File

@@ -204,6 +204,7 @@ int elbeemAddMesh(elbeemMesh *mesh) {
ntlGeometryObjModel *obj = new ntlGeometryObjModel( );
gpWorld->getRenderGlobals()->getSimScene()->addGeoClass( obj );
gpWorld->getRenderGlobals()->getRenderScene()->addGeoClass(obj);
obj->initModel(
mesh->numVertices, mesh->vertices, mesh->numTriangles, mesh->triangles,
mesh->channelSizeVertices, mesh->channelVertices );

View File

@@ -98,9 +98,9 @@ void MeanValueMeshCoords::computeWeights(vector<ntlVec3Gfx> &reference_vertices,
if(mvmFullDebug) errMsg("MeanValueMeshCoords::computeWeights","c="<<c<<" phi="<<phi<<" d="<<d);
//if (c[0] > 1. || c[0] < 0. || c[1] > 1. || c[1] < 0. || c[2] > 1. || c[2] < 0.) continue;
s[0] = sqrtf((float)(1.-c[0]*c[0]));
s[1] = sqrtf((float)(1.-c[1]*c[1]));
s[2] = sqrtf((float)(1.-c[2]*c[2]));
s[0] = sqrt((float)(1.-c[0]*c[0]));
s[1] = sqrt((float)(1.-c[1]*c[1]));
s[2] = sqrt((float)(1.-c[2]*c[2]));
if(mvmFullDebug) errMsg("MeanValueMeshCoords::computeWeights","s");
if (s[0] <= cEPS || s[1] <= cEPS || s[2] <= cEPS) {

View File

@@ -420,6 +420,10 @@ LbmFsgrSolver::handleCpdata()
return;
}
// check if we have control objects
if(mpControl->mCons.size()==0)
return;
if((mpControl->mCpUpdateInterval<1) || (this->mStepCnt%mpControl->mCpUpdateInterval==0)) {
// do full reinit later on...
}

View File

@@ -10,7 +10,7 @@ sources = env.Glob('intern/*.cpp')
pf = ['GHOST_DisplayManager', 'GHOST_System', 'GHOST_Window']
if window_system in ('linux2', 'openbsd3', 'sunos5', 'freebsd6'):
if window_system in ('linux2', 'openbsd3', 'sunos5', 'freebsd6', 'irix6'):
for f in pf:
sources.remove('intern' + os.sep + f + 'Win32.cpp')
sources.remove('intern' + os.sep + f + 'Carbon.cpp')

View File

@@ -434,16 +434,6 @@ GHOST_TSuccess GHOST_WindowWin32::setOrder(GHOST_TWindowOrder order)
GHOST_TSuccess GHOST_WindowWin32::swapBuffers()
{
// adding a glFinish() here is to prevent Geforce in 'full scene antialias' mode
// from antialising the Blender window. Officially a swapbuffers does a glFinish
// itself, so this feels really like a hack... but it won't harm. (ton)
//
// disabled this because it is a performance killer for the game engine, glFinish
// forces synchronization with the graphics card and calling it is strongly
// discouraged for good performance. (brecht)
//
// glFinish();
return ::SwapBuffers(m_hDC) == TRUE ? GHOST_kSuccess : GHOST_kFailure;
}

View File

@@ -33,7 +33,7 @@ SOURCEDIR = blender/po
include nan_definitions.mk
LINGUAS = ar bg ca cs de el es fi fr hr it ja nl pl pt_BR ro ru sr sr@Latn sv uk zh_CN
LINGUAS = ar bg ca cs de el es fi fr hr it ja ko nl pl pt_BR ro ru sr sr@Latn sv uk zh_CN
ifeq ($(OS), darwin)
DIR = $(OCGDIR)/bin/blender.app/Contents/Resources/locale/$@/LC_MESSAGES/

View File

@@ -1 +1 @@
2.47
2.48

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 282 KiB

View File

@@ -7,7 +7,7 @@
# Tooltip: 'Export to DirectX text file format format for XNA Animation Component Library.'
"""
__author__ = "vertex color exporting feature is added by mnemoto (original:minahito (original:Arben (Ben) Omari))"
__url__ = ("blender", "elysiun", "Adjuster's site http://sunday-lab.blogspot.com/, Author's site http://www.omariben.too.it","Adjuster's site http://ex.homeunix.net/")
__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/")
__version__ = "3.1"
__bpydoc__ = """\

View File

@@ -0,0 +1,708 @@
#dxfLibrary.py : provides functions for generating DXF files
# --------------------------------------------------------------------------
__version__ = "v1.27beta - 2008.10.05"
__author__ = "Stani Michiels(Stani), Remigiusz Fiedler(migius)"
__license__ = "GPL"
__url__ = "http://wiki.blender.org/index.php/Scripts/Manual/Export/autodesk_dxf"
__bpydoc__ ="""The script exports geometry data to DXF format r12 version.
Copyright %s
Version %s
License %s
Homepage %s
See the homepage for documentation.
url:
IDEAs:
-
TODO:
-
History
v1.27 - 2008.10.07 by migius
- beautifying output code: keys whitespace prefix
- refactoring DXF-strings format: NewLine moved to the end of
v1.26 - 2008.10.05 by migius
- modif POLYLINE to support POLYFACE
v1.25 - 2008.09.28 by migius
- modif FACE class for r12
v1.24 - 2008.09.27 by migius
- modif POLYLINE class for r12
- changing output format from r9 to r12(AC1009)
v1.1 (20/6/2005) by www.stani.be/python/sdxf
- Python library to generate dxf drawings
______________________________________________________________
""" % (__author__,__version__,__license__,__url__)
# --------------------------------------------------------------------------
# DXF Library: copyright (C) 2005 by Stani Michiels (AKA Stani)
# 2008 modif by Remigiusz Fiedler (AKA migius)
# --------------------------------------------------------------------------
# ***** 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 *****
#import Blender
#from Blender import Mathutils, Window, Scene, sys, Draw
#import BPyMessages
try:
import copy
#from struct import pack
except:
copy = None
####1) Private (only for developpers)
_HEADER_POINTS=['insbase','extmin','extmax']
#---helper functions-----------------------------------
def _point(x,index=0):
"""Convert tuple to a dxf point"""
#print 'deb: _point=', x #-------------
return '\n'.join([' %s\n%s'%((i+1)*10+index,x[i]) for i in range(len(x))])
def _points(plist):
"""Convert a list of tuples to dxf points"""
out = '\n'.join([_point(plist[i],i)for i in range(len(plist))])
#print 'deb: points=\n', out #-------------------
return out
#---base classes----------------------------------------
class _Call:
"""Makes a callable class."""
def copy(self):
"""Returns a copy."""
return copy.deepcopy(self)
def __call__(self,**attrs):
"""Returns a copy with modified attributes."""
copied=self.copy()
for attr in attrs:setattr(copied,attr,attrs[attr])
return copied
#-------------------------------------------------------
class _Entity(_Call):
"""Base class for _common group codes for entities."""
def __init__(self,color=None,extrusion=None,layer='0',
lineType=None,lineTypeScale=None,lineWeight=None,
thickness=None,parent=None):
"""None values will be omitted."""
self.color = color
self.extrusion = extrusion
self.layer = layer
self.lineType = lineType
self.lineTypeScale = lineTypeScale
self.lineWeight = lineWeight
self.thickness = thickness
self.parent = parent
def _common(self):
"""Return common group codes as a string."""
if self.parent:parent=self.parent
else:parent=self
result =''
if parent.layer!=None: result+=' 8\n%s\n'%parent.layer
if parent.color!=None: result+=' 62\n%s\n'%parent.color
if parent.extrusion!=None: result+='%s\n'%_point(parent.extrusion,200)
if parent.lineType!=None: result+=' 6\n%s\n'%parent.lineType
#TODO: if parent.lineWeight!=None: result+='370\n%s\n'%parent.lineWeight
if parent.lineTypeScale!=None: result+=' 48\n%s\n'%parent.lineTypeScale
if parent.thickness!=None: result+=' 39\n%s\n'%parent.thickness
return result
#--------------------------
class _Entities:
"""Base class to deal with composed objects."""
def __dxf__(self):
return []
def __str__(self):
return ''.join([str(x) for x in self.__dxf__()])
#--------------------------
class _Collection(_Call):
"""Base class to expose entities methods to main object."""
def __init__(self,entities=[]):
self.entities=copy.copy(entities)
#link entities methods to drawing
for attr in dir(self.entities):
if attr[0]!='_':
attrObject=getattr(self.entities,attr)
if callable(attrObject):
setattr(self,attr,attrObject)
####2) Constants
#---color values
BYBLOCK=0
BYLAYER=256
#---block-type flags (bit coded values, may be combined):
ANONYMOUS =1 # This is an anonymous block generated by hatching, associative dimensioning, other internal operations, or an application
NON_CONSTANT_ATTRIBUTES =2 # This block has non-constant attribute definitions (this bit is not set if the block has any attribute definitions that are constant, or has no attribute definitions at all)
XREF =4 # This block is an external reference (xref)
XREF_OVERLAY =8 # This block is an xref overlay
EXTERNAL =16 # This block is externally dependent
RESOLVED =32 # This is a resolved external reference, or dependent of an external reference (ignored on input)
REFERENCED =64 # This definition is a referenced external reference (ignored on input)
#---mtext flags
#attachment point
TOP_LEFT = 1
TOP_CENTER = 2
TOP_RIGHT = 3
MIDDLE_LEFT = 4
MIDDLE_CENTER = 5
MIDDLE_RIGHT = 6
BOTTOM_LEFT = 7
BOTTOM_CENTER = 8
BOTTOM_RIGHT = 9
#drawing direction
LEFT_RIGHT = 1
TOP_BOTTOM = 3
BY_STYLE = 5 #the flow direction is inherited from the associated text style
#line spacing style (optional):
AT_LEAST = 1 #taller characters will override
EXACT = 2 #taller characters will not override
#---polyline flags
CLOSED =1 # This is a closed polyline (or a polygon mesh closed in the M direction)
CURVE_FIT =2 # Curve-fit vertices have been added
SPLINE_FIT =4 # Spline-fit vertices have been added
POLYLINE_3D =8 # This is a 3D polyline
POLYGON_MESH =16 # This is a 3D polygon mesh
CLOSED_N =32 # The polygon mesh is closed in the N direction
POLYFACE_MESH =64 # The polyline is a polyface mesh
CONTINOUS_LINETYPE_PATTERN =128 # The linetype pattern is generated continuously around the vertices of this polyline
#---text flags
#horizontal
LEFT = 0
CENTER = 1
RIGHT = 2
ALIGNED = 3 #if vertical alignment = 0
MIDDLE = 4 #if vertical alignment = 0
FIT = 5 #if vertical alignment = 0
#vertical
BASELINE = 0
BOTTOM = 1
MIDDLE = 2
TOP = 3
####3) Classes
#---entitities -----------------------------------------------
#--------------------------
class Arc(_Entity):
"""Arc, angles in degrees."""
def __init__(self,center=(0,0,0),radius=1,
startAngle=0.0,endAngle=90,**common):
"""Angles in degrees."""
_Entity.__init__(self,**common)
self.center=center
self.radius=radius
self.startAngle=startAngle
self.endAngle=endAngle
def __str__(self):
return ' 0\nARC\n%s%s\n 40\n%s\n 50\n%s\n 51\n%s\n'%\
(self._common(),_point(self.center),
self.radius,self.startAngle,self.endAngle)
#-----------------------------------------------
class Circle(_Entity):
"""Circle"""
def __init__(self,center=(0,0,0),radius=1,**common):
_Entity.__init__(self,**common)
self.center=center
self.radius=radius
def __str__(self):
return ' 0\nCIRCLE\n%s%s\n 40\n%s\n'%\
(self._common(),_point(self.center),self.radius)
#-----------------------------------------------
class Face(_Entity):
"""3dface"""
def __init__(self,points,**common):
_Entity.__init__(self,**common)
if len(points)<4: #fix for r12 format
points.append(points[-1])
self.points=points
def __str__(self):
out = ' 0\n3DFACE\n%s%s\n' %(self._common(),_points(self.points))
#print 'deb:out=', out #-------------------
return out
#-----------------------------------------------
class Insert(_Entity):
"""Block instance."""
def __init__(self,name,point=(0,0,0),
xscale=None,yscale=None,zscale=None,
cols=None,colspacing=None,rows=None,rowspacing=None,
rotation=None,
**common):
_Entity.__init__(self,**common)
self.name=name
self.point=point
self.xscale=xscale
self.yscale=yscale
self.zscale=zscale
self.cols=cols
self.colspacing=colspacing
self.rows=rows
self.rowspacing=rowspacing
self.rotation=rotation
def __str__(self):
result=' 0\nINSERT\n 2\n%s\n%s\n%s\n'%\
(self.name,self._common(),_point(self.point))
if self.xscale!=None:result+=' 41\n%s\n'%self.xscale
if self.yscale!=None:result+=' 42\n%s\n'%self.yscale
if self.zscale!=None:result+=' 43\n%s\n'%self.zscale
if self.rotation:result+=' 50\n%s\n'%self.rotation
if self.cols!=None:result+=' 70\n%s\n'%self.cols
if self.colspacing!=None:result+=' 44\n%s\n'%self.colspacing
if self.rows!=None:result+=' 71\n%s\n'%self.rows
if self.rowspacing!=None:result+=' 45\n%s\n'%self.rowspacing
return result
#-----------------------------------------------
class Line(_Entity):
"""Line"""
def __init__(self,points,**common):
_Entity.__init__(self,**common)
self.points=points
def __str__(self):
return ' 0\nLINE\n%s%s\n' %(
self._common(), _points(self.points))
#-----------------------------------------------
class PolyLine(_Entity):
def __init__(self,points,org_point=[0,0,0],flag=0,width=None,**common):
_Entity.__init__(self,**common)
self.points=points
self.org_point=org_point
self.flag=flag
if self.flag==64:
self.points=points[0]
self.faces=points[1]
self.p_count=len(self.points)
self.f_count=len(self.faces)
self.width=width
def __str__(self):
result= ' 0\nPOLYLINE\n%s 70\n%s\n' %(self._common(),self.flag)
#print 'deb: self._common()', self._common() #----------
result+=' 66\n1\n'
result+='%s\n' %_point(self.org_point)
if self.flag==64:
result+=' 71\n%s\n' %self.p_count
result+=' 72\n%s\n' %self.f_count
for point in self.points:
result+=' 0\nVERTEX\n'
result+=' 8\n%s\n' %self.layer
result+='%s\n' %_point(point)
if self.flag==64: result+=' 70\n192\n'
if self.width: result+=' 40\n%s\n 41\n%s\n' %(self.width,self.width)
if self.flag==64:
for face in self.faces:
result+=' 0\nVERTEX\n'
result+=' 8\n%s\n' %self.layer
result+='%s\n' %_point(self.org_point)
result+=' 70\n128\n'
result+=' 71\n%s\n' %face[0]
result+=' 72\n%s\n' %face[1]
result+=' 73\n%s\n' %face[2]
if len(face)==4: result+=' 74\n%s\n' %face[3]
result+=' 0\nSEQEND\n'
result+=' 8\n%s\n' %self.layer
return result
#-----------------------------------------------
class Point(_Entity):
"""Colored solid fill."""
def __init__(self,points=None,**common):
_Entity.__init__(self,**common)
self.points=points
#-----------------------------------------------
class Solid(_Entity):
"""Colored solid fill."""
def __init__(self,points=None,**common):
_Entity.__init__(self,**common)
self.points=points
def __str__(self):
return ' 0\nSOLID\n%s%s\n' %(self._common(),
_points(self.points[:2]+[self.points[3],self.points[2]])
)
#-----------------------------------------------
class Text(_Entity):
"""Single text line."""
def __init__(self,text='',point=(0,0,0),alignment=None,
flag=None,height=1,justifyhor=None,justifyver=None,
rotation=None,obliqueAngle=None,style=None,xscale=None,**common):
_Entity.__init__(self,**common)
self.text=text
self.point=point
self.alignment=alignment
self.flag=flag
self.height=height
self.justifyhor=justifyhor
self.justifyver=justifyver
self.rotation=rotation
self.obliqueAngle=obliqueAngle
self.style=style
self.xscale=xscale
def __str__(self):
result= ' 0\nTEXT\n%s%s\n 40\n%s\n 1\n%s\n'%\
(self._common(),_point(self.point),self.height,self.text)
if self.rotation: result+=' 50\n%s\n'%self.rotation
if self.xscale: result+=' 41\n%s\n'%self.xscale
if self.obliqueAngle: result+=' 51\n%s\n'%self.obliqueAngle
if self.style: result+=' 7\n%s\n'%self.style
if self.flag: result+=' 71\n%s\n'%self.flag
if self.justifyhor: result+=' 72\n%s\n'%self.justifyhor
#TODO: if self.alignment: result+='%s\n'%_point(self.alignment,1)
if self.justifyver: result+=' 73\n%s\n'%self.justifyver
return result
#-----------------------------------------------
class Mtext(Text):
"""Surrogate for mtext, generates some Text instances."""
def __init__(self,text='',point=(0,0,0),width=250,spacingFactor=1.5,down=0,spacingWidth=None,**options):
Text.__init__(self,text=text,point=point,**options)
if down:spacingFactor*=-1
self.spacingFactor=spacingFactor
self.spacingWidth=spacingWidth
self.width=width
self.down=down
def __str__(self):
texts=self.text.replace('\r\n','\n').split('\n')
if not self.down:texts.reverse()
result=''
x=y=0
if self.spacingWidth:spacingWidth=self.spacingWidth
else:spacingWidth=self.height*self.spacingFactor
for text in texts:
while text:
result+='%s\n'%Text(text[:self.width],
point=(self.point[0]+x*spacingWidth,
self.point[1]+y*spacingWidth,
self.point[2]),
alignment=self.alignment,flag=self.flag,height=self.height,
justifyhor=self.justifyhor,justifyver=self.justifyver,
rotation=self.rotation,obliqueAngle=self.obliqueAngle,
style=self.style,xscale=self.xscale,parent=self
)
text=text[self.width:]
if self.rotation:x+=1
else:y+=1
return result[1:]
#-----------------------------------------------
##class _Mtext(_Entity):
## """Mtext not functioning for minimal dxf."""
## def __init__(self,text='',point=(0,0,0),attachment=1,
## charWidth=None,charHeight=1,direction=1,height=100,rotation=0,
## spacingStyle=None,spacingFactor=None,style=None,width=100,
## xdirection=None,**common):
## _Entity.__init__(self,**common)
## self.text=text
## self.point=point
## self.attachment=attachment
## self.charWidth=charWidth
## self.charHeight=charHeight
## self.direction=direction
## self.height=height
## self.rotation=rotation
## self.spacingStyle=spacingStyle
## self.spacingFactor=spacingFactor
## self.style=style
## self.width=width
## self.xdirection=xdirection
## def __str__(self):
## input=self.text
## text=''
## while len(input)>250:
## text+='3\n%s\n'%input[:250]
## input=input[250:]
## text+='1\n%s\n'%input
## result= '0\nMTEXT\n%s\n%s\n40\n%s\n41\n%s\n71\n%s\n72\n%s%s\n43\n%s\n50\n%s\n'%\
## (self._common(),_point(self.point),self.charHeight,self.width,
## self.attachment,self.direction,text,
## self.height,
## self.rotation)
## if self.style:result+='7\n%s\n'%self.style
## if self.xdirection:result+='%s\n'%_point(self.xdirection,1)
## if self.charWidth:result+='42\n%s\n'%self.charWidth
## if self.spacingStyle:result+='73\n%s\n'%self.spacingStyle
## if self.spacingFactor:result+='44\n%s\n'%self.spacingFactor
## return result
#---tables ---------------------------------------------------
#-----------------------------------------------
class Block(_Collection):
"""Use list methods to add entities, eg append."""
def __init__(self,name,layer='0',flag=0,base=(0,0,0),entities=[]):
self.entities=copy.copy(entities)
_Collection.__init__(self,entities)
self.layer=layer
self.name=name
self.flag=0
self.base=base
def __str__(self):
e=''.join([str(x)for x in self.entities])
return ' 0\nBLOCK\n 8\n%s\n 2\n%s\n 70\n%s\n%s\n 3\n%s\n%s 0\nENDBLK\n'%\
(self.layer,self.name.upper(),self.flag,_point(self.base),self.name.upper(),e)
#-----------------------------------------------
class Layer(_Call):
"""Layer"""
def __init__(self,name='pydxf',color=7,lineType='continuous',flag=64):
self.name=name
self.color=color
self.lineType=lineType
self.flag=flag
def __str__(self):
return ' 0\nLAYER\n 2\n%s\n 70\n%s\n 62\n%s\n 6\n%s\n'%\
(self.name.upper(),self.flag,self.color,self.lineType)
#-----------------------------------------------
class LineType(_Call):
"""Custom linetype"""
def __init__(self,name='continuous',description='Solid line',elements=[],flag=64):
# TODO: Implement lineType elements
self.name=name
self.description=description
self.elements=copy.copy(elements)
self.flag=flag
def __str__(self):
return ' 0\nLTYPE\n 2\n%s\n 70\n%s\n 3\n%s\n 72\n65\n 73\n%s\n 40\n0.0\n'%\
(self.name.upper(),self.flag,self.description,len(self.elements))
#-----------------------------------------------
class Style(_Call):
"""Text style"""
def __init__(self,name='standard',flag=0,height=0,widthFactor=40,obliqueAngle=50,
mirror=0,lastHeight=1,font='arial.ttf',bigFont=''):
self.name=name
self.flag=flag
self.height=height
self.widthFactor=widthFactor
self.obliqueAngle=obliqueAngle
self.mirror=mirror
self.lastHeight=lastHeight
self.font=font
self.bigFont=bigFont
def __str__(self):
return ' 0\nSTYLE\n 2\n%s\n 70\n%s\n 40\n%s\n 41\n%s\n 50\n%s\n 71\n%s\n 42\n%s\n 3\n%s\n 4\n%s\n'%\
(self.name.upper(),self.flag,self.flag,self.widthFactor,
self.obliqueAngle,self.mirror,self.lastHeight,
self.font.upper(),self.bigFont.upper())
#-----------------------------------------------
class View(_Call):
def __init__(self,name,flag=0,width=1,height=1,center=(0.5,0.5),
direction=(0,0,1),target=(0,0,0),lens=50,
frontClipping=0,backClipping=0,twist=0,mode=0):
self.name=name
self.flag=flag
self.width=width
self.height=height
self.center=center
self.direction=direction
self.target=target
self.lens=lens
self.frontClipping=frontClipping
self.backClipping=backClipping
self.twist=twist
self.mode=mode
def __str__(self):
return ' 0\nVIEW\n 2\n%s\n 70\n%s\n 40\n%s\n%s\n 41\n%s\n%s\n%s\n 42\n%s\n 43\n%s\n 44\n%s\n 50\n%s\n 71\n%s\n'%\
(self.name,self.flag,self.height,_point(self.center),self.width,
_point(self.direction,1),_point(self.target,2),self.lens,
self.frontClipping,self.backClipping,self.twist,self.mode)
#-----------------------------------------------
def ViewByWindow(name,leftBottom=(0,0),rightTop=(1,1),**options):
width=abs(rightTop[0]-leftBottom[0])
height=abs(rightTop[1]-leftBottom[1])
center=((rightTop[0]+leftBottom[0])*0.5,(rightTop[1]+leftBottom[1])*0.5)
return View(name=name,width=width,height=height,center=center,**options)
#---drawing
#-----------------------------------------------
class Drawing(_Collection):
"""Dxf drawing. Use append or any other list methods to add objects."""
def __init__(self,insbase=(0.0,0.0,0.0),extmin=(0.0,0.0),extmax=(0.0,0.0),
layers=[Layer()],linetypes=[LineType()],styles=[Style()],blocks=[],
views=[],entities=None,fileName='test.dxf'):
# TODO: replace list with None,arial
if not entities:entities=[]
_Collection.__init__(self,entities)
self.insbase=insbase
self.extmin=extmin
self.extmax=extmax
self.layers=copy.copy(layers)
self.linetypes=copy.copy(linetypes)
self.styles=copy.copy(styles)
self.views=copy.copy(views)
self.blocks=copy.copy(blocks)
self.fileName=fileName
#private
#self.acadver='9\n$ACADVER\n1\nAC1006\n'
self.acadver=' 9\n$ACADVER\n 1\nAC1009\n'
"""DXF AutoCAD-Release format codes
AC1021 2008, 2007
AC1018 2006, 2005, 2004
AC1015 2002, 2000i, 2000
AC1014 R14,14.01
AC1012 R13
AC1009 R12,11
AC1006 R10
AC1004 R9
AC1002 R2.6
AC1.50 R2.05
"""
def _name(self,x):
"""Helper function for self._point"""
return ' 9\n$%s\n' %x.upper()
def _point(self,name,x):
"""Point setting from drawing like extmin,extmax,..."""
return '%s%s' %(self._name(name),_point(x))
def _section(self,name,x):
"""Sections like tables,blocks,entities,..."""
if x: xstr=''.join(x)
else: xstr=''
return ' 0\nSECTION\n 2\n%s\n%s 0\nENDSEC\n'%(name.upper(),xstr)
def _table(self,name,x):
"""Tables like ltype,layer,style,..."""
if x: xstr=''.join(x)
else: xstr=''
return ' 0\nTABLE\n 2\n%s\n 70\n%s\n%s 0\nENDTAB\n'%(name.upper(),len(x),xstr)
def __str__(self):
"""Returns drawing as dxf string."""
header=[self.acadver]+[self._point(attr,getattr(self,attr))+'\n' for attr in _HEADER_POINTS]
header=self._section('header',header)
tables=[self._table('ltype',[str(x) for x in self.linetypes]),
self._table('layer',[str(x) for x in self.layers]),
self._table('style',[str(x) for x in self.styles]),
self._table('view',[str(x) for x in self.views]),
]
tables=self._section('tables',tables)
blocks=self._section('blocks',[str(x) for x in self.blocks])
entities=self._section('entities',[str(x) for x in self.entities])
all=''.join([header,tables,blocks,entities,' 0\nEOF\n'])
return all
def saveas(self,fileName):
self.fileName=fileName
self.save()
def save(self):
test=open(self.fileName,'w')
test.write(str(self))
test.close()
#---extras
#-----------------------------------------------
class Rectangle(_Entity):
"""Rectangle, creates lines."""
def __init__(self,point=(0,0,0),width=1,height=1,solid=None,line=1,**common):
_Entity.__init__(self,**common)
self.point=point
self.width=width
self.height=height
self.solid=solid
self.line=line
def __str__(self):
result=''
points=[self.point,(self.point[0]+self.width,self.point[1],self.point[2]),
(self.point[0]+self.width,self.point[1]+self.height,self.point[2]),
(self.point[0],self.point[1]+self.height,self.point[2]),self.point]
if self.solid:
result+= Solid(points=points[:-1],parent=self.solid)
if self.line:
for i in range(4):
result+= Line(points=[points[i],points[i+1]],parent=self)
return result[1:]
#-----------------------------------------------
class LineList(_Entity):
"""Like polyline, but built of individual lines."""
def __init__(self,points=[],org_point=[0,0,0],closed=0,**common):
_Entity.__init__(self,**common)
self.closed=closed
self.points=copy.copy(points)
def __str__(self):
if self.closed:points=self.points+[self.points[0]]
else: points=self.points
result=''
for i in range(len(points)-1):
result+= Line(points=[points[i],points[i+1]],parent=self)
return result[1:]
#-----------------------------------------------------
def test():
#Blocks
b=Block('test')
b.append(Solid(points=[(0,0,0),(1,0,0),(1,1,0),(0,1,0)],color=1))
b.append(Arc(center=(1,0,0),color=2))
#Drawing
d=Drawing()
#tables
d.blocks.append(b) #table blocks
d.styles.append(Style()) #table styles
d.views.append(View('Normal')) #table view
d.views.append(ViewByWindow('Window',leftBottom=(1,0),rightTop=(2,1))) #idem
#entities
d.append(Circle(center=(1,1,0),color=3))
d.append(Face(points=[(0,0,0),(1,0,0),(1,1,0),(0,1,0)],color=4))
d.append(Insert('test',point=(3,3,3),cols=5,colspacing=2))
d.append(Line(points=[(0,0,0),(1,1,1)]))
d.append(Mtext('Click on Ads\nmultiple lines with mtext',point=(1,1,1),color=5,rotation=90))
d.append(Text('Please donate!',point=(3,0,1)))
d.append(Rectangle(point=(2,2,2),width=4,height=3,color=6,solid=Solid(color=2)))
d.append(Solid(points=[(4,4,0),(5,4,0),(7,8,0),(9,9,0)],color=3))
d.append(PolyLine(points=[(1,1,1),(2,1,1),(2,2,1),(1,2,1)],closed=1,color=1))
#d.saveas('c:\\test.dxf')
d.saveas('test.dxf')
#-----------------------------------------------------
if __name__=='__main__':
if not copy:
Draw.PupMenu('Error%t|This script requires a full python install')
main()

View File

@@ -231,7 +231,7 @@ def read_bvh(file_path, GLOBAL_SCALE=1.0):
bvh_nodes_list= bvh_nodes.values()
while lineIdx < len(file_lines) -1:
while lineIdx < len(file_lines):
line= file_lines[lineIdx]
for bvh_node in bvh_nodes_list:
#for bvh_node in bvh_nodes_serial:
@@ -726,7 +726,7 @@ def load_bvh_ui(file, PREF_UI= True):
Blender.Window.WaitCursor(1)
# Get the BVH data and act on it.
t1= Blender.sys.time()
print '\tpassing bvh...',
print '\tparsing bvh...',
bvh_nodes= read_bvh(file, IMPORT_SCALE)
print '%.4f' % (Blender.sys.time()-t1)
t1= Blender.sys.time()

View File

@@ -1,5 +1,5 @@
#!BPY
# -*- coding: latin-1 -*-
"""
Name: 'Motion Capture (.c3d)...'
Blender: 246

View File

@@ -246,6 +246,10 @@ information about how to fix this.
fields = fields[2].split()
if len(fields) > 1:
fname = fields[1].split(sep)[-1]
i = 1
while not fname.endswith('.py'):
i += 1
fname = "%s %s" % (fname, fields[i])
ALL_SCRIPTS[fname] = (menuname, group_len - 1)
return True

View File

@@ -0,0 +1,407 @@
#!BPY
"""
Name: 'Autodesk DXF (.dxf)'
Blender: 247
Group: 'Export'
Tooltip: 'Export geometry to DXF-r12 (Drawing eXchange Format).'
"""
__version__ = "v1.27beta - 2008.10.07"
__author__ = "Remigiusz Fiedler (AKA migius)"
__license__ = "GPL"
__url__ = "http://wiki.blender.org/index.php/Scripts/Manual/Export/autodesk_dxf"
__bpydoc__ ="""The script exports Blender geometry to DXF format r12 version.
Version %s
Copyright %s
License %s
extern dependances: dxfLibrary.py
See the homepage for documentation.
url: %s
IDEAs:
- correct normals for POLYLINE-POLYFACE via proper point-order
- HPGL output for 2d and flattened 3d content
TODO:
- optimize back-faces removal (probably needs matrix transform)
- optimize POLYFACE routine: remove double-vertices
- optimize POLYFACE routine: remove unused vertices
- support hierarchies: groups, instances, parented structures
- support 210-code (3d orientation vector)
- presets for architectural scales
- write drawing extends for automatic view positioning in CAD
History
v1.27 - 2008.10.07 by migius
- exclude Stani's DXF-Library to extern module
v1.26 - 2008.10.05 by migius
- add "hidden mode" substitut: back-faces removal
- add support for mesh ->POLYFACE
- optimized code for "Flat" procedure
v1.25 - 2008.09.28 by migius
- modif FACE class for r12
- add mesh-polygon -> Bezier-curve converter (Yorik's code)
- add support for curves ->POLYLINEs
- add "3d-View to Flat" - geometry projection to XY-plane
v1.24 - 2008.09.27 by migius
- add start UI with preferences
- modif POLYLINE class for r12
- changing output format from r9 to r12(AC1009)
v1.23 - 2008.09.26 by migius
- add finish message-box
v1.22 - 2008.09.26 by migius
- add support for curves ->LINEs
- add support for mesh-edges ->LINEs
v1.21 - 2008.06.04 by migius
- initial adaptation for Blender
v1.1 (20/6/2005) by Stani Michiels www.stani.be/python/sdxf
- Python library to generate dxf drawings
______________________________________________________________
""" % (__author__,__version__,__license__,__url__)
# --------------------------------------------------------------------------
# Script copyright (C) 2008 Remigiusz Fiedler (AKA migius)
# --------------------------------------------------------------------------
# ***** 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 *****
import Blender
from Blender import Mathutils, Window, Scene, sys, Draw
import BPyMessages
#import dxfLibrary
#reload(dxfLibrary)
from dxfLibrary import *
#-----------------------------------------------------
def hidden_status(faces, mx_n):
#print 'HIDDEN_MODE: caution! not full implemented yet'
ok_faces = []
ok_edges = []
#sort out back-faces = with normals pointed away from camera
for f in faces:
#print 'deb: face=', f #---------
# get its normal-vector in localCS
vec_normal = f.no.copy()
#print 'deb: vec_normal=', vec_normal #------------------
#must be transfered to camera/view-CS
vec_normal *= mx_n
#vec_normal *= mb.rotationPart()
#print 'deb:2vec_normal=', vec_normal #------------------
#vec_normal *= mw0.rotationPart()
#print 'deb:3vec_normal=', vec_normal, '\n' #------------------
# normal must point the Z direction-hemisphere
if vec_normal[2] > 0.0 :
ok_faces.append(f.index)
for key in f.edge_keys:
#this test can be done faster with set()
if key not in ok_edges:
ok_edges.append(key)
#print 'deb: amount of visible faces=', len(ok_faces) #---------
#print 'deb: visible faces=', ok_faces #---------
#print 'deb: amount of visible edges=', len(ok_edges) #---------
#print 'deb: visible edges=', ok_edges #---------
return ok_faces, ok_edges
#-----------------------------------------------------
def projected_co(vec, mw):
# convert the world coordinates of vector to screen coordinates
#co = vec.co.copy().resize4D()
co = vec.copy().resize4D()
co[3] = 1.0
sc = co * mw
#print 'deb: viewprojection=', sc #---------
return [sc[0],sc[1],0.0]
#--------not used---------------------------------------------
def flatten(points, mw):
for i,v in enumerate(points):
v = projected_co(v, mw)
points[i]=v
#print 'deb: flatten points=', points #---------
return points
#-----------------------------------------------------
def exportMesh(ob, mx, mx_n):
entities = []
me = ob.getData(mesh=1)
#me.transform(mx)
# above is eventualy faster, but bad, cause
# directly transforms origin geometry and write back rounding errors
me_verts = me.verts[:] #we dont want manipulate origin data
#print 'deb: me_verts=', me_verts #---------
#me.transform(mx_inv) #counterpart to - back to the origin state
for v in me_verts:
v.co *= mx
faces=[]
edges=[]
if HIDDEN_MODE:
ok_faces, ok_edges = hidden_status(me.faces, mx_n)
#if (not FLATTEN) and len(me.faces)>0 and ONLYFACES:
if ONLYFACES:
if POLYFACES: #export 3D as POLYFACEs
allpoints = []
allfaces = []
allpoints = [v.co[:3] for v in me_verts]
for f in me.faces:
#print 'deb: face=', f #---------
if not HIDDEN_MODE or \
(HIDDEN_MODE and f.index in ok_faces):
if 1:
points = f.verts
face = [p.index+1 for p in points]
#print 'deb: face=', face #---------
allfaces.append(face)
else: #bad, cause create multiple vertex instances
points = f.verts
points = [ me_verts[p.index].co[:3] for p in points]
#points = [p.co[:3] for p in points]
#print 'deb: points=', points #---------
index = len(allpoints)+1
face = [index+i for i in range(len(points))]
allpoints.extend(points)
allfaces.append(face)
if allpoints and allfaces:
#print 'deb: allpoints=', allpoints #---------
#print 'deb: allfaces=', allfaces #---------
dxfPOLYFACE = PolyLine([allpoints, allfaces], flag=64)
entities.append(dxfPOLYFACE)
else: #export 3D as 3DFACEs
for f in me.faces:
#print 'deb: face=', f #---------
if not HIDDEN_MODE or \
(HIDDEN_MODE and f.index in ok_faces):
points = f.verts
points = [ me_verts[p.index].co[:3] for p in points]
#points = [p.co[:3] for p in points]
#print 'deb: points=', points #---------
dxfFACE = Face(points)
entities.append(dxfFACE)
else: #export 3D as LINEs
if HIDDEN_MODE and len(me.faces)!=0:
for e in ok_edges:
points = [ me_verts[key].co[:3] for key in e]
dxfLINE = Line(points)
entities.append(dxfLINE)
else:
for e in me.edges:
#print 'deb: edge=', e #---------
points=[]
#points = [e.v1.co*mx, e.v2.co*mx]
points = [ me_verts[key].co[:3] for key in e.key]
#print 'deb: points=', points #---------
dxfLINE = Line(points)
entities.append(dxfLINE)
return entities
#-----------------------------------------------------
def exportCurve(ob, mx):
entities = []
curve = ob.getData()
for cur in curve:
#print 'deb: START cur=', cur #--------------
if 1: #not cur.isNurb():
#print 'deb: START points' #--------------
points = []
org_point = [0.0,0.0,0.0]
for point in cur:
#print 'deb: point=', point #---------
if cur.isNurb():
vec = point[0:3]
else:
point = point.getTriple()
#print 'deb: point=', point #---------
vec = point[1]
#print 'deb: vec=', vec #---------
pkt = Mathutils.Vector(vec) * mx
#print 'deb: pkt=', pkt #---------
#pkt *= SCALE_FACTOR
if 0: #FLATTEN:
pkt = projected_co(pkt, mw)
points.append(pkt)
if cur.isCyclic(): closed = 1
else: closed = 0
if len(points)>1:
#print 'deb: points', points #--------------
if POLYLINES: dxfPLINE = PolyLine(points,org_point,closed)
else: dxfPLINE = LineList(points,org_point,closed)
entities.append(dxfPLINE)
return entities
#-----------------------------------------------------
def do_export(sel_group, filepath):
Window.WaitCursor(1)
t = sys.time()
#init Drawing ---------------------
d=Drawing()
#add Tables -----------------
#d.blocks.append(b) #table blocks
d.styles.append(Style()) #table styles
d.views.append(View('Normal')) #table view
d.views.append(ViewByWindow('Window',leftBottom=(1,0),rightTop=(2,1))) #idem
#add Entities --------------------
something_ready = False
#ViewVector = Mathutils.Vector(Window.GetViewVector())
#print 'deb: ViewVector=', ViewVector #------------------
mw0 = Window.GetViewMatrix()
#mw0 = Window.GetPerspMatrix() #TODO: how get it working?
mw = mw0.copy()
if FLATTEN:
m0 = Mathutils.Matrix()
m0[2][2]=0.0
mw *= m0 #flatten ViewMatrix
for ob in sel_group:
entities = []
mx = ob.matrix.copy()
mb = mx.copy()
#print 'deb: mb =\n', mb #---------
#print 'deb: mw0 =\n', mw0 #---------
mx_n = mx.rotationPart() * mw0.rotationPart() #trans-matrix for normal_vectors
if SCALE_FACTOR!=1.0: mx *= SCALE_FACTOR
if FLATTEN: mx *= mw
#mx_inv = mx.copy().invert()
#print 'deb: mx =\n', mx #---------
#print 'deb: mx_inv=\n', mx_inv #---------
if (ob.type == 'Mesh'):
entities = exportMesh(ob, mx, mx_n)
elif (ob.type == 'Curve'):
entities = exportCurve(ob, mx)
for e in entities:
d.append(e)
something_ready = True
if something_ready:
d.saveas(filepath)
Window.WaitCursor(0)
#Draw.PupMenu('DXF Exporter: job finished')
print 'exported to %s' % filepath
print 'finished in %.2f seconds' % (sys.time()-t)
else:
Window.WaitCursor(0)
print "Abort: selected objects dont mach choosen export option, nothing exported!"
Draw.PupMenu('DXF Exporter: nothing exported!|selected objects dont mach choosen export option!')
#----globals------------------------------------------
ONLYSELECTED = True
POLYLINES = True
ONLYFACES = False
POLYFACES = 1
FLATTEN = 0
HIDDEN_MODE = False #filter out hidden lines
SCALE_FACTOR = 1.0 #optional, can be done later in CAD too
#-----------------------------------------------------
def dxf_export_ui(filepath):
global ONLYSELECTED,\
POLYLINES,\
ONLYFACES,\
POLYFACES,\
FLATTEN,\
HIDDEN_MODE,\
SCALE_FACTOR
print '\n\nDXF-Export %s -----------------------' %__version__
#filepath = 'blend_test.dxf'
# Dont overwrite
if not BPyMessages.Warning_SaveOver(filepath):
print 'Aborted by user: nothing exported'
return
#test():return
PREF_ONLYSELECTED= Draw.Create(ONLYSELECTED)
PREF_POLYLINES= Draw.Create(POLYLINES)
PREF_ONLYFACES= Draw.Create(ONLYFACES)
PREF_POLYFACES= Draw.Create(POLYFACES)
PREF_FLATTEN= Draw.Create(FLATTEN)
PREF_HIDDEN_MODE= Draw.Create(HIDDEN_MODE)
PREF_SCALE_FACTOR= Draw.Create(SCALE_FACTOR)
PREF_HELP= Draw.Create(0)
block = [\
("only selected", PREF_ONLYSELECTED, "export only selected geometry"),\
("global Scale:", PREF_SCALE_FACTOR, 0.001, 1000, "set global Scale factor for exporting geometry"),\
("only faces", PREF_ONLYFACES, "from mesh-objects export only faces, otherwise only edges"),\
("write POLYFACE", PREF_POLYFACES, "export mesh to POLYFACE, otherwise to 3DFACEs"),\
("write POLYLINEs", PREF_POLYLINES, "export curve to POLYLINE, otherwise to LINEs"),\
("3D-View to Flat", PREF_FLATTEN, "flatten geometry according current 3d-View"),\
("Hidden Mode", PREF_HIDDEN_MODE, "filter out hidden lines"),\
#(''),\
("online Help", PREF_HELP, "calls DXF-Exporter Manual Page on Wiki.Blender.org"),\
]
if not Draw.PupBlock("DXF-Exporter %s" %__version__[:10], block): return
if PREF_HELP.val!=0:
try:
import webbrowser
webbrowser.open('http://wiki.blender.org/index.php?title=Scripts/Manual/Export/autodesk_dxf')
except:
Draw.PupMenu('DXF Exporter: %t|no connection to manual-page on Blender-Wiki! try:|\
http://wiki.blender.org/index.php?title=Scripts/Manual/Export/autodesk_dxf')
return
ONLYSELECTED = PREF_ONLYSELECTED.val
POLYLINES = PREF_POLYLINES.val
ONLYFACES = PREF_ONLYFACES.val
POLYFACES = PREF_POLYFACES.val
FLATTEN = PREF_FLATTEN.val
HIDDEN_MODE = PREF_HIDDEN_MODE.val
SCALE_FACTOR = PREF_SCALE_FACTOR.val
sce = Scene.GetCurrent()
if ONLYSELECTED: sel_group = sce.objects.selected
else: sel_group = sce.objects
if sel_group: do_export(sel_group, filepath)
else:
print "Abort: selection was empty, no object to export!"
Draw.PupMenu('DXF Exporter: nothing exported!|empty selection!')
# Timing the script is a good way to be aware on any speed hits when scripting
#-----------------------------------------------------
if __name__=='__main__':
#main()
if not copy:
Draw.PupMenu('Error%t|This script requires a full python install')
Window.FileSelector(dxf_export_ui, 'EXPORT DXF', sys.makename(ext='.dxf'))

View File

@@ -2887,7 +2887,7 @@ def fbx_ui():
def write_ui():
# globals
GLOBALS['EVENT'] = 2
GLOBALS['EVENT'] = EVENT_REDRAW
#GLOBALS['MOUSE'] = Window.GetMouseCoords()
GLOBALS['MOUSE'] = [i/2 for i in Window.GetScreenSize()]
GLOBALS['FILENAME'] = ''
@@ -2929,13 +2929,6 @@ def write_ui():
GLOBALS['_YROT90'] = Draw.Create(False)
GLOBALS['_ZROT90'] = Draw.Create(False)
# horrible ugly hack so tooltips draw, dosnt always work even
# Fixed in Draw.UIBlock for 2.45rc2, but keep this until 2.45 is released
Window.SetKeyQualifiers(0)
while Window.GetMouseButtons(): Blender.sys.sleep(10)
for i in xrange(100): Window.QHandle(i)
# END HORRID HACK
# best not do move the cursor
# Window.SetMouseCoords(*[i/2 for i in Window.GetScreenSize()])
@@ -2959,7 +2952,7 @@ def write_ui():
#fbx_ui_write('/test.fbx')
break
Draw.UIBlock(fbx_ui)
Draw.UIBlock(fbx_ui, 0)
# GLOBALS.clear()

View File

@@ -2,14 +2,14 @@
"""
Name: 'Wavefront (.obj)...'
Blender: 243
Blender: 248
Group: 'Export'
Tooltip: 'Save a Wavefront OBJ File'
"""
__author__ = "Campbell Barton, Jiri Hnidek"
__url__ = ['www.blender.org', 'blenderartists.org']
__version__ = "1.1"
__url__ = ['http://wiki.blender.org/index.php/Scripts/Manual/Export/wavefront_obj', 'www.blender.org', 'blenderartists.org']
__version__ = "1.2"
__bpydoc__ = """\
This script is an exporter to OBJ file format.
@@ -535,23 +535,31 @@ def write_ui(filename):
if not BPyMessages.Warning_SaveOver(filename):
return
EXPORT_APPLY_MODIFIERS = Draw.Create(1)
global EXPORT_APPLY_MODIFIERS, EXPORT_ROTX90, EXPORT_TRI, EXPORT_EDGES,\
EXPORT_NORMALS, EXPORT_NORMALS_HQ, EXPORT_UV,\
EXPORT_MTL, EXPORT_SEL_ONLY, EXPORT_ALL_SCENES,\
EXPORT_ANIMATION, EXPORT_COPY_IMAGES, EXPORT_BLEN_OBS,\
EXPORT_GROUP_BY_OB, EXPORT_GROUP_BY_MAT, EXPORT_KEEP_VERT_ORDER
EXPORT_APPLY_MODIFIERS = Draw.Create(0)
EXPORT_ROTX90 = Draw.Create(1)
EXPORT_TRI = Draw.Create(0)
EXPORT_EDGES = Draw.Create(1)
EXPORT_NORMALS = Draw.Create(0)
EXPORT_NORMALS_HQ = Draw.Create(1)
EXPORT_NORMALS_HQ = Draw.Create(0)
EXPORT_UV = Draw.Create(1)
EXPORT_MTL = Draw.Create(1)
EXPORT_SEL_ONLY = Draw.Create(1)
EXPORT_ALL_SCENES = Draw.Create(0)
EXPORT_ANIMATION = Draw.Create(0)
EXPORT_COPY_IMAGES = Draw.Create(0)
EXPORT_BLEN_OBS = Draw.Create(1)
EXPORT_BLEN_OBS = Draw.Create(0)
EXPORT_GROUP_BY_OB = Draw.Create(0)
EXPORT_GROUP_BY_MAT = Draw.Create(0)
EXPORT_KEEP_VERT_ORDER = Draw.Create(1)
# Old UI
'''
# removed too many options are bad!
# Get USER Options
@@ -580,12 +588,124 @@ def write_ui(filename):
if not Draw.PupBlock('Export...', pup_block):
return
'''
# BEGIN ALTERNATIVE UI *******************
if True:
EVENT_NONE = 0
EVENT_EXIT = 1
EVENT_REDRAW = 2
EVENT_EXPORT = 3
GLOBALS = {}
GLOBALS['EVENT'] = EVENT_REDRAW
#GLOBALS['MOUSE'] = Window.GetMouseCoords()
GLOBALS['MOUSE'] = [i/2 for i in Window.GetScreenSize()]
def obj_ui_set_event(e,v):
GLOBALS['EVENT'] = e
def do_split(e,v):
global EXPORT_BLEN_OBS, EXPORT_GROUP_BY_OB, EXPORT_GROUP_BY_MAT, EXPORT_APPLY_MODIFIERS, KEEP_VERT_ORDER
if EXPORT_BLEN_OBS.val or EXPORT_GROUP_BY_OB.val or EXPORT_GROUP_BY_MAT.val or EXPORT_APPLY_MODIFIERS.val:
EXPORT_KEEP_VERT_ORDER.val = 0
else:
EXPORT_KEEP_VERT_ORDER.val = 1
def do_vertorder(e,v):
global EXPORT_BLEN_OBS, EXPORT_GROUP_BY_OB, EXPORT_GROUP_BY_MAT, EXPORT_APPLY_MODIFIERS, KEEP_VERT_ORDER
if EXPORT_KEEP_VERT_ORDER.val:
EXPORT_BLEN_OBS.val = EXPORT_GROUP_BY_OB.val = EXPORT_GROUP_BY_MAT.val = EXPORT_APPLY_MODIFIERS.val = 0
else:
if not (EXPORT_BLEN_OBS.val or EXPORT_GROUP_BY_OB.val or EXPORT_GROUP_BY_MAT.val or EXPORT_APPLY_MODIFIERS.val):
EXPORT_KEEP_VERT_ORDER.val = 1
def do_help(e,v):
url = __url__[0]
print 'Trying to open web browser with documentation at this address...'
print '\t' + url
try:
import webbrowser
webbrowser.open(url)
except:
print '...could not open a browser window.'
def obj_ui():
ui_x, ui_y = GLOBALS['MOUSE']
# Center based on overall pup size
ui_x -= 165
ui_y -= 110
global EXPORT_APPLY_MODIFIERS, EXPORT_ROTX90, EXPORT_TRI, EXPORT_EDGES,\
EXPORT_NORMALS, EXPORT_NORMALS_HQ, EXPORT_UV,\
EXPORT_MTL, EXPORT_SEL_ONLY, EXPORT_ALL_SCENES,\
EXPORT_ANIMATION, EXPORT_COPY_IMAGES, EXPORT_BLEN_OBS,\
EXPORT_GROUP_BY_OB, EXPORT_GROUP_BY_MAT, EXPORT_KEEP_VERT_ORDER
Draw.Label('Context...', ui_x+9, ui_y+209, 220, 20)
Draw.BeginAlign()
EXPORT_SEL_ONLY = Draw.Toggle('Selection Only', EVENT_NONE, ui_x+9, ui_y+189, 110, 20, EXPORT_SEL_ONLY.val, 'Only export objects in visible selection. Else export whole scene.')
EXPORT_ALL_SCENES = Draw.Toggle('All Scenes', EVENT_NONE, ui_x+119, ui_y+189, 110, 20, EXPORT_ALL_SCENES.val, 'Each scene as a separate OBJ file.')
EXPORT_ANIMATION = Draw.Toggle('Animation', EVENT_NONE, ui_x+229, ui_y+189, 110, 20, EXPORT_ANIMATION.val, 'Each frame as a numbered OBJ file.')
Draw.EndAlign()
Draw.Label('Output Options...', ui_x+9, ui_y+159, 220, 20)
Draw.BeginAlign()
EXPORT_APPLY_MODIFIERS = Draw.Toggle('Apply Modifiers', EVENT_REDRAW, ui_x+9, ui_y+140, 110, 20, EXPORT_APPLY_MODIFIERS.val, 'Use transformed mesh data from each object. May break vert order for morph targets.', do_split)
EXPORT_ROTX90 = Draw.Toggle('Rotate X90', EVENT_NONE, ui_x+119, ui_y+140, 110, 20, EXPORT_ROTX90.val, 'Rotate on export so Blenders UP is translated into OBJs UP')
EXPORT_COPY_IMAGES = Draw.Toggle('Copy Images', EVENT_NONE, ui_x+229, ui_y+140, 110, 20, EXPORT_COPY_IMAGES.val, 'Copy image files to the export directory, never overwrite.')
Draw.EndAlign()
Draw.Label('Export...', ui_x+9, ui_y+109, 220, 20)
Draw.BeginAlign()
EXPORT_EDGES = Draw.Toggle('Edges', EVENT_NONE, ui_x+9, ui_y+90, 50, 20, EXPORT_EDGES.val, 'Edges not connected to faces.')
EXPORT_TRI = Draw.Toggle('Triangulate', EVENT_NONE, ui_x+59, ui_y+90, 70, 20, EXPORT_TRI.val, 'Triangulate quads.')
Draw.EndAlign()
Draw.BeginAlign()
EXPORT_MTL = Draw.Toggle('Materials', EVENT_NONE, ui_x+139, ui_y+90, 70, 20, EXPORT_MTL.val, 'Write a separate MTL file with the OBJ.')
EXPORT_UV = Draw.Toggle('UVs', EVENT_NONE, ui_x+209, ui_y+90, 31, 20, EXPORT_UV.val, 'Export texface UV coords.')
Draw.EndAlign()
Draw.BeginAlign()
EXPORT_NORMALS = Draw.Toggle('Normals', EVENT_NONE, ui_x+250, ui_y+90, 59, 20, EXPORT_NORMALS.val, 'Export vertex normal data (Ignored on import).')
EXPORT_NORMALS_HQ = Draw.Toggle('HQ', EVENT_NONE, ui_x+309, ui_y+90, 31, 20, EXPORT_NORMALS_HQ.val, 'Calculate high quality normals for rendering.')
Draw.EndAlign()
Draw.Label('Blender Objects as OBJ:', ui_x+9, ui_y+59, 220, 20)
Draw.BeginAlign()
EXPORT_BLEN_OBS = Draw.Toggle('Objects', EVENT_REDRAW, ui_x+9, ui_y+39, 60, 20, EXPORT_BLEN_OBS.val, 'Export blender objects as "OBJ objects".', do_split)
EXPORT_GROUP_BY_OB = Draw.Toggle('Groups', EVENT_REDRAW, ui_x+69, ui_y+39, 60, 20, EXPORT_GROUP_BY_OB.val, 'Export blender objects as "OBJ Groups".', do_split)
EXPORT_GROUP_BY_MAT = Draw.Toggle('Material Groups', EVENT_REDRAW, ui_x+129, ui_y+39, 100, 20, EXPORT_GROUP_BY_MAT.val, 'Group by materials.', do_split)
Draw.EndAlign()
EXPORT_KEEP_VERT_ORDER = Draw.Toggle('Keep Vert Order', EVENT_REDRAW, ui_x+239, ui_y+39, 100, 20, EXPORT_KEEP_VERT_ORDER.val, 'Keep vert and face order, disables some other options. Use for morph targets.', do_vertorder)
Draw.BeginAlign()
Draw.PushButton('Online Help', EVENT_REDRAW, ui_x+9, ui_y+9, 110, 20, 'Load the wiki page for this script', do_help)
Draw.PushButton('Cancel', EVENT_EXIT, ui_x+119, ui_y+9, 110, 20, '', obj_ui_set_event)
Draw.PushButton('Export', EVENT_EXPORT, ui_x+229, ui_y+9, 110, 20, 'Export with these settings', obj_ui_set_event)
Draw.EndAlign()
# hack so the toggle buttons redraw. this is not nice at all
while GLOBALS['EVENT'] not in (EVENT_EXIT, EVENT_EXPORT):
Draw.UIBlock(obj_ui, 0)
if GLOBALS['EVENT'] != EVENT_EXPORT:
return
# END ALTERNATIVE UI *********************
if EXPORT_KEEP_VERT_ORDER.val:
EXPORT_BLEN_OBS.val = False
EXPORT_GROUP_BY_OB.val = False
EXPORT_GROUP_BY_MAT.val = False
EXPORT_GROUP_BY_MAT.val = False
EXPORT_APPLY_MODIFIERS.val = False
Window.EditMode(0)

View File

@@ -448,11 +448,19 @@ def parse_help_info(script):
def parse_script_line(l):
tip = 'No tooltip'
try:
pieces = l.split("'")
name = pieces[1].replace('...','')
version, fname, userdir = pieces[2].strip().split()
tip = pieces[3]
data = pieces[2].strip().split()
version = data[0]
userdir = data[-1]
fname = data[1]
i = 1
while not fname.endswith('.py'):
i += 1
fname = '%s %s' % (fname, data[i])
if len(pieces) > 3: tip = pieces[3]
except:
return None

View File

@@ -128,17 +128,21 @@ hotkeys={
['RMB hold down', 'Popup menu'],
['Alt-RMB', 'Object Mode :Select but in a displayed list of objects located under the mouse cursor'],
['Alt-RMB', 'Edit Mode: Select EDGES LOOP '],
['Alt+Ctrl-RMB', 'Edit Mode: Select FACES LOOP'],
['Alt+Ctrl-RMB', 'UV Image Editor: Select face'],
['Alt-Ctrl-RMB', 'Edit Mode: Select FACES LOOP'],
['Alt-Ctrl-RMB', 'UV Image Editor: Select face'],
['Shift-RMB', 'Add/subtract to/from selection'],
['Wheel', 'Zoom view'],
['Transformations:', ''],
['Drag+Ctrl', 'Step adjustment'],
['Drag+Ctrl+Shift', 'Small step adjustment (Transform Widget : first select the axe or axes with LBM alone)'],
['Drag+Ctrl-Shift', 'Small step adjustment (Transform Widget : first select the axe or axes with LBM alone)'],
['Drag+Shift', 'Fine adjustment (Transform Widget : first select the axe or axes with LBM alone)'],
['LMB', 'Confirm transformation'],
['MMB', 'Toggle optional transform feature'],
['RMB', 'Abort transformation'],
['LMB', 'Grease Pencil: when "Draw Mode On", draw new stroke'],
['RMB', 'Grease Pencil: when "Draw Mode On", eraser tool for stroke segments'],
['Shift-LMB', 'Grease Pencil: draw new stroke'],
['Alt-RMB', 'Grease Pencil: eraser tool for stroke segments'],
['.', '...']
],
@@ -228,7 +232,7 @@ hotkeys={
['Home', 'OutLiner Windows, Show hierarchy'],
['PgUp', 'Edit Mode and Proportionnal Editing Tools, increase influence'],
['PgUp', 'Strip Editor, Move Down'],
['PgUn', 'TimeLine: Jump to next marker'],
['PgUp', 'TimeLine: Jump to next marker'],
['PgUp', 'IPO: Select next keyframe'],
['Ctrl-PgUp', 'IPO: Select and jump to next keyframe'],
['Ctrl-PgUn', 'TimeLine: Jump to next key'],
@@ -246,7 +250,6 @@ hotkeys={
['Alt-Up', 'Blender in Fullscreen mode'],
['Ctrl-Left', 'Previous screen'],
['Ctrl-Right', 'Next screen'],
['Ctrl-Alt-C', 'Object Mode : Add Constraint'],
['Ctrl-Down', 'Maximize window toggle'],
['Ctrl-Up', 'Maximize window toggle'],
['Shift-Arrow', 'Toggle first frame/ last frame'],
@@ -267,6 +270,7 @@ hotkeys={
['Ctrl-ALT-A', '3D-View: Armature Edit mode, align selected bones to active bone'],
['Shift-A', 'Sequencer: Add menu'],
['Shift-A', '3D-View: Add menu'],
['Shift-A', 'Sculpt Mode: Keep the brush center anchored to the initial location'],
['Shift-ALT-A', 'Play animation in all windows'],
['Shift-CTRL-A', 'Apply lattice / Make dupliverts real'],
['Shift-CTRL-A', 'Apply Deform '],
@@ -276,13 +280,13 @@ hotkeys={
"B":[
['B', 'Border select'],
['BB', 'Circle select'],
['Alt+B', 'Object Mode: Select visible view section in 3D space'],
['Alt-B', 'Object Mode: Select visible view section in 3D space'],
['Shift-B', 'Set render border (in active camera view)'],
['Ctrl-Alt+B', 'Object Mode: in 3D view, Bake (on an image in the uv editor window) the selected Meshes'], #243
['Ctrl-Alt+B', 'Object Mode: in 3D view, Bake Full render of selected Meshes'], #243
['Ctrl-Alt+B', 'Object Mode: in 3D view, Bake Ambient Occlusion of selected Meshes'], #243
['Ctrl-Alt+B', 'Object Mode: in 3D view, Bake Normals of the selected Meshes'], #243
['Ctrl-Alt+B', 'Object Mode: in 3D view, Bake Texture Only of selected Meshes'], #243
['Ctrl-Alt-B', 'Object Mode: in 3D view, Bake (on an image in the uv editor window) the selected Meshes'], #243
['Ctrl-Alt-B', 'Object Mode: in 3D view, Bake Full render of selected Meshes'], #243
['Ctrl-Alt-B', 'Object Mode: in 3D view, Bake Ambient Occlusion of selected Meshes'], #243
['Ctrl-Alt-B', 'Object Mode: in 3D view, Bake Normals of the selected Meshes'], #243
['Ctrl-Alt-B', 'Object Mode: in 3D view, Bake Texture Only of selected Meshes'], #243
['.', '...']
],
@@ -296,11 +300,12 @@ hotkeys={
['C', 'NODE window : Show cyclic referencies'], #243
['Alt-C', 'Object Mode: Convert menu'],
['Alt-C', 'Text Editor: Copy '],
['Ctrl-Alt-C', 'Object Mode : Add Constraint'],
['Ctrl-Shift-C', 'Text Editor: Copy selection to clipboard'],
['Ctrl-C', 'Copy menu (Copy properties of active to selected objects)'],
['Ctrl-C', 'UV Image Editor: Stick UVs to mesh vertex'],
['Ctrl-C','ARMATURE : posemode, Copy pose attributes'],
['Ctrl+Alt-C',' ARMATURE : posemode, add constraint to new empty object.'],
['Ctrl-Alt-C',' ARMATURE : posemode, add constraint to new empty object.'],
['Shift-C', 'Center and zoom view on selected objects'],
['Shift-C', 'UV Image Editor: Stick local UVs to mesh vertex'],
['.', '...']
@@ -394,9 +399,11 @@ hotkeys={
],
"I":[
['I', 'Keyframe menu'],
['Alt-I','ARMATURE : posemode, remove IK constraints.'],
['Ctrl-I','ARMATURE : add IK constraint'],
['I', 'Insert Keyframe menu'],
['Alt-I','Delete Keyframe menu'],
['Ctrl-I','Select Inverse'],
['Shift-I','ARMATURE : add IK constraint'],
['Ctrl-Alt-I','ARMATURE : posemode, remove IK constraints.'],
['.', '...']
],
@@ -434,6 +441,10 @@ hotkeys={
['Ctrl-L', 'Make links menu (for instance : to scene...)'],
['Shift-L', 'Select links menu'],
['Shift-L', 'NODE window: Select linked to '], #243
['Ctrl-L', 'POSELIB: browse poses'],
['Shift-L', 'POSELIB: add/replace pose'],
['Ctrl-Shift-L', 'POSELIB: rename pose'],
['Alt-L', 'POSELIB: remove pose'],
['.', '...']
],
@@ -484,8 +495,8 @@ hotkeys={
"P":[
['P', 'Object Mode: Start realtime engine'],
['P', 'Edit mode: Seperate vertices to new object'],
['shift-P', 'Edit mode: Push-Pull'],
['shift-P', 'Object mode: Add a preview window in the D window'],
['Shift-P', 'Edit mode: Push-Pull'],
['Shift-P', 'Object mode: Add a preview window in the D window'],
['P', 'UV Image Editor: Pin selected vertices. Pinned vertices will stay in place on the UV editor when executing an LSCM unwrap.'],
['Alt-P', 'Clear parent relationship'],
['Alt-P', 'UV Image Editor: Unpin UVs'],
@@ -494,6 +505,7 @@ hotkeys={
['Ctrl-Shift-P', 'Make active object parent of selected object without inverse'],
['Ctrl-P', 'Edit mode: Make active vertex parent of selected object'],
['Ctrl-P', 'ARMATURE : editmode, make bone parent.'],
['Ctrl-Alt-P', 'ARMATURE: edimode, separate bones to new object'],
['.', '...']
],
@@ -542,6 +554,7 @@ hotkeys={
['Alt-Shift-S,','Text editor : Select the line '],
['Ctrl-Alt-G', 'MANIPULATOR (transform widget): set in Size Mode'],
['Shift-S', 'Cursor/Grid snap menu'],
['Shift-S', 'Sculpt Mode: Smooth Stroke.'],
['Shift-S+1', 'VIDEO SEQUENCE editor : jump to the current frame '],
['.', '...']
],
@@ -557,7 +570,7 @@ hotkeys={
['Alt-T', 'Clear tracking of object'],
['Ctrl-T', 'Make selected object track active object'],
['Ctrl-T', 'Edit Mode: Convert to triangles'],
['Ctrl-ALT-T', 'Benchmark'],
['Ctrl-Alt-T', 'Benchmark'],
['.', '...']
],
@@ -595,9 +608,18 @@ hotkeys={
"W":[
['W', 'Edit Mode: Specials menu'],
['W', 'Edit Mode: Specials menu, ARMATURE 1 Subdivide'],
['W', 'Edit Mode: Specials menu, ARMATURE 2 Flip Left-Right Name'],
['W', 'Edit Mode: Specials menu, ARMATURE 2 Subdivide Multi'],
['W', 'Edit Mode: Specials menu, ARMATURE 3 Switch Direction'],
['W', 'Edit Mode: Specials menu, ARMATURE 4 Flip Left-Right Name'],
['W', 'Edit Mode: Specials menu, ARMATURE 5 AutoName Left-Right'],
['W', 'Edit Mode: Specials menu, ARMATURE 6 AutoName Front-Back'],
['W', 'Edit Mode: Specials menu, ARMATURE 7 AutoName Top-Bottom'],
['W', 'Edit Mode: Specials menu, CURVE 1 Subdivide'],
['W', 'Edit Mode: Specials menu, CURVE 2 Swich Direction'],
['W', 'Edit Mode: Specials menu, CURVE 3 Set Goal Weight'],
['W', 'Edit Mode: Specials menu, CURVE 4 Set Radius'],
['W', 'Edit Mode: Specials menu, CURVE 5 Smooth'],
['W', 'Edit Mode: Specials menu, CURVE 6 Smooth Radius'],
['W', 'Edit Mode: Specials menu, MESH 1 Subdivide'],
['W', 'Edit Mode: Specials menu, MESH 2 Subdivide Multi'],
['W', 'Edit Mode: Specials menu, MESH 3 Subdivide Multi Fractal'],
@@ -625,7 +647,6 @@ hotkeys={
['WY', 'UV Image Editor: Weld/Align Y axis'],
['Ctrl-W', 'Save current file'] ,
['Shift-W', 'Warp/bend selected vertices around cursor'],
['alt-W', 'Export in videoscape format'],
['.', '...']
],
@@ -636,6 +657,7 @@ hotkeys={
['X', 'IPO : Remove marker'],
['X', 'NODE window : delete'], #243
['Alt-X', 'Text Editor : Cut '],
['Alt-X', 'Grease Pencil: Delete menu'],
['Ctrl-X', 'Restore default state (Erase all)'],
['.', '...']
],

View File

@@ -2,14 +2,14 @@
"""
Name: 'Wavefront (.obj)...'
Blender: 242
Blender: 248
Group: 'Import'
Tooltip: 'Load a Wavefront OBJ File, Shift: batch import all dir.'
"""
__author__= "Campbell Barton", "Jiri Hnidek"
__url__= ["blender.org", "blenderartists.org"]
__version__= "2.0"
__url__= ['http://wiki.blender.org/index.php/Scripts/Manual/Import/wavefront_obj', 'blender.org', 'blenderartists.org']
__version__= "2.1"
__bpydoc__= """\
This script imports a Wavefront OBJ files to Blender.
@@ -756,19 +756,22 @@ def load_obj_ui(filepath, BATCH_LOAD= False):
if BPyMessages.Error_NoFile(filepath):
return
global CREATE_SMOOTH_GROUPS, CREATE_FGONS, CREATE_EDGES, SPLIT_OBJECTS, SPLIT_GROUPS, SPLIT_MATERIALS, CLAMP_SIZE, IMAGE_SEARCH, KEEP_VERT_ORDER
CREATE_SMOOTH_GROUPS= Draw.Create(0)
CREATE_FGONS= Draw.Create(1)
CREATE_EDGES= Draw.Create(1)
SPLIT_OBJECTS= Draw.Create(1)
SPLIT_GROUPS= Draw.Create(1)
SPLIT_MATERIALS= Draw.Create(1)
KEEP_VERT_ORDER= Draw.Create(1)
SPLIT_OBJECTS= Draw.Create(0)
SPLIT_GROUPS= Draw.Create(0)
SPLIT_MATERIALS= Draw.Create(0)
CLAMP_SIZE= Draw.Create(10.0)
IMAGE_SEARCH= Draw.Create(1)
KEEP_VERT_ORDER= Draw.Create(1)
# Get USER Options
# Note, Works but not pretty, instead use a more complicated GUI
'''
pup_block= [\
'Import...',\
('Smooth Groups', CREATE_SMOOTH_GROUPS, 'Surround smooth groups by sharp edges'),\
@@ -791,6 +794,102 @@ def load_obj_ui(filepath, BATCH_LOAD= False):
SPLIT_OBJECTS.val = False
SPLIT_GROUPS.val = False
SPLIT_MATERIALS.val = False
'''
# BEGIN ALTERNATIVE UI *******************
if True:
EVENT_NONE = 0
EVENT_EXIT = 1
EVENT_REDRAW = 2
EVENT_IMPORT = 3
GLOBALS = {}
GLOBALS['EVENT'] = EVENT_REDRAW
#GLOBALS['MOUSE'] = Window.GetMouseCoords()
GLOBALS['MOUSE'] = [i/2 for i in Window.GetScreenSize()]
def obj_ui_set_event(e,v):
GLOBALS['EVENT'] = e
def do_split(e,v):
global SPLIT_OBJECTS, SPLIT_GROUPS, SPLIT_MATERIALS, KEEP_VERT_ORDER
if SPLIT_OBJECTS.val or SPLIT_GROUPS.val or SPLIT_MATERIALS.val:
KEEP_VERT_ORDER.val = 0
else:
KEEP_VERT_ORDER.val = 1
def do_vertorder(e,v):
global SPLIT_OBJECTS, SPLIT_GROUPS, SPLIT_MATERIALS, KEEP_VERT_ORDER
if KEEP_VERT_ORDER.val:
SPLIT_OBJECTS.val = SPLIT_GROUPS.val = SPLIT_MATERIALS.val = 0
else:
if not (SPLIT_OBJECTS.val or SPLIT_GROUPS.val or SPLIT_MATERIALS.val):
KEEP_VERT_ORDER.val = 1
def do_help(e,v):
url = __url__[0]
print 'Trying to open web browser with documentation at this address...'
print '\t' + url
try:
import webbrowser
webbrowser.open(url)
except:
print '...could not open a browser window.'
def obj_ui():
ui_x, ui_y = GLOBALS['MOUSE']
# Center based on overall pup size
ui_x -= 165
ui_y -= 90
global CREATE_SMOOTH_GROUPS, CREATE_FGONS, CREATE_EDGES, SPLIT_OBJECTS, SPLIT_GROUPS, SPLIT_MATERIALS, CLAMP_SIZE, IMAGE_SEARCH, KEEP_VERT_ORDER
Draw.Label('Import...', ui_x+9, ui_y+159, 220, 21)
Draw.BeginAlign()
CREATE_SMOOTH_GROUPS = Draw.Toggle('Smooth Groups', EVENT_NONE, ui_x+9, ui_y+139, 110, 20, CREATE_SMOOTH_GROUPS.val, 'Surround smooth groups by sharp edges')
CREATE_FGONS = Draw.Toggle('NGons as FGons', EVENT_NONE, ui_x+119, ui_y+139, 110, 20, CREATE_FGONS.val, 'Import faces with more then 4 verts as fgons')
CREATE_EDGES = Draw.Toggle('Lines as Edges', EVENT_NONE, ui_x+229, ui_y+139, 110, 20, CREATE_EDGES.val, 'Import lines and faces with 2 verts as edges')
Draw.EndAlign()
Draw.Label('Separate objects by OBJ...', ui_x+9, ui_y+110, 220, 20)
Draw.BeginAlign()
SPLIT_OBJECTS = Draw.Toggle('Object', EVENT_REDRAW, ui_x+9, ui_y+89, 70, 21, SPLIT_OBJECTS.val, 'Import OBJ Objects into Blender Objects', do_split)
SPLIT_GROUPS = Draw.Toggle('Group', EVENT_REDRAW, ui_x+79, ui_y+89, 70, 21, SPLIT_GROUPS.val, 'Import OBJ Groups into Blender Objects', do_split)
SPLIT_MATERIALS = Draw.Toggle('Material', EVENT_REDRAW, ui_x+149, ui_y+89, 70, 21, SPLIT_MATERIALS.val, 'Import each material into a seperate mesh (Avoids > 16 per mesh error)', do_split)
Draw.EndAlign()
# Only used for user feedback
KEEP_VERT_ORDER = Draw.Toggle('Keep Vert Order', EVENT_REDRAW, ui_x+229, ui_y+89, 110, 21, KEEP_VERT_ORDER.val, 'Keep vert and face order, disables split options, enable for morph targets', do_vertorder)
Draw.Label('Options...', ui_x+9, ui_y+60, 211, 20)
CLAMP_SIZE = Draw.Number('Clamp Scale: ', EVENT_NONE, ui_x+9, ui_y+39, 211, 21, CLAMP_SIZE.val, 0.0, 1000.0, 'Clamp the size to this maximum (Zero to Disable)')
IMAGE_SEARCH = Draw.Toggle('Image Search', EVENT_NONE, ui_x+229, ui_y+39, 110, 21, IMAGE_SEARCH.val, 'Search subdirs for any assosiated images (Warning, may be slow)')
Draw.BeginAlign()
Draw.PushButton('Online Help', EVENT_REDRAW, ui_x+9, ui_y+9, 110, 21, 'Load the wiki page for this script', do_help)
Draw.PushButton('Cancel', EVENT_EXIT, ui_x+119, ui_y+9, 110, 21, '', obj_ui_set_event)
Draw.PushButton('Import', EVENT_IMPORT, ui_x+229, ui_y+9, 110, 21, 'Import with these settings', obj_ui_set_event)
Draw.EndAlign()
# hack so the toggle buttons redraw. this is not nice at all
while GLOBALS['EVENT'] not in (EVENT_EXIT, EVENT_IMPORT):
Draw.UIBlock(obj_ui, 0)
if GLOBALS['EVENT'] != EVENT_IMPORT:
return
# END ALTERNATIVE UI *********************
Window.WaitCursor(1)

1944
release/scripts/import_web3d.py Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -106,6 +106,12 @@ try:
except:
struct= chunk= cStringIO= None
# python 2.3 has no reversed() iterator. this will only work on lists and tuples
try:
reversed
except:
def reversed(l): return l[::-1]
### # Debuggin disabled in release.
### # do a search replace to enabe debug prints
### DEBUG = False

View File

@@ -216,7 +216,7 @@ def main():
# hack so the toggle buttons redraw. this is not nice at all
while GLOBALS['EVENT'] == EVENT_REDRAW:
Draw.UIBlock(terain_clamp_ui)
Draw.UIBlock(terain_clamp_ui, 0)
if __name__ == '__main__':
main()

View File

@@ -143,10 +143,10 @@ def file_callback(filename):
normal_key = rvec3d(normal)
if faceUV:
uvcoord= tuple(uv[j])
uvcoord= uv[j][0], 1.0-uv[j][1]
uvcoord_key = rvec2d(uvcoord)
elif vertexUV:
uvcoord= tuple(v.uvco)
uvcoord= v.uvco[0], 1.0-v.uvco[1]
uvcoord_key = rvec2d(uvcoord)
if vertexColors: color= col[j].r, col[j].g, col[j].b
@@ -209,8 +209,8 @@ def file_callback(filename):
for j, v in enumerate(f):
if f.smooth: normal= rvec3d(v.no)
else: normal= no
if faceUV: uvcoord= rvec2d(uv[j])
elif vertexUV: uvcoord= rvec2d(v.uvco)
if faceUV: uvcoord= rvec2d((uv[j][0], 1.0-uv[j][1]))
elif vertexUV: uvcoord= rvec2d((v.uvco[0], 1.0-v.uvco[1]))
if vertexColors: color= col[j].r, col[j].g, col[j].b
file.write('%d ' % vdict[v.index][normal, uvcoord, color])

View File

@@ -2,13 +2,13 @@
"""
Name: 'Stanford PLY (*.ply)...'
Blender: 241
Blender: 248
Group: 'Import'
Tip: 'Import a Stanford PLY file'
"""
__author__ = 'Bruce Merry'
__version__ = '0.92'
__version__ = '0.93'
__bpydoc__ = """\
This script imports Stanford PLY files into Blender. It supports per-vertex
normals, and per-face colours and texture coordinates.
@@ -35,20 +35,20 @@ Run this script from "File->Import" and select the desired PLY file.
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Updated by Campbell Barton AKA Ideasman, 10% faster code.
# 20th Oct 2008, 0.93 - Updated by Campbell Barton AKA ideasman42, use Mesh rather then NMesh, dont import normals, vcolors work again.
# Updated by Campbell Barton AKA Ideasman42, 10% faster code.
# Portions of this code are taken from mod_meshtools.py in Blender
# 2.32.
import Blender
try:
import re, struct, StringIO
import re, struct
except:
struct= None
class element_spec:
name = ''
count = 0
class element_spec(object):
__slots__ = 'name', 'count', 'properties'
def __init__(self, name, count):
self.name = name
self.count = count
@@ -64,10 +64,8 @@ class element_spec:
if p.name == name: return i
return -1
class property_spec:
name = ''
list_type = ''
numeric_type = ''
class property_spec(object):
__slots__ = 'name', 'list_type', 'numeric_type'
def __init__(self, name, list_type, numeric_type):
self.name = name
self.list_type = list_type
@@ -117,14 +115,17 @@ class property_spec:
else:
return self.read_format(format, 1, self.numeric_type, stream)[0]
class object_spec:
class object_spec(object):
__slots__ = 'specs'
'A list of element_specs'
specs = []
def __init__(self):
self.specs = []
def load(self, format, stream):
return dict([(i.name,[i.load(format, stream) for j in xrange(i.count) ]) for i in self.specs])
'''
# Longhand for above LC
answer = {}
for i in self.specs:
answer[i.name] = []
@@ -176,7 +177,7 @@ def read(filename):
if (len(tokens) < 3):
print 'Invalid format line'
return None
if (tokens[1] not in format_specs.keys()):
if (tokens[1] not in format_specs): # .keys()): # keys is implicit
print 'Unknown format', tokens[1]
return None
if (tokens[2] != version):
@@ -209,115 +210,132 @@ def read(filename):
return (obj_spec, obj);
def add_face(vertices, varr, indices, uvindices, colindices):
face = Blender.NMesh.Face([varr[i] for i in indices])
for index in indices:
vertex = vertices[index];
if uvindices:
face.uv.append((vertex[uvindices[0]], 1.0 - vertex[uvindices[1]]))
face.mode &= ~Blender.NMesh.FaceModes.TEX
if colindices:
if not uvindices: face.uv.append((0, 0)) # Force faceUV
face.col.append(Blender.NMesh.Col(vertex[colindices[0]], vertex[colindices[1]], vertex[colindices[2]], 255))
face.mode &= ~Blender.NMesh.FaceModes.TEX
return face
def filesel_callback(filename):
def load_ply(filename):
t = Blender.sys.time()
(obj_spec, obj) = read(filename)
obj_spec, obj = read(filename)
if obj == None:
print 'Invalid file'
return
vmap = {}
varr = []
uvindices = None
noindices = None
colindices = None
uvindices = colindices = None
# noindices = None # Ignore normals
for el in obj_spec.specs:
if el.name == 'vertex':
vindices = vindices_x, vindices_y, vindices_z = (el.index('x'), el.index('y'), el.index('z'))
if el.index('nx') >= 0 and el.index('ny') >= 0 and el.index('nz') >= 0:
noindices = (el.index('nx'), el.index('ny'), el.index('nz'))
if el.index('s') >= 0 and el.index('t') >= 0:
# noindices = (el.index('nx'), el.index('ny'), el.index('nz'))
# if -1 in noindices: noindices = None
uvindices = (el.index('s'), el.index('t'))
if el.index('red') >= 0 and el.index('green') and el.index('blue') >= 0:
if -1 in uvindices: uvindices = None
colindices = (el.index('red'), el.index('green'), el.index('blue'))
if -1 in colindices: colindices = None
elif el.name == 'face':
findex = el.index('vertex_indices')
mesh_faces = []
mesh_uvs = []
mesh_colors = []
mesh = Blender.NMesh.GetRaw()
NMVert = Blender.NMesh.Vert
for v in obj['vertex']:
def add_face(vertices, indices, uvindices, colindices):
mesh_faces.append(indices)
if uvindices: mesh_uvs.append([ (vertices[index][uvindices[0]], 1.0 - vertices[index][uvindices[1]]) for index in indices])
if colindices: mesh_colors.append([ (vertices[index][colindices[0]], vertices[index][colindices[1]], vertices[index][colindices[2]]) for index in indices])
if noindices > 0:
x,y,z,nx,ny,nz = vkey =\
(v[vindices_x], v[vindices_y], v[vindices_z],\
v[noindices[0]], v[noindices[1]], v[noindices[2]])
else:
x,y,z = vkey = (v[vindices_x], v[vindices_y], v[vindices_z])
#if not vmap.has_key(vkey):
try: # try uses 1 less dict lookup
varr.append(vmap[vkey])
except:
nmv = NMVert(vkey[0], vkey[1], vkey[2])
mesh.verts.append(nmv)
if noindices > 0:
nmv.no[0] = vkey[3]
nmv.no[1] = vkey[4]
nmv.no[2] = vkey[5]
vmap[vkey] = nmv
varr.append(vmap[vkey])
if uvindices or colindices:
# If we have Cols or UVs then we need to check the face order.
add_face_simple = add_face
# EVIL EEKADOODLE - face order annoyance.
def add_face(vertices, indices, uvindices, colindices):
if len(indices)==4:
if indices[2]==0 or indices[3]==0:
indices= indices[2], indices[3], indices[0], indices[1]
elif len(indices)==3:
if indices[2]==0:
indices= indices[1], indices[2], indices[0]
add_face_simple(vertices, indices, uvindices, colindices)
verts = obj['vertex']
if 'face' in obj:
for f in obj['face']:
ind = f[findex]
nind = len(ind)
if nind <= 4:
mesh.faces.append(add_face(verts, varr, ind, uvindices, colindices))
len_ind = len(ind)
if len_ind <= 4:
add_face(verts, ind, uvindices, colindices)
else:
for j in xrange(nind - 2):
mesh.faces.append(add_face(verts, varr, (ind[0], ind[j + 1], ind[j + 2]), uvindices, colindices))
# Fan fill the face
for j in xrange(len_ind - 2):
add_face(verts, (ind[0], ind[j + 1], ind[j + 2]), uvindices, colindices)
mesh = Blender.Mesh.New()
del obj # Reclaim memory
mesh.verts.extend([(v[vindices_x], v[vindices_y], v[vindices_z]) for v in obj['vertex']])
if mesh_faces:
mesh.faces.extend(mesh_faces, smooth=True, ignoreDups=True)
if uvindices or colindices:
if uvindices: mesh.faceUV = True
if colindices: mesh.vertexColors = True
for i, f in enumerate(mesh.faces):
if uvindices:
ply_uv = mesh_uvs[i]
for j, uv in enumerate(f.uv):
uv[:] = ply_uv[j]
if colindices:
ply_col = mesh_colors[i]
for j, col in enumerate(f.col):
col.r, col.g, col.b = ply_col[j]
mesh.calcNormals()
'''
if noindices:
normals = 1
else:
normals = 0
'''
objname = Blender.sys.splitext(Blender.sys.basename(filename))[0]
scn= Blender.Scene.GetCurrent()
scn.objects.selected = []
mesh.name= objname
scn.objects.new(mesh)
scn.objects.active = scn.objects.new(mesh)
Blender.Redraw()
Blender.Window.DrawProgressBar(1.0, '')
print '\nSuccessfully imported ' + Blender.sys.basename(filename) + ' ' + str(Blender.sys.time()-t)
print '\nSuccessfully imported "%s" in %.3f sec' % (filename, Blender.sys.time()-t)
def main():
if not struct:
Blender.Draw.PupMenu('This importer requires a full python install')
msg = 'This importer requires a full python install'
if Blender.mode == 'background': print msg
else: Blender.Draw.PupMenu(msg)
return
Blender.Window.FileSelector(filesel_callback, 'Import PLY', '*.ply')
Blender.Window.FileSelector(load_ply, 'Import PLY', '*.ply')
if __name__=='__main__':
main()
'''
import bpy
import os
files = os.popen('find /fe/ply -iname "*.ply"').readlines()
files.sort()
tot = len(files)
for i, f in enumerate(files):
if i < 26 or i > 1000000:
continue
#if i != 12686:
# continue
f = f.strip()
print f, i, tot
sce = bpy.data.scenes.new(f.split('/')[-1])
bpy.data.scenes.active = sce
# Window.
load_ply(f)
'''

View File

@@ -45,7 +45,7 @@ from Blender import Scene
sce = Scene.GetCurrent()
rend = sce.render
# default filename: theme's name + '_theme.py' in user's scripts dir:
# default filename: filename + scenename + '_renderlayer.py' in user's scripts dir:
default_fname = Blender.Get("scriptsdir")
if not default_fname:
default_fname = Blender.Get("uscriptsdir")
@@ -81,10 +81,10 @@ Remember to also set author, version and possibly url(s) above. You can also
define an __email__ tag, check some bundled script's source for examples.
\"\"\"
# This script was automatically generated by the save_theme.py bpython script.
# This script was automatically generated by the render_save_layers.py bpython script.
# By default, these generated scripts are released as Public Domain, but you
# are free to change the license of the scripts you generate with
# save_theme.py before releasing them.
# render_save_layers.py before releasing them.
import Blender
from Blender import Scene

View File

@@ -27,7 +27,7 @@ def main():
main()
'''
new_text = bpy.data.texts.new('gamelogic_example.py')
new_text = bpy.data.texts.new('gamelogic_simple.py')
new_text.write(script_data)
bpy.data.texts.active = new_text
Window.RedrawAll()

View File

@@ -47,6 +47,12 @@ def AngleBetweenVecs(a1,a2):
except:
return 180.0
# python 2.3 has no reversed() iterator. this will only work on lists and tuples
try:
reversed
except:
def reversed(l): return l[::-1]
class prettyface(object):
__slots__ = 'uv', 'width', 'height', 'children', 'xoff', 'yoff', 'has_parent', 'rot'
def __init__(self, data):
@@ -451,7 +457,10 @@ PREF_MARGIN_DIV= 512):
# Even boxes in groups of 4
for d, boxes in even_dict.items():
if d < max_int_dimension:
boxes.sort(key = lambda a: len(a.children))
# py 2.3 compat
try: boxes.sort(key = lambda a: len(a.children))
except: boxes.sort(lambda a, b: cmp(len(a.children), len(b.children)))
while len(boxes) >= 4:
# print "bar", len(boxes)
ok = True

View File

@@ -206,7 +206,7 @@ class VRML2Export:
if scene != inlines[0]:
return
else:
for i in range(allinlines):
for i in xrange(allinlines):
nameinline=inlines[i].getName()
if (nameinline not in self.namesStandard) and (i > 0):
self.writeIndented("DEF %s Inline {\n" % \
@@ -219,7 +219,7 @@ class VRML2Export:
def writeScript(self):
textEditor = Blender.Text.Get()
alltext = len(textEditor)
for i in range(alltext):
for i in xrange(alltext):
nametext = textEditor[i].getName()
nlines = textEditor[i].getNLines()
if (self.proto == 1):
@@ -227,14 +227,14 @@ class VRML2Export:
nametext == "proto.txt") and (nlines != None):
nalllines = len(textEditor[i].asLines())
alllines = textEditor[i].asLines()
for j in range(nalllines):
for j in xrange(nalllines):
self.writeIndented(alllines[j] + "\n")
elif (self.proto == 0):
if (nametext == "route" or nametext == "route.js" or \
nametext == "route.txt") and (nlines != None):
nalllines = len(textEditor[i].asLines())
alllines = textEditor[i].asLines()
for j in range(nalllines):
for j in xrange(nalllines):
self.writeIndented(alllines[j] + "\n")
self.writeIndented("\n")
@@ -556,21 +556,18 @@ class VRML2Export:
issmooth = 0
maters = me.materials
nummats = self.getNumMaterials(me)
nummats = len(me.materials)
# Vertex and Face colors trump materials and image textures
if (self.facecolors or self.vcolors):
if nummats > 0:
if maters[0]:
self.writeShape(ob, me, 0, None)
else:
self.writeShape(ob, me, -1, None)
else:
self.writeShape(ob, me, -1, None)
# Do meshes with materials, possible with image textures
# Do meshes with materials, possibly with image textures
elif nummats > 0:
for matnum in range(len(maters)):
if maters[matnum]:
for matnum in xrange(len(maters)):
images = []
if me.faceUV:
images = self.getImages(me, matnum)
@@ -608,15 +605,6 @@ class VRML2Export:
imageNames[imName]=1
return images
def getNumMaterials(self, me):
# Oh silly Blender, why do you sometimes have 'None' as
# a member of the me.materials array?
num = 0
for mat in me.materials:
if mat:
num = num + 1
return num
def writeCoordinates(self, me, meshName):
coordName = "coord_%s" % (meshName)
# look up coord name, use it if available
@@ -644,20 +632,43 @@ class VRML2Export:
self.writeIndented("}\n", -1)
self.writeIndented("\n")
def testShape(self, ob, me, matnum, image):
if ( (matnum == -1) and (image == None) ):
if ( len(me.faces) > 0 ):
return True
# Check if any faces the material or image
for face in me.faces:
if (matnum == -1):
if (face.image == image):
return True
elif (image == None):
if (face.mat == matnum):
return True
else:
if ((face.image == image) and (face.mat == matnum)):
return True
return False
def writeShape(self, ob, me, matnum, image):
# Note: at this point it is assumed for matnum!=-1 that the
# material in me.materials[matnum] is not equal to 'None'.
# Such validation should be performed by the function that
# calls this one.
# matnum == -1 means don't check the face.mat
# image == None means don't check face.image
if ( not self.testShape(ob, me, matnum, image) ):
return False
self.writeIndented("Shape {\n",1)
self.writeIndented("appearance Appearance {\n", 1)
if (matnum != -1):
mater = me.materials[matnum]
if (mater):
self.writeMaterial(mater, self.cleanStr(mater.name,''))
if (mater.mode & Blender.Material.Modes['TEXFACE']):
if image != None:
self.writeImageTexture(image.name, image.filename)
else:
self.writeDefaultMaterial()
else:
if image != None:
self.writeImageTexture(image.name, image.filename)
@@ -668,6 +679,8 @@ class VRML2Export:
self.writeIndented("}\n", -1)
return True
def writeGeometry(self, ob, me, matnum, image):
#-- IndexedFaceSet or IndexedLineSet
@@ -723,7 +736,7 @@ class VRML2Export:
indexStr = ""
if (matnum == -1) or (face.mat == matnum):
if (face.image == image):
for i in range(len(face.verts)):
for i in xrange(len(face.verts)):
uv = face.uv[i]
indexStr += "%s " % (j)
coordStr += "%s %s, " % \
@@ -770,13 +783,13 @@ class VRML2Export:
cols = [None] * len(me.verts)
for face in me.faces:
for vind in range(len(face.v)):
for vind in xrange(len(face.v)):
vertex = face.v[vind]
i = vertex.index
if cols[i] == None:
cols[i] = face.col[vind]
for i in range(len(me.verts)):
for i in xrange(len(me.verts)):
aColor = self.rgbToFS(cols[i])
self.writeUnindented("%s\n" % aColor)
@@ -784,6 +797,23 @@ class VRML2Export:
self.writeIndented("]\n",-1)
self.writeIndented("}\n",-1)
def writeDefaultMaterial(self):
matName = "default"
# look up material name, use it if available
if self.matNames.has_key(matName):
self.writeIndented("material USE MA_%s\n" % matName)
self.matNames[matName]+=1
return;
self.matNames[matName]=1
self.writeIndented("material DEF MA_%s Material {\n" % matName, 1)
self.writeIndented("diffuseColor 0.8 0.8 0.8\n")
self.writeIndented("specularColor 1.0 1.0 1.0\n")
self.writeIndented("shininess 0.5\n")
self.writeIndented("transparency 0.0\n")
self.writeIndented("}\n",-1)
def writeMaterial(self, mat, matName):
# look up material name, use it if available
if self.matNames.has_key(matName):

View File

@@ -61,6 +61,12 @@ def AngleBetweenVecsSafe(a1, a2):
except:
return 180.0
# Python 2.3 has no reversed.
try:
reversed
except:
def reversed(l): return l[::-1]
# Copied from blender, we could wrap this! - BKE_curve.c
# But probably not toooo bad in python
def forward_diff_bezier(q0, q1, q2, q3, pointlist, steps, axis):
@@ -266,7 +272,9 @@ class tree:
brch.calcData()
# Sort from big to small, so big branches get priority
self.branches_all.sort( key = lambda brch: -brch.bpoints[0].radius )
# Py 2.3 dosnt have keywords in sort
try: self.branches_all.sort( key = lambda brch: -brch.bpoints[0].radius )
except: self.branches_all.sort( lambda brch_a, brch_b: cmp(brch_b.bpoints[0].radius, brch_a.bpoints[0].radius) ) # py2.3
def closestBranchPt(self, co):
@@ -1144,7 +1152,8 @@ class tree:
# Try sorting by other properties! this is ok for now
for segments_level_current in segments_level:
segments_level_current.sort( key = lambda seg: -(seg.headCo-seg.tailCo).length )
try: segments_level_current.sort( key = lambda seg: -(seg.headCo-seg.tailCo).length )
except: segments_level_current.sort( lambda a,b: cmp((b.headCo-b.tailCo).length, (a.headCo-a.tailCo).length) ) # py2.3
for level in xrange(twig_fill_levels):
if len(segments_level) > level:
@@ -1370,18 +1379,23 @@ class tree:
# Get the branches based on our selection method!
if twig_select_mode==0:
branches_sorted.sort( key = lambda brch: brch.getLength())
try: branches_sorted.sort( key = lambda brch: brch.getLength())
except: branches_sorted.sort( lambda a,b: cmp(a.getLength(),a.getLength()) ) # py2.3
elif twig_select_mode==1:
branches_sorted.sort( key = lambda brch:-brch.getLength())
try: branches_sorted.sort( key = lambda brch:-brch.getLength())
except: branches_sorted.sort( lambda a,b: cmp(b.getLength(), a.getLength()) ) # py2.3
elif twig_select_mode==2:
branches_sorted.sort( key = lambda brch:brch.getStraightness())
try: branches_sorted.sort( key = lambda brch:brch.getStraightness())
except: branches_sorted.sort( lambda a,b: cmp(a.getStraightness(), b.getStraightness())) # py2.3
elif twig_select_mode==3:
branches_sorted.sort( key = lambda brch:-brch.getStraightness())
try: branches_sorted.sort( key = lambda brch:-brch.getStraightness())
except: branches_sorted.sort( lambda a,b: cmp(b.getStraightness(), a.getStraightness())) # py2.3
factor_int = int(len(self.branches_all) * twig_select_factor)
branches_sorted[factor_int:] = [] # remove the last part of the list
branches_sorted.sort( key = lambda brch: len(brch.bpoints))
try: branches_sorted.sort( key = lambda brch: len(brch.bpoints))
except: branches_sorted.sort( lambda a,b: cmp(len(a.bpoints), len(b.bpoints)) ) # py2.3
branches_new = []
#for i in xrange(ratio_int):

View File

@@ -1,37 +1,37 @@
PSF LICENSE AGREEMENT FOR PYTHON 2.3
------------------------------------
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
--------------------------------------------
1. This LICENSE AGREEMENT is between the Python Software Foundation
("PSF"), and the Individual or Organization ("Licensee") accessing and
otherwise using Python 2.3 software in source or binary form and its
associated documentation.
otherwise using this software ("Python") in source or binary form and
its associated documentation.
2. Subject to the terms and conditions of this License Agreement, PSF
hereby grants Licensee a nonexclusive, royalty-free, world-wide
license to reproduce, analyze, test, perform and/or display publicly,
prepare derivative works, distribute, and otherwise use Python 2.3
prepare derivative works, distribute, and otherwise use Python
alone or in any derivative version, provided, however, that PSF's
License Agreement and PSF's notice of copyright, i.e., "Copyright (c)
2001, 2002, 2003 Python Software Foundation; All Rights Reserved" are
retained in Python 2.3 alone or in any derivative version prepared by
Licensee.
2001, 2002, 2003, 2004, 2005, 2006 Python Software Foundation; All Rights
Reserved" are retained in Python alone or in any derivative version
prepared by Licensee.
3. In the event Licensee prepares a derivative work that is based on
or incorporates Python 2.3 or any part thereof, and wants to make
or incorporates Python or any part thereof, and wants to make
the derivative work available to others as provided herein, then
Licensee hereby agrees to include in any such work a brief summary of
the changes made to Python 2.3.
the changes made to Python.
4. PSF is making Python 2.3 available to Licensee on an "AS IS"
4. PSF is making Python available to Licensee on an "AS IS"
basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 2.3 WILL NOT
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
INFRINGE ANY THIRD PARTY RIGHTS.
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
2.3 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 2.3,
FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
6. This License Agreement will automatically terminate upon a material
@@ -43,6 +43,7 @@ Licensee. This License Agreement does not grant permission to use PSF
trademarks or trade name in a trademark sense to endorse or promote
products or services of Licensee, or any third party.
8. By copying, installing or otherwise using Python 2.3, Licensee
8. By copying, installing or otherwise using Python, Licensee
agrees to be bound by the terms and conditions of this License
Agreement.

Some files were not shown because too many files have changed in this diff Show More