1
1

merge from trunk - r17500 to HEAD

This commit is contained in:
2008-12-10 09:45:48 +00:00
70 changed files with 1847 additions and 450 deletions

231
config/irix6-config.py Normal file
View File

@@ -0,0 +1,231 @@
import os
LCGDIR = os.getcwd()+"/../lib/irix-6.5-mips"
LIBDIR = LCGDIR
print LCGDIR
WITH_BF_VERSE = 'false'
BF_VERSE_INCLUDE = "#extern/verse/dist"
BF_PYTHON = LCGDIR+'/python'
BF_PYTHON_VERSION = '2.5'
WITH_BF_STATICPYTHON = 'true'
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/python2.5/config/libpython${BF_PYTHON_VERSION}.a'
WITH_BF_OPENAL = 'true'
WITH_BF_STATICOPENAL = 'true'
BF_OPENAL = LCGDIR+'/openal'
BF_OPENAL_INC = '${BF_OPENAL}/include'
BF_OPENAL_LIB = 'openal'
BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
BF_OPENAL_LIBPATH = LIBDIR + '/lib'
# some distros have a separate libalut
# if you get linker complaints, you need to uncomment the line below
# BF_OPENAL_LIB = 'openal alut'
# BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a ${BF_OPENAL}/lib/libalut.a'
BF_CXX = '/usr'
WITH_BF_STATICCXX = 'false'
BF_CXX_LIB_STATIC = '${BF_CXX}/lib/libstdc++.a'
WITH_BF_SDL = 'true'
BF_SDL = LCGDIR+'/SDL' #$(shell sdl-config --prefix)
BF_SDL_INC = '${BF_SDL}/include/SDL' #$(shell $(BF_SDL)/bin/sdl-config --cflags)
BF_SDL_LIB = 'SDL audio iconv charset' #BF_SDL #$(shell $(BF_SDL)/bin/sdl-config --libs) -lSDL_mixer
BF_SDL_LIBPATH = '${BF_SDL}/lib'
WITH_BF_FMOD = 'false'
BF_FMOD = LIBDIR + '/fmod'
WITH_BF_OPENEXR = 'false'
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'
BF_OPENEXR_INC = '${BF_OPENEXR}/include/OpenEXR'
BF_OPENEXR_LIB = 'Half IlmImf Iex Imath '
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'
# BF_OPENEXR_LIBPATH = '${BF_OPENEXR}/lib'
WITH_BF_DDS = 'false'
WITH_BF_JPEG = 'false'
BF_JPEG = LCGDIR+'/jpeg'
BF_JPEG_INC = '${BF_JPEG}/include'
BF_JPEG_LIB = 'jpeg'
BF_JPEG_LIBPATH = '${BF_JPEG}/lib'
WITH_BF_PNG = 'false'
BF_PNG = LCGDIR+"/png"
BF_PNG_INC = '${BF_PNG}/include'
BF_PNG_LIB = 'png'
BF_PNG_LIBPATH = '${BF_PNG}/lib'
BF_TIFF = '/usr/nekoware'
BF_TIFF_INC = '${BF_TIFF}/include'
WITH_BF_ZLIB = 'true'
BF_ZLIB = LCGDIR+"/zlib"
BF_ZLIB_INC = '${BF_ZLIB}/include'
BF_ZLIB_LIB = 'z'
BF_ZLIB_LIBPATH = '${BF_ZLIB}/lib'
WITH_BF_INTERNATIONAL = 'true'
BF_GETTEXT = LCGDIR+'/gettext'
BF_GETTEXT_INC = '${BF_GETTEXT}/include'
BF_GETTEXT_LIB = 'gettextpo intl'
BF_GETTEXT_LIBPATH = '${BF_GETTEXT}/lib'
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_ODE = 'false'
BF_ODE = LIBDIR + '/ode'
BF_ODE_INC = BF_ODE + '/include'
BF_ODE_LIB = BF_ODE + '/lib/libode.a'
WITH_BF_BULLET = 'true'
BF_BULLET = '#extern/bullet2/src'
BF_BULLET_INC = '${BF_BULLET}'
BF_BULLET_LIB = 'extern_bullet'
BF_SOLID = '#extern/solid'
BF_SOLID_INC = '${BF_SOLID}'
BF_SOLID_LIB = 'extern_solid'
WITH_BF_YAFRAY = 'true'
#WITH_BF_NSPR = 'true'
#BF_NSPR = $(LIBDIR)/nspr
#BF_NSPR_INC = -I$(BF_NSPR)/include -I$(BF_NSPR)/include/nspr
#BF_NSPR_LIB =
# Uncomment the following line to use Mozilla inplace of netscape
#CPPFLAGS += -DMOZ_NOT_NET
# Location of MOZILLA/Netscape header files...
#BF_MOZILLA = $(LIBDIR)/mozilla
#BF_MOZILLA_INC = -I$(BF_MOZILLA)/include/mozilla/nspr -I$(BF_MOZILLA)/include/mozilla -I$(BF_MOZILLA)/include/mozilla/xpcom -I$(BF_MOZILLA)/include/mozilla/idl
#BF_MOZILLA_LIB =
# Will fall back to look in BF_MOZILLA_INC/nspr and BF_MOZILLA_LIB
# if this is not set.
#
# Be paranoid regarding library creation (do not update archives)
#BF_PARANOID = 'true'
# enable freetype2 support for text objects
BF_FREETYPE = LCGDIR+'/freetype'
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
BF_QUICKTIME = '/usr/local'
BF_QUICKTIME_INC = '${BF_QUICKTIME}/include'
WITH_BF_ICONV = 'true'
BF_ICONV = LIBDIR + "/iconv"
BF_ICONV_INC = '${BF_ICONV}/include'
BF_ICONV_LIB = 'iconv charset'
BF_ICONV_LIBPATH = '${BF_ICONV}/lib'
WITH_BF_BINRELOC = 'false'
# enable ffmpeg support
WITH_BF_FFMPEG = 'true' # -DWITH_FFMPEG
# Uncomment the following two lines to use system's ffmpeg
BF_FFMPEG = LCGDIR+'/ffmpeg'
BF_FFMPEG_LIB = 'avformat avcodec swscale avutil faad faac vorbis x264 ogg mp3lame z'
BF_FFMPEG_INC = '${BF_FFMPEG}/include'
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
# 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 = 'false'
BF_OPENJPEG = '#extern/libopenjpeg'
BF_OPENJPEG_LIB = ''
BF_OPENJPEG_INC = '${BF_OPENJPEG}/include'
BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
WITH_BF_REDCODE = 'false'
BF_REDCODE = '#extern/libredcode'
BF_REDCODE_LIB = ''
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'
BF_OPENGL = '/usr'
BF_OPENGL_INC = '${BF_OPENGL}/include'
BF_OPENGL_LIB = 'GL GLU X11 Xi Xext'
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'
CC = 'c99'
CXX = 'CC'
CCFLAGS = ['-pipe','-fPIC', '-n32']
CPPFLAGS = ['-DXP_UNIX']
CXXFLAGS = ['-pipe','-fPIC', '-n32']
REL_CFLAGS = ['-O2']
REL_CCFLAGS = ['-O2']
##BF_DEPEND = 'true'
##
##AR = ar
##ARFLAGS = ruv
##ARFLAGSQUIET = ru
##
C_WARN = '-no_prelink -ptused'
CC_WARN = '-no_prelink -ptused'
##FIX_STUBS_WARNINGS = -Wno-unused
LLIBS = 'c m dl pthread dmedia movie'
##LOPTS = --dynamic
##DYNLDFLAGS = -shared $(LDFLAGS)
BF_PROFILE_FLAGS = ['-pg','-g']
BF_PROFILE = 'false'
BF_DEBUG = 'false'
BF_DEBUG_FLAGS = '-g'
BF_BUILDDIR = '../build/irix6'
BF_INSTALLDIR='../install/irix6'
BF_DOCDIR='../install/doc'
#Link against pthread
LDIRS = []
LDIRS.append(BF_FREETYPE_LIBPATH)
LDIRS.append(BF_PNG_LIBPATH)
LDIRS.append(BF_ZLIB_LIBPATH)
LDIRS.append(BF_SDL_LIBPATH)
LDIRS.append(BF_OPENAL_LIBPATH)
LDIRS.append(BF_ICONV_LIBPATH)
PLATFORM_LINKFLAGS = []
for x in LDIRS:
PLATFORM_LINKFLAGS.append("-L"+x)
PLATFORM_LINKFLAGS += ['-L${LCGDIR}/jpeg/lib' , '-L/usr/lib32', '-n32', '-v', '-no_prelink']
print PLATFORM_LINKFLAGS
LINKFLAGS= PLATFORM_LINKFLAGS

5
extern/Makefile vendored
View File

@@ -57,10 +57,7 @@ ifeq ($(WITH_BINRELOC), true)
DIRS += binreloc
endif
TARGET =
ifneq ($(OS),irix)
TARGET=solid
endif
TARGET = solid
all::
@[ -d $(OCGDIR)/extern ] || mkdir -p $(OCGDIR)/extern

View File

@@ -47,6 +47,9 @@ ifneq ($(NAN_NO_OPENAL),true)
ifeq ($(OS),$(findstring $(OS), "linux freebsd solaris"))
DIRS += openal sdl
endif
ifeq ($(OS), irix)
DIRS += sdl
endif
else
export CPPFLAGS += -DNO_SOUND
endif

View File

@@ -154,12 +154,18 @@ int writePng(const char *fileName, unsigned char **rowsp, int w, int h);
*/
/* minimum */
#ifdef MIN
#undef MIN
#endif
template < class T >
inline T
MIN( T a, T b )
{ return (a < b) ? a : b ; }
/* maximum */
#ifdef MAX
#undef MAX
#endif
template < class T >
inline T
MAX( T a, T b )

View File

@@ -151,6 +151,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "blenderplayer", "..\gameeng
{415BFD6E-64CF-422B-AF88-C07F040A7292} = {415BFD6E-64CF-422B-AF88-C07F040A7292}
{670EC17A-0548-4BBF-A27B-636C7C188139} = {670EC17A-0548-4BBF-A27B-636C7C188139}
{4C3AB78A-52CA-4276-A041-39776E52D8C8} = {4C3AB78A-52CA-4276-A041-39776E52D8C8}
{E784098D-3ED8-433A-9353-9679415DDDC5} = {E784098D-3ED8-433A-9353-9679415DDDC5}
{6B801390-5F95-4F07-81A7-97FBA046AACC} = {6B801390-5F95-4F07-81A7-97FBA046AACC}
{CAE37E91-6570-43AC-A4B4-7A37A4B0FC94} = {CAE37E91-6570-43AC-A4B4-7A37A4B0FC94}
{76D90B92-ECC7-409C-9F98-A8814B90F3C0} = {76D90B92-ECC7-409C-9F98-A8814B90F3C0}
@@ -167,13 +168,16 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "blenderplayer", "..\gameeng
{E90C7BC2-CF30-4A60-A8F2-0050D592E358} = {E90C7BC2-CF30-4A60-A8F2-0050D592E358}
{8B8D4FC3-3234-4E54-8376-5AB83D00D164} = {8B8D4FC3-3234-4E54-8376-5AB83D00D164}
{4B6AFCC5-968C-424A-8F20-76E41B3BEF74} = {4B6AFCC5-968C-424A-8F20-76E41B3BEF74}
{0112CAD5-3584-412A-A2E5-1315A00437B4} = {0112CAD5-3584-412A-A2E5-1315A00437B4}
{5A2EA6DC-1A53-4E87-9166-52870CE3B4EA} = {5A2EA6DC-1A53-4E87-9166-52870CE3B4EA}
{E86B7BDE-C33C-4E55-9433-E74C141D7538} = {E86B7BDE-C33C-4E55-9433-E74C141D7538}
{32CC75E2-EE85-45E6-8E3D-513F58464F43} = {32CC75E2-EE85-45E6-8E3D-513F58464F43}
{9A307EE5-CD77-47BC-BD87-62508C7E19D8} = {9A307EE5-CD77-47BC-BD87-62508C7E19D8}
{AB590CED-F71F-4A17-A89B-18583ECD633D} = {AB590CED-F71F-4A17-A89B-18583ECD633D}
{B83C6BED-11EC-46C8-AFFA-121EEDE94373} = {B83C6BED-11EC-46C8-AFFA-121EEDE94373}
{1CC733F1-6AB5-4904-8F63-C08C46B79DD9} = {1CC733F1-6AB5-4904-8F63-C08C46B79DD9}
{B789C2F3-279E-4A85-8F0A-7F7AC068E598} = {B789C2F3-279E-4A85-8F0A-7F7AC068E598}
{524264F4-DF21-4B79-847F-E7CA643ECD0B} = {524264F4-DF21-4B79-847F-E7CA643ECD0B}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KX_blenderhook", "..\gameengine\blenderhook\KX_blenderhook.vcproj", "{8154A59A-CAED-403D-AB94-BC4E7C032666}"
@@ -621,19 +625,25 @@ Global
{0112CAD5-3584-412A-A2E5-1315A00437B4}.Blender Release|Win32.ActiveCfg = Blender Release|Win32
{0112CAD5-3584-412A-A2E5-1315A00437B4}.Blender Release|Win32.Build.0 = Blender Release|Win32
{0112CAD5-3584-412A-A2E5-1315A00437B4}.BlenderPlayer Debug|Win32.ActiveCfg = Blender Debug|Win32
{0112CAD5-3584-412A-A2E5-1315A00437B4}.BlenderPlayer Debug|Win32.Build.0 = Blender Debug|Win32
{0112CAD5-3584-412A-A2E5-1315A00437B4}.BlenderPlayer Release|Win32.ActiveCfg = Blender Release|Win32
{0112CAD5-3584-412A-A2E5-1315A00437B4}.BlenderPlayer Release|Win32.Build.0 = Blender Release|Win32
{B83C6BED-11EC-46C8-AFFA-121EEDE94373}.Blender Debug|Win32.ActiveCfg = Blender Debug|Win32
{B83C6BED-11EC-46C8-AFFA-121EEDE94373}.Blender Debug|Win32.Build.0 = Blender Debug|Win32
{B83C6BED-11EC-46C8-AFFA-121EEDE94373}.Blender Release|Win32.ActiveCfg = Blender Release|Win32
{B83C6BED-11EC-46C8-AFFA-121EEDE94373}.Blender Release|Win32.Build.0 = Blender Release|Win32
{B83C6BED-11EC-46C8-AFFA-121EEDE94373}.BlenderPlayer Debug|Win32.ActiveCfg = Blender Debug|Win32
{B83C6BED-11EC-46C8-AFFA-121EEDE94373}.BlenderPlayer Debug|Win32.Build.0 = Blender Debug|Win32
{B83C6BED-11EC-46C8-AFFA-121EEDE94373}.BlenderPlayer Release|Win32.ActiveCfg = Blender Release|Win32
{B83C6BED-11EC-46C8-AFFA-121EEDE94373}.BlenderPlayer Release|Win32.Build.0 = Blender Release|Win32
{524264F4-DF21-4B79-847F-E7CA643ECD0B}.Blender Debug|Win32.ActiveCfg = Blender Debug|Win32
{524264F4-DF21-4B79-847F-E7CA643ECD0B}.Blender Debug|Win32.Build.0 = Blender Debug|Win32
{524264F4-DF21-4B79-847F-E7CA643ECD0B}.Blender Release|Win32.ActiveCfg = Blender Release|Win32
{524264F4-DF21-4B79-847F-E7CA643ECD0B}.Blender Release|Win32.Build.0 = Blender Release|Win32
{524264F4-DF21-4B79-847F-E7CA643ECD0B}.BlenderPlayer Debug|Win32.ActiveCfg = Blender Debug|Win32
{524264F4-DF21-4B79-847F-E7CA643ECD0B}.BlenderPlayer Debug|Win32.Build.0 = Blender Debug|Win32
{524264F4-DF21-4B79-847F-E7CA643ECD0B}.BlenderPlayer Release|Win32.ActiveCfg = Blender Release|Win32
{524264F4-DF21-4B79-847F-E7CA643ECD0B}.BlenderPlayer Release|Win32.Build.0 = Blender Release|Win32
{D696C86B-0B53-4471-A50D-5B983A6FA4AD}.Blender Debug|Win32.ActiveCfg = Blender Debug|Win32
{D696C86B-0B53-4471-A50D-5B983A6FA4AD}.Blender Debug|Win32.Build.0 = Blender Debug|Win32
{D696C86B-0B53-4471-A50D-5B983A6FA4AD}.Blender Release|Win32.ActiveCfg = Blender Release|Win32
@@ -669,6 +679,7 @@ Global
{6461F05D-4698-47AB-A8E8-1CA2ACC9948B}.Blender Release|Win32.ActiveCfg = Blender Release|Win32
{6461F05D-4698-47AB-A8E8-1CA2ACC9948B}.Blender Release|Win32.Build.0 = Blender Release|Win32
{6461F05D-4698-47AB-A8E8-1CA2ACC9948B}.BlenderPlayer Debug|Win32.ActiveCfg = Blender Debug|Win32
{6461F05D-4698-47AB-A8E8-1CA2ACC9948B}.BlenderPlayer Debug|Win32.Build.0 = Blender Debug|Win32
{6461F05D-4698-47AB-A8E8-1CA2ACC9948B}.BlenderPlayer Release|Win32.ActiveCfg = Blender Release|Win32
{6461F05D-4698-47AB-A8E8-1CA2ACC9948B}.BlenderPlayer Release|Win32.Build.0 = Blender Release|Win32
{531D4862-D0E7-4B9B-A0B6-B3A6A25B547A}.Blender Debug|Win32.ActiveCfg = Blender Debug|Win32
@@ -694,7 +705,9 @@ Global
{E784098D-3ED8-433A-9353-9679415DDDC5}.Blender Release|Win32.ActiveCfg = Blender Release|Win32
{E784098D-3ED8-433A-9353-9679415DDDC5}.Blender Release|Win32.Build.0 = Blender Release|Win32
{E784098D-3ED8-433A-9353-9679415DDDC5}.BlenderPlayer Debug|Win32.ActiveCfg = Blender Debug|Win32
{E784098D-3ED8-433A-9353-9679415DDDC5}.BlenderPlayer Debug|Win32.Build.0 = Blender Debug|Win32
{E784098D-3ED8-433A-9353-9679415DDDC5}.BlenderPlayer Release|Win32.ActiveCfg = Blender Release|Win32
{E784098D-3ED8-433A-9353-9679415DDDC5}.BlenderPlayer Release|Win32.Build.0 = Blender Release|Win32
{EB75F4D6-2970-4A3A-8D99-2BAD7201C0E9}.Blender Debug|Win32.ActiveCfg = Blender Debug|Win32
{EB75F4D6-2970-4A3A-8D99-2BAD7201C0E9}.Blender Debug|Win32.Build.0 = Blender Debug|Win32
{EB75F4D6-2970-4A3A-8D99-2BAD7201C0E9}.Blender Release|Win32.ActiveCfg = Blender Release|Win32

View File

@@ -615,10 +615,18 @@
RelativePath="..\..\..\source\blender\nodes\intern\TEX_nodes\TEX_checker.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\nodes\intern\TEX_nodes\TEX_coord.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\nodes\intern\TEX_nodes\TEX_curves.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\nodes\intern\TEX_nodes\TEX_distance.c"
>
</File>
<File
RelativePath="..\..\..\source\blender\nodes\intern\TEX_nodes\TEX_hueSatVal.c"
>

View File

@@ -72,12 +72,12 @@
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386&#x0D;&#x0A;"
AdditionalDependencies="odelib.lib fmodvc.lib libbmfont.lib ws2_32.lib vfw32.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib openal_static.lib libjpeg.lib dxguid.lib libeay32.lib libpng.lib libz.lib qtmlClient.lib SDL.lib freetype2ST.lib python25_d.lib pthreadVSE2.lib pthreadVC2.lib Half.lib Iex.lib IlmImf.lib IlmThread.lib Imath.lib avcodec-51.lib avformat-52.lib avutil-49.lib swscale-0.lib"
AdditionalDependencies="odelib.lib fmodvc.lib ws2_32.lib vfw32.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib openal_static.lib libjpeg.lib dxguid.lib libeay32.lib libpng.lib libz.lib qtmlClient.lib SDL.lib freetype2ST.lib python25_d.lib pthreadVSE2.lib pthreadVC2.lib Half.lib Iex.lib IlmImf.lib IlmThread.lib Imath.lib avcodec-51.lib avformat-52.lib avutil-49.lib swscale-0.lib"
ShowProgress="0"
OutputFile="..\..\..\..\bin\debug\blenderplayer.exe"
LinkIncremental="2"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\..\..\..\..\lib\windows\sdl\lib;..\..\..\..\..\lib\windows\zlib\lib;..\..\..\..\..\lib\windows\ode\lib;..\..\..\..\..\lib\windows\png\lib;..\..\..\..\..\lib\windows\jpeg\lib;..\..\..\..\..\lib\windows\fmod\lib;..\..\..\..\..\lib\windows\openal\lib;..\..\..\..\..\lib\windows\freetype\lib;..\..\..\..\..\lib\windows\openexr\lib_vs2008;..\..\..\..\..\lib\windows\python\lib\lib25_vs2008;..\..\..\..\..\lib\windows\openssl\lib;..\..\..\..\..\lib\windows\QTDevWin\Libraries;..\..\..\..\..\build\msvc_9\libs\intern\debug;..\..\..\..\..\build\msvc_9\libs\extern\debug;..\..\..\..\..\lib\windows\pthreads\lib;..\..\..\..\..\lib\windows\ffmpeg\lib"
AdditionalLibraryDirectories="..\..\..\..\..\lib\windows\sdl\lib;..\..\..\..\..\lib\windows\zlib\lib;..\..\..\..\..\lib\windows\ode\lib;..\..\..\..\..\lib\windows\png\lib;..\..\..\..\..\lib\windows\jpeg\lib;..\..\..\..\..\lib\windows\fmod\lib;..\..\..\..\..\lib\windows\openal\lib;..\..\..\..\..\lib\windows\freetype\lib;..\..\..\..\..\lib\windows\openexr\lib_vs2008;..\..\..\..\..\lib\windows\python\lib\lib25_vs2008;..\..\..\..\..\lib\windows\openssl\lib;..\..\..\..\..\lib\windows\QTDevWin\Libraries;..\..\..\..\..\lib\windows\pthreads\lib;..\..\..\..\..\lib\windows\ffmpeg\lib"
IgnoreDefaultLibraryNames="libc.lib;libcmt.lib;msvcrt.lib;libcd.lib;msvcrtd.lib"
GenerateDebugInformation="true"
ProgramDatabaseFile="..\..\..\..\..\build\msvc_9\libs\debug\blenderplayer.pdb"
@@ -166,11 +166,11 @@
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odelib.lib fmodvc.lib libbmfont.lib ws2_32.lib vfw32.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib openal_static.lib libjpeg.lib dxguid.lib libeay32.lib libpng.lib libz.lib qtmlClient.lib SDL.lib freetype2ST.lib python25.lib pthreadVSE2.lib pthreadVC2.lib Half.lib Iex.lib IlmImf.lib IlmThread.lib Imath.lib avcodec-51.lib avformat-52.lib avutil-49.lib swscale-0.lib"
AdditionalDependencies="odelib.lib fmodvc.lib ws2_32.lib vfw32.lib odbc32.lib odbccp32.lib opengl32.lib glu32.lib openal_static.lib libjpeg.lib dxguid.lib libeay32.lib libpng.lib libz.lib qtmlClient.lib SDL.lib freetype2ST.lib python25_d.lib pthreadVSE2.lib pthreadVC2.lib Half.lib Iex.lib IlmImf.lib IlmThread.lib Imath.lib avcodec-51.lib avformat-52.lib avutil-49.lib swscale-0.lib"
OutputFile="..\..\..\..\bin\blenderplayer.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\..\..\..\..\lib\windows\sdl\lib;..\..\..\..\..\lib\windows\zlib\lib;..\..\..\..\..\lib\windows\ode\lib;..\..\..\..\..\lib\windows\png\lib;..\..\..\..\..\lib\windows\jpeg\lib;..\..\..\..\..\lib\windows\fmod\lib;..\..\..\..\..\lib\windows\openal\lib;..\..\..\..\..\lib\windows\freetype\lib;..\..\..\..\..\lib\windows\openexr\lib_vs2008;..\..\..\..\..\lib\windows\python\lib\lib25_vs2008;..\..\..\..\..\lib\windows\openssl\lib;..\..\..\..\..\lib\windows\QTDevWin\Libraries;..\..\..\..\..\build\msvc_9\libs\intern;..\..\..\..\..\build\msvc_9\libs\extern;..\..\..\..\..\lib\windows\pthreads\lib;..\..\..\..\..\lib\windows\ffmpeg\lib"
AdditionalLibraryDirectories="..\..\..\..\..\lib\windows\sdl\lib;..\..\..\..\..\lib\windows\zlib\lib;..\..\..\..\..\lib\windows\ode\lib;..\..\..\..\..\lib\windows\png\lib;..\..\..\..\..\lib\windows\jpeg\lib;..\..\..\..\..\lib\windows\fmod\lib;..\..\..\..\..\lib\windows\openal\lib;..\..\..\..\..\lib\windows\freetype\lib;..\..\..\..\..\lib\windows\openexr\lib_vs2008;..\..\..\..\..\lib\windows\python\lib\lib25_vs2008;..\..\..\..\..\lib\windows\openssl\lib;..\..\..\..\..\lib\windows\QTDevWin\Libraries;..\..\..\..\..\lib\windows\pthreads\lib;..\..\..\..\..\lib\windows\ffmpeg\lib"
IgnoreDefaultLibraryNames="libc.lib, msvcrt.lib, libcd.lib, libcmtd.lib, msvcrtd.lib"
ProgramDatabaseFile="..\..\..\..\..\build\msvc_9\libs\blenderplayer.pdb"
SubSystem="1"

View File

@@ -57,6 +57,12 @@ ifeq ($(OS),$(findstring $(OS), "freebsd irix linux openbsd solaris"))
NOPLUGINS?=true
endif
endif
# don"t build plugins on irix if using gcc
ifeq ($(OS), irix)
ifeq ($(IRIX_USE_GCC), true)
NOPLUGINS?=true
endif
endif
endif
ifeq ($(OS),windows)

View File

@@ -79,7 +79,7 @@ def addSlash(path):
return path + sys.sep
def comprehensiveImageLoad(imagePath, filePath, PLACE_HOLDER= True, RECURSIVE=True, VERBOSE=False):
def comprehensiveImageLoad(imagePath, filePath, PLACE_HOLDER= True, RECURSIVE=True, VERBOSE=False, CONVERT_CALLBACK=None):
'''
imagePath: The image filename
If a path precedes it, this will be searched as well.
@@ -93,13 +93,30 @@ def comprehensiveImageLoad(imagePath, filePath, PLACE_HOLDER= True, RECURSIVE=Tr
RECURSIVE: If True, directories will be recursivly searched.
Be carefull with this if you have files in your root directory because it may take a long time.
CASE_INSENSITIVE: for non win32 systems, find the correct case for the file.
CONVERT_CALLBACK: a function that takes an existing path and returns a new one.
Use this when loading image formats blender may not support, the CONVERT_CALLBACK
can take the path for a GIF (for example), convert it to a PNG and return the PNG's path.
For formats blender can read, simply return the path that is given.
'''
# VERBOSE = True
if VERBOSE: print 'img:', imagePath, 'file:', filePath
if os == None and CASE_INSENSITIVE:
CASE_INSENSITIVE = True
# When we have the file load it with this. try/except niceness.
def imageLoad(path):
#if path.endswith('\\') or path.endswith('/'):
# raise 'INVALID PATH'
if CONVERT_CALLBACK:
path = CONVERT_CALLBACK(path)
try:
img = bpy.data.images.new(filename=path)
if VERBOSE: print '\t\tImage loaded "%s"' % path

View File

@@ -12,3 +12,63 @@ def cleanName(name):
for ch in invalid: name = name.replace(ch, '_')
return name
def caseInsensitivePath(path, RET_FOUND=False):
'''
Get a case insensitive path on a case sensitive system
RET_FOUND is for internal use only, to avoid too many calls to os.path.exists
# Example usage
getCaseInsensitivePath('/hOmE/mE/sOmEpAtH.tXt')
'''
import os # todo, what happens with no os?
if os==None:
if RET_FOUND: ret = path, True
else: ret = path
return ret
if path=='' or os.path.exists(path):
if RET_FOUND: ret = path, True
else: ret = path
return ret
f = os.path.basename(path) # f may be a directory or a file
d = os.path.dirname(path)
suffix = ''
if not f: # dir ends with a slash?
if len(d) < len(path):
suffix = path[:len(path)-len(d)]
f = os.path.basename(d)
d = os.path.dirname(d)
if not os.path.exists(d):
d, found = caseInsensitivePath(d, True)
if not found:
if RET_FOUND: ret = path, False
else: ret = path
return ret
# at this point, the directory exists but not the file
try: # we are expecting 'd' to be a directory, but it could be a file
files = os.listdir(d)
except:
if RET_FOUND: ret = path, False
else: ret = path
f_low = f.lower()
try: f_nocase = [fl for fl in files if fl.lower() == f_low][0]
except: f_nocase = None
if f_nocase:
if RET_FOUND: ret = os.path.join(d, f_nocase) + suffix, True
else: ret = os.path.join(d, f_nocase) + suffix
return ret
else:
if RET_FOUND: ret = path, False
else: ret = path
return ret # cant find the right one, just return the path as is.

View File

@@ -66,8 +66,6 @@ import BPyMesh
import BPySys
import BPyMessages
import sys
## This was used to make V, but faster not to do all that
##valid = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_,.()[]{}'
##v = range(255)
@@ -184,7 +182,19 @@ def sane_texname(data): return sane_name(data, sane_name_mapping_tex)
def sane_takename(data): return sane_name(data, sane_name_mapping_take)
def sane_groupname(data): return sane_name(data, sane_name_mapping_group)
def derived_paths(fname_orig, basepath, FORCE_CWD=False):
'''
fname_orig - blender path, can be relative
basepath - fname_rel will be relative to this
FORCE_CWD - dont use the basepath, just add a ./ to the filename.
use when we know the file will be in the basepath.
'''
fname = Blender.sys.expandpath(fname_orig)
fname_strip = strip_path(fname)
if FORCE_CWD: fname_rel = '.' + Blender.sys.sep + fname_strip
else: fname_rel = Blender.sys.relpath(fname, basepath)
if fname_rel.startswith('//'): fname_rel = '.' + Blender.sys.sep + fname_rel[2:]
return fname, fname_strip, fname_rel
def mat4x4str(mat):
@@ -342,6 +352,8 @@ def write(filename, batch_objects = None, \
# end batch support
# Use this for working out paths relative to the export location
basepath = Blender.sys.dirname(filename)
# ----------------------------------------------
# storage classes
@@ -1141,10 +1153,9 @@ def write(filename, batch_objects = None, \
Property: "Width", "int", "",0
Property: "Height", "int", "",0''')
if tex:
fname = tex.filename
fname_strip = strip_path(fname)
fname, fname_strip, fname_rel = derived_paths(tex.filename, basepath, EXP_IMAGE_COPY)
else:
fname = fname_strip = ''
fname = fname_strip = fname_rel = ''
file.write('\n\t\t\tProperty: "Path", "charptr", "", "%s"' % fname_strip)
@@ -1163,7 +1174,7 @@ def write(filename, batch_objects = None, \
file.write('\n\t\tFilename: "%s"' % fname_strip)
if fname_strip: fname_strip = '/' + fname_strip
file.write('\n\t\tRelativeFilename: "fbx%s"' % fname_strip) # make relative
file.write('\n\t\tRelativeFilename: "%s"' % fname_rel) # make relative
file.write('\n\t}')
@@ -1202,13 +1213,14 @@ def write(filename, batch_objects = None, \
}''')
file.write('\n\t\tMedia: "Video::%s"' % texname)
if tex:
fname = tex.filename
file.write('\n\t\tFileName: "%s"' % strip_path(fname))
file.write('\n\t\tRelativeFilename: "fbx/%s"' % strip_path(fname)) # need some make relative command
fname, fname_strip, fname_rel = derived_paths(tex.filename, basepath, EXP_IMAGE_COPY)
else:
file.write('\n\t\tFileName: ""')
file.write('\n\t\tRelativeFilename: "fbx"')
fname = fname_strip = fname_rel = ''
file.write('\n\t\tFileName: "%s"' % fname_strip)
file.write('\n\t\tRelativeFilename: "%s"' % fname_rel) # need some make relative command
file.write('''
ModelUVTranslation: 0,0
@@ -2658,7 +2670,7 @@ Takes: {''')
# copy images if enabled
if EXP_IMAGE_COPY:
copy_images( Blender.sys.dirname(filename), [ tex[1] for tex in textures if tex[1] != None ])
copy_images( basepath, [ tex[1] for tex in textures if tex[1] != None ])
print 'export finished in %.4f sec.' % (Blender.sys.time() - start_time)
return True

View File

@@ -194,7 +194,7 @@ ifeq ($(WITH_FREETYPE2), true)
else
COMLIB += $(NAN_FTGL)/lib/libftgl.a
ifeq ($(OS), irix)
COMLIB += $(NAN_FREETYPE)/lib32/libfreetype.a
COMLIB += $(NAN_FREETYPE)/lib/libfreetype.a
else
COMLIB += $(NAN_FREETYPE)/lib/libfreetype.a
endif
@@ -395,9 +395,16 @@ else
NAN_SND_LIBS += $(ALUT)
NAN_SND_LIBS += $(SOUNDSYSTEM)
else
NAN_SND_LIBS = $(SOUNDSYSTEM)
NAN_SND_LIBS += $(DUMMYSOUND)
NAN_SND_LIBS += $(SOUNDSYSTEM)
ifeq ($(OS), irix)
NAN_SND_LIBS = $(SOUNDSYSTEM)
NAN_SND_LIBS += $(DUMMYSOUND)
NAN_SND_LIBS += $(SDLSOUND)
NAN_SND_LIBS += $(SOUNDSYSTEM)
else
NAN_SND_LIBS = $(SOUNDSYSTEM)
NAN_SND_LIBS += $(DUMMYSOUND)
NAN_SND_LIBS += $(SOUNDSYSTEM)
endif
endif
endif
endif

View File

@@ -401,6 +401,8 @@ struct TexResult;
#define TEX_NODE_ROTATE 114
#define TEX_NODE_VIEWER 115
#define TEX_NODE_TRANSLATE 116
#define TEX_NODE_COORD 117
#define TEX_NODE_DISTANCE 118
/* 201-299 reserved. Use like this: TEX_NODE_PROC + TEX_CLOUDS, etc */
#define TEX_NODE_PROC 200

View File

@@ -2886,6 +2886,8 @@ static void registerTextureNodes(ListBase *ntypelist)
nodeRegisterType(ntypelist, &tex_node_curve_time);
nodeRegisterType(ntypelist, &tex_node_invert);
nodeRegisterType(ntypelist, &tex_node_hue_sat);
nodeRegisterType(ntypelist, &tex_node_coord);
nodeRegisterType(ntypelist, &tex_node_distance);
nodeRegisterType(ntypelist, &tex_node_output);
nodeRegisterType(ntypelist, &tex_node_viewer);

View File

@@ -47,9 +47,9 @@
#include <time.h>
#include <sys/stat.h>
#if defined (__sun__) || defined (__sun)
#if defined (__sun__) || defined (__sun) || defined (__sgi)
#include <sys/statvfs.h> /* Other modern unix os's should probably use this also */
#elif !defined(__FreeBSD__) && !defined(linux) && (defined(__sgi) || defined(__sparc) || defined(__sparc__))
#elif !defined(__FreeBSD__) && !defined(linux) && (defined(__sparc) || defined(__sparc__))
#include <sys/statfs.h>
#endif
@@ -179,7 +179,7 @@ double BLI_diskfree(char *dir)
return (double) (freec*bytesps*sectorspc);
#else
#if defined (__sun__) || defined (__sun)
#if defined (__sun__) || defined (__sun) || defined (__sgi)
struct statvfs disk;
#else
struct statfs disk;
@@ -204,9 +204,9 @@ double BLI_diskfree(char *dir)
return -1;
#endif
#if defined (__sun__) || defined (__sun)
#if defined (__sun__) || defined (__sun) || defined (__sgi)
if (statvfs(name, &disk)) return(-1);
#elif !defined(__FreeBSD__) && !defined(linux) && (defined (__sgi) || defined(__sparc) || defined(__sparc__))
#elif !defined(__FreeBSD__) && !defined(linux) && (defined(__sparc) || defined(__sparc__))
/* WARNING - This may not be supported by geeneric unix os's - Campbell */
if (statfs(name, &disk, sizeof(struct statfs), 0)) return(-1);
#endif

View File

@@ -80,16 +80,16 @@ void IMB_convert_rgba_to_abgr(struct ImBuf *ibuf)
}
}
}
static void pixel_from_buffer(struct ImBuf *ibuf, unsigned char *outI, float *outF, int x, int y)
static void pixel_from_buffer(struct ImBuf *ibuf, unsigned char **outI, float **outF, int x, int y)
{
int offset = ibuf->x * y * 4 + 4*x;
if (ibuf->rect)
outI= (unsigned char *)ibuf->rect + offset;
*outI= (unsigned char *)ibuf->rect + offset;
if (ibuf->rect_float)
outF= (float *)ibuf->rect_float + offset;
*outF= (float *)ibuf->rect_float + offset;
}
/**************************************************************************
@@ -226,7 +226,7 @@ void bicubic_interpolation(ImBuf *in, ImBuf *out, float u, float v, int xout, in
if (in == NULL || (in->rect == NULL && in->rect_float == NULL)) return;
pixel_from_buffer(out, outI, outF, xout, yout); /* gcc warns these could be uninitialized, but its ok */
pixel_from_buffer(out, &outI, &outF, xout, yout); /* gcc warns these could be uninitialized, but its ok */
bicubic_interpolation_color(in, outI, outF, u, v);
}
@@ -309,7 +309,7 @@ void bilinear_interpolation(ImBuf *in, ImBuf *out, float u, float v, int xout, i
if (in == NULL || (in->rect == NULL && in->rect_float == NULL)) return;
pixel_from_buffer(out, outI, outF, xout, yout); /* gcc warns these could be uninitialized, but its ok */
pixel_from_buffer(out, &outI, &outF, xout, yout); /* gcc warns these could be uninitialized, but its ok */
bilinear_interpolation_color(in, outI, outF, u, v);
}
@@ -370,7 +370,7 @@ void neareast_interpolation(ImBuf *in, ImBuf *out, float x, float y, int xout, i
if (in == NULL || (in->rect == NULL && in->rect_float == NULL)) return;
pixel_from_buffer(out, outI, outF, xout, yout); /* gcc warns these could be uninitialized, but its ok */
pixel_from_buffer(out, &outI, &outF, xout, yout); /* gcc warns these could be uninitialized, but its ok */
neareast_interpolation_color(in, outI, outF, x, y);
}
}

View File

@@ -46,6 +46,7 @@ void PE_create_particle_edit(struct Object *ob, struct ParticleSystem *psys);
void PE_free_particle_edit(struct ParticleSystem *psys);
void PE_change_act(void *ob_v, void *act_v);
void PE_change_act_psys(struct Object *ob, struct ParticleSystem *psys);
int PE_can_edit(struct ParticleSystem *psys);
/* access */

View File

@@ -80,6 +80,7 @@ typedef struct TreeElement {
#define TSE_SEQUENCE 26
#define TSE_SEQ_STRIP 27
#define TSE_SEQUENCE_DUP 28
#define TSE_LINKED_PSYS 29
/* outliner search flags */
#define OL_FIND 0

View File

@@ -103,6 +103,13 @@ extern void do_cambuts(unsigned short event);
extern void do_armbuts(unsigned short event);
extern void do_uvcalculationbuts(unsigned short event);
extern void weight_paint_buttons(struct uiBlock *);
extern void brush_buttons(struct uiBlock *block, short sima,
int evt_nop, int evt_change,
int evt_browse, int evt_local,
int evt_del, int evt_keepdata,
int evt_texbrowse, int evt_texdel);
extern void particle_edit_buttons(struct uiBlock *);
extern char *get_vertexgroup_menustr(struct Object *ob); // used in object buttons

View File

@@ -468,6 +468,7 @@ int validSnappingNormal(TransInfo *t);
void initTrans(TransInfo *t);
void postTrans (TransInfo *t);
void resetTransRestrictions(TransInfo *t);
void drawLine(float *center, float *dir, char axis, short options);

View File

@@ -65,10 +65,12 @@ typedef struct ScriptLink {
/* these are special scriptlinks that can be assigned to
* a given space in a given ScrArea to:
* - (EVENT type) handle events sent to that space;
* - (DRAW type) draw on the space after its own drawing function finishes
* - (EVENT_ALL type): handle release events, too;
* - (DRAW type) draw on the space after its own drawing function finishes.
*/
#define SPACEHANDLER_VIEW3D_EVENT 1
#define SPACEHANDLER_VIEW3D_DRAW 2
#define SPACEHANDLER_VIEW3D_DRAW 1
#define SPACEHANDLER_VIEW3D_EVENT 2
#define SPACEHANDLER_VIEW3D_EVENT_ALL 3
#ifdef __cplusplus

View File

@@ -52,6 +52,8 @@ extern bNodeType tex_node_curve_rgb;
extern bNodeType tex_node_curve_time;
extern bNodeType tex_node_invert;
extern bNodeType tex_node_hue_sat;
extern bNodeType tex_node_coord;
extern bNodeType tex_node_distance;
extern bNodeType tex_node_rotate;
extern bNodeType tex_node_translate;

View File

@@ -0,0 +1,66 @@
/**
*
* ***** 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.
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): Mathias Panzenböck (panzi) <grosser.meister.morti@gmx.net>.
*
* ***** END GPL LICENSE BLOCK *****
*/
#include "../TEX_util.h"
static bNodeSocketType outputs[]= {
{ SOCK_VECTOR, 0, "Coordinates", 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f },
{ -1, 0, "" }
};
static void vectorfn(float *out, float *coord, bNode *node, bNodeStack **in, short thread)
{
out[0] = coord[0];
out[1] = coord[1];
out[2] = coord[2];
}
static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
{
tex_output(node, in, out[0], &vectorfn);
tex_do_preview(node, out[0], data);
}
bNodeType tex_node_coord= {
/* *next,*prev */ NULL, NULL,
/* type code */ TEX_NODE_COORD,
/* name */ "Coordinates",
/* width+range */ 120, 110, 160,
/* class+opts */ NODE_CLASS_INPUT, NODE_OPTIONS,
/* input sock */ NULL,
/* output sock */ outputs,
/* storage */ "node_coord",
/* execfunc */ exec,
/* butfunc */ NULL,
/* initfunc */ NULL,
/* freestoragefunc */ NULL,
/* copystoragefunc */ NULL,
/* id */ NULL
};

View File

@@ -0,0 +1,79 @@
/**
*
* ***** 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.
*
* The Original Code is Copyright (C) 2005 Blender Foundation.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): Mathias Panzenböck (panzi) <grosser.meister.morti@gmx.net>.
*
* ***** END GPL LICENSE BLOCK *****
*/
#include <math.h>
#include "BLI_arithb.h"
#include "../TEX_util.h"
static bNodeSocketType inputs[]= {
{ SOCK_VECTOR, 1, "Coordinate 1", 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f },
{ SOCK_VECTOR, 1, "Coordinate 2", 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f },
{ -1, 0, "" }
};
static bNodeSocketType outputs[]= {
{ SOCK_VALUE, 0, "Value", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
{ -1, 0, "" }
};
static void valuefn(float *out, float *coord, bNode *node, bNodeStack **in, short thread)
{
float coord1[3], coord2[3];
float x, y, z;
tex_input_vec(coord1, in[0], coord, thread);
tex_input_vec(coord2, in[1], coord, thread);
*out = VecLenf(coord2, coord1);
}
static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
{
tex_output(node, in, out[0], &valuefn);
tex_do_preview(node, out[0], data);
}
bNodeType tex_node_distance= {
/* *next,*prev */ NULL, NULL,
/* type code */ TEX_NODE_DISTANCE,
/* name */ "Distance",
/* width+range */ 120, 110, 160,
/* class+opts */ NODE_CLASS_CONVERTOR, NODE_OPTIONS,
/* input sock */ inputs,
/* output sock */ outputs,
/* storage */ "node_distance",
/* execfunc */ exec,
/* butfunc */ NULL,
/* initfunc */ NULL,
/* freestoragefunc */ NULL,
/* copystoragefunc */ NULL,
/* id */ NULL
};

View File

@@ -46,25 +46,32 @@ void tex_call_delegate(TexDelegate *dg, float *out, float *coord, short thread)
dg->fn(out, coord, dg->node, dg->in, thread);
}
void tex_input_vec(float *out, bNodeStack *in, float *coord, short thread)
void tex_input(float *out, int sz, bNodeStack *in, float *coord, short thread)
{
TexDelegate *dg = in->data;
if(dg) {
tex_call_delegate(dg, out, coord, thread);
tex_call_delegate(dg, in->vec, coord, thread);
if(in->hasoutput && in->sockettype == SOCK_VALUE) {
out[1] = out[2] = out[0];
out[3] = 1;
}
}
else {
QUATCOPY(out, in->vec);
if(in->hasoutput && in->sockettype == SOCK_VALUE)
in->vec[1] = in->vec[2] = in->vec[0];
}
memcpy(out, in->vec, sz * sizeof(float));
}
void tex_input_vec(float *out, bNodeStack *in, float *coord, short thread)
{
tex_input(out, 3, in, coord, thread);
}
void tex_input_rgba(float *out, bNodeStack *in, float *coord, short thread)
{
tex_input_vec(out, in, coord, thread);
tex_input(out, 4, in, coord, thread);
if(in->hasoutput && in->sockettype == SOCK_VALUE)
{
out[1] = out[2] = out[0];
out[3] = 1;
}
if(in->hasoutput && in->sockettype == SOCK_VECTOR) {
out[0] = out[0] * .5f + .5f;
@@ -83,8 +90,8 @@ float tex_input_value(bNodeStack *in, float *coord, short thread)
static void init_preview(bNode *node)
{
int xsize = node->prvr.xmax - node->prvr.xmin;
int ysize = node->prvr.ymax - node->prvr.ymin;
int xsize = (int)(node->prvr.xmax - node->prvr.xmin);
int ysize = (int)(node->prvr.ymax - node->prvr.ymin);
if(xsize == 0) {
xsize = PREV_RES;

View File

@@ -2403,7 +2403,7 @@ int BPY_is_spacehandler(Text *text, char spacetype)
char *line = tline->line;
/* Expected format: # SPACEHANDLER.SPACE.TYPE
* Ex: # SPACEHANDLER.VIEW3D.DRAW
* Exs: # SPACEHANDLER.VIEW3D.DRAW
* The actual checks are forgiving, so slight variations also work. */
if (line && line[0] == '#' && strstr(line, "HANDLER")) {
line++; /* skip '#' */
@@ -2411,11 +2411,19 @@ int BPY_is_spacehandler(Text *text, char spacetype)
/* only done for 3D View right now, trivial to add for others: */
switch (spacetype) {
case SPACE_VIEW3D:
if (strstr(line, "3D")) { /* VIEW3D, 3DVIEW */
line = strstr(line, "3D"); /* VIEW3D, 3DVIEW */
if (line) {
if (strstr(line, "DRAW")) type = SPACEHANDLER_VIEW3D_DRAW;
else if (strstr(line, "EVENT")) type = SPACEHANDLER_VIEW3D_EVENT;
else {
line = strstr(line, "EVENT");
if (line) {
if (strstr(line, "ALL")) {
type = SPACEHANDLER_VIEW3D_EVENT_ALL;
} else { type = SPACEHANDLER_VIEW3D_EVENT; }
}
}
}
break;
break;
}
}
}
@@ -2464,7 +2472,6 @@ int BPY_add_spacehandler(Text *text, ScrArea *sa, char spacetype)
if (handlertype) {
ScriptLink *slink = &sa->scriptlink;
void *stmp, *ftmp;
unsigned short space_event = SPACEHANDLER_VIEW3D_EVENT;
/* extend slink */
@@ -2484,17 +2491,8 @@ int BPY_add_spacehandler(Text *text, ScrArea *sa, char spacetype)
MEM_freeN(ftmp);
}
switch (spacetype) {
case SPACE_VIEW3D:
if (handlertype == 1) space_event = SPACEHANDLER_VIEW3D_EVENT;
else space_event = SPACEHANDLER_VIEW3D_DRAW;
break;
default:
break;
}
slink->scripts[slink->totscript] = (ID *)text;
slink->flag[slink->totscript]= space_event;
slink->flag[slink->totscript]= handlertype;
slink->totscript++;
slink->actscript = slink->totscript;
@@ -2508,6 +2506,7 @@ int BPY_do_spacehandlers( ScrArea *sa, unsigned short event,
{
ScriptLink *scriptlink;
int retval = 0;
short slink_event, spacehandlers_match;
PyGILState_STATE gilstate;
if (!sa || !(G.f & G_DOSCRIPTLINKS)) return 0;
@@ -2549,7 +2548,16 @@ int BPY_do_spacehandlers( ScrArea *sa, unsigned short event,
EXPP_dict_set_item_str(g_blenderdict, "eventValue", PyInt_FromLong(eventValue));
/* now run all assigned space handlers for this space and space_event */
for( index = 0; index < scriptlink->totscript; index++ ) {
spacehandlers_match = 0;
slink_event = scriptlink->flag[index];
if( slink_event == space_event )
spacehandlers_match = 1;
else if( ( space_event == SPACEHANDLER_VIEW3D_EVENT ) &&
( slink_event == SPACEHANDLER_VIEW3D_EVENT_ALL ) )
spacehandlers_match = 1;
/* for DRAW handlers: */
if (event == 0) {
glPushAttrib(GL_ALL_ATTRIB_BITS);
@@ -2558,8 +2566,8 @@ int BPY_do_spacehandlers( ScrArea *sa, unsigned short event,
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
}
if( ( scriptlink->flag[index] == space_event ) &&
if( spacehandlers_match &&
( scriptlink->scripts[index] != NULL ) ) {
dict = CreateGlobalDictionary();
ret = RunPython( ( Text * ) scriptlink->scripts[index], dict );

View File

@@ -1047,8 +1047,11 @@ void M_Blender_Init(void)
if (SpaceHandlers) {
BPy_constant *d = (BPy_constant *)SpaceHandlers;
PyConstant_Insert(d,"VIEW3D_EVENT",PyInt_FromLong(SPACEHANDLER_VIEW3D_EVENT));
/* EVENT_ALL are reported as EVENT on key presses
* and EVENT_RELEASE on key releases */
PyConstant_Insert(d,"VIEW3D_DRAW", PyInt_FromLong(SPACEHANDLER_VIEW3D_DRAW));
PyConstant_Insert(d,"VIEW3D_EVENT",PyInt_FromLong(SPACEHANDLER_VIEW3D_EVENT));
PyConstant_Insert(d,"VIEW3D_EVENT_RELEASE",PyInt_FromLong(SPACEHANDLER_VIEW3D_EVENT_ALL));
PyModule_AddObject(module, "SpaceHandlers", SpaceHandlers);
}

View File

@@ -59,6 +59,7 @@ static PyObject *M_sys_time( PyObject * self );
static PyObject *M_sys_sleep( PyObject * self, PyObject * args );
static PyObject *M_sys_expandpath( PyObject *self, PyObject *value);
static PyObject *M_sys_cleanpath( PyObject *self, PyObject *value);
static PyObject *M_sys_relpath( PyObject *self, PyObject *args);
/*****************************************************************************/
/* The following string definitions are used for documentation strings. */
@@ -128,6 +129,9 @@ If the special chars are not found in the given path, it is simply returned.";
static char M_sys_cleanpath_doc[] =
"(path) - Removes parts of a path that are not needed paths such as '../foo/../bar/' and '//./././'";
static char M_sys_relpath_doc[] =
"(path, start=\"//\") - Returns the path relative to the current blend file or start if spesified";
/*****************************************************************************/
/* Python method structure definition for Blender.sys module: */
/*****************************************************************************/
@@ -144,6 +148,7 @@ struct PyMethodDef M_sys_methods[] = {
{"time", ( PyCFunction ) M_sys_time, METH_NOARGS, M_sys_time_doc},
{"expandpath", M_sys_expandpath, METH_O, M_sys_expandpath_doc},
{"cleanpath", M_sys_cleanpath, METH_O, M_sys_cleanpath_doc},
{"relpath", M_sys_relpath, METH_VARARGS, M_sys_relpath_doc},
{NULL, NULL, 0, NULL}
};
@@ -231,9 +236,8 @@ static PyObject *M_sys_join( PyObject * self, PyObject * args )
char filename[FILE_MAXDIR + FILE_MAXFILE];
int pathlen = 0, namelen = 0;
if( !PyArg_ParseTuple( args, "ss", &path, &name ) )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected string argument" );
if( !PyArg_ParseTuple( args, "ss:Blender.sys.join", &path, &name ) )
return NULL;
pathlen = strlen( path ) + 1;
namelen = strlen( name ) + 1; /* + 1 to account for '\0' for BLI_strncpy */
@@ -300,10 +304,8 @@ static PyObject *M_sys_makename( PyObject * self, PyObject * args,
char *dot = NULL, *p = NULL, basename[FILE_MAXDIR + FILE_MAXFILE];
int n, len, lenext = 0;
if( !PyArg_ParseTupleAndKeywords( args, kw, "|ssi", kwlist,
&path, &ext, &strip ) )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected one or two strings and an int (or nothing) as arguments" );
if( !PyArg_ParseTupleAndKeywords( args, kw, "|ssi:Blender.sys.makename", kwlist, &path, &ext, &strip ) )
return NULL;
len = strlen( path ) + 1; /* + 1 to consider ending '\0' */
if( ext )
@@ -350,13 +352,12 @@ static PyObject *M_sys_sleep( PyObject * self, PyObject * args )
{
int millisecs = 10;
if( !PyArg_ParseTuple( args, "|i", &millisecs ) )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected int argument" );
if( !PyArg_ParseTuple( args, "|i:Blender.sys.sleep", &millisecs ) )
return NULL;
PIL_sleep_ms( millisecs );
return EXPP_incr_ret( Py_None );
Py_RETURN_NONE;
}
static PyObject *M_sys_exists( PyObject * self, PyObject * value )
@@ -419,3 +420,22 @@ static PyObject *M_sys_cleanpath( PyObject * self, PyObject * value )
return PyString_FromString(cleaned);
}
static PyObject *M_sys_relpath( PyObject * self, PyObject * args )
{
char *base = G.sce;
char *path;
char relpath[FILE_MAXDIR + FILE_MAXFILE];
char dir[FILE_MAXDIR];
char file[FILE_MAXFILE];
if( !PyArg_ParseTuple( args, "s|s:Blender.sys.relpath", &path, &base ) )
return NULL;
strncpy(relpath, path, sizeof(relpath));
BLI_makestringcode(base, relpath);
return PyString_FromString(relpath);
}

View File

@@ -184,11 +184,11 @@ Introduction:
Space Handler script links:
---------------------------
This is a new kind of script linked to spaces in a given window. Right now
only the 3D View has the necessary hooks, but the plan is to add access to
other types, too. Just to clarify naming conventions: in Blender, a screen
is partitioned in windows (also called areas) and each window can show any
space. Spaces are: 3D View, Text Editor, Scripts, Buttons, User Preferences,
These are scripts linked to spaces in a given window. Right now
only the 3D View has the necessary hooks. Just to clarify naming
conventions: in Blender, a screen is partitioned in windows (also
called areas) and each window can show any space.
Spaces are: 3D View, Text Editor, Scripts, Buttons, User Preferences,
Oops, etc.
Space handlers are texts in the Text Editor, like other script links, but they
@@ -196,12 +196,16 @@ Introduction:
text file}} must inform:
1. that they are space handlers;
2. the space they belong to;
3. whether they are EVENT or DRAW handlers.
3. whether they are EVENT, EVENT_RELEASE (EVENT ones reporting key release events) or DRAW handlers.
Example header for a 3D View EVENT handler::
# SPACEHANDLER.VIEW3D.EVENT
Example header for a 3D View EVENT handler that also receives release events::
# SPACEHANDLER.VIEW3D.EVENT.ALL
Example header for a 3D View DRAW handler::
# SPACEHANDLER.VIEW3D.DRAW
@@ -216,6 +220,10 @@ Introduction:
- process it (the script must set Blender.event to None then);
- ignore it.
EVENT ALL space handlers (header: # SPACEHANDLER.VIEW3D.EVENT.ALL) are executed
both for key presses (Blender.event = Blender.SpaceHandlers.VIEW3D_EVENT) and
for key releases (Blender.event = Blender.SpaceHandlers.VIEW3D_EVENT_RELEASE).
Setting C{Blender.event = None} tells Blender not to go on processing itself
the event, because it was grabbed by the script.
@@ -248,7 +256,7 @@ Introduction:
- B{bylink} is the same: True if the script is running as a script link;
- B{link}: integer from the L{Blender}.SpaceHandlers constant dictionary,
tells what space this handler belongs to and the handler's type
(EVENT, DRAW);
(EVENT, EVENT_RELEASE, DRAW);
- B{event}:
- EVENT handlers: an input event (check keys and mouse events in
L{Draw}) to be processed or ignored;
@@ -258,6 +266,7 @@ Introduction:
presses (since we don't pass releases) as 1 and mouse movements
(Draw.MOUSE.X and Draw.MOUSE.Y) as the current x or y coordinate,
for example;
- EVENT_RELEASE handlers (EVENT handlers executed during key release events): 0;
- DRAW handlers: 0 always.
B{Guidelines (important)}:

View File

@@ -174,3 +174,15 @@ def cleanpath (path):
@rtype: string
@return: the cleaned (if necessary) path.
"""
def relpath (path, start="//"):
"""
Returns the path relative to the start,
@note: If the path can be made relative it well start with "//", this is spesific to blender and should be converted to "./" for use as a system path.
@type path: string
@param path: a path name.
@type start: string
@param start: optional argument for the base path, the current blend files base path is used omitted
@rtype: string
@return: The path relative to start
"""

View File

@@ -94,6 +94,9 @@ if env['WITH_BF_SDL']:
else:
defs.append('DISABLE_SDL')
if env['WITH_BF_BULLET']:
defs.append('WITH_BULLET')
if env['BF_SPLIT_SRC'] and (env['OURPLATFORM'] == 'win32-mingw'):
for i in range(numlibs):
env.BlenderLib ( libname = 'src%d' % (i), sources = subsources[i], includes = Split(incs), defines = defs, libtype=['core', 'intern'], priority = [5, 25] )

View File

@@ -948,7 +948,7 @@ static void editing_panel_mesh_type(Object *ob, Mesh *me)
fdata= (G.obedit)? &G.editMesh->fdata: &me->fdata;
yco= customdata_buttons(block, me, fdata, CD_MTFACE, &acttface, &acttface_rnd, (G.f & G_TEXTUREPAINT ? &acttface_clone : NULL), (G.f & G_TEXTUREPAINT ? &acttface_mask : NULL),
B_SETTFACE, B_SETTFACE_RND, B_SETTFACE_CLONE, B_SETTFACE_MASK, B_NEWTFACE, "UV Texture", "UV Texture:",
"Set active UV texture", "Set rendering UV texture", "Set the layer used for texturepaint cloning", "Set the layer used for texturepaint masking", "Creates a new UV texture layer",
"Set active UV texture", "Set rendering UV texture", "Set the layer used for texturepaint cloning", "Set the texture paint stencil layer", "Creates a new UV texture layer",
"Removes the current UV texture layer", 190, 130);
yco= customdata_buttons(block, me, fdata, CD_MCOL, &actmcol, &actmcol_rnd, NULL, NULL,
@@ -5429,7 +5429,7 @@ char *get_vertexgroup_menustr(Object *ob)
qsort_ptr = MEM_callocN (defCount * sizeof (qsort_ptr[0]),
"qsort_ptr");
for (index = 1, dg = ob->defbase.first; dg; index++, dg=dg->next) {
printed = snprintf (qsort_ptr[index - 1], sizeof (dg->name), dg->name);
printed = snprintf (qsort_ptr[index - 1], sizeof (dg->name), "%s", dg->name);
snprintf (qsort_ptr[index - 1]+printed, 6+1, "%%x%d|", index); // +1 to move the \0 see above 999 max here too
}
@@ -6329,6 +6329,125 @@ void weight_paint_buttons(uiBlock *block)
}
}
void brush_buttons(uiBlock *block, short sima,
int evt_nop, int evt_change,
int evt_browse, int evt_local,
int evt_del, int evt_keepdata,
int evt_texbrowse, int evt_texdel)
{
ToolSettings *settings= G.scene->toolsettings;
Brush *brush= settings->imapaint.brush;
ID *id;
int yco, xco, butw, but_idx;
short *menupoin = sima ? &(G.sima->menunr) : &(G.buts->menunr);
short do_project = settings->imapaint.flag & IMAGEPAINT_PROJECT_DISABLE ? 0:1;
yco= 160;
butw = sima ? 80 : 106;
uiBlockBeginAlign(block);
but_idx = 0;
uiDefButS(block, ROW, evt_change, "Draw", butw*(but_idx++),yco,butw,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_DRAW, 0, 0, "Draw brush");
if (sima || do_project==0)
uiDefButS(block, ROW, evt_change, "Soften", butw*(but_idx++), yco,butw,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_SOFTEN, 0, 0, "Soften brush");
uiDefButS(block, ROW, evt_change, "Smear", butw*(but_idx++), yco,butw,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_SMEAR, 0, 0, "Smear brush");
if (sima || do_project)
uiDefButS(block, ROW, evt_change, "Clone", butw*(but_idx++), yco,butw,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_CLONE, 0, 0, "Clone brush, use RMB to drag source image");
uiBlockEndAlign(block);
yco -= 30;
uiBlockSetCol(block, TH_BUT_SETTING2);
id= (ID*)settings->imapaint.brush;
xco= std_libbuttons(block, 0, yco, 0, NULL, evt_browse, ID_BR, 0, id, NULL, menupoin, 0, evt_local, evt_del, 0, evt_keepdata);
uiBlockSetCol(block, TH_AUTO);
if(brush && !brush->id.lib) {
butw= 320-(xco+10);
uiDefButS(block, MENU, evt_nop, "Mix %x0|Add %x1|Subtract %x2|Multiply %x3|Lighten %x4|Darken %x5|Erase Alpha %x6|Add Alpha %x7", xco+10,yco,butw,19, &brush->blend, 0, 0, 0, 0, "Blending method for applying brushes");
uiBlockBeginAlign(block);
uiDefButBitS(block, TOG|BIT, BRUSH_AIRBRUSH, evt_change, "Airbrush", xco+10,yco-25,butw/2,19, &brush->flag, 0, 0, 0, 0, "Keep applying paint effect while holding mouse (spray)");
uiDefButF(block, NUM, evt_nop, "", xco+10 + butw/2,yco-25,butw/2,19, &brush->rate, 0.01, 1.0, 0, 0, "Number of paints per second for Airbrush");
uiBlockEndAlign(block);
if (sima) {
uiDefButBitS(block, TOG|BIT, BRUSH_TORUS, evt_change, "Wrap", xco+10,yco-45,butw,19, &brush->flag, 0, 0, 0, 0, "Enables torus wrapping");
yco -= 25;
}
else {
yco -= 25;
uiBlockBeginAlign(block);
uiDefButBitS(block, TOGN|BIT, IMAGEPAINT_PROJECT_DISABLE, B_REDR, "Project Paint", xco+10,yco-25,butw,19, &settings->imapaint.flag, 0, 0, 0, 0, "Use projection painting for improved consistency in the brush strokes");
if ((settings->imapaint.flag & IMAGEPAINT_PROJECT_DISABLE)==0) {
/* Projection Painting */
uiDefButBitS(block, TOGN|BIT, IMAGEPAINT_PROJECT_XRAY, B_NOP, "Occlude", xco+10,yco-45,butw/2,19, &settings->imapaint.flag, 0, 0, 0, 0, "Only paint onto the faces directly under the brush (slower)");
uiDefButBitS(block, TOGN|BIT, IMAGEPAINT_PROJECT_BACKFACE, B_NOP, "Cull", xco+10+butw/2,yco-45,butw/2,19, &settings->imapaint.flag, 0, 0, 0, 0, "Ignore faces pointing away from the view (faster)");
uiDefButBitS(block, TOGN|BIT, IMAGEPAINT_PROJECT_FLAT, B_NOP, "Normal", xco+10,yco-65,butw/2,19, &settings->imapaint.flag, 0, 0, 0, 0, "Paint most on faces pointing towards the view");
uiDefButS(block, NUM, B_NOP, "", xco+10 +(butw/2),yco-65,butw/2,19, &settings->imapaint.normal_angle, 10.0, 90.0, 0, 0, "Paint most on faces pointing towards the view acording to this angle)");
uiDefButS(block, NUM, B_NOP, "Bleed: ", xco+10,yco-85,butw,19, &settings->imapaint.seam_bleed, 0.0, 8.0, 0, 0, "Extend paint beyond the faces UVs to reduce seams (in pixels, slower)");
uiBlockEndAlign(block);
uiBlockBeginAlign(block);
uiDefButBitS(block, TOG|BIT, IMAGEPAINT_PROJECT_LAYER_MASK, B_NOP, "Stencil Layer", xco+10,yco-110,butw-30,19, &settings->imapaint.flag, 0, 0, 0, 0, "Set the mask layer from the UV layer buttons");
uiDefButBitS(block, TOG|BIT, IMAGEPAINT_PROJECT_LAYER_MASK_INV, B_NOP, "Inv", xco+10 + butw-30,yco-110,30,19, &settings->imapaint.flag, 0, 0, 0, 0, "Invert the mask");
uiBlockEndAlign(block);
}
uiBlockEndAlign(block);
}
uiBlockBeginAlign(block);
uiDefButF(block, COL, B_VPCOLSLI, "", 0,yco,200,19, brush->rgb, 0, 0, 0, 0, "");
uiDefButF(block, NUMSLI, evt_nop, "Opacity ", 0,yco-20,180,19, &brush->alpha, 0.0, 1.0, 0, 0, "The amount of pressure on the brush");
uiDefButBitS(block, TOG|BIT, BRUSH_ALPHA_PRESSURE, evt_nop, "P", 180,yco-20,20,19, &brush->flag, 0, 0, 0, 0, "Enables pressure sensitivity for tablets");
uiDefButI(block, NUMSLI, evt_nop, "Size ", 0,yco-40,180,19, &brush->size, 1, 200, 0, 0, "The size of the brush");
uiDefButBitS(block, TOG|BIT, BRUSH_SIZE_PRESSURE, evt_nop, "P", 180,yco-40,20,19, &brush->flag, 0, 0, 0, 0, "Enables pressure sensitivity for tablets");
uiDefButF(block, NUMSLI, evt_nop, "Falloff ", 0,yco-60,180,19, &brush->innerradius, 0.0, 1.0, 0, 0, "The fall off radius of the brush");
uiDefButBitS(block, TOG|BIT, BRUSH_RAD_PRESSURE, evt_nop, "P", 180,yco-60,20,19, &brush->flag, 0, 0, 0, 0, "Enables pressure sensitivity for tablets");
uiDefButF(block, NUMSLI, evt_nop, "Spacing ",0,yco-80,180,19, &brush->spacing, 1.0, 100.0, 0, 0, "Repeating paint on %% of brush diameter");
uiDefButBitS(block, TOG|BIT, BRUSH_SPACING_PRESSURE, evt_nop, "P", 180,yco-80,20,19, &brush->flag, 0, 0, 0, 0, "Enables pressure sensitivity for tablets");
uiBlockEndAlign(block);
yco -= 110;
if(sima && settings->imapaint.tool == PAINT_TOOL_CLONE) {
id= (ID*)brush->clone.image;
uiBlockSetCol(block, TH_BUT_SETTING2);
xco= std_libbuttons(block, 0, yco, 0, NULL, B_SIMACLONEBROWSE, ID_IM, 0, id, 0, menupoin, 0, 0, B_SIMACLONEDELETE, 0, 0);
uiBlockSetCol(block, TH_AUTO);
if(id) {
butw= 320-(xco+5);
uiDefButF(block, NUMSLI, evt_change, "B ",xco+5,yco,butw,19, &brush->clone.alpha , 0.0, 1.0, 0, 0, "Opacity of clone image display");
}
}
else {
MTex *mtex= brush->mtex[brush->texact];
uiBlockSetCol(block, TH_BUT_SETTING2);
id= (mtex)? (ID*)mtex->tex: NULL;
xco= std_libbuttons(block, 0, yco, 0, NULL, evt_texbrowse, ID_TE, 0, id, NULL, menupoin, 0, 0, evt_texdel, 0, 0);
/*uiDefButBitS(block, TOG|BIT, BRUSH_FIXED_TEX, evt_change, "Fixed", xco+5,yco,butw,19, &brush->flag, 0, 0, 0, 0, "Keep texture origin in fixed position");*/
uiBlockSetCol(block, TH_AUTO);
}
}
#if 0
uiDefButBitS(block, TOG|BIT, IMAGEPAINT_DRAW_TOOL_DRAWING, B_SIMABRUSHCHANGE, "TD", 0,1,50,19, &settings->imapaint.flag.flag, 0, 0, 0, 0, "Enables brush shape while drawing");
uiDefButBitS(block, TOG|BIT, IMAGEPAINT_DRAW_TOOL, B_SIMABRUSHCHANGE, "TP", 50,1,50,19, &settings->imapaint.flag.flag, 0, 0, 0, 0, "Enables brush shape while not drawing");
#endif
}
static void editing_panel_mesh_paint(void)
{
uiBlock *block;
@@ -6388,101 +6507,7 @@ static void editing_panel_mesh_paint(void)
uiBlockEndAlign(block);
}
else { /* texture paint */
ToolSettings *settings= G.scene->toolsettings;
Brush *brush= settings->imapaint.brush;
ID *id;
int yco, xco, butw;
yco= 160;
uiBlockBeginAlign(block);
if ((settings->imapaint.flag & IMAGEPAINT_PROJECT_DISABLE)==0) {
uiDefButS(block, ROW, B_SIMABRUSHCHANGE, "Draw", 0 ,yco,108,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_DRAW, 0, 0, "Draw brush");
uiDefButS(block, ROW, B_SIMABRUSHCHANGE, "Smear", 108 ,yco,106,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_SMEAR, 0, 0, "Smear brush");
uiDefButS(block, ROW, B_SIMABRUSHCHANGE, "Clone", 214,yco,106,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_CLONE, 0, 0, "Clone brush, use RMB to drag source image");
}
else {
uiDefButS(block, ROW, B_BRUSHCHANGE, "Draw", 0 ,yco,108,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_DRAW, 0, 0, "Draw brush");
uiDefButS(block, ROW, B_BRUSHCHANGE, "Soften", 108 ,yco,106,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_SOFTEN, 0, 0, "Soften brush");
uiDefButS(block, ROW, B_BRUSHCHANGE, "Smear", 214,yco,106,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_SMEAR, 0, 0, "Smear brush");
}
uiBlockEndAlign(block);
yco -= 30;
uiBlockSetCol(block, TH_BUT_SETTING2);
id= (ID*)settings->imapaint.brush;
xco= std_libbuttons(block, 0, yco, 0, NULL, B_BRUSHBROWSE, ID_BR, 0, id, NULL, &(G.buts->menunr), 0, B_BRUSHLOCAL, B_BRUSHDELETE, 0, B_BRUSHKEEPDATA);
uiBlockSetCol(block, TH_AUTO);
if(brush && !brush->id.lib) {
MTex *mtex= brush->mtex[brush->texact];
butw= 320-(xco+10);
uiDefButS(block, MENU, B_NOP, "Mix %x0|Add %x1|Subtract %x2|Multiply %x3|Lighten %x4|Darken %x5|Erase Alpha %x6|Add Alpha %x7", xco+10,yco,butw,19, &brush->blend, 0, 0, 0, 0, "Blending method for applying brushes");
// uiDefButBitS(block, TOG|BIT, BRUSH_TORUS, B_BRUSHCHANGE, "Wrap", xco+10,yco-25,butw,19, &brush->flag, 0, 0, 0, 0, "Enables torus wrapping");
uiBlockBeginAlign(block);
uiDefButBitS(block, TOG|BIT, BRUSH_AIRBRUSH, B_BRUSHCHANGE, "Airbrush", xco+10,yco-25,butw,19, &brush->flag, 0, 0, 0, 0, "Keep applying paint effect while holding mouse (spray)");
uiDefButF(block, NUM, B_NOP, "Rate ", xco+10,yco-45,butw,19, &brush->rate, 0.01, 1.0, 0, 0, "Number of paints per second for Airbrush");
uiBlockEndAlign(block);
uiDefButBitS(block, TOGN|BIT, IMAGEPAINT_PROJECT_DISABLE, B_REDR, "Project Paint", xco+10,yco-70,butw,19, &settings->imapaint.flag, 0, 0, 0, 0, "Use projection painting for improved consistency in the brush strokes");
yco -= 50;
if ((settings->imapaint.flag & IMAGEPAINT_PROJECT_DISABLE)==0) {
//uiDefButBitS(block, TOG|BIT, BRUSH_TORUS, B_BRUSHCHANGE, "Wrap", xco+10,yco-25,butw,19, &brush->flag, 0, 0, 0, 0, "Enables torus wrapping");
/* Projection Painting */
uiBlockBeginAlign(block);
uiDefButBitS(block, TOGN|BIT, IMAGEPAINT_PROJECT_XRAY, B_NOP, "Occlude", xco+10,yco-45,butw/2,19, &settings->imapaint.flag, 0, 0, 0, 0, "Only paint onto the faces directly under the brush (slower)");
uiDefButBitS(block, TOGN|BIT, IMAGEPAINT_PROJECT_BACKFACE, B_NOP, "Cull", xco+10+butw/2,yco-45,butw/2,19, &settings->imapaint.flag, 0, 0, 0, 0, "Ignore faces pointing away from the view (faster)");
uiDefButBitS(block, TOGN|BIT, IMAGEPAINT_PROJECT_FLAT, B_NOP, "Normal", xco+10,yco-65,butw/2,19, &settings->imapaint.flag, 0, 0, 0, 0, "Paint most on faces pointing towards the view");
uiDefButC(block, NUM, B_NOP, "", xco+10 +(butw/2),yco-65,butw/2,19, &settings->imapaint.normal_angle, 10.0, 90.0, 0, 0, "Paint most on faces pointing towards the view acording to this angle)");
uiDefButC(block, NUM, B_NOP, "Bleed: ", xco+10,yco-85,butw,19, &settings->imapaint.seam_bleed, 0.0, 8.0, 0, 0, "Extend paint beyond the faces UVs to reduce seams (in pixels, slower)");
uiBlockEndAlign(block);
uiBlockBeginAlign(block);
uiDefButBitS(block, TOG|BIT, IMAGEPAINT_PROJECT_LAYER_MASK, B_NOP, "Layer Mask", xco+10,yco-110,butw-30,19, &settings->imapaint.flag, 0, 0, 0, 0, "Set the mask layer from the UV layer buttons");
uiDefButBitS(block, TOG|BIT, IMAGEPAINT_PROJECT_LAYER_MASK_INV, B_NOP, "Inv", xco+10 + butw-30,yco-110,30,19, &settings->imapaint.flag, 0, 0, 0, 0, "Invert the mask");
uiBlockEndAlign(block);
}
uiBlockBeginAlign(block);
uiDefButF(block, COL, B_VPCOLSLI, "", 0,yco,200,19, brush->rgb, 0, 0, 0, 0, "");
uiDefButF(block, NUMSLI, B_NOP, "Opacity ", 0,yco-20,180,19, &brush->alpha, 0.0, 1.0, 0, 0, "The amount of pressure on the brush");
uiDefButBitS(block, TOG|BIT, BRUSH_ALPHA_PRESSURE, B_NOP, "P", 180,yco-20,20,19, &brush->flag, 0, 0, 0, 0, "Enables pressure sensitivity for tablets");
uiDefButI(block, NUMSLI, B_NOP, "Size ", 0,yco-40,180,19, &brush->size, 1, 200, 0, 0, "The size of the brush");
uiDefButBitS(block, TOG|BIT, BRUSH_SIZE_PRESSURE, B_NOP, "P", 180,yco-40,20,19, &brush->flag, 0, 0, 0, 0, "Enables pressure sensitivity for tablets");
uiDefButF(block, NUMSLI, B_NOP, "Falloff ", 0,yco-60,180,19, &brush->innerradius, 0.0, 1.0, 0, 0, "The fall off radius of the brush");
uiDefButBitS(block, TOG|BIT, BRUSH_RAD_PRESSURE, B_NOP, "P", 180,yco-60,20,19, &brush->flag, 0, 0, 0, 0, "Enables pressure sensitivity for tablets");
uiDefButF(block, NUMSLI, B_NOP, "Spacing ",0,yco-80,180,19, &brush->spacing, 1.0, 100.0, 0, 0, "Repeating paint on %% of brush diameter");
uiDefButBitS(block, TOG|BIT, BRUSH_SPACING_PRESSURE, B_NOP, "P", 180,yco-80,20,19, &brush->flag, 0, 0, 0, 0, "Enables pressure sensitivity for tablets");
uiBlockEndAlign(block);
yco -= 110;
if (settings->imapaint.tool == PAINT_TOOL_CLONE) {
if ((settings->imapaint.flag & IMAGEPAINT_PROJECT_DISABLE)==0) {
butw = 130;
uiBlockBeginAlign(block);
uiDefButBitS(block, TOG|BIT, IMAGEPAINT_PROJECT_LAYER_CLONE, B_REDR, "Clone from Layer", 0,yco,butw,20, &settings->imapaint.flag, 0, 0, 0, 0, "Use another UV layer as clone source, otherwise use 3D the cursor as the source");
uiBlockEndAlign(block);
}
} else {
uiBlockSetCol(block, TH_BUT_SETTING2);
id= (mtex)? (ID*)mtex->tex: NULL;
xco= std_libbuttons(block, 0, yco, 0, NULL, B_BTEXBROWSE, ID_TE, 0, id, NULL, &(G.buts->menunr), 0, 0, B_BTEXDELETE, 0, 0);
/*uiDefButBitS(block, TOG|BIT, BRUSH_FIXED_TEX, B_BRUSHCHANGE, "Fixed", xco+5,yco,butw,19, &brush->flag, 0, 0, 0, 0, "Keep texture origin in fixed position");*/
uiBlockSetCol(block, TH_AUTO);
}
}
brush_buttons(block, 0, B_NOP, B_BRUSHCHANGE, B_BRUSHBROWSE, B_BRUSHLOCAL, B_BRUSHDELETE, B_BRUSHKEEPDATA, B_BTEXBROWSE, B_BTEXDELETE);
}
}

View File

@@ -1388,9 +1388,9 @@ static void run_playanim(char *file)
calc_renderwin_rectangle((G.scene->r.xsch*G.scene->r.size)/100,
(G.scene->r.ysch*G.scene->r.size)/100, G.winpos, pos, size);
#ifdef WIN32
sprintf(str, "%s -a -s %d -e %d -p %d %d -f %d %g \"%s\"", bprogname, G.scene->r.sfra, G.scene->r.efra, pos[0], pos[1], G.scene->r.frs_sec, G.scene->r.frs_sec_base, file);
sprintf(str, "%s -a -s %d -e %d -p %d %d -f %d %g -j %d \"%s\"", bprogname, G.scene->r.sfra, G.scene->r.efra, pos[0], pos[1], G.scene->r.frs_sec, G.scene->r.frs_sec_base, G.scene->frame_step, file);
#else
sprintf(str, "\"%s\" -a -s %d -e %d -p %d %d -f %d %g \"%s\"", bprogname, G.scene->r.sfra, G.scene->r.efra, pos[0], pos[1], G.scene->r.frs_sec, G.scene->r.frs_sec_base, file);
sprintf(str, "\"%s\" -a -s %d -e %d -p %d %d -f %d %g -j %d \"%s\"", bprogname, G.scene->r.sfra, G.scene->r.efra, pos[0], pos[1], G.scene->r.frs_sec, G.scene->r.frs_sec_base, G.scene->frame_step, file);
#endif
system(str);
}

View File

@@ -1483,15 +1483,7 @@ static void image_panel_view_properties(short cntrl) // IMAGE_HANDLER_VIEW_PROPE
static void image_panel_paint(short cntrl) // IMAGE_HANDLER_PAINT
{
/* B_SIMABRUSHCHANGE only redraws and eats the mouse messages */
/* so that LEFTMOUSE does not 'punch' through the floating panel */
/* B_SIMANOTHING */
ToolSettings *settings= G.scene->toolsettings;
Brush *brush= settings->imapaint.brush;
uiBlock *block;
ID *id;
int yco, xco, butw;
if ((G.sima->image && (G.sima->flag & SI_DRAWTOOL))==0) {
return;
}
@@ -1501,75 +1493,8 @@ static void image_panel_paint(short cntrl) // IMAGE_HANDLER_PAINT
uiSetPanelHandler(IMAGE_HANDLER_PAINT); // for close and esc
if(uiNewPanel(curarea, block, "Image Paint", "Image", 10, 230, 318, 204)==0)
return;
yco= 160;
uiBlockBeginAlign(block);
uiDefButS(block, ROW, B_SIMABRUSHCHANGE, "Draw", 0 ,yco,80,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_DRAW, 0, 0, "Draw brush");
uiDefButS(block, ROW, B_SIMABRUSHCHANGE, "Soften", 80 ,yco,80,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_SOFTEN, 0, 0, "Soften brush");
uiDefButS(block, ROW, B_SIMABRUSHCHANGE, "Smear", 160,yco,80,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_SMEAR, 0, 0, "Smear brush");
uiDefButS(block, ROW, B_SIMABRUSHCHANGE, "Clone", 240,yco,80,19, &settings->imapaint.tool, 7.0, PAINT_TOOL_CLONE, 0, 0, "Clone brush, use RMB to drag source image");
uiBlockEndAlign(block);
yco -= 30;
uiBlockSetCol(block, TH_BUT_SETTING2);
id= (ID*)settings->imapaint.brush;
xco= std_libbuttons(block, 0, yco, 0, NULL, B_SIMABRUSHBROWSE, ID_BR, 0, id, NULL, &(G.sima->menunr), 0, B_SIMABRUSHLOCAL, B_SIMABRUSHDELETE, 0, B_KEEPDATA);
uiBlockSetCol(block, TH_AUTO);
if(brush && !brush->id.lib) {
butw= 320-(xco+10);
uiDefButS(block, MENU, B_SIMANOTHING, "Mix %x0|Add %x1|Subtract %x2|Multiply %x3|Lighten %x4|Darken %x5|Erase Alpha %x6|Add Alpha %x7", xco+10,yco,butw,19, &brush->blend, 0, 0, 0, 0, "Blending method for applying brushes");
uiDefButBitS(block, TOG|BIT, BRUSH_TORUS, B_SIMABRUSHCHANGE, "Wrap", xco+10,yco-25,butw,19, &brush->flag, 0, 0, 0, 0, "Enables torus wrapping");
uiBlockBeginAlign(block);
uiDefButBitS(block, TOG|BIT, BRUSH_AIRBRUSH, B_SIMABRUSHCHANGE, "Airbrush", xco+10,yco-50,butw,19, &brush->flag, 0, 0, 0, 0, "Keep applying paint effect while holding mouse (spray)");
uiDefButF(block, NUM, B_SIMANOTHING, "Rate ", xco+10,yco-70,butw,19, &brush->rate, 0.01, 1.0, 0, 0, "Number of paints per second for Airbrush");
uiBlockEndAlign(block);
yco -= 25;
uiBlockBeginAlign(block);
uiDefButF(block, COL, B_VPCOLSLI, "", 0,yco,200,19, brush->rgb, 0, 0, 0, 0, "");
uiDefButF(block, NUMSLI, B_SIMANOTHING, "Opacity ", 0,yco-20,180,19, &brush->alpha, 0.0, 1.0, 0, 0, "The amount of pressure on the brush");
uiDefButBitS(block, TOG|BIT, BRUSH_ALPHA_PRESSURE, B_SIMANOTHING, "P", 180,yco-20,20,19, &brush->flag, 0, 0, 0, 0, "Enables pressure sensitivity for tablets");
uiDefButI(block, NUMSLI, B_SIMANOTHING, "Size ", 0,yco-40,180,19, &brush->size, 1, 200, 0, 0, "The size of the brush");
uiDefButBitS(block, TOG|BIT, BRUSH_SIZE_PRESSURE, B_SIMANOTHING, "P", 180,yco-40,20,19, &brush->flag, 0, 0, 0, 0, "Enables pressure sensitivity for tablets");
uiDefButF(block, NUMSLI, B_SIMANOTHING, "Falloff ", 0,yco-60,180,19, &brush->innerradius, 0.0, 1.0, 0, 0, "The fall off radius of the brush");
uiDefButBitS(block, TOG|BIT, BRUSH_RAD_PRESSURE, B_SIMANOTHING, "P", 180,yco-60,20,19, &brush->flag, 0, 0, 0, 0, "Enables pressure sensitivity for tablets");
uiDefButF(block, NUMSLI, B_SIMANOTHING, "Spacing ",0,yco-80,180,19, &brush->spacing, 1.0, 100.0, 0, 0, "Repeating paint on %% of brush diameter");
uiDefButBitS(block, TOG|BIT, BRUSH_SPACING_PRESSURE, B_SIMANOTHING, "P", 180,yco-80,20,19, &brush->flag, 0, 0, 0, 0, "Enables pressure sensitivity for tablets");
uiBlockEndAlign(block);
yco -= 110;
if(settings->imapaint.tool == PAINT_TOOL_CLONE) {
id= (ID*)brush->clone.image;
uiBlockSetCol(block, TH_BUT_SETTING2);
xco= std_libbuttons(block, 0, yco, 0, NULL, B_SIMACLONEBROWSE, ID_IM, 0, id, 0, &G.sima->menunr, 0, 0, B_SIMACLONEDELETE, 0, 0);
uiBlockSetCol(block, TH_AUTO);
if(id) {
butw= 320-(xco+5);
uiDefButF(block, NUMSLI, B_SIMABRUSHCHANGE, "B ",xco+5,yco,butw,19, &brush->clone.alpha , 0.0, 1.0, 0, 0, "Opacity of clone image display");
}
}
else {
MTex *mtex= brush->mtex[brush->texact];
uiBlockSetCol(block, TH_BUT_SETTING2);
id= (mtex)? (ID*)mtex->tex: NULL;
xco= std_libbuttons(block, 0, yco, 0, NULL, B_SIMABTEXBROWSE, ID_TE, 0, id, NULL, &(G.sima->menunr), 0, 0, B_SIMABTEXDELETE, 0, 0);
/*uiDefButBitS(block, TOG|BIT, BRUSH_FIXED_TEX, B_SIMABRUSHCHANGE, "Fixed", xco+5,yco,butw,19, &brush->flag, 0, 0, 0, 0, "Keep texture origin in fixed position");*/
uiBlockSetCol(block, TH_AUTO);
}
}
#if 0
uiDefButBitS(block, TOG|BIT, IMAGEPAINT_DRAW_TOOL_DRAWING, B_SIMABRUSHCHANGE, "TD", 0,1,50,19, &settings->imapaint.flag.flag, 0, 0, 0, 0, "Enables brush shape while drawing");
uiDefButBitS(block, TOG|BIT, IMAGEPAINT_DRAW_TOOL, B_SIMABRUSHCHANGE, "TP", 50,1,50,19, &settings->imapaint.flag.flag, 0, 0, 0, 0, "Enables brush shape while not drawing");
#endif
brush_buttons(block, 1, B_SIMANOTHING, B_SIMABRUSHCHANGE, B_SIMABRUSHBROWSE, B_SIMABRUSHLOCAL, B_SIMABRUSHDELETE, B_KEEPDATA, B_SIMABTEXBROWSE, B_SIMABTEXDELETE);
}
static void image_panel_curves_reset(void *cumap_v, void *ibuf_v)

View File

@@ -165,6 +165,22 @@ void PE_change_act(void *ob_v, void *act_v)
}
}
void PE_change_act_psys(Object *ob, ParticleSystem *psys)
{
ParticleSystem *p;
if((p=psys_get_current(ob)))
p->flag &= ~PSYS_CURRENT;
psys->flag |= PSYS_CURRENT;
if(psys_check_enabled(ob, psys)) {
if(G.f & G_PARTICLEEDIT && !psys->edit)
PE_create_particle_edit(ob, psys);
PE_recalc_world_cos(ob, psys);
}
}
/* always gets atleast the first particlesystem even if PSYS_CURRENT flag is not set */
ParticleSystem *PE_get_current(Object *ob)
{

View File

@@ -160,6 +160,9 @@ static void do_time_redrawmenu(void *arg, int event)
if(event==1001) {
button(&G.scene->r.frs_sec,1,120,"FPS:");
}
else if(event==1002) {
G.scene->audio.flag ^= AUDIO_SYNC;
}
}
}
@@ -202,7 +205,11 @@ static uiBlock *time_redrawmenu(void *arg_unused)
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
sprintf(str, "Set Frames/Sec (%d/%f)", G.scene->r.frs_sec, G.scene->r.frs_sec_base);
if(G.scene->audio.flag & AUDIO_SYNC) icon= ICON_CHECKBOX_HLT;
else icon= ICON_CHECKBOX_DEHLT;
uiDefIconTextBut(block, BUTM, 1, icon, "Sync Playback to Frames/Sec", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1002, "");
sprintf(str, "Set Frames/Sec (%d/%2f)", G.scene->r.frs_sec, G.scene->r.frs_sec_base);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, str, 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1001, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");

View File

@@ -517,6 +517,8 @@ static uiBlock *view3d_view_spacehandlers(void *arg_unused)
if (handlertype == SPACEHANDLER_VIEW3D_EVENT)
BLI_strncpy(menustr, "Event: ", 8);
else if (handlertype == SPACEHANDLER_VIEW3D_EVENT_ALL)
BLI_strncpy(menustr, "Event+: ", 8);
else
BLI_strncpy(menustr, "Draw: ", 8);
BLI_strncpy(menustr+7, text->id.name+2, 22);

View File

@@ -50,6 +50,7 @@
#include "DNA_nla_types.h"
#include "DNA_object_types.h"
#include "DNA_oops_types.h"
#include "DNA_particle_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
@@ -87,6 +88,7 @@
#include "BIF_editarmature.h"
#include "BIF_editdeform.h"
#include "BIF_editnla.h"
#include "BIF_editparticle.h"
#include "BIF_editview.h"
#include "BIF_editconstraint.h"
#include "BIF_gl.h"
@@ -715,6 +717,13 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
outliner_add_element(soops, &te->subtree, ((ArmatureModifierData*) md)->object, te, TSE_LINKED_OB, 0);
} else if (md->type==eModifierType_Hook) {
outliner_add_element(soops, &te->subtree, ((HookModifierData*) md)->object, te, TSE_LINKED_OB, 0);
} else if (md->type==eModifierType_ParticleSystem) {
TreeElement *ten;
ParticleSystem *psys= ((ParticleSystemModifierData*) md)->psys;
ten = outliner_add_element(soops, &te->subtree, ob, te, TSE_LINKED_PSYS, 0);
ten->directdata = psys;
ten->name = psys->part->id.name+2;
}
}
}
@@ -1965,6 +1974,19 @@ static int tree_element_active_modifier(TreeElement *te, TreeStoreElem *tselem,
return 0;
}
static int tree_element_active_psys(TreeElement *te, TreeStoreElem *tselem, int set)
{
if(set) {
Object *ob= (Object *)tselem->id;
ParticleSystem *psys= te->directdata;
PE_change_act_psys(ob, psys);
extern_set_butspace(F7KEY, 0);
}
return 0;
}
static int tree_element_active_constraint(TreeElement *te, TreeStoreElem *tselem, int set)
{
if(set) {
@@ -2094,6 +2116,9 @@ static int tree_element_type_active(SpaceOops *soops, TreeElement *te, TreeStore
if(set) tree_element_active_object(soops, te);
else if(tselem->id==(ID *)OBACT) return 1;
break;
case TSE_LINKED_PSYS:
return tree_element_active_psys(te, tselem, set);
break;
case TSE_POSE_BASE:
return tree_element_active_pose(te, tselem, set);
break;
@@ -3203,6 +3228,8 @@ static void tselem_draw_icon(float x, float y, TreeStoreElem *tselem, TreeElemen
BIF_icon_draw(x, y, ICON_MODIFIER); break;
case TSE_LINKED_OB:
BIF_icon_draw(x, y, ICON_OBJECT); break;
case TSE_LINKED_PSYS:
BIF_icon_draw(x, y, ICON_PARTICLES); break;
case TSE_MODIFIER:
{
Object *ob= (Object *)tselem->id;
@@ -3230,6 +3257,9 @@ static void tselem_draw_icon(float x, float y, TreeStoreElem *tselem, TreeElemen
BIF_icon_draw(x, y, ICON_MOD_SOFT); break;
case eModifierType_Boolean:
BIF_icon_draw(x, y, ICON_MOD_BOOLEAN); break;
case eModifierType_ParticleSystem:
case eModifierType_ParticleInstance:
BIF_icon_draw(x, y, ICON_PARTICLES); break;
default:
BIF_icon_draw(x, y, ICON_DOT); break;
}

View File

@@ -169,6 +169,7 @@ typedef struct pict{
static struct ListBase _picsbase = {0,0};
static struct ListBase *picsbase = &_picsbase;
static int fromdisk = FALSE;
static int fstep = 1;
static float zoomx = 1.0 , zoomy = 1.0;
static double ptottime = 0.0, swaptime = 0.04;
@@ -208,14 +209,14 @@ static void toscreen(Pict *picture, struct ImBuf *ibuf)
char str[512];
cpack(-1);
glRasterPos2f(0.02f, 0.03f);
sprintf(str, "%s | %.2f frames/s\n", picture->name, 1.0 / swaptime);
sprintf(str, "%s | %.2f frames/s\n", picture->name, fstep / swaptime);
BMF_DrawString(G.fonts, str);
}
window_swap_buffers(g_window);
}
static void build_pict_list(char * first, int totframes)
static void build_pict_list(char * first, int totframes, int fstep)
{
int size,pic,file;
char *mem, name[512];
@@ -322,7 +323,7 @@ static void build_pict_list(char * first, int totframes)
ptottime = 0.0;
}
BLI_newname(name, +1);
BLI_newname(name, +fstep);
while(qtest()){
switch(qreadN(&val)){
@@ -396,6 +397,12 @@ void playanim(int argc, char **argv)
argc--;
argv++;
break;
case 'j':
fstep= MIN2(MAXFRAME, MAX2(1, atoi(argv[2])));
swaptime*= fstep;
argc--;
argv++;
break;
default:
printf("unknown option '%c': skipping\n", argv[1][1]);
break;
@@ -486,11 +493,11 @@ void playanim(int argc, char **argv)
efra = MAXFRAME;
}
build_pict_list(name, (efra - sfra) + 1);
build_pict_list(name, (efra - sfra) + 1, fstep);
for (i = 2; i < argc; i++){
strcpy(name, argv[i]);
build_pict_list(name, (efra - sfra) + 1);
build_pict_list(name, (efra - sfra) + 1, fstep);
}
IMB_freeImBuf(ibuf);
@@ -571,9 +578,9 @@ void playanim(int argc, char **argv)
if (val) {
if (qualN & SHIFT) {
if (ibuf)
printf(" Name: %s | Speed: %.2f frames/s\n", ibuf->name, 1.0 / swaptime);
printf(" Name: %s | Speed: %.2f frames/s\n", ibuf->name, fstep / swaptime);
} else {
swaptime = 1.0 / 5.0;
swaptime = fstep / 5.0;
}
}
break;
@@ -688,34 +695,34 @@ void playanim(int argc, char **argv)
}
break;
case PAD1:
swaptime = 1.0 / 60.0;
swaptime = fstep / 60.0;
break;
case PAD2:
swaptime = 1.0 / 50.0;
swaptime = fstep / 50.0;
break;
case PAD3:
swaptime = 1.0 / 30.0;
swaptime = fstep / 30.0;
break;
case PAD4:
if (qualN & SHIFT)
swaptime = 1.0 / 24.0;
swaptime = fstep / 24.0;
else
swaptime = 1.0 / 25.0;
swaptime = fstep / 25.0;
break;
case PAD5:
swaptime = 1.0 / 20.0;
swaptime = fstep / 20.0;
break;
case PAD6:
swaptime = 1.0 / 15.0;
swaptime = fstep / 15.0;
break;
case PAD7:
swaptime = 1.0 / 12.0;
swaptime = fstep / 12.0;
break;
case PAD8:
swaptime = 1.0 / 10.0;
swaptime = fstep / 10.0;
break;
case PAD9:
swaptime = 1.0 / 6.0;
swaptime = fstep / 6.0;
break;
case PADPLUSKEY:
if (val == 0) break;

View File

@@ -2007,8 +2007,8 @@ static void do_transform(Sequence * seq,float facf0, int x, int y,
tx = scale->xIni+(xo / 2.0f) + (scale->xFin-(xo / 2.0f) - scale->xIni+(xo / 2.0f)) * facf0;
ty = scale->yIni+(yo / 2.0f) + (scale->yFin-(yo / 2.0f) - scale->yIni+(yo / 2.0f)) * facf0;
}else{
tx = xo*(scale->xIni/100.0)+(xo / 2.0f) + (xo*(scale->xFin/100.0)-(xo / 2.0f) - xo*(scale->xIni/100.0)+(xo / 2.0f)) * facf0;
ty = yo*(scale->yIni/100.0)+(yo / 2.0f) + (yo*(scale->yFin/100.0)-(yo / 2.0f) - yo*(scale->yIni/100.0)+(yo / 2.0f)) * facf0;
tx = xo*(scale->xIni/100.0f)+(xo / 2.0f) + (xo*(scale->xFin/100.0f)-(xo / 2.0f) - xo*(scale->xIni/100.0f)+(xo / 2.0f)) * facf0;
ty = yo*(scale->yIni/100.0f)+(yo / 2.0f) + (yo*(scale->yFin/100.0f)-(yo / 2.0f) - yo*(scale->yIni/100.0f)+(yo / 2.0f)) * facf0;
}
//factor Rotate
@@ -2036,12 +2036,17 @@ static void do_transform(Sequence * seq,float facf0, int x, int y,
ys += (yo / 2.0f);
//interpolate
if(scale->interpolation==0)
switch(scale->interpolation) {
case 0:
neareast_interpolation(ibuf1,out, xs,ys,xi,yi);
if(scale->interpolation==1)
break;
case 1:
bilinear_interpolation(ibuf1,out, xs,ys,xi,yi);
if(scale->interpolation==2)
break;
case 2:
bicubic_interpolation(ibuf1,out, xs,ys,xi,yi);
break;
}
}
}

View File

@@ -1247,18 +1247,19 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
if( uiDoBlocks(&curarea->uiblocks, event, 1)!=UI_NOTHING ) event= 0;
if(event==UI_BUT_EVENT) do_butspace(val); /* temporal, view3d deserves own queue? */
#ifndef DISABLE_PYTHON
/* run any view3d event handler script links */
if(sa->scriptlink.totscript) {
if(BPY_do_spacehandlers(sa, event, val, SPACEHANDLER_VIEW3D_EVENT))
return; /* return if event was processed (swallowed) by handler(s) */
}
#endif
/* - we consider manipulator a button, defaulting to leftmouse
* - grease-pencil also defaults to leftmouse
*/
if(event==LEFTMOUSE) {
#ifndef DISABLE_PYTHON
/* run any view3d event handler script links */
if (sa->scriptlink.totscript) {
if (BPY_do_spacehandlers(sa, event, val, SPACEHANDLER_VIEW3D_EVENT))
return; /* return if event was processed (swallowed) by handler(s) */
}
#endif
if(gpencil_do_paint(sa, L_MOUSE)) return;
if(BIF_do_manipulator(sa)) return;
}
@@ -2963,7 +2964,17 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
}
}
}
#ifndef DISABLE_PYTHON
else { /* val= 0 */
/* run any view3d release event handler script links */
if(sa->scriptlink.totscript) {
if(BPY_do_spacehandlers(sa, event, 0, SPACEHANDLER_VIEW3D_EVENT_ALL))
return; /* return if event was processed (swallowed) by handler(s) */
}
}
#endif
if(doredraw) {
scrarea_queue_winredraw(curarea);
scrarea_queue_headredraw(curarea);

View File

@@ -737,6 +737,7 @@ static void transformEvent(unsigned short event, short val) {
case GKEY:
/* only switch when... */
if( ELEM3(Trans.mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL) ) {
resetTransRestrictions(&Trans);
restoreTransObjects(&Trans);
initTranslation(&Trans);
Trans.redraw = 1;
@@ -745,6 +746,7 @@ static void transformEvent(unsigned short event, short val) {
case SKEY:
/* only switch when... */
if( ELEM3(Trans.mode, TFM_ROTATION, TFM_TRANSLATION, TFM_TRACKBALL) ) {
resetTransRestrictions(&Trans);
restoreTransObjects(&Trans);
initResize(&Trans);
Trans.redraw = 1;
@@ -752,7 +754,9 @@ static void transformEvent(unsigned short event, short val) {
break;
case RKEY:
/* only switch when... */
if( ELEM4(Trans.mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) {
if( ELEM4(Trans.mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) {
resetTransRestrictions(&Trans);
if (Trans.mode == TFM_ROTATION) {
restoreTransObjects(&Trans);

View File

@@ -685,6 +685,8 @@ void BIF_drawConstraint(void)
return;
if (t->flag & T_USES_MANIPULATOR)
return;
if (t->flag & T_NO_CONSTRAINT)
return;
/* nasty exception for Z constraint in camera view */
if((t->flag & T_OBJECT) && G.vd->camera==OBACT && G.vd->persp==V3D_CAMOB)

View File

@@ -649,6 +649,11 @@ void drawLine(float *center, float *dir, char axis, short options)
myloadmatrix(G.vd->viewmat);
}
void resetTransRestrictions(TransInfo *t)
{
t->flag &= ~T_ALL_RESTRICTIONS;
}
void initTrans (TransInfo *t)
{

View File

@@ -29,6 +29,13 @@
#include <stdlib.h>
#include <string.h>
/* for setuid / getuid */
#ifdef __sgi
#include <sys/types.h>
#include <unistd.h>
#endif
/* This little block needed for linking to Blender... */
#include "MEM_guardedalloc.h"
@@ -201,7 +208,7 @@ static void print_help(void)
printf (" -t <threads>\tUse amount of <threads> for rendering (background mode only).\n");
printf (" [1-8], 0 for systems processor count.\n");
printf ("\nAnimation playback options:\n");
printf (" -a <file(s)>\tPlayback <file(s)>, only operates this way when -b is not used.\n");
printf (" -a <options> <file(s)>\tPlayback <file(s)>, only operates this way when -b is not used.\n");
printf (" -p <sx> <sy>\tOpen with lower left corner at <sx>, <sy>\n");
printf (" -m\t\tRead from disk (Don't buffer)\n");
printf (" -f <fps> <fps-base>\t\tSpecify FPS to start with\n");

View File

@@ -35,6 +35,7 @@ include nan_compile.mk
CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
CPPFLAGS += -I$(NAN_GLEW)/include
CPPFLAGS += -I$(NAN_SUMO)/include -I$(NAN_SOLID)/include
CPPFLAGS += -I$(NAN_SOLID)
CPPFLAGS += -I$(NAN_STRING)/include

View File

@@ -35,6 +35,7 @@ include nan_compile.mk
CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
CPPFLAGS += -I$(NAN_GLEW)/include
CPPFLAGS += -I$(OPENGL_HEADERS)
CPPFLAGS += -I$(NAN_STRING)/include

View File

@@ -185,7 +185,8 @@ void KX_BulletPhysicsController::SuspendDynamics(bool ghost)
m_savedMass = GetMass();
m_savedCollisionFilterGroup = handle->m_collisionFilterGroup;
m_savedCollisionFilterMask = handle->m_collisionFilterMask;
body->setActivationState(DISABLE_SIMULATION);
m_savedActivationState = body->getActivationState();
body->forceActivationState(DISABLE_SIMULATION);
GetPhysicsEnvironment()->updateCcdPhysicsController(this,
0.0,
btCollisionObject::CF_STATIC_OBJECT|((ghost)?btCollisionObject::CF_NO_CONTACT_RESPONSE:(m_savedCollisionFlags&btCollisionObject::CF_NO_CONTACT_RESPONSE)),
@@ -204,7 +205,7 @@ void KX_BulletPhysicsController::RestoreDynamics()
m_savedCollisionFlags,
m_savedCollisionFilterGroup,
m_savedCollisionFilterMask);
GetRigidBody()->forceActivationState(ACTIVE_TAG);
GetRigidBody()->forceActivationState(m_savedActivationState);
}
}

View File

@@ -9,6 +9,7 @@ class KX_BulletPhysicsController : public KX_IPhysicsController ,public CcdPhysi
{
private:
int m_savedCollisionFlags;
int m_savedActivationState;
short int m_savedCollisionFilterGroup;
short int m_savedCollisionFilterMask;
MT_Scalar m_savedMass;

View File

@@ -259,10 +259,75 @@ void KX_Camera::ExtractFrustumSphere()
if (m_set_frustum_center)
return;
// The most extreme points on the near and far plane. (normalized device coords)
MT_Vector4 hnear(1., 1., 0., 1.), hfar(1., 1., 1., 1.);
// compute sphere for the general case and not only symmetric frustum:
// the mirror code in ImageRender can use very asymmetric frustum.
// We will put the sphere center on the line that goes from origin to the center of the far clipping plane
// This is the optimal position if the frustum is symmetric or very asymmetric and probably close
// to optimal for the general case. The sphere center position is computed so that the distance to
// the near and far extreme frustum points are equal.
// get the transformation matrix from device coordinate to camera coordinate
MT_Matrix4x4 clip_camcs_matrix = m_projection_matrix;
clip_camcs_matrix.invert();
// detect which of the corner of the far clipping plane is the farthest to the origin
MT_Vector4 nfar; // far point in device normalized coordinate
MT_Point3 farpoint; // most extreme far point in camera coordinate
MT_Point3 nearpoint;// most extreme near point in camera coordinate
MT_Point3 farcenter(0.,0.,0.);// center of far cliping plane in camera coordinate
MT_Scalar F=1.0, N; // square distance of far and near point to origin
MT_Scalar f, n; // distance of far and near point to z axis. f is always > 0 but n can be < 0
MT_Scalar e, s; // far and near clipping distance (<0)
MT_Scalar c; // slope of center line = distance of far clipping center to z axis / far clipping distance
MT_Scalar z; // projection of sphere center on z axis (<0)
// tmp value
MT_Vector4 npoint(1., 1., 1., 1.);
MT_Vector4 hpoint;
MT_Point3 point;
MT_Scalar len;
for (int i=0; i<4; i++)
{
hpoint = clip_camcs_matrix*npoint;
point.setValue(hpoint[0]/hpoint[3], hpoint[1]/hpoint[3], hpoint[2]/hpoint[3]);
len = point.dot(point);
if (len > F)
{
nfar = npoint;
farpoint = point;
F = len;
}
// rotate by 90 degree along the z axis to walk through the 4 extreme points of the far clipping plane
len = npoint[0];
npoint[0] = -npoint[1];
npoint[1] = len;
farcenter += point;
}
// the far center is the average of the far clipping points
farcenter *= 0.25;
// the extreme near point is the opposite point on the near clipping plane
nfar.setValue(-nfar[0], -nfar[1], -1., 1.);
nfar = clip_camcs_matrix*nfar;
nearpoint.setValue(nfar[0]/nfar[3], nfar[1]/nfar[3], nfar[2]/nfar[3]);
N = nearpoint.dot(nearpoint);
e = farpoint[2];
s = nearpoint[2];
// projection on XY plane for distance to axis computation
MT_Point2 farxy(farpoint[0], farpoint[1]);
// f is forced positive by construction
f = farxy.length();
// get corresponding point on the near plane
farxy *= s/e;
// this formula preserve the sign of n
n = f*s/e - MT_Point2(nearpoint[0]-farxy[0], nearpoint[1]-farxy[1]).length();
c = MT_Point2(farcenter[0], farcenter[1]).length()/e;
// the big formula, it simplifies to (F-N)/(2(e-s)) for the symmetric case
z = (F-N)/(2.0*(e-s+c*(f-n)));
m_frustum_center = MT_Point3(farcenter[0]*z/e, farcenter[1]*z/e, z);
m_frustum_radius = m_frustum_center.distance(farpoint);
#if 0
// The most extreme points on the near and far plane. (normalized device coords)
MT_Vector4 hnear(1., 1., 0., 1.), hfar(1., 1., 1., 1.);
// Transform to hom camera local space
hnear = clip_camcs_matrix*hnear;
@@ -273,10 +338,12 @@ void KX_Camera::ExtractFrustumSphere()
MT_Point3 farpoint(hfar[0]/hfar[3], hfar[1]/hfar[3], hfar[2]/hfar[3]);
// Compute center
// don't use camera data in case the user specifies the matrix directly
m_frustum_center = MT_Point3(0., 0.,
(nearpoint.dot(nearpoint) - farpoint.dot(farpoint))/(2.0*(m_camdata.m_clipend - m_camdata.m_clipstart)));
(nearpoint.dot(nearpoint) - farpoint.dot(farpoint))/(2.0*(nearpoint[2]-farpoint[2] /*m_camdata.m_clipend - m_camdata.m_clipstart*/)));
m_frustum_radius = m_frustum_center.distance(farpoint);
#endif
// Transform to world space.
m_frustum_center = GetCameraToWorld()(m_frustum_center);
m_frustum_radius /= fabs(NodeGetWorldScaling()[NodeGetWorldScaling().closestAxis()]);

View File

@@ -615,6 +615,7 @@ void KX_GameObject::setAngularVelocity(const MT_Vector3& ang_vel,bool local)
m_pPhysicsController1->SetAngularVelocity(ang_vel,local);
}
void KX_GameObject::ResolveCombinedVelocities(
const MT_Vector3 & lin_vel,
const MT_Vector3 & ang_vel,
@@ -969,6 +970,10 @@ PyMethodDef KX_GameObject::Methods[] = {
{"getPosition", (PyCFunction) KX_GameObject::sPyGetPosition, METH_NOARGS},
{"setPosition", (PyCFunction) KX_GameObject::sPySetPosition, METH_O},
{"setWorldPosition", (PyCFunction) KX_GameObject::sPySetWorldPosition, METH_O},
{"applyForce", (PyCFunction) KX_GameObject::sPyApplyForce, METH_VARARGS},
{"applyTorque", (PyCFunction) KX_GameObject::sPyApplyTorque, METH_VARARGS},
{"applyRotation", (PyCFunction) KX_GameObject::sPyApplyRotation, METH_VARARGS},
{"applyMovement", (PyCFunction) KX_GameObject::sPyApplyMovement, METH_VARARGS},
{"getLinearVelocity", (PyCFunction) KX_GameObject::sPyGetLinearVelocity, METH_VARARGS},
{"setLinearVelocity", (PyCFunction) KX_GameObject::sPySetLinearVelocity, METH_VARARGS},
{"getAngularVelocity", (PyCFunction) KX_GameObject::sPyGetAngularVelocity, METH_VARARGS},
@@ -1261,6 +1266,65 @@ int KX_GameObject::_setattr(const STR_String& attr, PyObject *value) // _setattr
return SCA_IObject::_setattr(attr, value);
}
PyObject* KX_GameObject::PyApplyForce(PyObject* self, PyObject* args)
{
int local = 0;
PyObject* pyvect;
if (PyArg_ParseTuple(args, "O|i", &pyvect, &local)) {
MT_Vector3 force;
if (PyVecTo(pyvect, force)) {
ApplyForce(force, (local!=0));
Py_RETURN_NONE;
}
}
return NULL;
}
PyObject* KX_GameObject::PyApplyTorque(PyObject* self, PyObject* args)
{
int local = 0;
PyObject* pyvect;
if (PyArg_ParseTuple(args, "O|i", &pyvect, &local)) {
MT_Vector3 torque;
if (PyVecTo(pyvect, torque)) {
ApplyTorque(torque, (local!=0));
Py_RETURN_NONE;
}
}
return NULL;
}
PyObject* KX_GameObject::PyApplyRotation(PyObject* self, PyObject* args)
{
int local = 0;
PyObject* pyvect;
if (PyArg_ParseTuple(args, "O|i", &pyvect, &local)) {
MT_Vector3 rotation;
if (PyVecTo(pyvect, rotation)) {
ApplyRotation(rotation, (local!=0));
Py_RETURN_NONE;
}
}
return NULL;
}
PyObject* KX_GameObject::PyApplyMovement(PyObject* self, PyObject* args)
{
int local = 0;
PyObject* pyvect;
if (PyArg_ParseTuple(args, "O|i", &pyvect, &local)) {
MT_Vector3 movement;
if (PyVecTo(pyvect, movement)) {
ApplyMovement(movement, (local!=0));
Py_RETURN_NONE;
}
}
return NULL;
}
PyObject* KX_GameObject::PyGetLinearVelocity(PyObject* self, PyObject* args)
{

View File

@@ -772,6 +772,10 @@ public:
KX_PYMETHOD_NOARGS(KX_GameObject,GetPosition);
KX_PYMETHOD_O(KX_GameObject,SetPosition);
KX_PYMETHOD_O(KX_GameObject,SetWorldPosition);
KX_PYMETHOD_VARARGS(KX_GameObject, ApplyForce);
KX_PYMETHOD_VARARGS(KX_GameObject, ApplyTorque);
KX_PYMETHOD_VARARGS(KX_GameObject, ApplyRotation);
KX_PYMETHOD_VARARGS(KX_GameObject, ApplyMovement);
KX_PYMETHOD_VARARGS(KX_GameObject,GetLinearVelocity);
KX_PYMETHOD_VARARGS(KX_GameObject,SetLinearVelocity);
KX_PYMETHOD_VARARGS(KX_GameObject,GetAngularVelocity);

View File

@@ -184,7 +184,6 @@ private:
void RenderDebugProperties();
void RenderShadowBuffers(KX_Scene *scene);
void SetBackGround(KX_WorldInfo* worldinfo);
void SetWorldSettings(KX_WorldInfo* worldinfo);
void DoSound(KX_Scene* scene);
public:
@@ -193,6 +192,7 @@ public:
virtual ~KX_KetsjiEngine();
// set the devices and stuff. the client must take care of creating these
void SetWorldSettings(KX_WorldInfo* worldinfo);
void SetKeyboardDevice(SCA_IInputDevice* keyboarddevice);
void SetMouseDevice(SCA_IInputDevice* mousedevice);
void SetNetworkDevice(NG_NetworkDeviceInterface* networkdevice);
@@ -205,6 +205,8 @@ public:
void SetGame2IpoMode(bool game2ipo,int startFrame);
RAS_IRasterizer* GetRasterizer(){return m_rasterizer;};
RAS_ICanvas* GetCanvas(){return m_canvas;};
RAS_IRenderTools* GetRenderTools(){return m_rendertools;};
///returns true if an update happened to indicate -> Render
bool NextFrame();

View File

@@ -1249,7 +1249,7 @@ void KX_Scene::MarkVisible(RAS_IRasterizer* rasty, KX_GameObject* gameobj,KX_Cam
// If the camera is inside this node, then the object is visible.
if (!vis)
{
vis = gameobj->GetSGNode()->inside( GetActiveCamera()->GetCameraLocation() );
vis = gameobj->GetSGNode()->inside( cam->GetCameraLocation() );
}
// Test the object's bound sphere against the view frustum.

View File

@@ -123,6 +123,50 @@ class KX_GameObject:
@return: The game object's rotation matrix
@note: When using this matrix with Blender.Mathutils.Matrix() types, it will need to be transposed.
"""
def applyMovement(movement, local = 0):
"""
Sets the game object's movement.
@type movement: 3d vector.
@param movement: movement vector.
@type local: boolean
@param local: - False: you get the "global" movement ie: relative to world orientation (default).
- True: you get the "local" movement ie: relative to object orientation.
"""
def applyRotation(movement, local = 0):
"""
Sets the game object's rotation.
@type rotation: 3d vector.
@param rotation: rotation vector.
@type local: boolean
@param local: - False: you get the "global" rotation ie: relative to world orientation (default).
- True: you get the "local" rotation ie: relative to object orientation.
"""
def applyForce(force, local = 0):
"""
Sets the game object's force.
This requires a dynamic object.
@type force: 3d vector.
@param force: force vector.
@type local: boolean
@param local: - False: you get the "global" force ie: relative to world orientation (default).
- True: you get the "local" force ie: relative to object orientation.
"""
def applyTorque(torque, local = 0):
"""
Sets the game object's torque.
This requires a dynamic object.
@type torque: 3d vector.
@param torque: torque vector.
@type local: boolean
@param local: - False: you get the "global" torque ie: relative to world orientation (default).
- True: you get the "local" torque ie: relative to object orientation.
"""
def getLinearVelocity(local = 0):
"""
Gets the game object's linear velocity.
@@ -143,6 +187,8 @@ class KX_GameObject:
This method sets game object's velocity through it's centre of mass,
ie no angular velocity component.
This requires a dynamic object.
@type velocity: 3d vector.
@param velocity: linear velocity vector.
@type local: boolean
@@ -163,6 +209,8 @@ class KX_GameObject:
"""
Sets the game object's angular velocity.
This requires a dynamic object.
@type velocity: 3d vector.
@param velocity: angular velocity vector.
@type local: boolean

View File

@@ -212,9 +212,6 @@ public :
RAS_FrameFrustum &frustum
);
private :
static
void
ComputeDefaultFrustum(
@@ -225,6 +222,8 @@ private :
RAS_FrameFrustum & frustum
);
private :
static
void
ComputeBestFitViewRect(

View File

@@ -200,6 +200,7 @@ public:
* @return true if stereo mode is enabled.
*/
virtual bool Stereo()=0;
virtual StereoMode GetStereoMode()=0;
virtual bool InterlacedStereo()=0;
/**
* Sets which eye buffer subsequent primitives will be rendered to.

View File

@@ -406,14 +406,16 @@ void RAS_OpenGLRasterizer::SetRenderArea()
break;
}
}
void RAS_OpenGLRasterizer::SetStereoMode(const StereoMode stereomode)
{
m_stereomode = stereomode;
}
RAS_IRasterizer::StereoMode RAS_OpenGLRasterizer::GetStereoMode()
{
return m_stereomode;
}
bool RAS_OpenGLRasterizer::Stereo()
{
@@ -775,7 +777,7 @@ MT_Matrix4x4 RAS_OpenGLRasterizer::GetFrustumMatrix(
float frustnear,
float frustfar,
float focallength,
bool
bool
){
MT_Matrix4x4 result;
double mat[16];

View File

@@ -137,6 +137,7 @@ public:
virtual void SetRenderArea();
virtual void SetStereoMode(const StereoMode stereomode);
virtual RAS_IRasterizer::StereoMode GetStereoMode();
virtual bool Stereo();
virtual bool InterlacedStereo();
virtual void SetEye(const StereoEye eye);

View File

@@ -204,6 +204,12 @@ void registerAllExceptions(void)
ImageSizesNotMatchDesc.registerDesc();
SceneInvalidDesc.registerDesc();
CameraInvalidDesc.registerDesc();
ObserverInvalidDesc.registerDesc();
MirrorInvalidDesc.registerDesc();
MirrorSizeInvalidDesc.registerDesc();
MirrorNormalInvalidDesc.registerDesc();
MirrorHorizontalDesc.registerDesc();
MirrorTooSmallDesc.registerDesc();
SourceVideoEmptyDesc.registerDesc();
SourceVideoCreationDesc.registerDesc();
}

View File

@@ -202,6 +202,12 @@ extern ExpDesc MaterialNotAvailDesc;
extern ExpDesc ImageSizesNotMatchDesc;
extern ExpDesc SceneInvalidDesc;
extern ExpDesc CameraInvalidDesc;
extern ExpDesc ObserverInvalidDesc;
extern ExpDesc MirrorInvalidDesc;
extern ExpDesc MirrorSizeInvalidDesc;
extern ExpDesc MirrorNormalInvalidDesc;
extern ExpDesc MirrorHorizontalDesc;
extern ExpDesc MirrorTooSmallDesc;
extern ExpDesc SourceVideoEmptyDesc;
extern ExpDesc SourceVideoCreationDesc;

View File

@@ -24,96 +24,238 @@ http://www.gnu.org/copyleft/lesser.txt.
#include <PyObjectPlus.h>
#include <structmember.h>
#include <float.h>
#include <math.h>
#include <KX_BlenderCanvas.h>
#include <KX_BlenderRenderTools.h>
#include <RAS_IRasterizer.h>
#include <RAS_OpenGLRasterizer.h>
#include <KX_WorldInfo.h>
#include <KX_Light.h>
#include <BIF_gl.h>
#include "KX_PythonInit.h"
#include "DNA_scene_types.h"
#include "RAS_CameraData.h"
#include "RAS_MeshObject.h"
#include "BLI_arithb.h"
#include "ImageRender.h"
#include "ImageBase.h"
#include "BlendType.h"
#include "Exception.h"
#include "Texture.h"
ExceptionID SceneInvalid, CameraInvalid;
ExceptionID SceneInvalid, CameraInvalid, ObserverInvalid;
ExceptionID MirrorInvalid, MirrorSizeInvalid, MirrorNormalInvalid, MirrorHorizontal, MirrorTooSmall;
ExpDesc SceneInvalidDesc (SceneInvalid, "Scene object is invalid");
ExpDesc CameraInvalidDesc (CameraInvalid, "Camera object is invalid");
#if 0 // not yet supported
ExpDesc ObserverInvalidDesc (ObserverInvalid, "Observer object is invalid");
ExpDesc MirrorInvalidDesc (MirrorInvalid, "Mirror object is invalid");
ExpDesc MirrorSizeInvalidDesc (MirrorSizeInvalid, "Mirror has no vertex or no size");
ExpDesc MirrorNormalInvalidDesc (MirrorNormalInvalid, "Cannot determine mirror plane");
ExpDesc MirrorHorizontalDesc (MirrorHorizontal, "Mirror is horizontal in local space");
ExpDesc MirrorTooSmallDesc (MirrorTooSmall, "Mirror is too small");
// constructor
ImageRender::ImageRender (KX_Scene * scene, KX_Camera * camera) : m_scene(scene),
m_camera(camera)
ImageRender::ImageRender (KX_Scene * scene, KX_Camera * camera) :
ImageViewport(),
m_render(true),
m_scene(scene),
m_camera(camera),
m_owncamera(false),
m_observer(NULL),
m_mirror(NULL),
m_clip(100.f)
{
// create screen area
m_area.winrct.xmin = m_upLeft[0];
m_area.winrct.ymin = m_upLeft[1];
m_area.winx = m_size[0];
m_area.winy = m_size[1];
// create canvas
m_canvas = new KX_BlenderCanvas(&m_area);
// create render tools
m_rendertools = new KX_BlenderRenderTools();
// create rasterizer
m_rasterizer = new RAS_OpenGLRasterizer(m_canvas);
m_rasterizer->Init();
// initialize background colour
setBackground(0, 0, 255);
// refresh lights
refreshLights();
setBackground(0, 0, 255, 255);
// retrieve rendering objects
m_engine = KX_GetActiveEngine();
m_rasterizer = m_engine->GetRasterizer();
m_canvas = m_engine->GetCanvas();
m_rendertools = m_engine->GetRenderTools();
}
// destructor
ImageRender::~ImageRender (void)
{
// release allocated objects
delete m_rasterizer;
delete m_rendertools;
delete m_canvas;
if (m_owncamera)
m_camera->Release();
}
// set background color
void ImageRender::setBackground (unsigned char red, unsigned char green, unsigned char blue)
void ImageRender::setBackground (int red, int green, int blue, int alpha)
{
m_background[0] = red;
m_background[1] = green;
m_background[2] = blue;
m_rasterizer->SetBackColor(m_background[0], m_background[1], m_background[2], 1.0);
m_background[0] = (red < 0) ? 0.f : (red > 255) ? 1.f : float(red)/255.f;
m_background[1] = (green < 0) ? 0.f : (green > 255) ? 1.f : float(green)/255.f;
m_background[2] = (blue < 0) ? 0.f : (blue > 255) ? 1.f : float(blue)/255.f;
m_background[3] = (alpha < 0) ? 0.f : (alpha > 255) ? 1.f : float(alpha)/255.f;
}
// capture image from viewport
void ImageRender::calcImage (unsigned int texId)
{
// setup camera
bool cameraPasive = !m_camera->GetViewport();
// render scene
Render();
// reset camera
if (cameraPasive) m_camera->EnableViewport(false);
if (m_rasterizer->GetDrawingMode() != RAS_IRasterizer::KX_TEXTURED || // no need for texture
m_camera->GetViewport() || // camera must be inactive
m_camera == m_scene->GetActiveCamera())
{
// no need to compute texture in non texture rendering
m_avail = false;
return;
}
// render the scene from the camera
Render();
// get image from viewport
ImageViewport::calcImage(texId);
// restore OpenGL state
m_canvas->EndFrame();
}
void ImageRender::Render()
{
//
}
RAS_FrameFrustum frustrum;
// refresh lights
void ImageRender::refreshLights (void)
{
// clear lights list
//m_rendertools->RemoveAllLights();
// set lights
//for (int idx = 0; idx < scene->GetLightList()->GetCount(); ++idx)
// m_rendertools->AddLight(((KX_LightObject*)(scene->GetLightList()->GetValue(idx)))->GetLightData());
}
if (!m_render)
return;
if (m_mirror)
{
// mirror mode, compute camera frustrum, position and orientation
// convert mirror position and normal in world space
const MT_Matrix3x3 & mirrorObjWorldOri = m_mirror->GetSGNode()->GetWorldOrientation();
const MT_Point3 & mirrorObjWorldPos = m_mirror->GetSGNode()->GetWorldPosition();
const MT_Vector3 & mirrorObjWorldScale = m_mirror->GetSGNode()->GetWorldScaling();
MT_Point3 mirrorWorldPos =
mirrorObjWorldPos + mirrorObjWorldScale * (mirrorObjWorldOri * m_mirrorPos);
MT_Vector3 mirrorWorldZ = mirrorObjWorldOri * m_mirrorZ;
// get observer world position
const MT_Point3 & observerWorldPos = m_observer->GetSGNode()->GetWorldPosition();
// get plane D term = mirrorPos . normal
MT_Scalar mirrorPlaneDTerm = mirrorWorldPos.dot(mirrorWorldZ);
// compute distance of observer to mirror = D - observerPos . normal
MT_Scalar observerDistance = mirrorPlaneDTerm - observerWorldPos.dot(mirrorWorldZ);
// if distance < 0.01 => observer is on wrong side of mirror, don't render
if (observerDistance < 0.01f)
return;
// set camera world position = observerPos + normal * 2 * distance
MT_Point3 cameraWorldPos = observerWorldPos + (MT_Scalar(2.0)*observerDistance)*mirrorWorldZ;
m_camera->GetSGNode()->SetLocalPosition(cameraWorldPos);
// set camera orientation: z=normal, y=mirror_up in world space, x= y x z
MT_Vector3 mirrorWorldY = mirrorObjWorldOri * m_mirrorY;
MT_Vector3 mirrorWorldX = mirrorObjWorldOri * m_mirrorX;
MT_Matrix3x3 cameraWorldOri(
mirrorWorldX[0], mirrorWorldY[0], mirrorWorldZ[0],
mirrorWorldX[1], mirrorWorldY[1], mirrorWorldZ[1],
mirrorWorldX[2], mirrorWorldY[2], mirrorWorldZ[2]);
m_camera->GetSGNode()->SetLocalOrientation(cameraWorldOri);
m_camera->GetSGNode()->UpdateWorldData(0.0);
// compute camera frustrum:
// get position of mirror relative to camera: offset = mirrorPos-cameraPos
MT_Vector3 mirrorOffset = mirrorWorldPos - cameraWorldPos;
// convert to camera orientation
mirrorOffset = mirrorOffset * cameraWorldOri;
// scale mirror size to world scale:
// get closest local axis for mirror Y and X axis and scale height and width by local axis scale
MT_Scalar x, y;
x = fabs(m_mirrorY[0]);
y = fabs(m_mirrorY[1]);
float height = (x > y) ?
((x > fabs(m_mirrorY[2])) ? mirrorObjWorldScale[0] : mirrorObjWorldScale[2]):
((y > fabs(m_mirrorY[2])) ? mirrorObjWorldScale[1] : mirrorObjWorldScale[2]);
x = fabs(m_mirrorX[0]);
y = fabs(m_mirrorX[1]);
float width = (x > y) ?
((x > fabs(m_mirrorX[2])) ? mirrorObjWorldScale[0] : mirrorObjWorldScale[2]):
((y > fabs(m_mirrorX[2])) ? mirrorObjWorldScale[1] : mirrorObjWorldScale[2]);
width *= m_mirrorHalfWidth;
height *= m_mirrorHalfHeight;
// left = offsetx-width
// right = offsetx+width
// top = offsety+height
// bottom = offsety-height
// near = -offsetz
// far = near+100
frustrum.x1 = mirrorOffset[0]-width;
frustrum.x2 = mirrorOffset[0]+width;
frustrum.y1 = mirrorOffset[1]-height;
frustrum.y2 = mirrorOffset[1]+height;
frustrum.camnear = -mirrorOffset[2];
frustrum.camfar = -mirrorOffset[2]+m_clip;
}
const float ortho = 100.0;
const RAS_IRasterizer::StereoMode stereomode = m_rasterizer->GetStereoMode();
// The screen area that ImageViewport will copy is also the rendering zone
m_canvas->SetViewPort(m_position[0], m_position[1], m_position[0]+m_capSize[0]-1, m_position[1]+m_capSize[1]-1);
m_canvas->ClearColor(m_background[0], m_background[1], m_background[2], m_background[3]);
m_canvas->ClearBuffer(RAS_ICanvas::COLOR_BUFFER|RAS_ICanvas::DEPTH_BUFFER);
m_rasterizer->BeginFrame(RAS_IRasterizer::KX_TEXTURED,m_engine->GetClockTime());
m_rendertools->BeginFrame(m_rasterizer);
m_engine->SetWorldSettings(m_scene->GetWorldInfo());
m_rendertools->SetAuxilaryClientInfo(m_scene);
m_rasterizer->DisplayFog();
// matrix calculation, don't apply any of the stereo mode
m_rasterizer->SetStereoMode(RAS_IRasterizer::RAS_STEREO_NOSTEREO);
if (m_mirror)
{
// frustrum was computed above
// get frustrum matrix and set projection matrix
MT_Matrix4x4 projmat = m_rasterizer->GetFrustumMatrix(
frustrum.x1, frustrum.x2, frustrum.y1, frustrum.y2, frustrum.camnear, frustrum.camfar);
m_camera->SetProjectionMatrix(projmat);
} else if (m_camera->hasValidProjectionMatrix())
{
m_rasterizer->SetProjectionMatrix(m_camera->GetProjectionMatrix());
} else
{
float lens = m_camera->GetLens();
bool orthographic = !m_camera->GetCameraData()->m_perspective;
float nearfrust = m_camera->GetCameraNear();
float farfrust = m_camera->GetCameraFar();
float aspect_ratio = 1.0f;
Scene *blenderScene = m_scene->GetBlenderScene();
if (orthographic) {
lens *= ortho;
nearfrust = (nearfrust + 1.0)*ortho;
farfrust *= ortho;
}
// compute the aspect ratio from frame blender scene settings so that render to texture
// works the same in Blender and in Blender player
if (blenderScene->r.ysch != 0)
aspect_ratio = float(blenderScene->r.xsch) / float(blenderScene->r.ysch);
RAS_FramingManager::ComputeDefaultFrustum(
nearfrust,
farfrust,
lens,
aspect_ratio,
frustrum);
MT_Matrix4x4 projmat = m_rasterizer->GetFrustumMatrix(
frustrum.x1, frustrum.x2, frustrum.y1, frustrum.y2, frustrum.camnear, frustrum.camfar);
m_camera->SetProjectionMatrix(projmat);
}
MT_Transform camtrans(m_camera->GetWorldToCamera());
if (!m_camera->GetCameraData()->m_perspective)
camtrans.getOrigin()[2] *= ortho;
MT_Matrix4x4 viewmat(camtrans);
m_rasterizer->SetViewMatrix(viewmat, m_camera->NodeGetWorldPosition(),
m_camera->GetCameraLocation(), m_camera->GetCameraOrientation());
m_camera->SetModelviewMatrix(viewmat);
// restore the stereo mode now that the matrix is computed
m_rasterizer->SetStereoMode(stereomode);
// do not update the mesh, we don't want to do it more than once per frame
//m_scene->UpdateMeshTransformations();
m_scene->CalculateVisibleMeshes(m_rasterizer,m_camera);
m_scene->RenderBuckets(camtrans, m_rasterizer, m_rendertools);
}
// cast Image pointer to ImageRender
@@ -174,26 +316,31 @@ static int ImageRender_init (PyObject * pySelf, PyObject * args, PyObject * kwds
// get background color
PyObject * getBackground (PyImage * self, void * closure)
{
return Py_BuildValue("[BBB]", getImageRender(self)->getBackground()[0],
getImageRender(self)->getBackground()[1], getImageRender(self)->getBackground()[2]);
return Py_BuildValue("[BBBB]",
getImageRender(self)->getBackground(0),
getImageRender(self)->getBackground(1),
getImageRender(self)->getBackground(2),
getImageRender(self)->getBackground(3));
}
// set color
static int setBackground (PyImage * self, PyObject * value, void * closure)
{
// check validity of parameter
if (value == NULL || !PySequence_Check(value) || PySequence_Length(value) != 3
if (value == NULL || !PySequence_Check(value) || PySequence_Length(value) != 4
|| !PyInt_Check(PySequence_Fast_GET_ITEM(value, 0))
|| !PyInt_Check(PySequence_Fast_GET_ITEM(value, 1))
|| !PyInt_Check(PySequence_Fast_GET_ITEM(value, 2)))
|| !PyInt_Check(PySequence_Fast_GET_ITEM(value, 2))
|| !PyInt_Check(PySequence_Fast_GET_ITEM(value, 3)))
{
PyErr_SetString(PyExc_TypeError, "The value must be a sequence of 3 ints");
PyErr_SetString(PyExc_TypeError, "The value must be a sequence of 4 integer between 0 and 255");
return -1;
}
// set background color
getImageRender(self)->setBackground((unsigned char)(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 0))),
(unsigned char)(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 1))),
(unsigned char)(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 2))));
(unsigned char)(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 2))),
(unsigned char)(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 3))));
// success
return 0;
}
@@ -209,6 +356,10 @@ static PyMethodDef imageRenderMethods[] =
static PyGetSetDef imageRenderGetSets[] =
{
{(char*)"background", (getter)getBackground, (setter)setBackground, (char*)"background color", NULL},
// attribute from ImageViewport
{(char*)"capsize", (getter)ImageViewport_getCaptureSize, (setter)ImageViewport_setCaptureSize, (char*)"size of render area", NULL},
{(char*)"alpha", (getter)ImageViewport_getAlpha, (setter)ImageViewport_setAlpha, (char*)"use alpha in texture", NULL},
{(char*)"whole", (getter)ImageViewport_getWhole, (setter)ImageViewport_setWhole, (char*)"use whole viewport to render", NULL},
// attributes from ImageBase class
{(char*)"image", (getter)Image_getImage, NULL, (char*)"image data", NULL},
{(char*)"size", (getter)Image_getSize, NULL, (char*)"image size", NULL},
@@ -263,5 +414,315 @@ PyTypeObject ImageRenderType =
Image_allocNew, /* tp_new */
};
// object initialization
static int ImageMirror_init (PyObject * pySelf, PyObject * args, PyObject * kwds)
{
// parameters - scene object
PyObject * scene;
// reference object for mirror
PyObject * observer;
// object holding the mirror
PyObject * mirror;
// material of the mirror
short materialID = 0;
// parameter keywords
static char *kwlist[] = {"scene", "observer", "mirror", "material", NULL};
// get parameters
if (!PyArg_ParseTupleAndKeywords(args, kwds, "OOO|h", kwlist, &scene, &observer, &mirror, &materialID))
return -1;
try
{
// get scene pointer
KX_Scene * scenePtr (NULL);
if (scene != NULL && PyObject_TypeCheck(scene, &KX_Scene::Type))
scenePtr = static_cast<KX_Scene*>(scene);
else
THRWEXCP(SceneInvalid, S_OK);
// get observer pointer
KX_GameObject * observerPtr (NULL);
if (observer != NULL && PyObject_TypeCheck(observer, &KX_GameObject::Type))
observerPtr = static_cast<KX_GameObject*>(observer);
else if (observer != NULL && PyObject_TypeCheck(observer, &KX_Camera::Type))
observerPtr = static_cast<KX_Camera*>(observer);
else
THRWEXCP(ObserverInvalid, S_OK);
// get mirror pointer
KX_GameObject * mirrorPtr (NULL);
if (mirror != NULL && PyObject_TypeCheck(mirror, &KX_GameObject::Type))
mirrorPtr = static_cast<KX_GameObject*>(mirror);
else
THRWEXCP(MirrorInvalid, S_OK);
// locate the material in the mirror
RAS_IPolyMaterial * material = getMaterial(mirror, materialID);
if (material == NULL)
THRWEXCP(MaterialNotAvail, S_OK);
// get pointer to image structure
PyImage * self = reinterpret_cast<PyImage*>(pySelf);
// create source object
if (self->m_image != NULL)
{
delete self->m_image;
self->m_image = NULL;
}
self->m_image = new ImageRender(scenePtr, observerPtr, mirrorPtr, material);
}
catch (Exception & exp)
{
exp.report();
return -1;
}
// initialization succeded
return 0;
}
// get background color
PyObject * getClip (PyImage * self, void * closure)
{
return PyFloat_FromDouble(getImageRender(self)->getClip());
}
// set clip
static int setClip (PyImage * self, PyObject * value, void * closure)
{
// check validity of parameter
double clip;
if (value == NULL || !PyFloat_Check(value) || (clip = PyFloat_AsDouble(value)) < 0.01 || clip > 5000.0)
{
PyErr_SetString(PyExc_TypeError, "The value must be an float between 0.01 and 5000");
return -1;
}
// set background color
getImageRender(self)->setClip(float(clip));
// success
return 0;
}
// attributes structure
static PyGetSetDef imageMirrorGetSets[] =
{
{(char*)"clip", (getter)getClip, (setter)setClip, (char*)"clipping distance", NULL},
// attribute from ImageRender
{(char*)"background", (getter)getBackground, (setter)setBackground, (char*)"background color", NULL},
// attribute from ImageViewport
{(char*)"capsize", (getter)ImageViewport_getCaptureSize, (setter)ImageViewport_setCaptureSize, (char*)"size of render area", NULL},
{(char*)"alpha", (getter)ImageViewport_getAlpha, (setter)ImageViewport_setAlpha, (char*)"use alpha in texture", NULL},
{(char*)"whole", (getter)ImageViewport_getWhole, (setter)ImageViewport_setWhole, (char*)"use whole viewport to render", NULL},
// attributes from ImageBase class
{(char*)"image", (getter)Image_getImage, NULL, (char*)"image data", NULL},
{(char*)"size", (getter)Image_getSize, NULL, (char*)"image size", NULL},
{(char*)"scale", (getter)Image_getScale, (setter)Image_setScale, (char*)"fast scale of image (near neighbour)", NULL},
{(char*)"flip", (getter)Image_getFlip, (setter)Image_setFlip, (char*)"flip image vertically", NULL},
{(char*)"filter", (getter)Image_getFilter, (setter)Image_setFilter, (char*)"pixel filter", NULL},
{NULL}
};
// constructor
ImageRender::ImageRender (KX_Scene * scene, KX_GameObject * observer, KX_GameObject * mirror, RAS_IPolyMaterial * mat) :
ImageViewport(),
m_render(false),
m_scene(scene),
m_observer(observer),
m_mirror(mirror),
m_clip(100.f)
{
// this constructor is used for automatic planar mirror
// create a camera, take all data by default, in any case we will recompute the frustrum on each frame
RAS_CameraData camdata;
vector<RAS_TexVert*> mirrorVerts;
vector<RAS_TexVert*>::iterator it;
float mirrorArea = 0.f;
float mirrorNormal[3] = {0.f, 0.f, 0.f};
float mirrorUp[3];
float dist, vec[3];
float zaxis[3] = {0.f, 0.f, 1.f};
float mirrorMat[3][3];
float left, right, top, bottom, back;
m_camera= new KX_Camera(scene, KX_Scene::m_callbacks, camdata);
m_camera->SetName("__mirror__cam__");
// don't add the camera to the scene object list, it doesn't need to be accessible
m_owncamera = true;
// retrieve rendering objects
m_engine = KX_GetActiveEngine();
m_rasterizer = m_engine->GetRasterizer();
m_canvas = m_engine->GetCanvas();
m_rendertools = m_engine->GetRenderTools();
// locate the vertex assigned to mat and do following calculation in mesh coordinates
for (int meshIndex = 0; meshIndex < mirror->GetMeshCount(); meshIndex++)
{
RAS_MeshObject* mesh = mirror->GetMesh(meshIndex);
int numPolygons = mesh->NumPolygons();
for (int polygonIndex=0; polygonIndex < numPolygons; polygonIndex++)
{
RAS_Polygon* polygon = mesh->GetPolygon(polygonIndex);
if (polygon->GetMaterial()->GetPolyMaterial() == mat)
{
RAS_TexVert *v1, *v2, *v3, *v4;
float normal[3];
float area;
// this polygon is part of the mirror,
v1 = polygon->GetVertex(0);
v2 = polygon->GetVertex(1);
v3 = polygon->GetVertex(2);
mirrorVerts.push_back(v1);
mirrorVerts.push_back(v2);
mirrorVerts.push_back(v3);
if (polygon->VertexCount() == 4)
{
v4 = polygon->GetVertex(3);
mirrorVerts.push_back(v4);
area = CalcNormFloat4((float*)v1->getXYZ(), (float*)v2->getXYZ(), (float*)v3->getXYZ(), (float*)v4->getXYZ(), normal);
} else
{
area = CalcNormFloat((float*)v1->getXYZ(), (float*)v2->getXYZ(), (float*)v3->getXYZ(), normal);
}
area = fabs(area);
mirrorArea += area;
VecMulf(normal, area);
VecAddf(mirrorNormal, mirrorNormal, normal);
}
}
}
if (mirrorVerts.size() == 0 || mirrorArea < FLT_EPSILON)
{
// no vertex or zero size mirror
THRWEXCP(MirrorSizeInvalid, S_OK);
}
// compute average normal of mirror faces
VecMulf(mirrorNormal, 1.0f/mirrorArea);
if (Normalize(mirrorNormal) == 0.f)
{
// no normal
THRWEXCP(MirrorNormalInvalid, S_OK);
}
// the mirror plane has an equation of the type ax+by+cz = d where (a,b,c) is the normal vector
// mirror up direction is the projection of Z on the plane
// scalar product between normal and Z axis
dist = Inpf(mirrorNormal, zaxis);
if (dist < FLT_EPSILON)
{
// the mirror is already vertical
VecCopyf(mirrorUp, zaxis);
}
else
{
// projection of Z to normal
VecCopyf(vec, mirrorNormal);
VecMulf(vec, dist);
VecSubf(mirrorUp, zaxis, mirrorNormal);
if (Normalize(mirrorUp) == 0.f)
{
// mirror is horizontal
THRWEXCP(MirrorHorizontal, S_OK);
return;
}
}
// compute rotation matrix between local coord and mirror coord
// to match camera orientation, we select mirror z = -normal, y = up, x = y x z
VecCopyf(mirrorMat[2], mirrorNormal);
VecMulf(mirrorMat[2], -1.0f);
VecCopyf(mirrorMat[1], mirrorUp);
Crossf(mirrorMat[0], mirrorMat[1], mirrorMat[2]);
// transpose to make it a orientation matrix from local space to mirror space
Mat3Transp(mirrorMat);
// transform all vertex to plane coordinates and determine mirror position
left = FLT_MAX;
right = -FLT_MAX;
bottom = FLT_MAX;
top = -FLT_MAX;
back = -FLT_MAX; // most backward vertex (=highest Z coord in mirror space)
for (it = mirrorVerts.begin(); it != mirrorVerts.end(); it++)
{
VecCopyf(vec, (float*)(*it)->getXYZ());
Mat3MulVecfl(mirrorMat, vec);
if (vec[0] < left)
left = vec[0];
if (vec[0] > right)
right = vec[0];
if (vec[1] < bottom)
bottom = vec[1];
if (vec[1] > top)
top = vec[1];
if (vec[2] > back)
back = vec[2];
}
// now store this information in the object for later rendering
m_mirrorHalfWidth = (right-left)*0.5f;
m_mirrorHalfHeight = (top-bottom)*0.5f;
if (m_mirrorHalfWidth < 0.01f || m_mirrorHalfHeight < 0.01f)
{
// mirror too small
THRWEXCP(MirrorTooSmall, S_OK);
}
// mirror position in mirror coord
vec[0] = (left+right)*0.5f;
vec[1] = (top+bottom)*0.5f;
vec[2] = back;
// convert it in local space: transpose again the matrix to get back to mirror to local transform
Mat3Transp(mirrorMat);
Mat3MulVecfl(mirrorMat, vec);
// mirror position in local space
m_mirrorPos.setValue(vec[0], vec[1], vec[2]);
// mirror normal vector (pointed towards the back of the mirror) in local space
m_mirrorZ.setValue(-mirrorNormal[0], -mirrorNormal[1], -mirrorNormal[2]);
m_mirrorY.setValue(mirrorUp[0], mirrorUp[1], mirrorUp[2]);
m_mirrorX = m_mirrorY.cross(m_mirrorZ);
m_render = true;
setBackground(0, 0, 255, 255);
}
// define python type
PyTypeObject ImageMirrorType =
{
PyObject_HEAD_INIT(NULL)
0, /*ob_size*/
"VideoTexture.ImageMirror", /*tp_name*/
sizeof(PyImage), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)Image_dealloc, /*tp_dealloc*/
0, /*tp_print*/
0, /*tp_getattr*/
0, /*tp_setattr*/
0, /*tp_compare*/
0, /*tp_repr*/
0, /*tp_as_number*/
0, /*tp_as_sequence*/
0, /*tp_as_mapping*/
0, /*tp_hash */
0, /*tp_call*/
0, /*tp_str*/
0, /*tp_getattro*/
0, /*tp_setattro*/
0, /*tp_as_buffer*/
Py_TPFLAGS_DEFAULT, /*tp_flags*/
"Image source from mirror", /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
imageRenderMethods, /* tp_methods */
0, /* tp_members */
imageMirrorGetSets, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
(initproc)ImageMirror_init, /* tp_init */
0, /* tp_alloc */
Image_allocNew, /* tp_new */
};
#endif // #if 0

View File

@@ -42,42 +42,56 @@ class ImageRender : public ImageViewport
public:
/// constructor
ImageRender (KX_Scene * scene, KX_Camera * camera);
ImageRender (KX_Scene * scene, KX_GameObject * observer, KX_GameObject * mirror, RAS_IPolyMaterial * mat);
/// destructor
virtual ~ImageRender (void);
/// get background color
unsigned char * getBackground (void) { return m_background; }
int getBackground (int idx) { return (idx < 0 || idx > 3) ? 0 : int(m_background[idx]*255.f); }
/// set background color
void setBackground (unsigned char red, unsigned char green, unsigned char blue);
void setBackground (int red, int green, int blue, int alpha);
/// clipping distance
float getClip (void) { return m_clip; }
/// set whole buffer use
void setClip (float clip) { m_clip = clip; }
protected:
/// true if ready to render
bool m_render;
/// rendered scene
KX_Scene * m_scene;
/// camera for render
KX_Camera * m_camera;
/// screen area for rendering
ScrArea m_area;
/// rendering device
RAS_ICanvas * m_canvas;
/// rasterizer
RAS_IRasterizer * m_rasterizer;
/// render tools
RAS_IRenderTools * m_rendertools;
/// do we own the camera?
bool m_owncamera;
/// for mirror operation
KX_GameObject * m_observer;
KX_GameObject * m_mirror;
float m_clip; // clipping distance
float m_mirrorHalfWidth; // mirror width in mirror space
float m_mirrorHalfHeight; // mirror height in mirror space
MT_Point3 m_mirrorPos; // mirror center position in local space
MT_Vector3 m_mirrorZ; // mirror Z axis in local space
MT_Vector3 m_mirrorY; // mirror Y axis in local space
MT_Vector3 m_mirrorX; // mirror X axis in local space
/// canvas
RAS_ICanvas* m_canvas;
/// rasterizer
RAS_IRasterizer* m_rasterizer;
/// render tools
RAS_IRenderTools* m_rendertools;
/// engine
KX_KetsjiEngine* m_engine;
/// background colour
unsigned char m_background[3];
float m_background[4];
/// render 3d scene to image
virtual void calcImage (unsigned int texId);
/// refresh lights
void refreshLights (void);
/// methods from KX_KetsjiEngine
bool BeginFrame();
void EndFrame();
void Render();
void SetupRenderFrame(KX_Scene *scene, KX_Camera* cam);
void RenderFrame(KX_Scene* scene, KX_Camera* cam);

View File

@@ -34,12 +34,12 @@ http://www.gnu.org/copyleft/lesser.txt.
// constructor
ImageViewport::ImageViewport (void) : m_texInit(false)
ImageViewport::ImageViewport (void) : m_alpha(false), m_texInit(false)
{
// get viewport rectangle
glGetIntegerv(GL_VIEWPORT, m_viewport);
// create buffer for viewport image
m_viewportImage = new BYTE [3 * getViewportSize()[0] * getViewportSize()[1]];
m_viewportImage = new BYTE [4 * getViewportSize()[0] * getViewportSize()[1]];
// set attributes
setWhole(false);
}
@@ -62,7 +62,7 @@ void ImageViewport::setWhole (bool whole)
m_capSize[idx] = whole ? short(getViewportSize()[idx])
: calcSize(short(getViewportSize()[idx]));
// position
m_position[idx] = whole ? 0 : (getViewportSize()[idx] - m_capSize[idx]) >> 1;
m_position[idx] = whole ? 0 : ((getViewportSize()[idx] - m_capSize[idx]) >> 1);
}
// init image
init(m_capSize[0], m_capSize[1]);
@@ -123,20 +123,31 @@ void ImageViewport::calcImage (unsigned int texId)
&& m_capSize[1] == calcSize(m_capSize[1]) && !m_flip)
{
// just copy current viewport to texture
glBindTexture(GL_TEXTURE_2D, texId);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_upLeft[0], m_upLeft[1], (GLsizei)m_capSize[0], (GLsizei)m_capSize[1]);
// image is not available
m_avail = false;
glBindTexture(GL_TEXTURE_2D, texId);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_upLeft[0], m_upLeft[1], (GLsizei)m_capSize[0], (GLsizei)m_capSize[1]);
// image is not available
m_avail = false;
}
// otherwise copy viewport to buffer, if image is not available
else if (!m_avail)
{
// get frame buffer data
glReadPixels(m_upLeft[0], m_upLeft[1], (GLsizei)m_capSize[0], (GLsizei)m_capSize[1], GL_RGB,
GL_UNSIGNED_BYTE, m_viewportImage);
// filter loaded data
FilterRGB24 filt;
filterImage(filt, m_viewportImage, m_capSize);
if (m_alpha)
{
glReadPixels(m_upLeft[0], m_upLeft[1], (GLsizei)m_capSize[0], (GLsizei)m_capSize[1], GL_RGBA,
GL_UNSIGNED_BYTE, m_viewportImage);
// filter loaded data
FilterRGBA32 filt;
filterImage(filt, m_viewportImage, m_capSize);
}
else
{
glReadPixels(m_upLeft[0], m_upLeft[1], (GLsizei)m_capSize[0], (GLsizei)m_capSize[1], GL_RGB,
GL_UNSIGNED_BYTE, m_viewportImage);
// filter loaded data
FilterRGB24 filt;
filterImage(filt, m_viewportImage, m_capSize);
}
}
}
@@ -151,14 +162,14 @@ inline ImageViewport * getImageViewport (PyImage * self)
// get whole
static PyObject * ImageViewport_getWhole (PyImage * self, void * closure)
PyObject * ImageViewport_getWhole (PyImage * self, void * closure)
{
if (self->m_image != NULL && getImageViewport(self)->getWhole()) Py_RETURN_TRUE;
else Py_RETURN_FALSE;
}
// set whole
static int ImageViewport_setWhole (PyImage * self, PyObject * value, void * closure)
int ImageViewport_setWhole (PyImage * self, PyObject * value, void * closure)
{
// check parameter, report failure
if (value == NULL || !PyBool_Check(value))
@@ -172,6 +183,28 @@ static int ImageViewport_setWhole (PyImage * self, PyObject * value, void * clos
return 0;
}
// get alpha
PyObject * ImageViewport_getAlpha (PyImage * self, void * closure)
{
if (self->m_image != NULL && getImageViewport(self)->getAlpha()) Py_RETURN_TRUE;
else Py_RETURN_FALSE;
}
// set whole
int ImageViewport_setAlpha (PyImage * self, PyObject * value, void * closure)
{
// check parameter, report failure
if (value == NULL || !PyBool_Check(value))
{
PyErr_SetString(PyExc_TypeError, "The value must be a bool");
return -1;
}
// set alpha
if (self->m_image != NULL) getImageViewport(self)->setAlpha(value == Py_True);
// success
return 0;
}
// get position
static PyObject * ImageViewport_getPosition (PyImage * self, void * closure)
@@ -202,14 +235,14 @@ static int ImageViewport_setPosition (PyImage * self, PyObject * value, void * c
}
// get capture size
static PyObject * ImageViewport_getCaptureSize (PyImage * self, void * closure)
PyObject * ImageViewport_getCaptureSize (PyImage * self, void * closure)
{
return Py_BuildValue("(ii)", getImageViewport(self)->getCaptureSize()[0],
getImageViewport(self)->getCaptureSize()[1]);
}
// set capture size
static int ImageViewport_setCaptureSize (PyImage * self, PyObject * value, void * closure)
int ImageViewport_setCaptureSize (PyImage * self, PyObject * value, void * closure)
{
// check validity of parameter
if (value == NULL || !PySequence_Check(value) || PySequence_Length(value) != 2
@@ -242,6 +275,7 @@ static PyGetSetDef imageViewportGetSets[] =
{(char*)"whole", (getter)ImageViewport_getWhole, (setter)ImageViewport_setWhole, (char*)"use whole viewport to capture", NULL},
{(char*)"position", (getter)ImageViewport_getPosition, (setter)ImageViewport_setPosition, (char*)"upper left corner of captured area", NULL},
{(char*)"capsize", (getter)ImageViewport_getCaptureSize, (setter)ImageViewport_setCaptureSize, (char*)"size of viewport area being captured", NULL},
{(char*)"alpha", (getter)ImageViewport_getAlpha, (setter)ImageViewport_setAlpha, (char*)"use alpha in texture", NULL},
// attributes from ImageBase class
{(char*)"image", (getter)Image_getImage, NULL, (char*)"image data", NULL},
{(char*)"size", (getter)Image_getSize, NULL, (char*)"image size", NULL},

View File

@@ -43,6 +43,12 @@ public:
bool getWhole (void) { return m_whole; }
/// set whole buffer use
void setWhole (bool whole);
/// is alpha channel used
bool getAlpha (void) { return m_alpha; }
/// set whole buffer use
void setAlpha (bool alpha) { m_alpha = alpha; }
/// get capture size in viewport
short * getCaptureSize (void) { return m_capSize; }
/// set capture size in viewport
@@ -61,6 +67,8 @@ protected:
short m_capSize[2];
/// use whole viewport
bool m_whole;
/// use alpha channel
bool m_alpha;
/// position of capture rectangle in viewport
GLint m_position[2];
@@ -79,6 +87,12 @@ protected:
GLint * getViewportSize (void) { return m_viewport + 2; }
};
PyObject * ImageViewport_getCaptureSize (PyImage * self, void * closure);
int ImageViewport_setCaptureSize (PyImage * self, PyObject * value, void * closure);
PyObject * ImageViewport_getWhole (PyImage * self, void * closure);
int ImageViewport_setWhole (PyImage * self, PyObject * value, void * closure);
PyObject * ImageViewport_getAlpha (PyImage * self, void * closure);
int ImageViewport_setAlpha (PyImage * self, PyObject * value, void * closure);
#endif

View File

@@ -32,6 +32,7 @@ http://www.gnu.org/copyleft/lesser.txt.
#include "ImageBase.h"
#include "BlendType.h"
#include "Exception.h"
// type Texture declaration
@@ -82,5 +83,10 @@ RAS_IPolyMaterial * getMaterial (PyObject *obj, short matID);
// get material ID
short getMaterialID (PyObject * obj, char * name);
// Exceptions
extern ExceptionID MaterialNotAvail;
// object type
extern BlendType<KX_GameObject> gameObjectType;
#endif

View File

@@ -132,6 +132,7 @@ extern PyTypeObject FilterBGR24Type;
extern PyTypeObject ImageBuffType;
extern PyTypeObject ImageMixType;
extern PyTypeObject ImageRenderType;
extern PyTypeObject ImageMirrorType;
extern PyTypeObject ImageViewportType;
extern PyTypeObject ImageViewportType;
@@ -144,7 +145,8 @@ static void registerAllTypes(void)
#endif
pyImageTypes.add(&ImageBuffType, "ImageBuff");
pyImageTypes.add(&ImageMixType, "ImageMix");
//pyImageTypes.add(&ImageRenderType, "ImageRender");
pyImageTypes.add(&ImageRenderType, "ImageRender");
pyImageTypes.add(&ImageMirrorType, "ImageMirror");
pyImageTypes.add(&ImageViewportType, "ImageViewport");
pyFilterTypes.add(&FilterBlueScreenType, "FilterBlueScreen");

View File

@@ -120,22 +120,34 @@ ifeq ($(OS),freebsd)
endif
ifeq ($(OS),irix)
CC = cc
CCC = CC
CFLAGS += -n32 -mips3 -Xcpluscomm
CCFLAGS += -n32 -mips3 -Xcpluscomm -LANG:std
ifdef MIPS73_ISOHEADERS
CCFLAGS += -LANG:libc_in_namespace_std=off -I$(MIPS73_ISOHEADERS)
else
CCFLAGS += -LANG:libc_in_namespace_std=off
endif
REL_CFLAGS += -n32 -mips3 -O2 -OPT:Olimit=0
REL_CCFLAGS += -n32 -mips3 -O2 -OPT:Olimit=0
ifeq ($(IRIX_USE_GCC),true)
CC = gcc
CCC = g++
CFLAGS += -fPIC -funsigned-char -fno-strict-aliasing -mabi=n32 -mips4
CCFLAGS += -fPIC -fpermissive -funsigned-char -fno-strict-aliasing -mabi=n32 -mips4
REL_CFLAGS += -O2
REL_CCFLAGS += -O2
CPPFLAGS += -DXP_UNIX
DBG_CFLAGS += -g3 -gdwarf-2 -ggdb
DBG_CCFLAGS += -g3 -gdwarf-2 -ggdb
else
CC = cc
CCC = CC
CFLAGS += -n32 -mips3 -Xcpluscomm
CCFLAGS += -n32 -mips3 -Xcpluscomm -LANG:std
ifdef MIPS73_ISOHEADERS
CCFLAGS += -LANG:libc_in_namespace_std=off -I$(MIPS73_ISOHEADERS)
else
CCFLAGS += -LANG:libc_in_namespace_std=off
endif
REL_CFLAGS += -n32 -mips3 -O2 -OPT:Olimit=0
REL_CCFLAGS += -n32 -mips3 -O2 -OPT:Olimit=0
endif
OPENGL_HEADERS = /usr/include
NAN_DEPEND = true
AR = CC
ARFLAGS = -ar -o
ARFLAGSQUIET = -ar -o
ARFLAGSQUIET = -ar -o
endif
ifeq ($(OS),linux)

View File

@@ -75,6 +75,7 @@ else
export NAN_SOLID ?= $(LCGDIR)/solid
export NAN_QHULL ?= $(LCGDIR)/qhull
endif
export NAN_USE_BULLET ?= true
export NAN_BULLET2 ?= $(LCGDIR)/bullet2
export NAN_SUMO ?= $(SRCHOME)/gameengine/Physics/Sumo
export NAN_FUZZICS ?= $(SRCHOME)/gameengine/Physics/Sumo/Fuzzics
@@ -83,7 +84,7 @@ endif
export NAN_GUARDEDALLOC ?= $(LCGDIR)/guardedalloc
export NAN_IKSOLVER ?= $(LCGDIR)/iksolver
export NAN_BSP ?= $(LCGDIR)/bsp
export NAN_BOOLOP ?= $(LCGDIR)/boolop
export NAN_BOOLOP ?= $(LCGDIR)/boolop
export NAN_SOUNDSYSTEM ?= $(LCGDIR)/SoundSystem
export NAN_STRING ?= $(LCGDIR)/string
export NAN_MEMUTIL ?= $(LCGDIR)/memutil
@@ -116,7 +117,7 @@ endif
export WITH_DDS ?= true
ifeq ($(OS),windows)
export NAN_WINTAB ?= $(LCGDIR)/wintab
export NAN_WINTAB ?= $(LCGDIR)/wintab
ifeq ($(FREE_WINDOWS), true)
export NAN_PTHREADS ?= $(LCGDIR)/pthreads
export NAN_OPENEXR ?= $(LCGDIR)/gcc/openexr
@@ -129,28 +130,34 @@ endif
endif
else
ifeq ($(OS),darwin)
export NAN_OPENEXR ?= $(LCGDIR)/openexr
ifeq ($(CPU),powerpc)
export NAN_OPENEXR_LIBS ?= $(NAN_OPENEXR)/lib/libIlmImf.a $(NAN_OPENEXR)/lib/libHalf.a $(NAN_OPENEXR)/lib/libIex.a
else
export NAN_OPENEXR_LIBS ?= $(NAN_OPENEXR)/lib/libIlmImf.a $(NAN_OPENEXR)/lib/libHalf.a $(NAN_OPENEXR)/lib/libIex.a $(NAN_OPENEXR)/lib/libIlmThread.a
endif
export NAN_OPENEXR ?= $(LCGDIR)/openexr
ifeq ($(CPU),powerpc)
export NAN_OPENEXR_LIBS ?= $(NAN_OPENEXR)/lib/libIlmImf.a $(NAN_OPENEXR)/lib/libHalf.a $(NAN_OPENEXR)/lib/libIex.a
else
export NAN_OPENEXR_LIBS ?= $(NAN_OPENEXR)/lib/libIlmImf.a $(NAN_OPENEXR)/lib/libHalf.a $(NAN_OPENEXR)/lib/libIex.a $(NAN_OPENEXR)/lib/libIlmThread.a
endif
else
ifeq ($(OS),linux)
ifeq ($(WITH_OPENEXR), true)
NAN_OPENEXR?=$(shell pkg-config --variable=prefix OpenEXR )
NAN_OPENEXR_INC?=$(shell pkg-config --cflags OpenEXR )
NAN_OPENEXR_LIBS?=$(addprefix ${NAN_OPENEXR}/lib/lib,$(addsuffix .a,$(shell pkg-config --libs-only-l OpenEXR | sed -s "s/-l//g" )))
endif
ifeq ($(WITH_OPENEXR), true)
NAN_OPENEXR?=$(shell pkg-config --variable=prefix OpenEXR )
NAN_OPENEXR_INC?=$(shell pkg-config --cflags OpenEXR )
NAN_OPENEXR_LIBS?=$(addprefix ${NAN_OPENEXR}/lib/lib,$(addsuffix .a,$(shell pkg-config --libs-only-l OpenEXR | sed -s "s/-l//g" )))
endif
else
ifeq ($(OS), solaris)
# this only exists at the moment for i386-64 CPU Types at the moment
export NAN_OPENEXR ?= $(LCGDIR)/openexr
export NAN_OPENEXR_LIBS ?= $(NAN_OPENEXR)/lib/libIlmImf.a $(NAN_OPENEXR)/lib/libHalf.a $(NAN_OPENEXR)/lib/libIex.a $(NAN_OPENEXR)/lib/libIlmThread.a -lrt
else
export NAN_OPENEXR ?= /usr/local
export NAN_OPENEXR_LIBS ?= $(NAN_OPENEXR)/lib/libIlmImf.a $(NAN_OPENEXR)/lib/libHalf.a $(NAN_OPENEXR)/lib/libIex.a
ifeq ($(OS), irix)
ifeq ($(IRIX_USE_GCC), true)
export NAN_OPENEXR ?= $(LCGDIR)/openexr/gcc
else
export NAN_OPENEXR ?= $(LCGDIR)/openexr
endif
endif
export NAN_OPENEXR_INC ?= -I$(NAN_OPENEXR)/include -I$(NAN_OPENEXR)/include/OpenEXR
export NAN_OPENEXR_LIBS ?= $(NAN_OPENEXR)/lib/libIlmImf.a $(NAN_OPENEXR)/lib/libHalf.a $(NAN_OPENEXR)/lib/libIex.a $(NAN_OPENEXR)/lib/libIlmThread.a
endif
endif
endif
@@ -331,23 +338,27 @@ endif
export NAN_PYTHON ?= $(LCGDIR)/python
export NAN_PYTHON_VERSION ?= 2.3
export NAN_PYTHON_BINARY ?= $(NAN_PYTHON)/bin/python$(NAN_PYTHON_VERSION)
export NAN_PYTHON_LIB ?= $(NAN_PYTHON)/lib/python$(NAN_PYTHON_VERSION)/config/libpython$(NAN_PYTHON_VERSION).a
export NAN_PYTHON_LIB ?= $(NAN_PYTHON)/lib/python$(NAN_PYTHON_VERSION)/config/libpython$(NAN_PYTHON_VERSION).a -lpthread
export NAN_OPENAL ?= $(LCGDIR)/openal
export NAN_FMOD ?= $(LCGDIR)/fmod
export NAN_JPEG ?= $(LCGDIR)/jpeg
export NAN_PNG ?= $(LCGDIR)/png
export NAN_TIFF ?= /usr/freeware
export NAN_TIFF ?= $(LCGDIR)/tiff
export NAN_ODE ?= $(LCGDIR)/ode
export NAN_TERRAPLAY ?= $(LCGDIR)/terraplay
export NAN_MESA ?= /usr/src/Mesa-3.1
export NAN_ZLIB ?= /usr/freeware
export NAN_ZLIB ?= $(LCGDIR)/zlib
export NAN_NSPR ?= $(LCGDIR)/nspr
export NAN_FREETYPE ?= /usr/freeware
export NAN_GETTEXT ?= /usr/freeware
export NAN_GETTEXT_LIB ?= $(NAN_GETTEXT)/lib32/libintl.a
export NAN_FREETYPE ?= $(LCGDIR)/freetype
export NAN_ICONV ?= $(LCGDIR)/iconv
export NAN_GETTEXT ?= $(LCGDIR)/gettext
export NAN_GETTEXT_LIB ?= $(NAN_GETTEXT)/lib/libintl.a $(NAN_ICONV)/lib/libiconv.a
export NAN_SDL ?= $(LCGDIR)/sdl
export NAN_SDLLIBS ?= -L$(NAN_SDL)/lib -lSDL
export NAN_SDLLIBS ?= $(NAN_SDL)/lib/libSDL.a
export NAN_SDLCFLAGS ?= -I$(NAN_SDL)/include/SDL
export NAN_FFMPEG ?= $(LCGDIR)/ffmpeg
export NAN_FFMPEGLIBS = $(NAN_FFMPEG)/lib/libavformat.a $(NAN_FFMPEG)/lib/libavcodec.a $(NAN_FFMPEG)/lib/libswscale.a $(NAN_FFMPEG)/lib/libavutil.a $(NAN_FFMPEG)/lib/libogg.a $(NAN_FFMPEG)/lib/libfaad.a $(NAN_FFMPEG)/lib/libmp3lame.a $(NAN_FFMPEG)/lib/libvorbis.a $(NAN_FFMPEG)/lib/libx264.a $(NAN_FFMPEG)/lib/libfaac.a $(NAN_ZLIB)/lib/libz.a
export NAN_FFMPEGCFLAGS ?= -I$(NAN_FFMPEG)/include
# Uncomment the following line to use Mozilla inplace of netscape
# CPPFLAGS +=-DMOZ_NOT_NET

View File

@@ -72,11 +72,19 @@ ifeq ($(OS),freebsd)
endif
ifeq ($(OS),irix)
LDFLAGS += -mips3
LLIBS = -lmovieGL -lGLU -lGL -lXmu -lXext -lX11 -lc -lm -ldmedia
LLIBS += -lcl -laudio -ldb -lCio -lz
LLIBS += -lpthread
LLIBS += -woff 84,171
ifeq ($(IRIX_USE_GCC), true)
LDFLAGS += -mabi=n32 -mips4
DBG_LDFLAGS += -LD_LAYOUT:lgot_buffer=40
else
LDFLAGS += -n32 -mips3
LDFLAGS += -woff 84,171
endif
LLIBS = -lmovieGL -lGLU -lGL -lXmu -lXext -lXi -lX11 -lc -lm -ldmedia
LLIBS += -lcl -laudio
ifneq ($(IRIX_USE_GCC), true)
LLIBS += -lCio -ldb
endif
LLIBS += -lz -lpthread
DYNLDFLAGS = -shared $(LDFLAGS)
endif
@@ -90,7 +98,7 @@ ifeq ($(OS),linux)
ifeq ($(CPU),$(findstring $(CPU), "i386 x86_64 ia64 parisc64 powerpc sparc64"))
COMMENT = "MESA 3.1"
LLIBS = -L$(NAN_MESA)/lib -L/usr/X11R6/lib -lXmu -lXext -lX11 -lXi
LLIBS += -lutil -lc -lm -ldl -lpthread
LLIBS += -lutil -lc -lm -ldl -lpthread
# LLIBS += -L$(NAN_ODE)/lib -lode
LOPTS = -export-dynamic
DADD = -lGL -lGLU