This commit is contained in:
2009-01-28 00:43:46 +00:00
236 changed files with 10961 additions and 1602 deletions

View File

@@ -175,7 +175,7 @@ IF(UNIX)
SET(FFMPEG /usr)
SET(FFMPEG_INC ${FFMPEG}/include)
SET(FFMPEG_LIB avformat avcodec avutil)
SET(FFMPEG_LIB avformat avcodec avutil avdevice swscale)
SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
SET(JPEG_LIB jpeg)

View File

@@ -115,8 +115,9 @@ if toolset:
env.Tool('mstoolkit', ['tools'])
else:
env = BlenderEnvironment(tools=[toolset], ENV = os.environ)
if env:
btools.SetupSpawn(env)
# xxx commented out, as was supressing warnings under mingw..
#if env:
# btools.SetupSpawn(env)
else:
env = BlenderEnvironment(ENV = os.environ)
@@ -321,10 +322,15 @@ if not quickie and do_clean:
print "remove file %s"%(B.root_build_dir+entry)
os.remove(B.root_build_dir+entry)
for confile in ['extern/ffmpeg/config.mak', 'extern/x264/config.mak',
'extern/xvidcore/build/generic/platform.inc']:
'extern/xvidcore/build/generic/platform.inc', 'extern/ffmpeg/include']:
if os.path.exists(confile):
print "clean file %s"%confile
os.remove(confile)
if os.path.isdir(confile):
for root, dirs, files in os.walk(confile):
for name in files:
os.remove(os.path.join(root, name))
else:
os.remove(confile)
print B.bc.OKGREEN+'...done'+B.bc.ENDC
else:
print B.bc.HEADER+'Already Clean, nothing to do.'+B.bc.ENDC

View File

@@ -40,7 +40,11 @@ else:
# enable ffmpeg support
WITH_BF_FFMPEG = True # -DWITH_FFMPEG
BF_FFMPEG = "#extern/ffmpeg"
BF_FFMPEG_INC = '${BF_FFMPEG}/include'
# trick : The version of ffmpeg in extern/ffmpeg uses explicit libav.. directory in #include statements
# To keep Blender compatible with older versions, I add ${BF_FFMPEG} to the inc dir so that ffmpeg
# finds the files directly in extern/ffmpeg/libav... while blender finds them in
# extern/ffmpeg/include.
BF_FFMPEG_INC = '${BF_FFMPEG}/include ${BF_FFMPEG}'
if USE_SDK==True:
BF_FFMPEG_EXTRA = '-isysroot '+MACOSX_SDK+' -mmacosx-version-min='+MAC_MIN_VERS
#BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'

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 avdevice 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}'
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

View File

@@ -139,8 +139,13 @@ BF_FFMPEG = '#extern/ffmpeg'
BF_FFMPEG_LIB = ''
# Uncomment the following two lines to use system's ffmpeg
# BF_FFMPEG = '/usr'
# BF_FFMPEG_LIB = 'avformat avcodec swscale avutil'
BF_FFMPEG_INC = '${BF_FFMPEG}/include'
# BF_FFMPEG_LIB = 'avformat avcodec swscale avutil avdevice'
# trick : The version of ffmpeg in extern/ffmpeg uses explicit libav.. directory in #include statements
# To keep Blender compatible with older version, I add ${BF_FFMPEG} to the inc dir so that ffmpeg
# finds the files directly in extern/ffmpeg/libav... while blender finds them in
# extern/ffmpeg/include. When using system ffmpeg, you don't need that, assuming the system library
# still use the flat directory model, otherwise will not compile anyway
BF_FFMPEG_INC = '${BF_FFMPEG}/include ${BF_FFMPEG}'
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
# enable ogg, vorbis and theora in ffmpeg
@@ -152,13 +157,14 @@ BF_OGG_LIB = 'ogg vorbis theoraenc theoradec'
WITH_BF_OPENJPEG = True
BF_OPENJPEG = '#extern/libopenjpeg'
BF_OPENJPEG_LIB = ''
BF_OPENJPEG_INC = '${BF_OPENJPEG}/include'
BF_OPENJPEG_INC = '${BF_OPENJPEG}'
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_INC = '${BF_REDCODE}/include'
BF_REDCODE_INC = '${BF_REDCODE}/../' #C files request "libredcode/format.h" which is in "#extern/libredcode/format.h", stupid but compiles for now.
BF_REDCODE_LIBPATH='${BF_REDCODE}/lib'
# Mesa Libs should go here if your using them as well....

View File

@@ -131,7 +131,7 @@ WITH_BF_FFMPEG = False # -DWITH_FFMPEG
BF_FFMPEG = '/usr/local'
BF_FFMPEG_INC = '${BF_FFMPEG}/include'
BF_FFMPEG_LIBPATH='${BF_FFMPEG}/lib'
BF_FFMPEG_LIB = 'avformat avcodec avutil'
BF_FFMPEG_LIB = 'avformat avcodec avutil avdevice'
# Mesa Libs should go here if your using them as well....
WITH_BF_STATICOPENGL = False

View File

@@ -6,10 +6,12 @@ BF_VERSE_INCLUDE = "#extern/verse/dist"
BF_PYTHON = LIBDIR + '/python'
BF_PYTHON_VERSION = '2.5'
WITH_BF_STATICPYTHON = False
BF_PYTHON_INC = '${BF_PYTHON}/include/python${BF_PYTHON_VERSION}'
BF_PYTHON_BINARY = 'python'
BF_PYTHON_LIB = 'python25'
BF_PYTHON_LIBPATH = '${BF_PYTHON}/lib/lib25_vs2005'
BF_PYTHON_LIB_STATIC = '${BF_PYTHON}/lib/lib25_vs2005/libpython25.a'
WITH_BF_OPENAL = True
WITH_BF_STATICOPENAL = False
@@ -21,7 +23,7 @@ BF_OPENAL_LIBPATH = '${BF_OPENAL}/lib'
BF_OPENAL_LIB_STATIC = '${BF_OPENAL}/lib/libopenal.a'
WITH_BF_FFMPEG = False
BF_FFMPEG_LIB = 'avformat swscale avcodec avutil xvidcore x264'
BF_FFMPEG_LIB = 'avformat swscale avcodec avutil avdevice xvidcore x264'
BF_FFMPEG_LIBPATH = LIBDIR + '/gcc/ffmpeg/lib'
BF_FFMPEG_INC = LIBDIR + '/gcc/ffmpeg/include'
@@ -170,4 +172,4 @@ BF_PROFILE = False
BF_BUILDDIR = '..\\build\\win32-mingw'
BF_INSTALLDIR='..\\install\\win32-mingw'
BF_DOCDIR = '..\\install\\doc'
BF_DOCDIR = '..\\install\\doc'

View File

@@ -153,6 +153,10 @@ BF_QUICKTIME_LIB = 'qtmlClient'
BF_QUICKTIME_LIBPATH = '${BF_QUICKTIME}/Libraries'
WITH_BF_OPENJPEG = True
BF_OPENJPEG = '#extern/libopenjpeg'
BF_OPENJPEG_LIB = ''
BF_OPENJPEG_INC = '${BF_OPENJPEG}'
BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib'
WITH_BF_REDCODE = False
BF_REDCODE_INC = '#extern'

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

@@ -49,8 +49,6 @@ void btCompoundShape::addChildShape(const btTransform& localTransform,btCollisio
child.m_childShapeType = shape->getShapeType();
child.m_childMargin = shape->getMargin();
m_children.push_back(child);
//extend the local aabbMin/aabbMax
btVector3 localAabbMin,localAabbMax;
shape->getAabb(localTransform,localAabbMin,localAabbMax);
@@ -69,10 +67,11 @@ void btCompoundShape::addChildShape(const btTransform& localTransform,btCollisio
if (m_dynamicAabbTree)
{
const btDbvtVolume bounds=btDbvtVolume::FromMM(localAabbMin,localAabbMax);
int index = m_children.size()-1;
int index = m_children.size();
child.m_node = m_dynamicAabbTree->insert(bounds,(void*)index);
}
m_children.push_back(child);
}
void btCompoundShape::removeChildShapeByIndex(int childShapeIndex)

View File

@@ -6,9 +6,12 @@ Import('env')
sources = env.Glob('*.c')
incs = '.'
flags = []
defs = []
if env['OURPLATFORM'] == 'win32-vc':
flags = []
defs.append('OPJ_STATIC')
else:
flags = ['-Wall', '-O3', '-ffast-math', '-std=c99']
@@ -19,6 +22,6 @@ if not env['OURPLATFORM'] == 'win32-vc':
oj_env.BlenderLib ( libname='extern_openjpeg',
sources=sources, includes=Split(incs),
defines=[],
defines=defs,
libtype=['core','intern','player'],
priority=[10, 10, 300], compileflags = flags)
priority=[300, 300, 300], compileflags = flags)

View File

@@ -40,25 +40,8 @@
==========================================================
*/
#if defined(OPJ_STATIC) || !(defined(WIN32) || defined(__WIN32__))
#define OPJ_API
#define OPJ_CALLCONV
#else
#define OPJ_CALLCONV __stdcall
/*
The following ifdef block is the standard way of creating macros which make exporting
from a DLL simpler. All files within this DLL are compiled with the OPJ_EXPORTS
symbol defined on the command line. this symbol should not be defined on any project
that uses this DLL. This way any other project whose source files include this file see
OPJ_API functions as being imported from a DLL, wheras this DLL sees symbols
defined with this macro as being exported.
*/
#ifdef OPJ_EXPORTS
#define OPJ_API __declspec(dllexport)
#else
#define OPJ_API __declspec(dllimport)
#endif /* OPJ_EXPORTS */
#endif /* !OPJ_STATIC || !WIN32 */
#ifndef __cplusplus
#if defined(HAVE_STDBOOL_H)

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

@@ -1031,15 +1031,20 @@ getClipboard(int flag
//This needs to change so we do not wait for ever or check owner first
while(1) {
XNextEvent(m_display, &xevent);
if(xevent.type == SelectionNotify) {
if(XGetWindowProperty(m_display, m_window, xevent.xselection.property, 0L, 4096L, False, AnyPropertyType, &rtype, &bits, &len, &bytes, &data) == Success) {
if (data) {
tmp_data = (unsigned char*) malloc(strlen((char*)data)+1);
strcpy((char*)tmp_data, (char*)data);
XFree(data);
return (GHOST_TUns8*)tmp_data;
if(xevent.type == SelectionNotify) {
if (xevent.xselection.property ) { /* eric4 on linux gives zero Atom xevent.xselection.property value, closes blender instantly */
if(XGetWindowProperty(m_display, m_window, xevent.xselection.property , 0L, 4096L, False, AnyPropertyType, &rtype, &bits, &len, &bytes, &data) == Success) {
if (data) {
tmp_data = (unsigned char*) malloc(strlen((char*)data)+1);
strcpy((char*)tmp_data, (char*)data);
XFree(data);
return (GHOST_TUns8*)tmp_data;
}
}
}
else {
fprintf(stderr, "error: cut buffer had a zero xevent.xselection.property, FIXME\n"); // XXX fix this problem!
}
return NULL;
}
}

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

@@ -73,7 +73,7 @@
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="SDL.lib freetype2ST.lib gnu_gettext.lib qtmlClient.lib openal_static.lib ws2_32.lib dxguid.lib opengl32.lib libjpeg.lib glu32.lib vfw32.lib winmm.lib libpng_st.lib zlib.lib python25.lib pthreadVSE2.lib pthreadVC2.lib libtiff.lib Half.lib Iex.lib IlmImf.lib Imath.lib IlmThread.lib avcodec-51.lib avformat-52.lib avutil-49.lib swscale-0.lib"
AdditionalDependencies="SDL.lib freetype2ST.lib gnu_gettext.lib qtmlClient.lib openal_static.lib ws2_32.lib dxguid.lib opengl32.lib libjpeg.lib glu32.lib vfw32.lib winmm.lib libpng_st.lib zlib.lib python25.lib pthreadVSE2.lib pthreadVC2.lib libtiff.lib Half.lib Iex.lib IlmImf.lib Imath.lib IlmThread.lib avcodec-51.lib avformat-52.lib avutil-49.lib swscale-0.lib avdevice-52.lib"
ShowProgress="0"
OutputFile="..\..\bin\blender.exe"
LinkIncremental="1"

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

@@ -10,7 +10,7 @@ Tip: 'Import an AC3D (.ac) file.'
__author__ = "Willian P. Germano"
__url__ = ("blender", "blenderartists.org", "AC3D's homepage, http://www.ac3d.org",
"PLib 3d gaming lib, http://plib.sf.net")
__version__ = "2.43.1 2007-02-21"
__version__ = "2.48.1 2009-01-11"
__bpydoc__ = """\
This script imports AC3D models into Blender.
@@ -31,6 +31,7 @@ Known issues:<br>
Config Options:<br>
- display transp (toggle): if "on", objects that have materials with alpha < 1.0 are shown with translucency (transparency) in the 3D View.<br>
- subdiv (toggle): if "on", ac3d objects meant to be subdivided receive a SUBSURF modifier in Blender.<br>
- emis as mircol: store the emissive rgb color from AC3D as mirror color in Blender -- this is a hack to preserve the values and be able to export them using the equivalent option in the exporter.<br>
- textures dir (string): if non blank, when imported texture paths are
wrong in the .ac file, Blender will also look for them at this dir.
@@ -50,11 +51,12 @@ users can configure (see config options above).
# --------------------------------------------------------------------------
# Thanks: Melchior Franz for extensive bug testing and reporting, making this
# version cope much better with old or bad .ac files, among other improvements;
# Stewart Andreason for reporting a serious crash.
# Stewart Andreason for reporting a serious crash; Francesco Brisa for the
# emis as mircol functionality (w/ patch).
# --------------------------------------------------------------------------
# ***** BEGIN GPL LICENSE BLOCK *****
#
# Copyright (C) 2004-2007: Willian P. Germano, wgermano _at_ ig.com.br
# Copyright (C) 2004-2009: Willian P. Germano, wgermano _at_ ig.com.br
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -89,15 +91,19 @@ DISPLAY_TRANSP = True
SUBDIV = True
EMIS_AS_MIRCOL = False
tooltips = {
'DISPLAY_TRANSP': 'Turn transparency on in the 3d View for objects using materials with alpha < 1.0.',
'SUBDIV': 'Apply a SUBSURF modifier to objects meant to appear subdivided.',
'TEXTURES_DIR': 'Additional folder to look for missing textures.'
'TEXTURES_DIR': 'Additional folder to look for missing textures.',
'EMIS_AS_MIRCOL': 'Store emis color as mirror color in Blender.'
}
def update_registry():
global TEXTURES_DIR, DISPLAY_TRANSP
rd = dict([('tooltips', tooltips), ('TEXTURES_DIR', TEXTURES_DIR), ('DISPLAY_TRANSP', DISPLAY_TRANSP), ('SUBDIV', SUBDIV)])
global TEXTURES_DIR, DISPLAY_TRANSP, EMIS_AS_MIRCOL
rd = dict([('tooltips', tooltips), ('TEXTURES_DIR', TEXTURES_DIR), ('DISPLAY_TRANSP', DISPLAY_TRANSP), ('SUBDIV', SUBDIV), ('EMIS_AS_MIRCOL', EMIS_AS_MIRCOL)])
Registry.SetKey('ac3d_import', rd, True)
rd = Registry.GetKey('ac3d_import', True)
@@ -109,6 +115,7 @@ if rd:
TEXTURES_DIR = rd['TEXTURES_DIR']
DISPLAY_TRANSP = rd['DISPLAY_TRANSP']
SUBDIV = rd['SUBDIV']
EMIS_AS_MIRCOL = rd['EMIS_AS_MIRCOL']
except:
update_registry()
else: update_registry()
@@ -299,7 +306,7 @@ class AC3DImport:
lines = self.lines
line = lines[i].split()
mat_name = ''
mat_col = mat_amb = mat_emit = mat_spec_col = [0,0,0]
mat_col = mat_amb = mat_emit = mat_spec_col = mat_mir_col = [0,0,0]
mat_alpha = 1
mat_spec = 1.0
@@ -310,11 +317,15 @@ class AC3DImport:
mat_amb = (v[0]+v[1]+v[2]) / 3.0
v = map(float,[line[11],line[12],line[13]])
mat_emit = (v[0]+v[1]+v[2]) / 3.0
if EMIS_AS_MIRCOL:
mat_emit = 0
mat_mir_col = map(float,[line[11],line[12],line[13]])
mat_spec_col = map(float,[line[15],line[16],line[17]])
mat_spec = float(line[19]) / 64.0
mat_alpha = float(line[-1])
mat_alpha = 1 - mat_alpha
self.mlist.append([mat_name, mat_col, mat_amb, mat_emit, mat_spec_col, mat_spec, mat_alpha])
self.mlist.append([mat_name, mat_col, mat_amb, mat_emit, mat_spec_col, mat_spec, mat_mir_col, mat_alpha])
i += 1
line = lines[i].split()
@@ -590,7 +601,8 @@ class AC3DImport:
m.emit = mat[3]
m.specCol = (mat[4][0], mat[4][1], mat[4][2])
m.spec = mat[5]
m.alpha = mat[6]
m.mirCol = (mat[6][0], mat[6][1], mat[6][2])
m.alpha = mat[7]
if m.alpha < 1.0:
m.mode |= MAT_MODE_ZTRANSP
has_transp_mats = True

View File

@@ -155,7 +155,7 @@ usrObjectNamePrefix= ""
# if that armature had bones (spine, neck, arm) and the bone prefix was "a."
# the bones and IPO curves will be (a.spine, a.neck, a.arm)
R2D = 18/3.1415 # radian to grad
R2D = 18/3.141592653589793 # radian to grad
BLENDER_VERSION = Blender.Get('version')
# Gets the current scene, there can be many scenes in 1 blend file.

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

@@ -225,15 +225,5 @@ from math import pi, sin, cos, sqrt
def angleToLength(angle):
# Alredy accounted for
if angle < 0.000001:
return 1.0
angle = 2*pi*angle/360
x,y = cos(angle), sin(angle)
# print "YX", x,y
# 0 d is hoz to the right.
# 90d is vert upward.
fac=1/x
x=x*fac
y=y*fac
return sqrt((x*x)+(y*y))
if angle < 0.000001: return 1.0
else: return abs(1.0 / cos(pi*angle/180));

View File

@@ -479,7 +479,7 @@ def pickMeshRayFaceWeight(me, orig, rdir):
w0 = (l1+l2)
w1 = (l0+l2)
w2 = (l1+l2)
w2 = (l1+l0)
totw= w0 + w1 + w2
w0=w0/totw

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

@@ -1,10 +1,10 @@
#dxfLibrary.py : provides functions for generating DXF files
# --------------------------------------------------------------------------
__version__ = "v1.27beta - 2008.10.05"
__author__ = "Stani Michiels(Stani), Remigiusz Fiedler(migius)"
__version__ = "v1.28beta - 2008.12.13"
__author__ = "Stani Michiels(Stani), Remigiusz Fiedler(migius)"
__license__ = "GPL"
__url__ = "http://wiki.blender.org/index.php/Scripts/Manual/Export/autodesk_dxf"
__bpydoc__ ="""The script exports geometry data to DXF format r12 version.
__url__ = "http://wiki.blender.org/index.php/Scripts/Manual/Export/autodesk_dxf"
__bpydoc__ ="""The library to export geometry data to DXF format r12 version.
Copyright %s
Version %s
@@ -12,15 +12,17 @@ License %s
Homepage %s
See the homepage for documentation.
url:
Dedicated thread on BlenderArtists: http://blenderartists.org/forum/showthread.php?t=136439
IDEAs:
-
TODO:
-
- add support for SPLINEs
History
v1.28 - 2008.12.13 by Steeve/BlenderArtists
- bugfix for EXTMIN/EXTMAX to suit Cycas-CAD
v1.27 - 2008.10.07 by migius
- beautifying output code: keys whitespace prefix
- refactoring DXF-strings format: NewLine moved to the end of
@@ -154,56 +156,56 @@ BYBLOCK=0
BYLAYER=256
#---block-type flags (bit coded values, may be combined):
ANONYMOUS =1 # This is an anonymous block generated by hatching, associative dimensioning, other internal operations, or an application
ANONYMOUS =1 # This is an anonymous block generated by hatching, associative dimensioning, other internal operations, or an application
NON_CONSTANT_ATTRIBUTES =2 # This block has non-constant attribute definitions (this bit is not set if the block has any attribute definitions that are constant, or has no attribute definitions at all)
XREF =4 # This block is an external reference (xref)
XREF_OVERLAY =8 # This block is an xref overlay
EXTERNAL =16 # This block is externally dependent
RESOLVED =32 # This is a resolved external reference, or dependent of an external reference (ignored on input)
REFERENCED =64 # This definition is a referenced external reference (ignored on input)
XREF =4 # This block is an external reference (xref)
XREF_OVERLAY =8 # This block is an xref overlay
EXTERNAL =16 # This block is externally dependent
RESOLVED =32 # This is a resolved external reference, or dependent of an external reference (ignored on input)
REFERENCED =64 # This definition is a referenced external reference (ignored on input)
#---mtext flags
#attachment point
TOP_LEFT = 1
TOP_CENTER = 2
TOP_RIGHT = 3
MIDDLE_LEFT = 4
MIDDLE_CENTER = 5
TOP_LEFT = 1
TOP_CENTER = 2
TOP_RIGHT = 3
MIDDLE_LEFT = 4
MIDDLE_CENTER = 5
MIDDLE_RIGHT = 6
BOTTOM_LEFT = 7
BOTTOM_CENTER = 8
BOTTOM_RIGHT = 9
BOTTOM_LEFT = 7
BOTTOM_CENTER = 8
BOTTOM_RIGHT = 9
#drawing direction
LEFT_RIGHT = 1
TOP_BOTTOM = 3
BY_STYLE = 5 #the flow direction is inherited from the associated text style
LEFT_RIGHT = 1
TOP_BOTTOM = 3
BY_STYLE = 5 #the flow direction is inherited from the associated text style
#line spacing style (optional):
AT_LEAST = 1 #taller characters will override
EXACT = 2 #taller characters will not override
AT_LEAST = 1 #taller characters will override
EXACT = 2 #taller characters will not override
#---polyline flags
CLOSED =1 # This is a closed polyline (or a polygon mesh closed in the M direction)
CURVE_FIT =2 # Curve-fit vertices have been added
SPLINE_FIT =4 # Spline-fit vertices have been added
POLYLINE_3D =8 # This is a 3D polyline
POLYGON_MESH =16 # This is a 3D polygon mesh
CLOSED_N =32 # The polygon mesh is closed in the N direction
POLYFACE_MESH =64 # The polyline is a polyface mesh
CONTINOUS_LINETYPE_PATTERN =128 # The linetype pattern is generated continuously around the vertices of this polyline
CLOSED =1 # This is a closed polyline (or a polygon mesh closed in the M direction)
CURVE_FIT =2 # Curve-fit vertices have been added
SPLINE_FIT =4 # Spline-fit vertices have been added
POLYLINE_3D =8 # This is a 3D polyline
POLYGON_MESH =16 # This is a 3D polygon mesh
CLOSED_N =32 # The polygon mesh is closed in the N direction
POLYFACE_MESH =64 # The polyline is a polyface mesh
CONTINOUS_LINETYPE_PATTERN =128 # The linetype pattern is generated continuously around the vertices of this polyline
#---text flags
#horizontal
LEFT = 0
CENTER = 1
RIGHT = 2
ALIGNED = 3 #if vertical alignment = 0
MIDDLE = 4 #if vertical alignment = 0
FIT = 5 #if vertical alignment = 0
LEFT = 0
CENTER = 1
RIGHT = 2
ALIGNED = 3 #if vertical alignment = 0
MIDDLE = 4 #if vertical alignment = 0
FIT = 5 #if vertical alignment = 0
#vertical
BASELINE = 0
BOTTOM = 1
MIDDLE = 2
TOP = 3
BASELINE = 0
BOTTOM = 1
MIDDLE = 2
TOP = 3
####3) Classes
#---entitities -----------------------------------------------
@@ -239,7 +241,7 @@ class Face(_Entity):
"""3dface"""
def __init__(self,points,**common):
_Entity.__init__(self,**common)
if len(points)<4: #fix for r12 format
while len(points)<4: #fix for r12 format
points.append(points[-1])
self.points=points
@@ -336,10 +338,14 @@ class PolyLine(_Entity):
#-----------------------------------------------
class Point(_Entity):
"""Colored solid fill."""
"""Point."""
def __init__(self,points=None,**common):
_Entity.__init__(self,**common)
self.points=points
def __str__(self): #TODO:
return ' 0\nPOINT\n%s%s\n' %(self._common(),
_points(self.points)
)
#-----------------------------------------------
class Solid(_Entity):
@@ -468,7 +474,7 @@ class Block(_Collection):
self.name=name
self.flag=0
self.base=base
def __str__(self):
def __str__(self): #TODO:
e=''.join([str(x)for x in self.entities])
return ' 0\nBLOCK\n 8\n%s\n 2\n%s\n 70\n%s\n%s\n 3\n%s\n%s 0\nENDBLK\n'%\
(self.layer,self.name.upper(),self.flag,_point(self.base),self.name.upper(),e)
@@ -552,11 +558,12 @@ def ViewByWindow(name,leftBottom=(0,0),rightTop=(1,1),**options):
#-----------------------------------------------
class Drawing(_Collection):
"""Dxf drawing. Use append or any other list methods to add objects."""
def __init__(self,insbase=(0.0,0.0,0.0),extmin=(0.0,0.0),extmax=(0.0,0.0),
def __init__(self,insbase=(0.0,0.0,0.0),extmin=(0.0,0.0,0.0),extmax=(0.0,0.0,0.0),
layers=[Layer()],linetypes=[LineType()],styles=[Style()],blocks=[],
views=[],entities=None,fileName='test.dxf'):
# TODO: replace list with None,arial
if not entities:entities=[]
if not entities:
entities=[]
_Collection.__init__(self,entities)
self.insbase=insbase
self.extmin=extmin
@@ -680,9 +687,9 @@ def test():
#Drawing
d=Drawing()
#tables
d.blocks.append(b) #table blocks
d.styles.append(Style()) #table styles
d.views.append(View('Normal')) #table view
d.blocks.append(b) #table blocks
d.styles.append(Style()) #table styles
d.views.append(View('Normal')) #table view
d.views.append(ViewByWindow('Window',leftBottom=(1,0),rightTop=(2,1))) #idem
#entities

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
@@ -1434,13 +1446,13 @@ def write(filename, batch_objects = None, \
for f in me.faces:
for col in f.col:
if i==-1:
file.write('%i,%i,%i' % (col[0], col[1], col[2]))
file.write('%i,%i,%i,255' % (col[0], col[1], col[2]))
i=0
else:
if i==7:
file.write('\n\t\t\t\t')
i=0
file.write(',%i,%i,%i' % (col[0], col[1], col[2]))
file.write(',%i,%i,%i,255' % (col[0], col[1], col[2]))
i+=1
ii+=1 # One more Color
@@ -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

@@ -1,17 +1,17 @@
#!BPY
"""
Name: 'Blender/Python Scripting API'
Blender: 244
Blender: 248
Group: 'Help'
Tooltip: 'The Blender Python API reference manual'
"""
__author__ = "Matt Ebb"
__url__ = ("blender", "blenderartist")
__version__ = "1.0"
__version__ = "1.0.1"
__bpydoc__ = """\
This script opens the user's default web browser at http://www.blender.org's
"Blenders Python API" page.
"Blender Python API Reference" page.
"""
# --------------------------------------------------------------------------
@@ -38,4 +38,4 @@ This script opens the user's default web browser at http://www.blender.org's
import Blender, webbrowser
version = str(int(Blender.Get('version')))
webbrowser.open('http://www.blender.org/documentation/'+ version +'PythonDoc/index.html')
webbrowser.open('http://www.blender.org/documentation/'+ version +'PythonDoc/')

View File

@@ -8,7 +8,7 @@ Tooltip: 'Show help information about a chosen installed script.'
"""
__author__ = "Willian P. Germano"
__version__ = "0.1 11/02/04"
__version__ = "0.3 01/21/09"
__email__ = ('scripts', 'Author, wgermano:ig*com*br')
__url__ = ('blender', 'blenderartists.org')
@@ -47,8 +47,6 @@ Hotkeys:<br>
# $Id$
#
# --------------------------------------------------------------------------
# sysinfo.py version 0.1 Jun 09, 2004
# --------------------------------------------------------------------------
# ***** BEGIN GPL LICENSE BLOCK *****
#
# Copyright (C) 2004: Willian P. Germano, wgermano _at_ ig.com.br
@@ -69,6 +67,9 @@ Hotkeys:<br>
#
# ***** END GPL LICENCE BLOCK *****
# --------------------------------------------------------------------------
# Thanks: Brendon Murphy (suggestion) and Kevin Morgan (implementation)
# for the "run" button; Jean-Michel Soler for pointing a parsing error
# with multilines using triple single quotes.
import Blender
from Blender import sys as bsys, Draw, Window, Registry
@@ -355,7 +356,12 @@ def parse_pyobj(var, lines, i):
l = "ERROR"
elif l[0] == "'":
if l[-1] == '\\':
if l[1:3] == "''": # '''
if l.find("'''", 3) < 0: # multiline
l2, i = parse_pyobj_close("'''", lines, i)
if l[-1] == '\\': l = l[:-1]
l = "%s%s" % (l, l2)
elif l[-1] == '\\':
l2, i = parse_pyobj_close("'", lines, i)
l = "%s%s" % (l, l2)
elif l[-1] == "'" and l[-2] != '\\': # single line: '...'
@@ -543,6 +549,7 @@ BEVT_GMENU = range(100, len_gmenus + 100)
BEVT_VIEWSOURCE = 1
BEVT_EXIT = 2
BEVT_BACK = 3
BEVT_EXEC = 4 # Executes Script
# gui callbacks:
@@ -551,7 +558,7 @@ def gui(): # drawing the screen
global SCREEN, START_SCREEN, SCRIPT_SCREEN
global SCRIPT_INFO, AllGroups, GROUP_MENUS
global BEVT_EMAIL, BEVT_LINK
global BEVT_VIEWSOURCE, BEVT_EXIT, BEVT_BACK, BEVT_GMENU, BUT_GMENU
global BEVT_VIEWSOURCE, BEVT_EXIT, BEVT_BACK, BEVT_GMENU, BUT_GMENU, BEVT_EXEC
global PADDING, WIN_W, WIN_H, SCROLL_DOWN, COLUMNS, FMODE
theme = Theme.Get()[0]
@@ -674,8 +681,11 @@ def gui(): # drawing the screen
'View this script\'s source code in the Text Editor (hotkey: S)')
Draw.PushButton('exit', BEVT_EXIT, x + 45, 17, 45, bh,
'Exit from Scripts Help Browser (hotkey: Q)')
if not FMODE: Draw.PushButton('back', BEVT_BACK, x + 2*45, 17, 45, bh,
if not FMODE:
Draw.PushButton('back', BEVT_BACK, x + 2*45, 17, 45, bh,
'Back to scripts selection screen (hotkey: ESC)')
Draw.PushButton('run script', BEVT_EXEC, x + 3*45, 17, 60, bh, 'Run this script')
BGL.glColor3ub(COL_TXTHI[0],COL_TXTHI[1], COL_TXTHI[2])
BGL.glRasterPos2i(x, 5)
Draw.Text('use the arrow keys or the mouse wheel to scroll text', 'small')
@@ -766,6 +776,14 @@ def button_event(evt): # gui button events
SCRIPT_INFO = None
SCROLL_DOWN = 0
Draw.Redraw()
elif evt == BEVT_EXEC: # Execute script
exec_line = ''
if SCRIPT_INFO.script.userdir:
exec_line = bsys.join(Blender.Get('uscriptsdir'), SCRIPT_INFO.script.fname)
else:
exec_line = bsys.join(Blender.Get('scriptsdir'), SCRIPT_INFO.script.fname)
Blender.Run(exec_line)
keepon = True
FMODE = False # called by Blender.ShowHelp(name) API function ?

View File

@@ -1,16 +1,16 @@
#!BPY
"""
Name: 'Getting Started'
Blender: 234
Blender: 248
Group: 'Help'
Tooltip: 'Help for new users'
"""
__author__ = "Matt Ebb"
__url__ = ("blender", "blenderartists.org")
__version__ = "1.0"
__version__ = "1.0.1"
__bpydoc__ = """\
This script opens the user's default web browser at www.blender3d.org's
This script opens the user's default web browser at www.blender.org's
"Getting Started" page.
"""
@@ -39,5 +39,4 @@ This script opens the user's default web browser at www.blender3d.org's
# --------------------------------------------------------------------------
import Blender, webbrowser
version = str(Blender.Get('version'))
webbrowser.open('http://www.blender3d.org/Help/?pg=GettingStarted&ver=' + version)
webbrowser.open('http://www.blender.org/education-help/tutorials/getting-started/')

View File

@@ -1,17 +1,17 @@
#!BPY
"""
Name: 'Manual'
Blender: 234
Blender: 248
Group: 'Help'
Tooltip: 'The Blender reference manual'
Tooltip: 'The Blender Wiki manual'
"""
__author__ = "Matt Ebb"
__url__ = ("blender", "blenderartists.org")
__version__ = "1.0"
__version__ = "1.0.1"
__bpydoc__ = """\
This script opens the user's default web browser at www.blender3d.org's
"Blender Manual" page.
This script opens the user's default web browser at www.blender.org's
"Manual" page.
"""
# --------------------------------------------------------------------------
@@ -37,5 +37,4 @@ This script opens the user's default web browser at www.blender3d.org's
# --------------------------------------------------------------------------
import Blender, webbrowser
version = str(Blender.Get('version'))
webbrowser.open('http://www.blender3d.org/Help/?pg=Manual&ver=' + version)
webbrowser.open('http://wiki.blender.org/index.php/Manual')

View File

@@ -1,17 +1,17 @@
#!BPY
"""
Name: 'Release Notes'
Blender: 234
Name: 'Release Logs'
Blender: 248
Group: 'Help'
Tooltip: 'Information about the changes in this version of Blender'
"""
__author__ = "Matt Ebb"
__url__ = ("blender", "blenderartists.org")
__version__ = "1.0"
__version__ = "1.0.1"
__bpydoc__ = """\
This script opens the user's default web browser at www.blender3d.org's
"Release Notes" page.
This script opens the user's default web browser at www.blender.org's
"Release Logs" page.
"""
# --------------------------------------------------------------------------
@@ -37,5 +37,5 @@ This script opens the user's default web browser at www.blender3d.org's
# --------------------------------------------------------------------------
import Blender, webbrowser
version = str(Blender.Get('version'))
webbrowser.open('http://www.blender3d.org/Help/?pg=ReleaseNotes&ver=' + version)
webbrowser.open('http://www.blender.org/development/release-logs/')

View File

@@ -2,17 +2,17 @@
"""
Name: 'Tutorials'
Blender: 234
Blender: 248
Group: 'Help'
Tooltip: 'Tutorials for learning to use Blender'
"""
__author__ = "Matt Ebb"
__url__ = ("blender", "blenderartists.org")
__version__ = "1.0"
__version__ = "1.0.1"
__bpydoc__ = """\
This script opens the user's default web browser at www.blender3d.org's
"Blender Tutorials" page.
This script opens the user's default web browser at www.blender.org's
"Tutorials" page.
"""
# --------------------------------------------------------------------------
@@ -38,5 +38,4 @@ This script opens the user's default web browser at www.blender3d.org's
# --------------------------------------------------------------------------
import Blender, webbrowser
version = str(Blender.Get('version'))
webbrowser.open('http://www.blender3d.org/Help/?pg=Tutorials&ver=' + version)
webbrowser.open('http://www.blender.org/education-help/tutorials/')

View File

@@ -2,17 +2,17 @@
"""
Name: 'Blender Website'
Blender: 234
Blender: 248
Group: 'HelpWebsites'
Tooltip: 'The official Blender website'
"""
__author__ = "Matt Ebb"
__url__ = ("blender", "blenderartists.org")
__version__ = "1.0"
__version__ = "1.0.1"
__bpydoc__ = """\
This script opens the user's default web browser at Blender's main site,
www.blender3d.org.
www.blender.org.
"""
@@ -39,4 +39,4 @@ www.blender3d.org.
# --------------------------------------------------------------------------
import Blender, webbrowser
webbrowser.open('http://www.blender3d.org/')
webbrowser.open('http://www.blender.org/')

View File

@@ -2,17 +2,17 @@
"""
Name: 'Developer Community'
Blender: 234
Blender: 248
Group: 'HelpWebsites'
Tooltip: 'Get involved with Blender development'
"""
__author__ = "Matt Ebb"
__url__ = ("blender", "blenderartists.org")
__version__ = "1.0"
__version__ = "1.0.1"
__bpydoc__ = """\
This script opens the user's default web browser at www.blender.org, the
Blender development portal.
This script opens the user's default web browser at www.blender.org's
"Get Involved" page.
"""
# --------------------------------------------------------------------------
@@ -38,4 +38,4 @@ Blender development portal.
# --------------------------------------------------------------------------
import webbrowser
webbrowser.open('http://www.blender.org')
webbrowser.open('http://www.blender.org/community/get-involved/')

View File

@@ -2,16 +2,16 @@
"""
Name: 'Blender E-Shop'
Blender: 234
Blender: 248
Group: 'HelpWebsites'
Tooltip: 'Buy official Blender resources and merchandise online'
"""
__author__ = "Matt Ebb"
__url__ = ("blender", "blenderartists.org")
__version__ = "1.0"
__version__ = "1.0.1"
__bpydoc__ = """\
This script opens the user's default web browser at www.blender3d.org's
This script opens the user's default web browser at www.blender.org's
"E-Shop" section.
"""

View File

@@ -2,16 +2,16 @@
"""
Name: 'User Community'
Blender: 234
Blender: 248
Group: 'HelpWebsites'
Tooltip: 'Get involved with other Blender users'
"""
__author__ = "Matt Ebb"
__url__ = ("blender", "blenderartists.org")
__version__ = "1.0"
__version__ = "1.0.1"
__bpydoc__ = """\
This script opens the user's default web browser at www.blender3d.org's
This script opens the user's default web browser at www.blender.org's
"User Community" page.
"""
@@ -38,4 +38,4 @@ This script opens the user's default web browser at www.blender3d.org's
# --------------------------------------------------------------------------
import webbrowser
webbrowser.open('http://www.blender3d.org/Community')
webbrowser.open('http://www.blender.org/community/user-community/')

File diff suppressed because it is too large Load Diff

View File

@@ -112,7 +112,7 @@ def mesh2polys():
Window.EditMode(0)
me = meshOb.getData(mesh=1)
polygons= polysFromMesh(me)
w=t=1
w = 1.0
cu= Curve.New()
cu.name = me.name
cu.setFlag(1)
@@ -128,7 +128,7 @@ def mesh2polys():
vIdx= 0
v= poly[vIdx]
cu.appendNurb([v.co.x, v.co.y, v.co.z, w, t])
cu.appendNurb((v.co.x, v.co.y, v.co.z, w))
vIdx += 1
cu[i].type= 0 # Poly Line
@@ -139,7 +139,7 @@ def mesh2polys():
# Add all the points in the polyline.
while vIdx<len(poly):
v= poly[vIdx]
cu.appendPoint(i, [v.co.x, v.co.y, v.co.z, w])
cu.appendPoint(i, (v.co.x, v.co.y, v.co.z, w))
vIdx+=1
i+=1
Window.WaitCursor(0)

View File

@@ -0,0 +1,124 @@
#!BPY
"""
Name: 'Background Job Example'
Blender: 248
Group: 'ScriptTemplate'
Tooltip: 'Script template for automating tasks from the command line with blender'
"""
from Blender import Window
import bpy
script_data = \
'''# This script is an example of how you can run blender from the command line (in background mode with no interface)
# to automate tasks, in this example it creates a text object, camera and light, then renders and/or saves it.
# This example also shows how you can parse command line options to python scripts.
#
# Example usage for this test.
# blender -b -P $HOME/background_job.py -- --text="Hello World" --render="/tmp/hello" --save="/tmp/hello.blend"
#
# Notice all python args are after the '--' argument.
import Blender
import bpy
def example_function(body_text, save_path, render_path):
sce= bpy.data.scenes.active
txt_data= bpy.data.curves.new('MyText', 'Text3d')
# Text Object
txt_ob = sce.objects.new(txt_data) # add the data to the scene as an object
txt_data.setText(body_text) # set the body text to the command line arg given
txt_data.setAlignment(Blender.Text3d.MIDDLE)# center text
# Camera
cam_data= bpy.data.cameras.new('MyCam') # create new camera data
cam_ob= sce.objects.new(cam_data) # add the camera data to the scene (creating a new object)
sce.objects.camera= cam_ob # set the active camera
cam_ob.loc= 0,0,10
# Lamp
lamp_data= bpy.data.lamps.new('MyLamp')
lamp_ob= sce.objects.new(lamp_data)
lamp_ob.loc= 2,2,5
if save_path:
try:
f= open(save_path, 'w')
f.close()
ok= True
except:
print 'Cannot save to path "%s"' % save_path
ok= False
if ok:
Blender.Save(save_path, 1)
if render_path:
render= sce.render
render.extensions= True
render.renderPath = render_path
render.sFrame= 1
render.eFrame= 1
render.renderAnim()
import sys # to get command line args
import optparse # to parse options for us and print a nice help message
script_name= 'background_job.py'
def main():
# get the args passed to blender after "--", all of which are ignored by blender specifically
# so python may receive its own arguments
argv= sys.argv
if '--' not in argv:
argv = [] # as if no args are passed
else:
argv = argv[argv.index('--')+1: ] # get all args after "--"
# When --help or no args are given, print this help
usage_text = 'Run blender in background mode with this script:\n'
usage_text += ' blender -b -P ' + script_name + ' -- [options]'
parser = optparse.OptionParser(usage = usage_text)
# Example background utility, add some text and renders or saves it (with options)
# Possible types are: string, int, long, choice, float and complex.
parser.add_option('-t', '--text', dest='body_text', help='This text will be used to render an image', type='string')
parser.add_option('-s', '--save', dest='save_path', help='Save the generated file to the specified path', metavar='FILE')
parser.add_option('-r', '--render', dest='render_path', help='Render an image to the specified path', metavar='FILE')
options, args = parser.parse_args(argv) # In this example we wont use the args
if not argv:
parser.print_help()
return
if not options.body_text:
print 'Error: --text="some string" argument not given, aborting.\n'
parser.print_help()
return
# Run the example function
example_function(options.body_text, options.save_path, options.render_path)
print 'batch job finished, exiting'
if __name__ == '__main__':
main()
'''
new_text = bpy.data.texts.new('background_job.py')
new_text.write(script_data)
bpy.data.texts.active = new_text
Window.RedrawAll()

View File

@@ -42,28 +42,15 @@ from Blender import *
import bpy
import BPyMesh
def extend():
sce = bpy.data.scenes.active
ob = sce.objects.active
# print ob, ob.type
if ob == None or ob.type != 'Mesh':
Draw.PupMenu('ERROR: No mesh object.')
def extend(EXTEND_MODE,ob):
if EXTEND_MODE == -1:
return
# Toggle Edit mode
me = ob.getData(mesh=1)
me_verts = me.verts
# Toggle Edit mode
is_editmode = Window.EditMode()
if is_editmode:
Window.EditMode(0)
me = ob.getData(mesh=1)
me_verts = me.verts
# 0:normal extend, 1:edge length
EXTEND_MODE = Draw.PupMenu("Use Face Area%t|Loop Average%x2|None%x0")
if EXTEND_MODE == -1:
return
Window.WaitCursor(1)
t = sys.time()
edge_average_lengths = {}
@@ -153,8 +140,7 @@ def extend():
uvs_vhash_target[edgepair_outer_target[iA]][:] = uvs_vhash_source[edgepair_inner_source[1]] + (uvs_vhash_source[edgepair_inner_source[1]] - uvs_vhash_source[edgepair_outer_source[0]])
if not me.faceUV:
Draw.PupMenu('ERROR: Mesh has no face UV coords.')
return
me.faceUV= True
face_act = me.activeFace
if face_act == -1:
@@ -247,7 +233,22 @@ def extend():
Window.RedrawAll()
Window.WaitCursor(0)
if __name__ == '__main__':
extend()
def main():
sce = bpy.data.scenes.active
ob = sce.objects.active
# print ob, ob.type
if ob == None or ob.type != 'Mesh':
Draw.PupMenu('ERROR: No mesh object.')
return
# 0:normal extend, 1:edge length
EXTEND_MODE = Draw.PupMenu("Use Face Area%t|Loop Average%x2|None%x0")
extend(EXTEND_MODE,ob)
if __name__ == '__main__':
main()

View File

@@ -171,6 +171,9 @@ def main():
f_uv = f.uv
return [(v.co-face_corner_main, f_uv[i]) for i,v in enumerate(f.v)]
if me.faceUV==False:
me.faceUV= True
coords = [ (co,uv) for f in me.faces if f.sel for co, uv in get_face_coords(f)]
coords_orig = [uv.copy() for co, uv in coords]
@@ -264,4 +267,5 @@ def main():
if __name__=='__main__':
main()
Window.DrawProgressBar(1.0, '')
Window.DrawProgressBar(1.0, '')

View File

@@ -27,6 +27,7 @@ def matcol(mat):
int(mat.R*255),\
int(mat.G*255),\
int(mat.B*255)
else:
return None
def mat2vcol(PREF_SEL_FACES_ONLY, PREF_ACTOB_ONLY, PREF_MULTIPLY_COLOR):
@@ -47,7 +48,7 @@ def mat2vcol(PREF_SEL_FACES_ONLY, PREF_ACTOB_ONLY, PREF_MULTIPLY_COLOR):
me= ob.getData(mesh=1)
try:
me.faceUV=True
me.vertexColors=True
except: # no faces
continue

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

@@ -1,3 +1,4 @@
/**
* blenlib/BKE_blender.h (mar-2001 nzc)
*

View File

@@ -53,6 +53,7 @@ int brush_clone_image_delete(struct Brush *brush);
/* sampling */
float brush_sample_falloff(struct Brush *brush, float dist);
float brush_sample_falloff_noalpha(struct Brush *brush, float dist);
void brush_sample_tex(struct Brush *brush, float *xy, float *rgba);
void brush_imbuf_new(struct Brush *brush, short flt, short texfalloff, int size,
struct ImBuf **imbuf);

View File

@@ -198,8 +198,12 @@ int CustomData_get_layer_index(const struct CustomData *data, int type);
int CustomData_get_named_layer_index(const struct CustomData *data, int type, char *name);
int CustomData_get_active_layer_index(const struct CustomData *data, int type);
int CustomData_get_render_layer_index(const struct CustomData *data, int type);
int CustomData_get_clone_layer_index(const struct CustomData *data, int type);
int CustomData_get_mask_layer_index(const struct CustomData *data, int type);
int CustomData_get_active_layer(const struct CustomData *data, int type);
int CustomData_get_render_layer(const struct CustomData *data, int type);
int CustomData_get_clone_layer(const struct CustomData *data, int type);
int CustomData_get_mask_layer(const struct CustomData *data, int type);
/* copies the data from source to the data element at index in the first
* layer of type
@@ -227,10 +231,14 @@ void *CustomData_set_layer_n(const struct CustomData *data, int type, int n, voi
/* sets the nth layer of type as active */
void CustomData_set_layer_active(struct CustomData *data, int type, int n);
void CustomData_set_layer_render(struct CustomData *data, int type, int n);
void CustomData_set_layer_clone(struct CustomData *data, int type, int n);
void CustomData_set_layer_mask(struct CustomData *data, int type, int n);
/* same as above but works with an index from CustomData_get_layer_index */
void CustomData_set_layer_active_index(struct CustomData *data, int type, int n);
void CustomData_set_layer_render_index(struct CustomData *data, int type, int n);
void CustomData_set_layer_clone_index(struct CustomData *data, int type, int n);
void CustomData_set_layer_mask_index(struct CustomData *data, int type, int n);
/* adds flag to the layer flags */
void CustomData_set_layer_flag(struct CustomData *data, int type, int flag);

View File

@@ -227,6 +227,7 @@ typedef struct Global {
#define G_FILE_GLSL_NO_RAMPS (1 << 19)
#define G_FILE_GLSL_NO_NODES (1 << 20)
#define G_FILE_GLSL_NO_EXTRA_TEX (1 << 21)
#define G_FILE_IGNORE_DEPRECATION_WARNINGS (1 << 22)
/* G.windowstate */
#define G_WINDOWSTATE_USERDEF 0

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

@@ -65,8 +65,6 @@ IF(WITH_PLAYER)
SUBDIRS(bad_level_call_stubs)
ENDIF(WITH_PLAYER)
ADD_DEFINITIONS(-DWITH_CCGSUBSURF)
BLENDERLIB(bf_blenkernel "${SRC}" "${INC}")
IF(WITH_VERSE)

View File

@@ -42,6 +42,9 @@ if env['WITH_BF_VERSE']:
if env['WITH_BF_OPENEXR']:
defs += ' WITH_OPENEXR'
if env['WITH_BF_OPENJPEG']:
defs += ' WITH_OPENJPEG'
if env['WITH_BF_DDS']:
defs += ' WITH_DDS'
@@ -53,6 +56,9 @@ if env['WITH_BF_QUICKTIME']:
defs += ' WITH_QUICKTIME'
incs += ' ' + env['BF_QUICKTIME_INC']
if env['WITH_BF_BULLET']:
defs += ' WITH_BULLET'
if env['BF_NO_ELBEEM']:
defs += ' DISABLE_ELBEEM'

View File

@@ -328,6 +328,23 @@ float brush_sample_falloff(Brush *brush, float dist)
return 0.0f;
}
float brush_sample_falloff_noalpha(Brush *brush, float dist)
{
float outer, inner;
outer = brush->size >> 1;
inner = outer*brush->innerradius;
if (dist <= inner) {
return 1.0f;
}
else if ((dist < outer) && (inner < outer)) {
return 1.0f - sqrt((dist - inner)/(outer - inner));
}
else
return 0.0f;
}
void brush_sample_tex(Brush *brush, float *xy, float *rgba)
{
MTex *mtex= brush->mtex[brush->texact];

View File

@@ -1236,7 +1236,7 @@ int cloth_collision_moving_edges ( ClothModifierData *clmd, CollisionModifierDat
if(out_normalVelocity < 0.0)
{
out_normalVelocity*= -1.0;
VecMulf(out_normal, -1.0);
VecNegf(out_normal);
}
*/
/* Inelastic repulsion impulse. */

View File

@@ -1044,7 +1044,7 @@ static void vectomat (float *vec, float *target_up, short axis, short upflag, sh
n[2] = 1.0;
}
if (axis > 2) axis -= 3;
else VecMulf(n,-1);
else VecNegf(n);
/* n specifies the transformation of the track axis */
if (flags & TARGET_Z_UP) {
@@ -2182,7 +2182,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
Projf(vec2, vec, cob->matrix[0]);
VecSubf(totmat[1], vec, vec2);
Normalize(totmat[1]);
VecMulf(totmat[1],-1);
VecNegf(totmat[1]);
/* the x axis is fixed */
totmat[0][0] = cob->matrix[0][0];
@@ -2200,7 +2200,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
Projf(vec2, vec, cob->matrix[0]);
VecSubf(totmat[2], vec, vec2);
Normalize(totmat[2]);
VecMulf(totmat[2],-1);
VecNegf(totmat[2]);
/* the x axis is fixed */
totmat[0][0] = cob->matrix[0][0];
@@ -2265,7 +2265,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
Projf(vec2, vec, cob->matrix[1]);
VecSubf(totmat[0], vec, vec2);
Normalize(totmat[0]);
VecMulf(totmat[0],-1);
VecNegf(totmat[0]);
/* the y axis is fixed */
totmat[1][0] = cob->matrix[1][0];
@@ -2283,7 +2283,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
Projf(vec2, vec, cob->matrix[1]);
VecSubf(totmat[2], vec, vec2);
Normalize(totmat[2]);
VecMulf(totmat[2],-1);
VecNegf(totmat[2]);
/* the y axis is fixed */
totmat[1][0] = cob->matrix[1][0];
@@ -2348,7 +2348,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
Projf(vec2, vec, cob->matrix[2]);
VecSubf(totmat[0], vec, vec2);
Normalize(totmat[0]);
VecMulf(totmat[0],-1);
VecNegf(totmat[0]);
/* the z axis is fixed */
totmat[2][0] = cob->matrix[2][0];
@@ -2366,7 +2366,7 @@ static void locktrack_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *
Projf(vec2, vec, cob->matrix[2]);
VecSubf(totmat[1], vec, vec2);
Normalize(totmat[1]);
VecMulf(totmat[1],-1);
VecNegf(totmat[1]);
/* the z axis is fixed */
totmat[2][0] = cob->matrix[2][0];

View File

@@ -833,7 +833,6 @@ void makeNurbcurve(Nurb *nu, float *coord_array, float *tilt_array, float *radiu
sum= (float *)MEM_callocN(sizeof(float)*len, "makeNurbcurve1");
resolu= (resolu*SEGMENTSU(nu));
if((nu->flagu & CU_CYCLIC)==0) resolu++;
if(resolu==0) {
MEM_freeN(sum);
@@ -1685,7 +1684,6 @@ void makeBevelList(Object *ob)
else if((nu->type & 7)==CU_NURBS) {
if(nu->pntsv==1) {
len= (resolu*SEGMENTSU(nu));
if((nu->flagu & CU_CYCLIC)==0) len++;
bl= MEM_callocN(sizeof(BevList)+len*sizeof(BevPoint), "makeBevelList3");
BLI_addtail(&(cu->bev), bl);

View File

@@ -606,7 +606,7 @@ void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
{
const LayerTypeInfo *typeInfo;
CustomDataLayer *layer, *newlayer;
int i, type, number = 0, lasttype = -1, lastactive = 0, lastrender = 0;
int i, type, number = 0, lasttype = -1, lastactive = 0, lastrender = 0, lastclone = 0, lastmask = 0;
for(i = 0; i < source->totlayer; ++i) {
layer = &source->layers[i];
@@ -618,6 +618,8 @@ void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
number = 0;
lastactive = layer->active;
lastrender = layer->active_rnd;
lastclone = layer->active_clone;
lastmask = layer->active_mask;
lasttype = type;
}
else
@@ -637,6 +639,8 @@ void CustomData_merge(const struct CustomData *source, struct CustomData *dest,
if(newlayer) {
newlayer->active = lastactive;
newlayer->active_rnd = lastrender;
newlayer->active_clone = lastclone;
newlayer->active_mask = lastmask;
}
}
}
@@ -736,6 +740,28 @@ int CustomData_get_render_layer_index(const CustomData *data, int type)
return -1;
}
int CustomData_get_clone_layer_index(const CustomData *data, int type)
{
int i;
for(i=0; i < data->totlayer; ++i)
if(data->layers[i].type == type)
return i + data->layers[i].active_clone;
return -1;
}
int CustomData_get_mask_layer_index(const CustomData *data, int type)
{
int i;
for(i=0; i < data->totlayer; ++i)
if(data->layers[i].type == type)
return i + data->layers[i].active_mask;
return -1;
}
int CustomData_get_active_layer(const CustomData *data, int type)
{
int i;
@@ -758,6 +784,27 @@ int CustomData_get_render_layer(const CustomData *data, int type)
return -1;
}
int CustomData_get_clone_layer(const CustomData *data, int type)
{
int i;
for(i=0; i < data->totlayer; ++i)
if(data->layers[i].type == type)
return data->layers[i].active_clone;
return -1;
}
int CustomData_get_mask_layer(const CustomData *data, int type)
{
int i;
for(i=0; i < data->totlayer; ++i)
if(data->layers[i].type == type)
return data->layers[i].active_mask;
return -1;
}
void CustomData_set_layer_active(CustomData *data, int type, int n)
{
@@ -777,6 +824,24 @@ void CustomData_set_layer_render(CustomData *data, int type, int n)
data->layers[i].active_rnd = n;
}
void CustomData_set_layer_clone(CustomData *data, int type, int n)
{
int i;
for(i=0; i < data->totlayer; ++i)
if(data->layers[i].type == type)
data->layers[i].active_clone = n;
}
void CustomData_set_layer_mask(CustomData *data, int type, int n)
{
int i;
for(i=0; i < data->totlayer; ++i)
if(data->layers[i].type == type)
data->layers[i].active_mask = n;
}
/* for using with an index from CustomData_get_active_layer_index and CustomData_get_render_layer_index */
void CustomData_set_layer_active_index(CustomData *data, int type, int n)
{
@@ -796,6 +861,23 @@ void CustomData_set_layer_render_index(CustomData *data, int type, int n)
data->layers[i].active_rnd = n-i;
}
void CustomData_set_layer_clone_index(CustomData *data, int type, int n)
{
int i;
for(i=0; i < data->totlayer; ++i)
if(data->layers[i].type == type)
data->layers[i].active_clone = n-i;
}
void CustomData_set_layer_mask_index(CustomData *data, int type, int n)
{
int i;
for(i=0; i < data->totlayer; ++i)
if(data->layers[i].type == type)
data->layers[i].active_mask = n-i;
}
void CustomData_set_layer_flag(struct CustomData *data, int type, int flag)
{
@@ -882,9 +964,13 @@ static CustomDataLayer *customData_add_layer__internal(CustomData *data,
if(index > 0 && data->layers[index-1].type == type) {
data->layers[index].active = data->layers[index-1].active;
data->layers[index].active_rnd = data->layers[index-1].active_rnd;
data->layers[index].active_clone = data->layers[index-1].active_clone;
data->layers[index].active_mask = data->layers[index-1].active_mask;
} else {
data->layers[index].active = 0;
data->layers[index].active_rnd = 0;
data->layers[index].active_clone = 0;
data->layers[index].active_mask = 0;
}
customData_update_offsets(data);
@@ -944,6 +1030,8 @@ int CustomData_free_layer(CustomData *data, int type, int totelem, int index)
for (; i < data->totlayer && data->layers[i].type == type; i++) {
data->layers[i].active--;
data->layers[i].active_rnd--;
data->layers[i].active_clone--;
data->layers[i].active_mask--;
}
}

View File

@@ -887,7 +887,6 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase)
}
else if((nu->type & 7)==CU_NURBS) {
len= (resolu*SEGMENTSU(nu));
if((nu->flagu & CU_CYCLIC)==0) len++;
dl= MEM_callocN(sizeof(DispList), "makeDispListsurf");
dl->verts= MEM_callocN(len*3*sizeof(float), "dlverts");
@@ -1381,7 +1380,7 @@ void makeDispListSurf(Object *ob, ListBase *dispbase, int forRender)
for (nu=nubase->first; nu; nu=nu->next) {
if(forRender || nu->hide==0) {
if(nu->pntsv==1) {
len= nu->pntsu*nu->resolu;
len= SEGMENTSU(nu)*nu->resolu;
dl= MEM_callocN(sizeof(DispList), "makeDispListsurf");
dl->verts= MEM_callocN(len*3*sizeof(float), "dlverts");

View File

@@ -251,7 +251,7 @@ static float eff_calc_visibility(Object *ob, float *co, float *dir)
return 0;
VECCOPY(norm, dir);
VecMulf(norm, -1.0);
VecNegf(norm);
len = Normalize(norm);
// check all collision objects

View File

@@ -767,6 +767,10 @@ int BKE_imtype_to_ftype(int imtype)
return RAWTGA;
else if(imtype==R_HAMX)
return AN_hamx;
#ifdef WITH_OPENJPEG
else if(imtype==R_JP2)
return JP2;
#endif
else
return JPG|90;
}
@@ -801,6 +805,10 @@ int BKE_ftype_to_imtype(int ftype)
return R_RAWTGA;
else if(ftype == AN_hamx)
return R_HAMX;
#ifdef WITH_OPENJPEG
else if(ftype & JP2)
return R_JP2;
#endif
else
return R_JPEG90;
}
@@ -877,6 +885,12 @@ void BKE_add_image_extension(char *string, int imtype)
if(!BLI_testextensie(string, ".tga"))
extension= ".tga";
}
#ifdef WITH_OPENJPEG
else if(imtype==R_JP2) {
if(!BLI_testextensie(string, ".jp2"))
extension= ".jp2";
}
#endif
else { // R_MOVIE, R_AVICODEC, R_AVIRAW, R_AVIJPEG, R_JPEG90, R_QUICKTIME etc
if(!( BLI_testextensie(string, ".jpg") || BLI_testextensie(string, ".jpeg")))
extension= ".jpg";
@@ -1220,6 +1234,28 @@ int BKE_write_ibuf(ImBuf *ibuf, char *name, int imtype, int subimtype, int quali
else if(imtype==R_HAMX) {
ibuf->ftype= AN_hamx;
}
#ifdef WITH_OPENJPEG
else if(imtype==R_JP2) {
if(quality < 10) quality= 90;
ibuf->ftype= JP2|quality;
if (subimtype & R_JPEG2K_16BIT) {
ibuf->ftype |= JP2_16BIT;
} else if (subimtype & R_JPEG2K_12BIT) {
ibuf->ftype |= JP2_12BIT;
}
if (subimtype & R_JPEG2K_YCC) {
ibuf->ftype |= JP2_YCC;
}
if (subimtype & R_JPEG2K_CINE_PRESET) {
ibuf->ftype |= JP2_CINE;
if (subimtype & R_JPEG2K_CINE_48FPS)
ibuf->ftype |= JP2_CINE_48FPS;
}
}
#endif
else {
/* R_JPEG90, R_MOVIE, etc. default we save jpegs */
if(quality < 10) quality= 90;

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

@@ -831,7 +831,7 @@ void psys_thread_distribute_particle(ParticleThread *thread, ParticleData *pa, C
VecCopyf(tan,seam->tan);
VecSubf(temp2,co1,temp);
if(Inpf(tan,temp2)<0.0f)
VecMulf(tan,-1.0f);
VecNegf(tan);
}
for(w=0; w<maxw; w++){
VecSubf(temp2,ptn[w].co,temp);
@@ -1877,7 +1877,7 @@ void reset_particle(ParticleData *pa, ParticleSystem *psys, ParticleSystemModifi
}
/* create rotation quat */
VecMulf(rot_vec,-1.0);
VecNegf(rot_vec);
vectoquat(rot_vec, OB_POSX, OB_POSZ, q2);
/* randomize rotation quat */
@@ -3022,7 +3022,7 @@ static void particle_intersect_face(void *userdata, int index, const BVHTreeRay
CalcNormFloat(t0, t1, t2, col->nor);
VECSUB(temp, co2, co1);
if(Inpf(col->nor, temp) > 0.0f)
VecMulf(col->nor, -1.0f);
VecNegf(col->nor);
VECCOPY(col->vel,vel);
@@ -3802,7 +3802,7 @@ static void boid_body(BoidVecFunc *bvf, ParticleData *pa, ParticleSystem *psys,
VecRotToQuat(pa->state.vel,bank,q);
VECCOPY(dvec,pa->state.vel);
VecMulf(dvec,-1.0f);
VecNegf(dvec);
vectoquat(dvec, OB_POSX, OB_POSZ, q2);
QuatMul(pa->state.rot,q,q2);

View File

@@ -241,6 +241,7 @@ int VecLen(int *v1, int *v2);
float VecLenf(float *v1, float *v2);
float VecLength(float *v);
void VecMulf(float *v1, float f);
void VecNegf(float *v1);
int VecLenCompare(float *v1, float *v2, float limit);
int VecCompare(float *v1, float *v2, float limit);

View File

@@ -2190,6 +2190,13 @@ void VecMulf(float *v1, float f)
v1[2]*= f;
}
void VecNegf(float *v1)
{
v1[0] = -v1[0];
v1[1] = -v1[1];
v1[2] = -v1[2];
}
void VecOrthoBasisf(float *v, float *v1, float *v2)
{
float f = sqrt(v[0]*v[0] + v[1]*v[1]);
@@ -3958,7 +3965,7 @@ int SweepingSphereIntersectsTriangleUV(float p1[3], float p2[3], float radius, f
Normalize(nor);
/* flip normal */
if(Inpf(nor,vel)>0.0f) VecMulf(nor,-1.0f);
if(Inpf(nor,vel)>0.0f) VecNegf(nor);
a=Inpf(p1,nor)-Inpf(v0,nor);
nordotv=Inpf(nor,vel);
@@ -4629,7 +4636,7 @@ void tangent_from_uv(float *uv1, float *uv2, float *uv3, float *co1, float *co2,
/* check flip */
if ((ct[0]*n[0] + ct[1]*n[1] + ct[2]*n[2]) < 0.0f)
VecMulf(tang, -1.0f);
VecNegf(tang);
}
/* used for zoom values*/

View File

@@ -809,15 +809,15 @@ static void testAxialSymmetry(BGraph *graph, BNode* root_node, BNode* node1, BNo
if (abs(nor[0]) > abs(nor[1]) && abs(nor[0]) > abs(nor[2]) && nor[0] < 0)
{
VecMulf(nor, -1);
VecNegf(nor);
}
else if (abs(nor[1]) > abs(nor[0]) && abs(nor[1]) > abs(nor[2]) && nor[1] < 0)
{
VecMulf(nor, -1);
VecNegf(nor);
}
else if (abs(nor[2]) > abs(nor[1]) && abs(nor[2]) > abs(nor[0]) && nor[2] < 0)
{
VecMulf(nor, -1);
VecNegf(nor);
}
/* mirror node2 along axis */

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

@@ -3191,6 +3191,7 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
FluidsimModifierData *fluidmd = (FluidsimModifierData*) md;
fluidmd->fss= newdataadr(fd, fluidmd->fss);
fluidmd->fss->meshSurfNormals = 0;
}
else if (md->type==eModifierType_Collision) {
@@ -7870,6 +7871,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
fluidmd->fss->lastgoodframe = INT_MAX;
fluidmd->fss->flag = 0;
fluidmd->fss->meshSurfNormals = 0;
}
}
}
@@ -8093,6 +8095,17 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
if (main->versionfile < 248 || (main->versionfile == 248 && main->subversionfile < 2)) {
Scene *sce;
/* Note, these will need to be added for painting */
for (sce= main->scene.first; sce; sce= sce->id.next) {
sce->toolsettings->imapaint.seam_bleed = 2;
sce->toolsettings->imapaint.normal_angle = 80;
}
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */

View File

@@ -56,6 +56,10 @@
#endif
#define RADHDR (1<<24)
#ifdef WITH_OPENJPEG
#define JP2 (1 << 18)
#endif
#define RAWTGA (TGA | 1)
#define JPG_STD (JPG | (0 << 8))
@@ -113,6 +117,7 @@
#define IS_tim(x) (x->ftype & TIM)
#define IS_tiff(x) (x->ftype & TIFF)
#define IS_openexr(x) (x->ftype & OPENEXR)
#define IS_jp2(x) (x->ftype & JP2)
#define IMAGIC 0732

View File

@@ -306,7 +306,7 @@ void GPU_material_bind_uniforms(GPUMaterial *material, float obmat[][4], float v
if(material->dynproperty & DYN_LAMP_VEC) {
VECCOPY(lamp->dynvec, lamp->vec);
Normalize(lamp->dynvec);
VecMulf(lamp->dynvec, -1.0f);
VecNegf(lamp->dynvec);
Mat4Mul3Vecfl(viewmat, lamp->dynvec);
}

View File

@@ -181,6 +181,15 @@ typedef enum {
#define DDS (1 << 19)
#endif
#ifdef WITH_OPENJPEG
#define JP2 (1 << 18)
#define JP2_12BIT (1 << 17)
#define JP2_16BIT (1 << 16)
#define JP2_YCC (1 << 15)
#define JP2_CINE (1 << 14)
#define JP2_CINE_48FPS (1 << 13)
#endif
#define RAWTGA (TGA | 1)
#define JPG_STD (JPG | (0 << 8))
@@ -217,6 +226,7 @@ typedef enum {
#define IS_tga(x) (x->ftype & TGA)
#define IS_png(x) (x->ftype & PNG)
#define IS_openexr(x) (x->ftype & OPENEXR)
#define IS_jp2(x) (x->ftype & JP2)
#define IS_cineon(x) (x->ftype & CINEON)
#define IS_dpx(x) (x->ftype & DPX)
#define IS_bmp(x) (x->ftype & BMP)

View File

@@ -0,0 +1,49 @@
/*
* IMB_jp2.h
*
* $Id: IMB_bmp.h 14444 2008-04-16 22:40:48Z hos $
*
* ***** 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) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
/**
* \file IMB_jp2.h
* \ingroup imbuf
* \brief Function declarations for jp2.c
*/
#ifndef IMB_JP2_H
#define IMB_JP2_H
#ifdef WITH_OPENJPEG
struct ImBuf;
int imb_is_a_jp2(void *buf);
struct ImBuf *imb_jp2_decode(unsigned char *mem, int size, int flags);
short imb_savejp2(struct ImBuf *ibuf, char *name, int flags);
#endif /* WITH_OPENJPEG */
#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

@@ -0,0 +1,736 @@
/**
*
* ***** 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.
*
* Contributor(s): Campbell Barton
*
* ***** END GPL LICENSE BLOCK *****
*/
#ifdef WITH_OPENJPEG
#include "BLI_blenlib.h"
#include "imbuf.h"
#include "imbuf_patch.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
#include "IMB_allocimbuf.h"
#include "IMB_jp2.h"
#include "openjpeg.h"
#define JP2_FILEHEADER_SIZE 14
static char JP2_HEAD[]= {0x0, 0x0, 0x0, 0x0C, 0x6A, 0x50, 0x20, 0x20, 0x0D, 0x0A, 0x87, 0x0A};
/* We only need this because of how the presets are set */
typedef struct img_folder{
/** The directory path of the folder containing input images*/
char *imgdirpath;
/** Output format*/
char *out_format;
/** Enable option*/
char set_imgdir;
/** Enable Cod Format for output*/
char set_out_format;
/** User specified rate stored in case of cinema option*/
float *rates;
}img_fol_t;
static int checkj2p(unsigned char *mem) /* J2K_CFMT */
{
return memcmp(JP2_HEAD, mem, 12) ? 0 : 1;
}
int imb_is_a_jp2(void *buf)
{
return checkj2p(buf);
}
/**
sample error callback expecting a FILE* client object
*/
void error_callback(const char *msg, void *client_data) {
FILE *stream = (FILE*)client_data;
fprintf(stream, "[ERROR] %s", msg);
}
/**
sample warning callback expecting a FILE* client object
*/
void warning_callback(const char *msg, void *client_data) {
FILE *stream = (FILE*)client_data;
fprintf(stream, "[WARNING] %s", msg);
}
/**
sample debug callback expecting no client object
*/
void info_callback(const char *msg, void *client_data) {
(void)client_data;
fprintf(stdout, "[INFO] %s", msg);
}
struct ImBuf *imb_jp2_decode(unsigned char *mem, int size, int flags)
{
struct ImBuf *ibuf = 0;
int use_float = 0; /* for precissions higher then 8 use float */
unsigned char *rect= NULL;
float *rect_float= NULL;
long signed_offsets[4] = {0,0,0,0};
int float_divs[4];
int index;
int w, h, depth;
opj_dparameters_t parameters; /* decompression parameters */
opj_event_mgr_t event_mgr; /* event manager */
opj_image_t *image = NULL;
int i;
opj_dinfo_t* dinfo = NULL; /* handle to a decompressor */
opj_cio_t *cio = NULL;
if (checkj2p(mem) == 0) return(0);
/* configure the event callbacks (not required) */
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
event_mgr.error_handler = error_callback;
event_mgr.warning_handler = warning_callback;
event_mgr.info_handler = info_callback;
/* set decoding parameters to default values */
opj_set_default_decoder_parameters(&parameters);
/* JPEG 2000 compressed image data */
/* get a decoder handle */
dinfo = opj_create_decompress(CODEC_JP2);
/* catch events using our callbacks and give a local context */
opj_set_event_mgr((opj_common_ptr)dinfo, &event_mgr, stderr);
/* setup the decoder decoding parameters using the current image and user parameters */
opj_setup_decoder(dinfo, &parameters);
/* open a byte stream */
cio = opj_cio_open((opj_common_ptr)dinfo, mem, size);
/* decode the stream and fill the image structure */
image = opj_decode(dinfo, cio);
if(!image) {
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
opj_destroy_decompress(dinfo);
opj_cio_close(cio);
return NULL;
}
/* close the byte stream */
opj_cio_close(cio);
if((image->numcomps * image->x1 * image->y1) == 0)
{
fprintf(stderr,"\nError: invalid raw image parameters\n");
return NULL;
}
w = image->comps[0].w;
h = image->comps[0].h;
switch (image->numcomps) {
case 1: /* Greyscale */
case 3: /* Color */
depth= 24;
break;
default: /* 2 or 4 - Greyscale or Color + alpha */
depth= 32; /* greyscale + alpha */
break;
}
i = image->numcomps;
if (i>4) i= 4;
while (i) {
i--;
if (image->comps[i].prec > 8)
use_float = 1;
if (image->comps[i].sgnd)
signed_offsets[i]= 1 << (image->comps[i].prec - 1);
/* only needed for float images but dosnt hurt to calc this */
float_divs[i]= (1<<image->comps[i].prec)-1;
}
if (use_float) {
ibuf= IMB_allocImBuf(w, h, depth, IB_rectfloat, 0);
rect_float = ibuf->rect_float;
} else {
ibuf= IMB_allocImBuf(w, h, depth, IB_rect, 0);
rect = (unsigned char *) ibuf->rect;
}
if (ibuf==NULL) {
if(dinfo)
opj_destroy_decompress(dinfo);
return NULL;
}
ibuf->ftype = JP2;
if (use_float) {
rect_float = ibuf->rect_float;
if (image->numcomps < 3) {
/* greyscale 12bits+ */
for (i = 0; i < w * h; i++, rect_float+=4) {
index = w * h - ((i) / (w) + 1) * w + (i) % (w);
rect_float[0]= rect_float[1]= rect_float[2]= (float)(image->comps[0].data[index] + signed_offsets[0]) / float_divs[0];
if (image->numcomps == 2)
rect_float[3]= (image->comps[1].data[index] + signed_offsets[1]) / float_divs[1];
else
rect_float[3]= 1.0f;
}
} else {
/* rgb or rgba 12bits+ */
for (i = 0; i < w * h; i++, rect_float+=4) {
index = w * h - ((i) / (w) + 1) * w + (i) % (w);
rect_float[0]= (float)(image->comps[0].data[index] + signed_offsets[0]) / float_divs[0];
rect_float[1]= (float)(image->comps[1].data[index] + signed_offsets[1]) / float_divs[1];
rect_float[2]= (float)(image->comps[2].data[index] + signed_offsets[2]) / float_divs[2];
if (image->numcomps >= 4)
rect_float[3]= (float)(image->comps[2].data[index] + signed_offsets[3]) / float_divs[3];
else
rect_float[3]= 1.0f;
}
}
} else {
if (image->numcomps < 3) {
/* greyscale */
for (i = 0; i < w * h; i++, rect+=4) {
index = w * h - ((i) / (w) + 1) * w + (i) % (w);
rect_float[0]= rect_float[1]= rect_float[2]= (image->comps[0].data[index] + signed_offsets[0]);
if (image->numcomps == 2)
rect[3]= image->comps[1].data[index] + signed_offsets[1];
else
rect[3]= 255;
}
} else {
/* 8bit rgb or rgba */
for (i = 0; i < w * h; i++, rect+=4) {
int index = w * h - ((i) / (w) + 1) * w + (i) % (w);
rect[0]= image->comps[0].data[index] + signed_offsets[0];
rect[1]= image->comps[1].data[index] + signed_offsets[1];
rect[2]= image->comps[2].data[index] + signed_offsets[2];
if (image->numcomps >= 4)
rect[3]= image->comps[2].data[index] + signed_offsets[3];
else
rect[3]= 255;
}
}
}
/* free remaining structures */
if(dinfo) {
opj_destroy_decompress(dinfo);
}
/* free image data structure */
opj_image_destroy(image);
if (flags & IB_rect) {
IMB_rect_from_float(ibuf);
}
return(ibuf);
}
//static opj_image_t* rawtoimage(const char *filename, opj_cparameters_t *parameters, raw_cparameters_t *raw_cp) {
/* prec can be 8, 12, 16 */
#define UPSAMPLE_8_TO_12(_val) ((_val<<4) | (_val & ((1<<4)-1)))
#define UPSAMPLE_8_TO_16(_val) ((_val<<8)+_val)
#define DOWNSAMPLE_FLOAT_TO_8BIT(_val) (_val)<=0.0f?0: ((_val)>=1.0f?255: (int)(255.0f*(_val)))
#define DOWNSAMPLE_FLOAT_TO_12BIT(_val) (_val)<=0.0f?0: ((_val)>=1.0f?4095: (int)(4095.0f*(_val)))
#define DOWNSAMPLE_FLOAT_TO_16BIT(_val) (_val)<=0.0f?0: ((_val)>=1.0f?65535: (int)(65535.0f*(_val)))
/*
2048x1080 (2K) at 24 fps or 48 fps, or 4096x2160 (4K) at 24 fps; 3<>12 bits per pixel, XYZ color space
* In 2K, for Scope (2.39:1) presentation 2048x858 pixels of the imager is used
* In 2K, for Flat (1.85:1) presentation 1998x1080 pixels of the imager is used
*/
/* ****************************** COPIED FROM image_to_j2k.c */
/* ----------------------------------------------------------------------- */
#define CINEMA_24_CS 1302083 /*Codestream length for 24fps*/
#define CINEMA_48_CS 651041 /*Codestream length for 48fps*/
#define COMP_24_CS 1041666 /*Maximum size per color component for 2K & 4K @ 24fps*/
#define COMP_48_CS 520833 /*Maximum size per color component for 2K @ 48fps*/
static int initialise_4K_poc(opj_poc_t *POC, int numres){
POC[0].tile = 1;
POC[0].resno0 = 0;
POC[0].compno0 = 0;
POC[0].layno1 = 1;
POC[0].resno1 = numres-1;
POC[0].compno1 = 3;
POC[0].prg1 = CPRL;
POC[1].tile = 1;
POC[1].resno0 = numres-1;
POC[1].compno0 = 0;
POC[1].layno1 = 1;
POC[1].resno1 = numres;
POC[1].compno1 = 3;
POC[1].prg1 = CPRL;
return 2;
}
void cinema_parameters(opj_cparameters_t *parameters){
parameters->tile_size_on = false;
parameters->cp_tdx=1;
parameters->cp_tdy=1;
/*Tile part*/
parameters->tp_flag = 'C';
parameters->tp_on = 1;
/*Tile and Image shall be at (0,0)*/
parameters->cp_tx0 = 0;
parameters->cp_ty0 = 0;
parameters->image_offset_x0 = 0;
parameters->image_offset_y0 = 0;
/*Codeblock size= 32*32*/
parameters->cblockw_init = 32;
parameters->cblockh_init = 32;
parameters->csty |= 0x01;
/*The progression order shall be CPRL*/
parameters->prog_order = CPRL;
/* No ROI */
parameters->roi_compno = -1;
parameters->subsampling_dx = 1; parameters->subsampling_dy = 1;
/* 9-7 transform */
parameters->irreversible = 1;
}
void cinema_setup_encoder(opj_cparameters_t *parameters,opj_image_t *image, img_fol_t *img_fol){
int i;
float temp_rate;
switch (parameters->cp_cinema){
case CINEMA2K_24:
case CINEMA2K_48:
if(parameters->numresolution > 6){
parameters->numresolution = 6;
}
if (!((image->comps[0].w == 2048) || (image->comps[0].h == 1080))){
fprintf(stdout,"Image coordinates %d x %d is not 2K compliant.\nJPEG Digital Cinema Profile-3 "
"(2K profile) compliance requires that at least one of coordinates match 2048 x 1080\n",
image->comps[0].w,image->comps[0].h);
parameters->cp_rsiz = STD_RSIZ;
}
break;
case CINEMA4K_24:
if(parameters->numresolution < 1){
parameters->numresolution = 1;
}else if(parameters->numresolution > 7){
parameters->numresolution = 7;
}
if (!((image->comps[0].w == 4096) || (image->comps[0].h == 2160))){
fprintf(stdout,"Image coordinates %d x %d is not 4K compliant.\nJPEG Digital Cinema Profile-4"
"(4K profile) compliance requires that at least one of coordinates match 4096 x 2160\n",
image->comps[0].w,image->comps[0].h);
parameters->cp_rsiz = STD_RSIZ;
}
parameters->numpocs = initialise_4K_poc(parameters->POC,parameters->numresolution);
break;
case OFF:
/* do nothing */
break;
}
switch (parameters->cp_cinema){
case CINEMA2K_24:
case CINEMA4K_24:
for(i=0 ; i<parameters->tcp_numlayers ; i++){
temp_rate = 0 ;
if (img_fol->rates[i]== 0){
parameters->tcp_rates[0]= ((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/
(CINEMA_24_CS * 8 * image->comps[0].dx * image->comps[0].dy);
}else{
temp_rate =((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/
(img_fol->rates[i] * 8 * image->comps[0].dx * image->comps[0].dy);
if (temp_rate > CINEMA_24_CS ){
parameters->tcp_rates[i]= ((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/
(CINEMA_24_CS * 8 * image->comps[0].dx * image->comps[0].dy);
}else{
parameters->tcp_rates[i]= img_fol->rates[i];
}
}
}
parameters->max_comp_size = COMP_24_CS;
break;
case CINEMA2K_48:
for(i=0 ; i<parameters->tcp_numlayers ; i++){
temp_rate = 0 ;
if (img_fol->rates[i]== 0){
parameters->tcp_rates[0]= ((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/
(CINEMA_48_CS * 8 * image->comps[0].dx * image->comps[0].dy);
}else{
temp_rate =((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/
(img_fol->rates[i] * 8 * image->comps[0].dx * image->comps[0].dy);
if (temp_rate > CINEMA_48_CS ){
parameters->tcp_rates[0]= ((float) (image->numcomps * image->comps[0].w * image->comps[0].h * image->comps[0].prec))/
(CINEMA_48_CS * 8 * image->comps[0].dx * image->comps[0].dy);
}else{
parameters->tcp_rates[i]= img_fol->rates[i];
}
}
}
parameters->max_comp_size = COMP_48_CS;
break;
case OFF:
/* do nothing */
break;
}
parameters->cp_disto_alloc = 1;
}
static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) {
unsigned char *rect;
float *rect_float;
int subsampling_dx = parameters->subsampling_dx;
int subsampling_dy = parameters->subsampling_dy;
int i, numcomps, w, h, prec;
int x,y, y_row;
OPJ_COLOR_SPACE color_space;
opj_image_cmptparm_t cmptparm[4]; /* maximum of 4 components */
opj_image_t * image = NULL;
img_fol_t img_fol; /* only needed for cinema presets */
memset(&img_fol,0,sizeof(img_fol_t));
if (ibuf->ftype & JP2_CINE) {
if (ibuf->x==4096 || ibuf->y==2160)
parameters->cp_cinema= CINEMA4K_24;
else {
if (ibuf->ftype & JP2_CINE_48FPS) {
parameters->cp_cinema= CINEMA2K_48;
}
else {
parameters->cp_cinema= CINEMA2K_24;
}
}
if (parameters->cp_cinema){
img_fol.rates = (float*)MEM_mallocN(parameters->tcp_numlayers * sizeof(float), "jp2_rates");
for(i=0; i< parameters->tcp_numlayers; i++){
img_fol.rates[i] = parameters->tcp_rates[i];
}
cinema_parameters(parameters);
}
color_space= CLRSPC_SYCC;
prec= 12;
numcomps= 3;
}
else {
/* Get settings from the imbuf */
color_space = (ibuf->ftype & JP2_YCC) ? CLRSPC_SYCC : CLRSPC_SRGB;
if (ibuf->ftype & JP2_16BIT) prec= 16;
else if (ibuf->ftype & JP2_12BIT) prec= 12;
else prec= 8;
/* 32bit images == alpha channel */
/* grayscale not supported yet */
numcomps= (ibuf->depth==32) ? 4 : 3;
}
w= ibuf->x;
h= ibuf->y;
/* initialize image components */
memset(&cmptparm[0], 0, 4 * sizeof(opj_image_cmptparm_t));
for(i = 0; i < numcomps; i++) {
cmptparm[i].prec = prec;
cmptparm[i].bpp = prec;
cmptparm[i].sgnd = 0;
cmptparm[i].dx = subsampling_dx;
cmptparm[i].dy = subsampling_dy;
cmptparm[i].w = w;
cmptparm[i].h = h;
}
/* create the image */
image = opj_image_create(numcomps, &cmptparm[0], color_space);
if(!image) {
printf("Error: opj_image_create() failed\n");
return NULL;
}
/* set image offset and reference grid */
image->x0 = parameters->image_offset_x0;
image->y0 = parameters->image_offset_y0;
image->x1 = parameters->image_offset_x0 + (w - 1) * subsampling_dx + 1;
image->y1 = parameters->image_offset_y0 + (h - 1) * subsampling_dy + 1;
/* set image data */
rect = (unsigned char*) ibuf->rect;
rect_float= ibuf->rect_float;
if (rect_float && rect && prec==8) {
/* No need to use the floating point buffer, just write the 8 bits from the char buffer */
rect_float= NULL;
}
if (rect_float) {
switch (prec) {
case 8: /* Convert blenders float color channels to 8,12 or 16bit ints */
for(y=h-1; y>=0; y--) {
y_row = y*w;
for(x=0; x<w; x++, rect_float+=4) {
i = y_row + x;
image->comps[0].data[i] = DOWNSAMPLE_FLOAT_TO_8BIT(rect_float[0]);
image->comps[1].data[i] = DOWNSAMPLE_FLOAT_TO_8BIT(rect_float[1]);
image->comps[2].data[i] = DOWNSAMPLE_FLOAT_TO_8BIT(rect_float[2]);
if (numcomps>3)
image->comps[3].data[i] = DOWNSAMPLE_FLOAT_TO_8BIT(rect_float[3]);
}
}
break;
case 12:
for(y=h-1; y>=0; y--) {
y_row = y*w;
for(x=0; x<w; x++, rect_float+=4) {
i = y_row + x;
image->comps[0].data[i] = DOWNSAMPLE_FLOAT_TO_12BIT(rect_float[0]);
image->comps[1].data[i] = DOWNSAMPLE_FLOAT_TO_12BIT(rect_float[1]);
image->comps[2].data[i] = DOWNSAMPLE_FLOAT_TO_12BIT(rect_float[2]);
if (numcomps>3)
image->comps[3].data[i] = DOWNSAMPLE_FLOAT_TO_12BIT(rect_float[3]);
}
}
break;
case 16:
for(y=h-1; y>=0; y--) {
y_row = y*w;
for(x=0; x<w; x++, rect_float+=4) {
i = y_row + x;
image->comps[0].data[i] = DOWNSAMPLE_FLOAT_TO_16BIT(rect_float[0]);
image->comps[1].data[i] = DOWNSAMPLE_FLOAT_TO_16BIT(rect_float[1]);
image->comps[2].data[i] = DOWNSAMPLE_FLOAT_TO_16BIT(rect_float[2]);
if (numcomps>3)
image->comps[3].data[i] = DOWNSAMPLE_FLOAT_TO_16BIT(rect_float[3]);
}
}
break;
}
} else {
/* just use rect*/
switch (prec) {
case 8:
for(y=h-1; y>=0; y--) {
y_row = y*w;
for(x=0; x<w; x++, rect+=4) {
i = y_row + x;
image->comps[0].data[i] = rect[0];
image->comps[1].data[i] = rect[1];
image->comps[2].data[i] = rect[2];
if (numcomps>3)
image->comps[3].data[i] = rect[3];
}
}
break;
case 12: /* Up Sampling, a bit pointless but best write the bit depth requested */
for(y=h-1; y>=0; y--) {
y_row = y*w;
for(x=0; x<w; x++, rect+=4) {
i = y_row + x;
image->comps[0].data[i]= UPSAMPLE_8_TO_12(rect[0]);
image->comps[1].data[i]= UPSAMPLE_8_TO_12(rect[1]);
image->comps[2].data[i]= UPSAMPLE_8_TO_12(rect[2]);
if (numcomps>3)
image->comps[3].data[i]= UPSAMPLE_8_TO_12(rect[3]);
}
}
break;
case 16:
for(y=h-1; y>=0; y--) {
y_row = y*w;
for(x=0; x<w; x++, rect+=4) {
i = y_row + x;
image->comps[0].data[i]= UPSAMPLE_8_TO_16(rect[0]);
image->comps[1].data[i]= UPSAMPLE_8_TO_16(rect[1]);
image->comps[2].data[i]= UPSAMPLE_8_TO_16(rect[2]);
if (numcomps>3)
image->comps[3].data[i]= UPSAMPLE_8_TO_16(rect[3]);
}
}
break;
}
}
/* Decide if MCT should be used */
parameters->tcp_mct = image->numcomps == 3 ? 1 : 0;
if(parameters->cp_cinema){
cinema_setup_encoder(parameters,image,&img_fol);
}
if (img_fol.rates)
MEM_freeN(img_fol.rates);
return image;
}
/* Found write info at http://users.ece.gatech.edu/~slabaugh/personal/c/bitmapUnix.c */
short imb_savejp2(struct ImBuf *ibuf, char *name, int flags) {
int quality = ibuf->ftype & 0xff;
int bSuccess;
opj_cparameters_t parameters; /* compression parameters */
opj_event_mgr_t event_mgr; /* event manager */
opj_image_t *image = NULL;
/*
configure the event callbacks (not required)
setting of each callback is optionnal
*/
memset(&event_mgr, 0, sizeof(opj_event_mgr_t));
event_mgr.error_handler = error_callback;
event_mgr.warning_handler = warning_callback;
event_mgr.info_handler = info_callback;
/* set encoding parameters to default values */
opj_set_default_encoder_parameters(&parameters);
/* compression ratio */
/* invert range, from 10-100, 100-1
* where jpeg see's 1 and highest quality (lossless) and 100 is very low quality*/
parameters.tcp_rates[0]= ((100-quality)/90.0f*99.0f) + 1;
parameters.tcp_numlayers = 1; // only one resolution
parameters.cp_disto_alloc = 1;
image= ibuftoimage(ibuf, &parameters);
{ /* JP2 format output */
int codestream_length;
opj_cio_t *cio = NULL;
FILE *f = NULL;
/* get a JP2 compressor handle */
opj_cinfo_t* cinfo = opj_create_compress(CODEC_JP2);
/* catch events using our callbacks and give a local context */
opj_set_event_mgr((opj_common_ptr)cinfo, &event_mgr, stderr);
/* setup the encoder parameters using the current image and using user parameters */
opj_setup_encoder(cinfo, &parameters, image);
/* open a byte stream for writing */
/* allocate memory for all tiles */
cio = opj_cio_open((opj_common_ptr)cinfo, NULL, 0);
/* encode the image */
bSuccess = opj_encode(cinfo, cio, image, NULL); /* last arg used to be parameters.index but this deprecated */
if (!bSuccess) {
opj_cio_close(cio);
fprintf(stderr, "failed to encode image\n");
return 0;
}
codestream_length = cio_tell(cio);
/* write the buffer to disk */
f = fopen(name, "wb");
if (!f) {
fprintf(stderr, "failed to open %s for writing\n", name);
return 1;
}
fwrite(cio->buffer, 1, codestream_length, f);
fclose(f);
fprintf(stderr,"Generated outfile %s\n",name);
/* close and free the byte stream */
opj_cio_close(cio);
/* free remaining compression structures */
opj_destroy_compress(cinfo);
}
/* free image data */
opj_image_destroy(image);
return 1;
}
#endif /* WITH_OPENJPEG */

View File

@@ -38,5 +38,9 @@ SET(INC
${OPENEXR_INC}
)
IF(WITH_OPENEXR)
ADD_DEFINITIONS(-DWITH_OPENEXR)
ENDIF(WITH_OPENEXR)
BLENDERLIB(bf_openexr "${SRC}" "${INC}")
#env.BlenderLib ('bf_openexr', source_files, incs, defs, libtype=['core','player'], priority = [90, 200])

View File

@@ -58,6 +58,10 @@
#include "IMB_dpxcineon.h"
#include "BKE_global.h"
#ifdef WITH_OPENJPEG
#include "IMB_jp2.h"
#endif
#ifdef WITH_OPENEXR
#include "openexr/openexr_api.h"
#endif
@@ -161,11 +165,16 @@ ImBuf *IMB_ibImageFromMemory(int *mem, int size, int flags) {
if (ibuf) return (ibuf);
#endif
#ifdef WITH_OPENJPEG
ibuf = imb_jp2_decode((uchar *)mem, size, flags);
if (ibuf) return (ibuf);
#endif
#ifdef WITH_DDS
ibuf = imb_load_dds((uchar *)mem, size, flags);
if (ibuf) return (ibuf);
#endif
#ifdef WITH_QUICKTIME
#if defined(_WIN32) || defined (__APPLE__)
if(G.have_quicktime) {

View File

@@ -68,10 +68,14 @@
#include "quicktime_import.h"
#endif
#ifdef WITH_OPENJPEG
#include "IMB_jp2.h"
#endif
#ifdef WITH_FFMPEG
#include <ffmpeg/avcodec.h>
#include <ffmpeg/avformat.h>
//#include <ffmpeg/avdevice.h>
#include <ffmpeg/avdevice.h>
#include <ffmpeg/log.h>
#if LIBAVFORMAT_VERSION_INT < (49 << 16)
@@ -140,7 +144,11 @@ static int IMB_ispic_name(char *name)
/*
if (imb_is_a_bmp(buf)) return(BMP);
*/
#ifdef WITH_OPENJPEG
if (imb_is_a_jp2(buf)) return(JP2);
#endif
#ifdef WITH_QUICKTIME
#if defined(_WIN32) || defined(__APPLE__)
if(G.have_quicktime) {
@@ -190,6 +198,9 @@ int IMB_ispic(char *filename)
|| BLI_testextensie(filename, ".cin")
#ifdef WITH_BF_OPENEXR
|| BLI_testextensie(filename, ".exr")
#endif
#ifdef WITH_BF_OPENJPEG
|| BLI_testextensie(filename, ".jp2")
#endif
|| BLI_testextensie(filename, ".sgi")) {
return IMB_ispic_name(filename);
@@ -210,6 +221,9 @@ int IMB_ispic(char *filename)
#endif
#ifdef WITH_BF_OPENEXR
|| BLI_testextensie(filename, ".exr")
#endif
#ifdef WITH_BF_OPENJPEG
|| BLI_testextensie(filename, ".jp2")
#endif
|| BLI_testextensie(filename, ".iff")
|| BLI_testextensie(filename, ".lbm")
@@ -258,7 +272,7 @@ void do_init_ffmpeg()
if (!ffmpeg_init) {
ffmpeg_init = 1;
av_register_all();
//avdevice_register_all();
avdevice_register_all();
if ((G.f & G_DEBUG) == 0)
{

View File

@@ -55,6 +55,9 @@
#include "IMB_bmp.h"
#include "IMB_tiff.h"
#include "IMB_radiance_hdr.h"
#ifdef WITH_OPENJPEG
#include "IMB_jp2.h"
#endif
#ifdef WITH_OPENEXR
#include "openexr/openexr_api.h"
#endif
@@ -129,6 +132,11 @@ short IMB_saveiff(struct ImBuf *ibuf, char *name, int flags)
if (IS_dpx(ibuf)) {
return imb_save_dpx(ibuf, name, flags);
}
#ifdef WITH_OPENJPEG
if (IS_jp2(ibuf)) {
return imb_savejp2(ibuf, name, flags);
}
#endif
file = open(name, O_BINARY | O_RDWR | O_CREAT | O_TRUNC, 0666);
if (file < 0) return (FALSE);

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

@@ -80,6 +80,7 @@ void viewmove(int mode);
void viewmoveNDOFfly(int mode);
void viewmoveNDOF(int mode);
void view_zoom_mouseloc(float dfac, short *mouseloc);
int view_mouse_depth( float mouse_worldloc[3], short mval[2], int dist);
int get_view3d_viewplane(int winxi, int winyi, rctf *viewplane, float *clipsta, float *clipend, float *pixsize);
void setwinmatrixview3d(int winx, int winy, struct rctf *rect);

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
@@ -448,6 +455,8 @@ void curvemap_buttons(struct uiBlock *block, struct CurveMapping *cumap, char la
#define B_GEN_SKELETON 2085
#define B_RETARGET_SKELETON 2086
#define B_SETTFACE_CLONE 2087
#define B_SETTFACE_MASK 2088
/* *********************** */
#define B_VGROUPBUTS 2100

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

@@ -82,7 +82,7 @@ typedef struct bEditObjectActuator {
char name[32];
float linVelocity[3]; /* initial lin. velocity on creation */
float angVelocity[3]; /* initial ang. velocity on creation */
float pad;
float mass;
short localflag; /* flag for the lin & ang. vel: apply locally */
short dyn_operation;
} bEditObjectActuator;

View File

@@ -37,6 +37,8 @@ typedef struct CustomDataLayer {
int flag; /* general purpose flag */
int active; /* number of the active layer of this type */
int active_rnd; /* number of the layer to render*/
int active_clone; /* number of the layer to render*/
int active_mask; /* number of the layer to render*/
char pad[4];
char name[32]; /* layer name */
void *data; /* layer data */

View File

@@ -310,6 +310,10 @@ typedef struct RenderData {
/* cineon */
short cineonwhite, cineonblack;
float cineongamma;
/* jpeg2000 */
short jp2_preset, jp2_depth;
int rpad3;
} RenderData;
/* control render convert and shading engine */
@@ -345,7 +349,9 @@ typedef struct TimeMarker {
typedef struct ImagePaintSettings {
struct Brush *brush;
short flag, tool;
int pad3;
/* for projection painting only */
short seam_bleed,normal_angle;
} ImagePaintSettings;
typedef struct ParticleBrushData {
@@ -690,6 +696,7 @@ typedef struct Scene {
#define R_DPX 27
#define R_MULTILAYER 28
#define R_DDS 29
#define R_JP2 30
/* subimtype, flag options for imtype */
#define R_OPENEXR_HALF 1
@@ -698,6 +705,13 @@ typedef struct Scene {
#define R_CINEON_LOG 8
#define R_TIFF_16BIT 16
#define R_JPEG2K_12BIT 32 /* Jpeg2000 */
#define R_JPEG2K_16BIT 64
#define R_JPEG2K_YCC 128 /* when disabled use RGB */
#define R_JPEG2K_CINE_PRESET 256
#define R_JPEG2K_CINE_48FPS 512
/* bake_mode: same as RE_BAKE_xxx defines */
/* bake_flag: */
#define R_BAKE_CLEAR 1
@@ -799,6 +813,15 @@ typedef struct Scene {
#define IMAGEPAINT_DRAW_TOOL 2
#define IMAGEPAINT_DRAW_TOOL_DRAWING 4
/* projection painting only */
#define IMAGEPAINT_PROJECT_DISABLE 8 /* Non projection 3D painting */
#define IMAGEPAINT_PROJECT_XRAY 16
#define IMAGEPAINT_PROJECT_BACKFACE 32
#define IMAGEPAINT_PROJECT_FLAT 64
#define IMAGEPAINT_PROJECT_LAYER_CLONE 128
#define IMAGEPAINT_PROJECT_LAYER_MASK 256
#define IMAGEPAINT_PROJECT_LAYER_MASK_INV 512
/* toolsettings->uvcalc_flag */
#define UVCALC_FILLHOLES 1
#define UVCALC_NO_ASPECT_CORRECT 2 /* would call this UVCALC_ASPECT_CORRECT, except it should be default with old file */

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

@@ -55,8 +55,6 @@ IF(WITH_FFMPEG)
ADD_DEFINITIONS(-DWITH_FFMPEG)
ENDIF(WITH_FFMPEG)
ADD_DEFINITIONS(-DWITH_CCGSUBSURF)
BLENDERLIB(bf_nodes "${SRC}" "${INC}")
IF(WITH_VERSE)

View File

@@ -46,6 +46,4 @@ if env['WITH_BF_QUICKTIME']:
defs += ' WITH_QUICKTIME'
incs += ' ' + env['BF_QUICKTIME_INC']
defs += ' WITH_CCGSUBSURF '
env.BlenderLib ( libname = 'nodes', sources = sources, includes = Split(incs), defines = Split(defs), libtype=['core','player'], priority = [65, 20] )

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

@@ -78,6 +78,7 @@ static void do_filter_edge(CompBuf *out, CompBuf *in, float *filter, float fac)
QUATCOPY(fp, row2+4);
}
else if(pix==CB_VAL) {
fp+= pix;
for(x=2; x<rowlen; x++) {
f1= filter[0]*row1[0] + filter[1]*row1[1] + filter[2]*row1[2] + filter[3]*row2[0] + filter[4]*row2[1] + filter[5]*row2[2] + filter[6]*row3[0] + filter[7]*row3[1] + filter[8]*row3[2];
f2= filter[0]*row1[0] + filter[3]*row1[1] + filter[6]*row1[2] + filter[1]*row2[0] + filter[4]*row2[1] + filter[7]*row2[2] + filter[2]*row3[0] + filter[5]*row3[1] + filter[8]*row3[2];

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

@@ -1560,7 +1560,7 @@ static int script_setter( BPy_Constraint *self, int type, PyObject *value )
break;
case EXPP_CONSTR_SCRIPT: {
Text *text = (( BPy_Text * )value)->text;
if( !BPy_Object_Check( value ) )
if( !BPy_Text_Check( value ) )
return EXPP_ReturnIntError( PyExc_TypeError,
"expected BPy text argument" );
con->text = text;
@@ -2291,6 +2291,7 @@ static PyObject *ConstraintSeq_remove( BPy_ConstraintSeq *self, BPy_Constraint *
{
bConstraint *con = locate_constr(self, value);
bPoseChannel *active= NULL;
int tmpflag= 0;
/* if we can't locate the constraint, return (exception already set) */
if (!con)
@@ -2304,6 +2305,11 @@ static PyObject *ConstraintSeq_remove( BPy_ConstraintSeq *self, BPy_Constraint *
if (active) active->bone->flag &= ~BONE_ACTIVE;
self->pchan->bone->flag |= BONE_ACTIVE;
}
if(!(self->obj->flag & OB_POSEMODE)) {
self->obj->flag |= OB_POSEMODE;
tmpflag= 1;
}
}
/* del_constr_func() frees constraint + its data */
@@ -2314,6 +2320,8 @@ static PyObject *ConstraintSeq_remove( BPy_ConstraintSeq *self, BPy_Constraint *
if (active) active->bone->flag |= BONE_ACTIVE;
self->pchan->bone->flag &= ~BONE_ACTIVE;
}
if(tmpflag)
self->obj->flag &= ~OB_POSEMODE;
/* erase the link to the constraint */
value->con = NULL;

View File

@@ -467,9 +467,6 @@ PyObject *CurNurb_append( BPy_CurNurb * self, PyObject * value )
PyObject *CurNurb_appendPointToNurb( Nurb * nurb, PyObject * value )
{
int i;
int size;
int npoints = nurb->pntsu;
/*
@@ -520,81 +517,58 @@ PyObject *CurNurb_appendPointToNurb( Nurb * nurb, PyObject * value )
}
else if( PySequence_Check( value ) ) {
size = PySequence_Size( value );
/* printf("\ndbg: got a sequence of size %d\n", size ); */
if( size == 4 || size == 5 || size == 6) {
BPoint *tmp;
tmp = nurb->bp; /* save old pts */
nurb->bp =
( BPoint * ) MEM_mallocN( sizeof( BPoint ) *
( npoints + 1 ),
"CurNurb_append1" );
if( !nurb->bp )
return ( EXPP_ReturnPyObjError
( PyExc_MemoryError,
"allocation failed" ) );
memmove( nurb->bp, tmp, sizeof( BPoint ) * npoints );
if( tmp )
MEM_freeN( tmp );
++nurb->pntsu;
/* initialize new BPoint from old */
memcpy( nurb->bp + npoints, nurb->bp,
sizeof( BPoint ) );
for( i = 0; i < 4; ++i ) {
PyObject *item = PySequence_GetItem( value, i );
if (item == NULL)
return NULL;
nurb->bp[npoints].vec[i] = ( float ) PyFloat_AsDouble( item );
Py_DECREF( item );
}
if (size >= 5) {
PyObject *item = PySequence_GetItem( value, 4 );
if (item == NULL)
return NULL;
nurb->bp[npoints].alfa = ( float ) PyFloat_AsDouble( item );
Py_DECREF( item );
}
else {
nurb->bp[npoints].alfa = 0.0f;
}
if (size == 6) {
PyObject *item = PySequence_GetItem( value, 5 );
if (item == NULL)
return NULL;
nurb->bp[npoints].radius = ( float ) PyFloat_AsDouble( item );
Py_DECREF( item );
}
else {
nurb->bp[npoints].radius = 1.0f;
}
nurb->bp[npoints].weight = 0.0; /* softbody weight TODO - add access to this, is zero elsewhere but through blender is 1.0 by default */
makeknots( nurb, 1, nurb->flagu >> 1 );
} else {
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected a sequence of 4 or 6 floats" );
float xco, yco, zco, wval, tilt=0.0f, radius=1.0f;
PyObject *args;
BPoint *tmp;
if (PyTuple_Check(value)) {
args= value;
}
else {
args= PySequence_Tuple(value);
}
if (!PyArg_ParseTuple(args, "ffff|ff", &xco, &yco, &zco, &wval, &tilt, &radius)) {
return EXPP_ReturnPyObjError( PyExc_TypeError, "expected a sequence of 4 to 6 floats" );
}
if (args != value) {
Py_DECREF(args);
}
tmp = nurb->bp; /* save old pts */
nurb->bp =
( BPoint * ) MEM_mallocN( sizeof( BPoint ) *
( npoints + 1 ),
"CurNurb_append1" );
if( !nurb->bp )
return ( EXPP_ReturnPyObjError
( PyExc_MemoryError,
"allocation failed" ) );
memmove( nurb->bp, tmp, sizeof( BPoint ) * npoints );
if( tmp )
MEM_freeN( tmp );
++nurb->pntsu;
/* initialize new BPoint from old */
memcpy( nurb->bp + npoints, nurb->bp,
sizeof( BPoint ) );
tmp= nurb->bp+npoints;
tmp->vec[0] = xco;
tmp->vec[1] = yco;
tmp->vec[2] = zco;
tmp->vec[3] = wval;
tmp->alfa = tilt;
tmp->radius = radius;
tmp->weight = 0.0; /* softbody weight TODO - add access to this, is zero elsewhere but through blender is 1.0 by default */
makeknots( nurb, 1, nurb->flagu >> 1 );
} else {
/* bail with error */
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected a sequence of 4 to 6 floats" );
return EXPP_ReturnPyObjError( PyExc_TypeError, "expected a sequence of 4 to 6 floats" );
}

View File

@@ -822,7 +822,6 @@ static PyObject *Curve_appendNurb( BPy_Curve * self, PyObject * value )
new_nurb->bezt->f2 = SELECT;
new_nurb->bezt->f3 = SELECT;
new_nurb->bezt->hide = 0;
new_nurb->bezt->radius = 1.0;
/* calchandlesNurb( new_nurb ); */
} else { /* set up bp */
new_nurb->pntsv = 1;
@@ -832,7 +831,6 @@ static PyObject *Curve_appendNurb( BPy_Curve * self, PyObject * value )
new_nurb->flagv = 0;
new_nurb->bp->f1 = 0;
new_nurb->bp->hide = 0;
new_nurb->bp->radius = 1.0;
new_nurb->knotsu = 0;
/*makenots( new_nurb, 1, new_nurb->flagu >> 1); */
}

View File

@@ -533,21 +533,16 @@ static PyObject *BPy_IDGroup_HasKey(BPy_IDProperty *self, PyObject *value)
Py_RETURN_FALSE;
}
static PyObject *BPy_IDGroup_Update(BPy_IDProperty *self, PyObject *vars)
static PyObject *BPy_IDGroup_Update(BPy_IDProperty *self, PyObject *value)
{
PyObject *pyob, *pkey, *pval;
PyObject *pkey, *pval;
Py_ssize_t i=0;
if (PySequence_Size(vars) != 1)
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected an object derived from dict.");
pyob = PyTuple_GET_ITEM(vars, 0);
if (!PyDict_Check(pyob))
if (!PyDict_Check(value))
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected an object derived from dict.");
while (PyDict_Next(pyob, &i, &pkey, &pval)) {
while (PyDict_Next(value, &i, &pkey, &pval)) {
BPy_IDGroup_Map_SetItem(self, pkey, pval);
if (PyErr_Occurred()) return NULL;
}
@@ -571,7 +566,7 @@ static struct PyMethodDef BPy_IDGroup_methods[] = {
"get the values associated with this group."},
{"has_key", (PyCFunction)BPy_IDGroup_HasKey, METH_O,
"returns true if the group contains a key, false if not."},
{"update", (PyCFunction)BPy_IDGroup_Update, METH_VARARGS,
{"update", (PyCFunction)BPy_IDGroup_Update, METH_O,
"updates the values in the group with the values of another or a dict."},
{"convert_to_pyobject", (PyCFunction)BPy_IDGroup_ConvertToPy, METH_NOARGS,
"return a purely python version of the group."},

View File

@@ -5390,9 +5390,9 @@ static PyObject *MFaceSeq_delete( BPy_MFaceSeq * self, PyObject *args )
/* see how many args we need to parse */
len = PySequence_Size( args );
if( len < 1 )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"sequence must contain at least one int or MFace" );
if( len < 1 ) {
Py_RETURN_NONE;
}
face_table = MEM_callocN( len*sizeof( unsigned int ),
"face_table" );

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