merge 16951:17122

This commit is contained in:
Martin Poirier 2008-10-20 00:48:10 +00:00
commit a806c1eb7f
181 changed files with 13398 additions and 3552 deletions

@ -64,7 +64,7 @@ OPTION(WITH_OPENEXR "Enable OpenEXR Support (http://www.openexr.com)" ON)
OPTION(WITH_FFMPEG "Enable FFMPeg Support (http://ffmpeg.mplayerhq.hu/)" OFF) OPTION(WITH_FFMPEG "Enable FFMPeg Support (http://ffmpeg.mplayerhq.hu/)" OFF)
OPTION(WITH_OPENAL "Enable OpenAL Support (http://www.openal.org)" ON) OPTION(WITH_OPENAL "Enable OpenAL Support (http://www.openal.org)" ON)
OPTION(WITH_OPENMP "Enable OpenMP (has to be supported by the compiler)" OFF) OPTION(WITH_OPENMP "Enable OpenMP (has to be supported by the compiler)" OFF)
OPTION(WITH_WEBPLUGIN "Enable Web Plugin (Mozilla-Unix only)" OFF) OPTION(WITH_WEBPLUGIN "Enable Web Plugin (Unix only)" OFF)
IF(NOT WITH_GAMEENGINE AND WITH_PLAYER) IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE") MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE")
@ -428,6 +428,17 @@ SET(FTGL_INC ${FTGL}/include)
SET(FTGL_LIB extern_ftgl) SET(FTGL_LIB extern_ftgl)
#-----------------------------------------------------------------------------
# Blender WebPlugin
IF(WITH_WEBPLUGIN)
SET(GECKO_DIR "${CMAKE_SOURCE_DIR}/../gecko-sdk/" CACHE PATH "Gecko SDK path")
SET(WEBPLUGIN_SANDBOX_MODE "apparmor" CACHE STRING "WEB Plugin sandbox mode, can be apparmor, privsep, none")
SET(WITH_PLAYER ON)
ENDIF(WITH_WEBPLUGIN)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Configure OpenGL. # Configure OpenGL.
INCLUDE(${CMAKE_ROOT}/Modules/FindOpenGL.cmake) INCLUDE(${CMAKE_ROOT}/Modules/FindOpenGL.cmake)
@ -457,12 +468,6 @@ SUBDIRS(
# Blender Application # Blender Application
SUBDIRS(source/creator) SUBDIRS(source/creator)
#-----------------------------------------------------------------------------
# Blender WebPlugin
IF(WITH_WEBPLUGIN)
SET(MOZILLA_DIR "${CMAKE_SOURCE_DIR}/../gecko-sdk/" CACHE PATH "Gecko SDK path")
SET(WITH_PLAYER ON)
ENDIF(WITH_WEBPLUGIN)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Blender Player # Blender Player

@ -277,15 +277,15 @@ if 'blenderlite' in B.targets:
env['WITH_BF_BINRELOC'] = False env['WITH_BF_BINRELOC'] = False
env['BF_BUILDINFO'] = False env['BF_BUILDINFO'] = False
env['BF_NO_ELBEEM'] = True env['BF_NO_ELBEEM'] = True
# lastly we check for root_build_dir ( we should not do before, otherwise we might do wrong builddir # lastly we check for root_build_dir ( we should not do before, otherwise we might do wrong builddir
#B.root_build_dir = B.arguments.get('BF_BUILDDIR', '..'+os.sep+'build'+os.sep+platform+os.sep) #B.root_build_dir = B.arguments.get('BF_BUILDDIR', '..'+os.sep+'build'+os.sep+platform+os.sep)
B.root_build_dir = env['BF_BUILDDIR'] B.root_build_dir = env['BF_BUILDDIR']
env['BUILDDIR'] = B.root_build_dir B.doc_build_dir = env['BF_DOCDIR']
if not B.root_build_dir[-1]==os.sep: if not B.root_build_dir[-1]==os.sep:
B.root_build_dir += os.sep B.root_build_dir += os.sep
if not B.doc_build_dir[-1]==os.sep:
B.doc_build_dir += os.sep
# We do a shortcut for clean when no quicklist is given: just delete # We do a shortcut for clean when no quicklist is given: just delete
# builddir without reading in SConscripts # builddir without reading in SConscripts
@ -294,8 +294,18 @@ if 'clean' in B.targets:
do_clean = True do_clean = True
if not quickie and do_clean: if not quickie and do_clean:
if os.path.exists(B.doc_build_dir):
print B.bc.HEADER+'Cleaning doc dir...'+B.bc.ENDC
dirs = os.listdir(B.doc_build_dir)
for entry in dirs:
if os.path.isdir(B.doc_build_dir + entry) == 1:
print "clean dir %s"%(B.doc_build_dir+entry)
shutil.rmtree(B.doc_build_dir+entry)
else: # remove file
print "remove file %s"%(B.doc_build_dir+entry)
os.remove(B.root_build_dir+entry)
if os.path.exists(B.root_build_dir): if os.path.exists(B.root_build_dir):
print B.bc.HEADER+'Cleaning...'+B.bc.ENDC print B.bc.HEADER+'Cleaning build dir...'+B.bc.ENDC
dirs = os.listdir(B.root_build_dir) dirs = os.listdir(B.root_build_dir)
for entry in dirs: for entry in dirs:
if os.path.isdir(B.root_build_dir + entry) == 1: if os.path.isdir(B.root_build_dir + entry) == 1:
@ -321,6 +331,8 @@ if not os.path.isdir ( B.root_build_dir):
os.makedirs ( B.root_build_dir + 'extern' ) os.makedirs ( B.root_build_dir + 'extern' )
os.makedirs ( B.root_build_dir + 'lib' ) os.makedirs ( B.root_build_dir + 'lib' )
os.makedirs ( B.root_build_dir + 'bin' ) os.makedirs ( B.root_build_dir + 'bin' )
if not os.path.isdir(B.doc_build_dir):
os.makedirs ( B.doc_build_dir )
Help(opts.GenerateHelpText(env)) Help(opts.GenerateHelpText(env))
@ -363,7 +375,8 @@ dobj = B.buildinfo(env, "dynamic") + B.resources
thestatlibs, thelibincs = B.setup_staticlibs(env) thestatlibs, thelibincs = B.setup_staticlibs(env)
thesyslibs = B.setup_syslibs(env) thesyslibs = B.setup_syslibs(env)
env.BlenderProg(B.root_build_dir, "blender", dobj + mainlist + thestatlibs, [], thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender') if 'blender' in B.targets or not env['WITH_BF_NOBLENDER']:
env.BlenderProg(B.root_build_dir, "blender", dobj + mainlist + thestatlibs, [], thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender')
if env['WITH_BF_PLAYER']: if env['WITH_BF_PLAYER']:
playerlist = B.create_blender_liblist(env, 'player') playerlist = B.create_blender_liblist(env, 'player')
env.BlenderProg(B.root_build_dir, "blenderplayer", dobj + playerlist + thestatlibs, [], thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blenderplayer') env.BlenderProg(B.root_build_dir, "blenderplayer", dobj + playerlist + thestatlibs, [], thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blenderplayer')
@ -534,6 +547,10 @@ nsisaction = env.Action(btools.NSIS_Installer, btools.NSIS_print)
nsiscmd = env.Command('nsisinstaller', None, nsisaction) nsiscmd = env.Command('nsisinstaller', None, nsisaction)
nsisalias = env.Alias('nsis', nsiscmd) nsisalias = env.Alias('nsis', nsiscmd)
if 'blender' in B.targets:
blenderexe= env.Alias('blender', B.program_list)
Depends(blenderexe,installtarget)
if env['WITH_BF_PLAYER']: if env['WITH_BF_PLAYER']:
blenderplayer = env.Alias('blenderplayer', B.program_list) blenderplayer = env.Alias('blenderplayer', B.program_list)
Depends(blenderplayer,installtarget) Depends(blenderplayer,installtarget)
@ -560,5 +577,6 @@ if not env['WITHOUT_BF_INSTALL']:
# TODO: build stubs and link into blenderplayer # TODO: build stubs and link into blenderplayer
#------------ EPYDOC #------------ EPYDOC
# TODO: run epydoc if env['WITH_BF_BPYDOC']:
SConscript(['source/blender/python/api2_2x/doc/SConscript'])

@ -268,3 +268,4 @@ BF_DEBUG_FLAGS = '-g'
BF_BUILDDIR='../build/darwin' BF_BUILDDIR='../build/darwin'
BF_INSTALLDIR='../install/darwin' BF_INSTALLDIR='../install/darwin'
BF_DOCDIR='../install/doc'

@ -205,6 +205,7 @@ BF_DEBUG_FLAGS = '-g'
BF_BUILDDIR = '../build/linux2' BF_BUILDDIR = '../build/linux2'
BF_INSTALLDIR='../install/linux2' BF_INSTALLDIR='../install/linux2'
BF_DOCDIR='../install/doc'
#Link against pthread #Link against pthread

@ -148,3 +148,4 @@ BF_DEBUG_FLAGS= ''
BF_BUILDDIR = '../build/linuxcross' BF_BUILDDIR = '../build/linuxcross'
BF_INSTALLDIR='../install/linuxcross' BF_INSTALLDIR='../install/linuxcross'
BF_DOCDIR='../install/doc'

@ -163,3 +163,4 @@ BF_DEBUG_FLAGS = '-g'
BF_BUILDDIR='../build/openbsd3' BF_BUILDDIR='../build/openbsd3'
BF_INSTALLDIR='../install/openbsd3' BF_INSTALLDIR='../install/openbsd3'
BF_DOCDIR='../install/doc'

@ -177,6 +177,7 @@ BF_DEBUG_FLAGS = ''
BF_BUILDDIR = '../build/sunos5' BF_BUILDDIR = '../build/sunos5'
BF_INSTALLDIR='../install/sunos5' BF_INSTALLDIR='../install/sunos5'
BF_DOCDIR='../install/doc'
PLATFORM_LINKFLAGS = [''] PLATFORM_LINKFLAGS = ['']

@ -167,3 +167,4 @@ BF_PROFILE = 'false'
BF_BUILDDIR = '..\\build\\win32-mingw' BF_BUILDDIR = '..\\build\\win32-mingw'
BF_INSTALLDIR='..\\install\\win32-mingw' BF_INSTALLDIR='..\\install\\win32-mingw'
BF_DOCDIR = '..\\install\\doc'

@ -187,3 +187,4 @@ PLATFORM_LINKFLAGS = '''
BF_BUILDDIR = '..\\build\\win32-vc' BF_BUILDDIR = '..\\build\\win32-vc'
BF_INSTALLDIR='..\\install\\win32-vc' BF_INSTALLDIR='..\\install\\win32-vc'
BF_DOCDIR='..\\install\\doc'

@ -1015,7 +1015,7 @@ btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendly(btCollisio
btAssert(pt); btAssert(pt);
pt->m_appliedImpulse = solveManifold.m_appliedImpulse; pt->m_appliedImpulse = solveManifold.m_appliedImpulse;
pt->m_appliedImpulseLateral1 = m_tmpSolverFrictionConstraintPool[solveManifold.m_frictionIndex].m_appliedImpulse; pt->m_appliedImpulseLateral1 = m_tmpSolverFrictionConstraintPool[solveManifold.m_frictionIndex].m_appliedImpulse;
pt->m_appliedImpulseLateral1 = m_tmpSolverFrictionConstraintPool[solveManifold.m_frictionIndex+1].m_appliedImpulse; pt->m_appliedImpulseLateral2 = m_tmpSolverFrictionConstraintPool[solveManifold.m_frictionIndex+1].m_appliedImpulse;
//do a callback here? //do a callback here?

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

@ -306,8 +306,16 @@ void btSoftBody::appendFace(int node0,int node1,int node2,Material* mat)
} }
// //
void btSoftBody::appendAnchor(int node,btRigidBody* body) void btSoftBody::appendAnchor(int node,btRigidBody* body,bool disableCollisionWithBody=false)
{ {
if (disableCollisionWithBody)
{
if (m_collisionDisabledObjects.findLinearSearch(body)==m_collisionDisabledObjects.size())
{
m_collisionDisabledObjects.push_back(body);
}
}
Anchor a; Anchor a;
a.m_node = &m_nodes[node]; a.m_node = &m_nodes[node];
a.m_body = body; a.m_body = body;

@ -49,6 +49,8 @@ struct btSoftBodyWorldInfo
class btSoftBody : public btCollisionObject class btSoftBody : public btCollisionObject
{ {
public: public:
btAlignedObjectArray<class btCollisionObject*> m_collisionDisabledObjects;
// //
// Enumerations // Enumerations
// //
@ -667,7 +669,7 @@ public:
Material* mat=0); Material* mat=0);
/* Append anchor */ /* Append anchor */
void appendAnchor( int node, void appendAnchor( int node,
btRigidBody* body); btRigidBody* body,bool disableCollision);
/* Append linear joint */ /* Append linear joint */
void appendLinearJoint(const LJoint::Specs& specs,Cluster* body0,Body body1); void appendLinearJoint(const LJoint::Specs& specs,Cluster* body0,Body body1);
void appendLinearJoint(const LJoint::Specs& specs,Body body=Body()); void appendLinearJoint(const LJoint::Specs& specs,Body body=Body());

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

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

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

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

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

@ -91,21 +91,24 @@ SND_SoundObject::~SND_SoundObject()
void SND_SoundObject::StartSound() void SND_SoundObject::StartSound()
{ {
m_playstate = SND_MUST_PLAY; if (m_id >= 0)
m_playstate = SND_MUST_PLAY;
} }
void SND_SoundObject::StopSound() void SND_SoundObject::StopSound()
{ {
m_playstate = SND_MUST_STOP; if (m_id >= 0)
m_playstate = SND_MUST_STOP;
} }
void SND_SoundObject::PauseSound() void SND_SoundObject::PauseSound()
{ {
m_playstate = SND_MUST_PAUSE; if (m_id >= 0)
m_playstate = SND_MUST_PAUSE;
} }

@ -285,26 +285,32 @@ unsigned int SND_GetBitRate(void* sample)
/* gets the length of the actual sample data (without the header) */ /* gets the length of the actual sample data (without the header) */
unsigned int SND_GetNumberOfSamples(void* sample) unsigned int SND_GetNumberOfSamples(void* sample, int sample_length)
{ {
unsigned int chunklength, length = 0, offset = 16; unsigned int chunklength, length = 0, offset;
char data[4]; unsigned short block_align;
if (CheckSample(sample)) if (CheckSample(sample))
{ {
memcpy(&chunklength, ((char*)sample) + offset, 4); memcpy(&chunklength, ((char*)sample) + 16, 4);
memcpy(&block_align, ((char*)sample) + 32, 2); /* always 2 or 4 it seems */
/* This was endian unsafe. See top of the file for the define. */ /* This was endian unsafe. See top of the file for the define. */
if (SND_fEndian == SND_endianBig) SWITCH_INT(chunklength); if (SND_fEndian == SND_endianBig)
{
offset = offset + chunklength + 4; SWITCH_INT(chunklength);
memcpy(data, ((char*)sample) + offset, 4); SWITCH_SHORT(block_align);
}
offset = 16 + chunklength + 4;
/* This seems very unsafe, what if data is never found (f.i. corrupt file)... */ /* This seems very unsafe, what if data is never found (f.i. corrupt file)... */
// lets find "data" // lets find "data"
while (memcmp(data, "data", 4)) while (memcmp(((char*)sample) + offset, "data", 4))
{ {
offset += 4; offset += block_align;
memcpy(data, ((char*)sample) + offset, 4);
if (offset+block_align > sample_length) /* save us from crashing */
return 0;
} }
offset += 4; offset += 4;
memcpy(&length, ((char*)sample) + offset, 4); memcpy(&length, ((char*)sample) + offset, 4);
@ -319,34 +325,38 @@ unsigned int SND_GetNumberOfSamples(void* sample)
/* gets the size of the entire header (file - sampledata) */ /* gets the size of the entire header (file - sampledata) */
unsigned int SND_GetHeaderSize(void* sample) unsigned int SND_GetHeaderSize(void* sample, int sample_length)
{ {
unsigned int chunklength, headersize = 0, offset = 16; unsigned int chunklength, headersize = 0, offset = 16;
char data[4]; unsigned short block_align;
if (CheckSample(sample)) if (CheckSample(sample))
{ {
memcpy(&chunklength, ((char*)sample) + offset, 4); memcpy(&chunklength, ((char*)sample) + offset, 4);
memcpy(&block_align, ((char*)sample) + 32, 2); /* always 2 or 4 it seems */
/* This was endian unsafe. See top of the file for the define. */ /* This was endian unsafe. See top of the file for the define. */
if (SND_fEndian == SND_endianBig) SWITCH_INT(chunklength); if (SND_fEndian == SND_endianBig)
{
SWITCH_INT(chunklength);
SWITCH_SHORT(block_align);
}
offset = offset + chunklength + 4; offset = offset + chunklength + 4;
memcpy(data, ((char*)sample) + offset, 4);
// lets find "data" // lets find "data"
while (memcmp(data, "data", 4)) while (memcmp(((char*)sample) + offset, "data", 4))
{ {
offset += 4; offset += block_align;
memcpy(data, ((char*)sample) + offset, 4);
if (offset+block_align > sample_length) /* save us from crashing */
return 0;
} }
headersize = offset + 8; headersize = offset + 8;
} }
return headersize; return headersize;
} }
unsigned int SND_GetExtraChunk(void* sample) unsigned int SND_GetExtraChunk(void* sample)
{ {
unsigned int extrachunk = 0, chunklength, offset = 16; unsigned int extrachunk = 0, chunklength, offset = 16;
@ -382,58 +392,60 @@ void SND_GetSampleInfo(signed char* sample, SND_WaveSlot* waveslot)
if (CheckSample(sample)) if (CheckSample(sample))
{ {
memcpy(&fileheader, sample, sizeof(WavFileHeader)); memcpy(&fileheader, sample, sizeof(WavFileHeader));
fileheader.size = SND_GetHeaderSize(sample); fileheader.size = SND_GetHeaderSize(sample, waveslot->GetFileSize());
sample += sizeof(WavFileHeader); if (fileheader.size) { /* this may fail for corrupt files */
fileheader.size = ((fileheader.size+1) & ~1) - 4; sample += sizeof(WavFileHeader);
fileheader.size = ((fileheader.size+1) & ~1) - 4;
while ((fileheader.size > 0) && (memcpy(&chunkheader, sample, sizeof(WavChunkHeader)))) while ((fileheader.size > 0) && (memcpy(&chunkheader, sample, sizeof(WavChunkHeader))))
{
sample += sizeof(WavChunkHeader);
if (!memcmp(chunkheader.id, "fmt ", 4))
{ {
memcpy(&fmtheader, sample, sizeof(WavFmtHeader)); sample += sizeof(WavChunkHeader);
waveslot->SetSampleFormat(fmtheader.format); if (!memcmp(chunkheader.id, "fmt ", 4))
if (fmtheader.format == 0x0001)
{ {
waveslot->SetNumberOfChannels(fmtheader.numberofchannels); memcpy(&fmtheader, sample, sizeof(WavFmtHeader));
waveslot->SetBitRate(fmtheader.bitrate); waveslot->SetSampleFormat(fmtheader.format);
waveslot->SetSampleRate(fmtheader.samplerate);
if (fmtheader.format == 0x0001)
{
waveslot->SetNumberOfChannels(fmtheader.numberofchannels);
waveslot->SetBitRate(fmtheader.bitrate);
waveslot->SetSampleRate(fmtheader.samplerate);
sample += chunkheader.size;
}
else
{
memcpy(&fmtexheader, sample, sizeof(WavFmtExHeader));
sample += chunkheader.size;
}
}
else if (!memcmp(chunkheader.id, "data", 4))
{
if (fmtheader.format == 0x0001)
{
waveslot->SetNumberOfSamples(chunkheader.size);
sample += chunkheader.size;
}
else if (fmtheader.format == 0x0011)
{
//IMA ADPCM
}
else if (fmtheader.format == 0x0055)
{
//MP3 WAVE
}
}
else if (!memcmp(chunkheader.id, "smpl", 4))
{
memcpy(&sampleheader, sample, sizeof(WavSampleHeader));
//loop = sampleheader.loops;
sample += chunkheader.size; sample += chunkheader.size;
} }
else else
{
memcpy(&fmtexheader, sample, sizeof(WavFmtExHeader));
sample += chunkheader.size; sample += chunkheader.size;
}
}
else if (!memcmp(chunkheader.id, "data", 4))
{
if (fmtheader.format == 0x0001)
{
waveslot->SetNumberOfSamples(chunkheader.size);
sample += chunkheader.size;
}
else if (fmtheader.format == 0x0011)
{
//IMA ADPCM
}
else if (fmtheader.format == 0x0055)
{
//MP3 WAVE
}
}
else if (!memcmp(chunkheader.id, "smpl", 4))
{
memcpy(&sampleheader, sample, sizeof(WavSampleHeader));
//loop = sampleheader.loops;
sample += chunkheader.size;
}
else
sample += chunkheader.size;
sample += chunkheader.size & 1; sample += chunkheader.size & 1;
fileheader.size -= (((chunkheader.size + 1) & ~1) + 8); fileheader.size -= (((chunkheader.size + 1) & ~1) + 8);
}
} }
} }
} }

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

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

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

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

@ -1 +1 @@
2.47 2.48

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 251 KiB

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

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

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

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

File diff suppressed because it is too large Load Diff

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

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

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

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

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

1938
release/scripts/import_web3d.py Executable file

File diff suppressed because it is too large Load Diff

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

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

@ -639,7 +639,7 @@ class VRML2Export:
# Check if any faces the material or image # Check if any faces the material or image
for face in me.faces: for face in me.faces:
if (matnum == -1): if (matnum == -1):
if (f.image == image): if (face.image == image):
return True return True
elif (image == None): elif (image == None):
if (face.mat == matnum): if (face.mat == matnum):

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

@ -182,12 +182,11 @@ Function MigrateUserSettings
${EndIf} ${EndIf}
FunctionEnd FunctionEnd
!define DLL_VER "8.00.50727.42" !define DLL_VER "9.00.21022.8"
!define DLL_VER2 "7.10.3052.4"
Function LocateCallback_80 Function LocateCallback_90
MoreInfo::GetProductVersion "$R9" MoreInfo::GetProductVersion "$R9"
Pop $0 Pop $0
${VersionCompare} "$0" "${DLL_VER}" $R1 ${VersionCompare} "$0" "${DLL_VER}" $R1
@ -196,7 +195,7 @@ Function LocateCallback_80
StrCmp $R1 1 0 old StrCmp $R1 1 0 old
old: old:
StrCmp $R1 2 0 end StrCmp $R1 2 0 end
; Found DLL is older ; Found DLL is older
Call DownloadDLL Call DownloadDLL
end: end:
@ -206,35 +205,14 @@ Function LocateCallback_80
FunctionEnd FunctionEnd
Function LocateCallback_71
MoreInfo::GetProductVersion "$R9"
Pop $0
${VersionCompare} "$0" "${DLL_VER2}" $R1
StrCmp $R1 0 0 new
new:
StrCmp $R1 1 0 old
old:
StrCmp $R1 2 0 end
; Found DLL is older
Call PythonInstall
end:
StrCpy "$0" StopLocate
StrCpy $DLL_found "true"
Push "$0"
FunctionEnd
Function DownloadDLL Function DownloadDLL
MessageBox MB_OK "You will need to download the Microsoft Visual C++ 2005 Redistributable Package in order to run Blender. Pressing OK will take you to the download page, please follow the instructions on the page that appears." MessageBox MB_OK "You will need to download the Microsoft Visual C++ 2008 Redistributable Package in order to run Blender. Pressing OK will take you to the download page, please follow the instructions on the page that appears."
StrCpy $0 "http://www.microsoft.com/downloads/details.aspx?familyid=32BC1BEE-A3F9-4C13-9C99-220B62A191EE&displaylang=en" StrCpy $0 "http://www.microsoft.com/downloads/details.aspx?FamilyID=9b2da534-3e03-4391-8a4d-074b9f2bc1bf&DisplayLang=en"
Call openLinkNewWindow Call openLinkNewWindow
FunctionEnd FunctionEnd
Function PythonInstall Function PythonInstall
MessageBox MB_OK "You will need to install python 2.5 in order to run blender. Pressing OK will take you to the python.org website." MessageBox MB_OK "You will need to install python 2.5.2 in order to run blender. Pressing OK will take you to the python.org website."
StrCpy $0 "http://www.python.org" StrCpy $0 "http://www.python.org"
Call openLinkNewWindow Call openLinkNewWindow
FunctionEnd FunctionEnd
@ -359,19 +337,19 @@ Section "Blender-VERSION (required)" SecCopyUI
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "UninstallString" '"$INSTDIR\uninstall.exe"' WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Blender" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteUninstaller "uninstall.exe" WriteUninstaller "uninstall.exe"
IfSilent 0 +2
Goto silentdone
; Check for msvcr80.dll - give notice to download if not found ; Check for msvcr80.dll - give notice to download if not found
MessageBox MB_OK "The installer will now check your system for the required system dlls." MessageBox MB_OK "The installer will now check your system for the required system dlls."
StrCpy $1 $WINDIR StrCpy $1 $WINDIR
StrCpy $DLL_found "false" StrCpy $DLL_found "false"
${Locate} "$1" "/L=F /M=MSVCR80.DLL /S=0B" "LocateCallback_80" ${Locate} "$1" "/L=F /M=MSVCR90.DLL /S=0B" "LocateCallback_90"
StrCmp $DLL_found "false" 0 +2 StrCmp $DLL_found "false" 0 +2
Call DownloadDLL Call DownloadDLL
StrCpy $1 $WINDIR ReadRegStr $0 HKLM SOFTWARE\Python\PythonCore\2.5\InstallPath ""
StrCpy $DLL_found "false" StrCmp $0 "" 0 +2
${Locate} "$1" "/L=F /M=MSVCR71.DLL /S=0B" "LocateCallback_71"
StrCmp $DLL_found "false" 0 +2
Call PythonInstall Call PythonInstall
silentdone:
SectionEnd SectionEnd
Section "Add Start Menu shortcuts" Section2 Section "Add Start Menu shortcuts" Section2
@ -424,7 +402,7 @@ Section "Uninstall"
Delete "$DESKTOP\Blender.lnk" Delete "$DESKTOP\Blender.lnk"
; remove directories used. ; remove directories used.
RMDir /r $BLENDERHOME\.blender\locale RMDir /r $BLENDERHOME\.blender\locale
MessageBox MB_YESNO "Erase .blender\scripts folder? (ALL contents will be erased!)" IDNO Next MessageBox MB_YESNO "Erase .blender\scripts folder? (ALL contents will be erased!)" /SD IDYES IDNO Next
RMDir /r $BLENDERHOME\.blender\scripts RMDir /r $BLENDERHOME\.blender\scripts
RMDir /r $BLENDERHOME\.blender\scripts\bpymodules RMDir /r $BLENDERHOME\.blender\scripts\bpymodules
RMDir /r $BLENDERHOME\.blender\scripts\bpydata RMDir /r $BLENDERHOME\.blender\scripts\bpydata

@ -40,8 +40,8 @@ extern "C" {
struct ListBase; struct ListBase;
struct MemFile; struct MemFile;
#define BLENDER_VERSION 247 #define BLENDER_VERSION 248
#define BLENDER_SUBVERSION 10 #define BLENDER_SUBVERSION 0
#define BLENDER_MINVERSION 245 #define BLENDER_MINVERSION 245
#define BLENDER_MINSUBVERSION 15 #define BLENDER_MINSUBVERSION 15

@ -78,6 +78,7 @@ BulletSoftBody *bsbNew(void)
bsb->kSHR = 1.0f; bsb->kSHR = 1.0f;
bsb->kAHR = 0.7f; bsb->kAHR = 0.7f;
bsb->collisionflags = 0; bsb->collisionflags = 0;
//bsb->collisionflags = OB_BSB_COL_CL_RS + OB_BSB_COL_CL_SS; //bsb->collisionflags = OB_BSB_COL_CL_RS + OB_BSB_COL_CL_SS;
bsb->numclusteriterations = 64; bsb->numclusteriterations = 64;

@ -1313,16 +1313,18 @@ CollisionModifierData **get_collisionobjects(Object *self, int *numcollobj)
coll_ob = base->object; coll_ob = base->object;
if(coll_ob == self)
continue;
if(coll_ob->pd && coll_ob->pd->deflect) if(coll_ob->pd && coll_ob->pd->deflect)
{ {
collmd = ( CollisionModifierData * ) modifiers_findByType ( coll_ob, eModifierType_Collision ); collmd = ( CollisionModifierData * ) modifiers_findByType ( coll_ob, eModifierType_Collision );
} }
else
collmd = NULL;
if ( collmd ) if ( collmd )
{ {
if(coll_ob == self)
continue;
if(numobj >= maxobj) if(numobj >= maxobj)
{ {
// realloc // realloc
@ -1351,16 +1353,18 @@ CollisionModifierData **get_collisionobjects(Object *self, int *numcollobj)
coll_ob = go->ob; coll_ob = go->ob;
collmd = NULL; collmd = NULL;
if(coll_ob == self)
continue;
if(coll_ob->pd && coll_ob->pd->deflect) if(coll_ob->pd && coll_ob->pd->deflect)
{ {
collmd = ( CollisionModifierData * ) modifiers_findByType ( coll_ob, eModifierType_Collision ); collmd = ( CollisionModifierData * ) modifiers_findByType ( coll_ob, eModifierType_Collision );
} }
else
collmd = NULL;
if ( !collmd ) if ( !collmd )
continue; continue;
if(coll_ob == self)
continue;
if( !collmd->bvhtree) if( !collmd->bvhtree)
continue; continue;

@ -292,7 +292,7 @@ int surfindex_displist(DispList *dl, int a, int *b, int *p1, int *p2, int *p3, i
(*b)= 1; (*b)= 1;
} }
if( (dl->flag & DL_CYCL_U) && a==dl->parts-1) { \ if( (dl->flag & DL_CYCL_V) && a==dl->parts-1) { \
(*p3)-= dl->nr*dl->parts; \ (*p3)-= dl->nr*dl->parts; \
(*p4)-= dl->nr*dl->parts; \ (*p4)-= dl->nr*dl->parts; \
} }

@ -352,7 +352,10 @@ IDProperty *IDP_GetProperties(ID *id, int create_if_needed)
if (create_if_needed) { if (create_if_needed) {
id->properties = MEM_callocN(sizeof(IDProperty), "IDProperty"); id->properties = MEM_callocN(sizeof(IDProperty), "IDProperty");
id->properties->type = IDP_GROUP; id->properties->type = IDP_GROUP;
strcpy(id->name, "top_level_group"); /* dont overwite the data's name and type
* some functions might need this if they
* dont have a real ID, should be named elsewhere - Campbell */
/* strcpy(id->name, "top_level_group");*/
} }
return id->properties; return id->properties;
} }

@ -1571,7 +1571,7 @@ static ImBuf *image_load_sequence_multilayer(Image *ima, ImageUser *iuser, int f
ibuf->channels= rpass->channels; ibuf->channels= rpass->channels;
image_initialize_after_load(ima, ibuf); image_initialize_after_load(ima, ibuf);
image_assign_ibuf(ima, ibuf, iuser->multi_index, frame); image_assign_ibuf(ima, ibuf, iuser?iuser->multi_index:0, frame);
} }
// else printf("pass not found\n"); // else printf("pass not found\n");

@ -284,10 +284,10 @@ void set_four_ipo(float d, float *data, int type)
} }
else if(type==KEY_BSPLINE) { else if(type==KEY_BSPLINE) {
data[0]= -0.1666f*d3 +0.5f*d2 -0.5f*d +0.16666f; data[0]= -0.16666666f*d3 +0.5f*d2 -0.5f*d +0.16666666f;
data[1]= 0.5f*d3 -d2 +0.6666f; data[1]= 0.5f*d3 -d2 +0.6666666f;
data[2]= -0.5f*d3 +0.5f*d2 +0.5f*d +0.1666f; data[2]= -0.5f*d3 +0.5f*d2 +0.5f*d +0.16666666f;
data[3]= 0.1666f*d3 ; data[3]= 0.16666666f*d3 ;
} }
} }
} }
@ -313,10 +313,10 @@ void set_afgeleide_four_ipo(float d, float *data, int type)
} }
else if(type==KEY_BSPLINE) { else if(type==KEY_BSPLINE) {
data[0]= -0.1666f*3.0f*d2 +d -0.5f; data[0]= -0.16666666f*3.0f*d2 +d -0.5f;
data[1]= 1.5f*d2 -2.0f*d; data[1]= 1.5f*d2 -2.0f*d;
data[2]= -1.5f*d2 +d +0.5f; data[2]= -1.5f*d2 +d +0.5f;
data[3]= 0.1666f*3.0f*d2 ; data[3]= 0.16666666f*3.0f*d2 ;
} }
} }
} }

@ -407,6 +407,10 @@ void *copy_libblock(void *rt)
lb= wich_libbase(G.main, GS(id->name)); lb= wich_libbase(G.main, GS(id->name));
idn= alloc_libblock(lb, GS(id->name), id->name+2); idn= alloc_libblock(lb, GS(id->name), id->name+2);
if(idn==NULL) {
printf("ERROR: Illegal ID name for %s (Crashing now)\n", id->name);
}
idn_len= MEM_allocN_len(idn); idn_len= MEM_allocN_len(idn);
if(idn_len - sizeof(ID) > 0) { if(idn_len - sizeof(ID) > 0) {
cp= (char *)id; cp= (char *)id;

@ -7759,6 +7759,8 @@ static void shrinkwrapModifier_copyData(ModifierData *md, ModifierData *target)
tsmd->keepDist = smd->keepDist; tsmd->keepDist = smd->keepDist;
tsmd->shrinkType= smd->shrinkType; tsmd->shrinkType= smd->shrinkType;
tsmd->shrinkOpts= smd->shrinkOpts; tsmd->shrinkOpts= smd->shrinkOpts;
tsmd->projAxis = smd->projAxis;
tsmd->subsurfLevels = smd->subsurfLevels;
} }
CustomDataMask shrinkwrapModifier_requiredDataMask(ModifierData *md) CustomDataMask shrinkwrapModifier_requiredDataMask(ModifierData *md)

@ -642,6 +642,10 @@ static void multires_update_vertices(Mesh *me, EditMesh *em)
MultiApplyData data; MultiApplyData data;
int i, j; int i, j;
/* XXX added this to prevent crash, but if it works? (ton) */
if(me->mr->verts==NULL)
return;
/* Prepare deltas */ /* Prepare deltas */
pr_deltas= MEM_callocN(sizeof(vec3f)*last_lvl->totvert, "multires deltas 1"); pr_deltas= MEM_callocN(sizeof(vec3f)*last_lvl->totvert, "multires deltas 1");
cr_deltas= MEM_callocN(sizeof(vec3f)*last_lvl->totvert, "multires deltas 2"); cr_deltas= MEM_callocN(sizeof(vec3f)*last_lvl->totvert, "multires deltas 2");

@ -3101,7 +3101,7 @@ static void deflect_particle(Object *pob, ParticleSystemModifierData *psmd, Part
col.md = ( CollisionModifierData * ) ( modifiers_findByType ( ec->ob, eModifierType_Collision ) ); col.md = ( CollisionModifierData * ) ( modifiers_findByType ( ec->ob, eModifierType_Collision ) );
col.ob_t = ob; col.ob_t = ob;
if(col.md->bvhtree) if(col.md && col.md->bvhtree)
BLI_bvhtree_ray_cast(col.md->bvhtree, col.co1, ray_dir, radius, &hit, particle_intersect_face, &col); BLI_bvhtree_ray_cast(col.md->bvhtree, col.co1, ray_dir, radius, &hit, particle_intersect_face, &col);
} }
} }

@ -78,10 +78,7 @@ char *PIL_dynlib_get_error_as_string(PILdynlib* lib) {
/* if lib is NULL reset the last error code */ /* if lib is NULL reset the last error code */
err= GetLastError(); err= GetLastError();
if (!lib) { if (!lib) SetLastError(ERROR_SUCCESS);
SetLastError(ERROR_SUCCESS);
err = ERROR_SUCCESS;
}
if (err) { if (err) {
static char buf[1024]; static char buf[1024];
@ -96,7 +93,7 @@ char *PIL_dynlib_get_error_as_string(PILdynlib* lib) {
return buf; return buf;
} }
return "unrecognized error"; return err;
} }
void PIL_dynlib_close(PILdynlib *lib) { void PIL_dynlib_close(PILdynlib *lib) {

@ -95,12 +95,12 @@ char *BLI_last_slash(const char *string) {
void BLI_add_slash(char *string) { void BLI_add_slash(char *string) {
int len = strlen(string); int len = strlen(string);
#ifdef WIN32 #ifdef WIN32
if (string[len-1]!='\\') { if (len==0 || string[len-1]!='\\') {
string[len] = '\\'; string[len] = '\\';
string[len+1] = '\0'; string[len+1] = '\0';
} }
#else #else
if (string[len-1]!='/') { if (len==0 || string[len-1]!='/') {
string[len] = '/'; string[len] = '/';
string[len+1] = '\0'; string[len+1] = '\0';
} }
@ -303,7 +303,8 @@ void BLI_recurdir_fileops(char *dirname) {
int BLI_rename(char *from, char *to) { int BLI_rename(char *from, char *to) {
if (!BLI_exists(from)) return 0; if (!BLI_exists(from)) return 0;
if (BLI_exists(to)) /* make sure the filenames are different (case insensitive) before removing */
if (BLI_exists(to) && BLI_strcasecmp(from, to))
if(BLI_delete(to, 0, 0)) return 1; if(BLI_delete(to, 0, 0)) return 1;
return rename(from, to); return rename(from, to);

@ -7785,23 +7785,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
/* sun/sky */ /* sun/sky */
if(main->versionfile < 246) { if(main->versionfile < 246) {
Lamp *la;
Object *ob; Object *ob;
bActuator *act; bActuator *act;
for(la=main->lamp.first; la; la= la->id.next) {
la->sun_effect_type = 0;
la->horizon_brightness = 1.0;
la->spread = 1.0;
la->sun_brightness = 1.0;
la->sun_size = 1.0;
la->backscattered_light = 1.0;
la->atm_turbidity = 2.0;
la->atm_inscattering_factor = 1.0;
la->atm_extinction_factor = 1.0;
la->atm_distance_factor = 1.0;
la->sun_intensity = 1.0;
}
/* dRot actuator change direction in 2.46 */ /* dRot actuator change direction in 2.46 */
for(ob = main->object.first; ob; ob= ob->id.next) { for(ob = main->object.first; ob; ob= ob->id.next) {
for(act= ob->actuators.first; act; act= act->next) { for(act= ob->actuators.first; act; act= act->next) {
@ -7956,7 +7942,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
bMessageActuator *msgAct = (bMessageActuator *) act->data; bMessageActuator *msgAct = (bMessageActuator *) act->data;
if (strlen(msgAct->toPropName) > 2) { if (strlen(msgAct->toPropName) > 2) {
/* strip first 2 chars, would have only worked if these were OB anyway */ /* strip first 2 chars, would have only worked if these were OB anyway */
strncpy(msgAct->toPropName, msgAct->toPropName+2, sizeof(msgAct->toPropName)); memmove( msgAct->toPropName, msgAct->toPropName+2, sizeof(msgAct->toPropName)-2 );
} else { } else {
msgAct->toPropName[0] = '\0'; msgAct->toPropName[0] = '\0';
} }
@ -7964,6 +7950,26 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
} }
} }
} }
if (main->versionfile < 248) {
Lamp *la;
for(la=main->lamp.first; la; la= la->id.next) {
if(la->atm_turbidity == 0.0) {
la->sun_effect_type = 0;
la->horizon_brightness = 1.0;
la->spread = 1.0;
la->sun_brightness = 1.0;
la->sun_size = 1.0;
la->backscattered_light = 1.0;
la->atm_turbidity = 2.0;
la->atm_inscattering_factor = 1.0;
la->atm_extinction_factor = 1.0;
la->atm_distance_factor = 1.0;
la->sun_intensity = 1.0;
}
}
}
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */ /* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */ /* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */

@ -51,6 +51,7 @@ typedef struct GPUFrameBuffer GPUFrameBuffer;
struct GPUShader; struct GPUShader;
typedef struct GPUShader GPUShader; typedef struct GPUShader GPUShader;
void GPU_extensions_disable(void);
void GPU_extensions_init(void); /* call this before running any of the functions below */ void GPU_extensions_init(void); /* call this before running any of the functions below */
void GPU_extensions_exit(void); void GPU_extensions_exit(void);
int GPU_extensions_minimum_support(void); int GPU_extensions_minimum_support(void);

@ -220,12 +220,24 @@ static int gpu_get_mipmap(void)
return GTS.domipmap && (!(G.f & G_TEXTUREPAINT)); return GTS.domipmap && (!(G.f & G_TEXTUREPAINT));
} }
static GLenum gpu_get_mipmap_filter() static GLenum gpu_get_mipmap_filter(int mag)
{ {
/* linearmipmap is off by default /* linearmipmap is off by default *when mipmapping is off,
* when mipmapping is off, use unfiltered display */ * use unfiltered display */
return GTS.linearmipmap? GL_LINEAR_MIPMAP_LINEAR : if(mag) {
(GTS.domipmap ? GL_LINEAR_MIPMAP_NEAREST : GL_NEAREST); if(GTS.linearmipmap || GTS.domipmap)
return GL_LINEAR;
else
return GL_NEAREST;
}
else {
if(GTS.linearmipmap)
return GL_LINEAR_MIPMAP_LINEAR;
else if(GTS.domipmap)
return GL_LINEAR_MIPMAP_NEAREST;
else
return GL_NEAREST;
}
} }
/* Set OpenGL state for an MTFace */ /* Set OpenGL state for an MTFace */
@ -359,6 +371,8 @@ int GPU_verify_image(Image *ima, int tftile, int tfmode, int compare)
else else
GTS.tile= tftile; GTS.tile= tftile;
GTS.tile = MAX2(0, GTS.tile);
if(ima) { if(ima) {
GTS.tileXRep = ima->xrep; GTS.tileXRep = ima->xrep;
GTS.tileYRep = ima->yrep; GTS.tileYRep = ima->yrep;
@ -477,12 +491,12 @@ int GPU_verify_image(Image *ima, int tftile, int tfmode, int compare)
if (!gpu_get_mipmap()) { if (!gpu_get_mipmap()) {
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, rectw, recth, 0, GL_RGBA, GL_UNSIGNED_BYTE, rect); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, rectw, recth, 0, GL_RGBA, GL_UNSIGNED_BYTE, rect);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter()); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
} }
else { else {
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, rectw, recth, GL_RGBA, GL_UNSIGNED_BYTE, rect); gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, rectw, recth, GL_RGBA, GL_UNSIGNED_BYTE, rect);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gpu_get_mipmap_filter()); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gpu_get_mipmap_filter(0));
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter()); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
ima->tpageflag |= IMA_MIPMAP_COMPLETE; ima->tpageflag |= IMA_MIPMAP_COMPLETE;
} }
@ -574,8 +588,8 @@ void GPU_paint_set_mipmap(int mipmap)
if(ima->bindcode) { if(ima->bindcode) {
if(ima->tpageflag & IMA_MIPMAP_COMPLETE) { if(ima->tpageflag & IMA_MIPMAP_COMPLETE) {
glBindTexture(GL_TEXTURE_2D, ima->bindcode); glBindTexture(GL_TEXTURE_2D, ima->bindcode);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gpu_get_mipmap_filter()); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gpu_get_mipmap_filter(0));
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter()); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
} }
else else
GPU_free_image(ima); GPU_free_image(ima);
@ -588,7 +602,7 @@ void GPU_paint_set_mipmap(int mipmap)
if(ima->bindcode) { if(ima->bindcode) {
glBindTexture(GL_TEXTURE_2D, ima->bindcode); glBindTexture(GL_TEXTURE_2D, ima->bindcode);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter()); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
} }
} }
} }

@ -66,11 +66,17 @@
- arb draw buffers? 2.0 core - arb draw buffers? 2.0 core
*/ */
struct GPUGlobal { static struct GPUGlobal {
GLint maxtextures; GLint maxtextures;
GLuint currentfb; GLuint currentfb;
int minimumsupport; int minimumsupport;
} GG = {1, 0, 0}; int extdisabled;
} GG = {1, 0, 0, 0};
void GPU_extensions_disable()
{
GG.extdisabled = 1;
}
void GPU_extensions_init() void GPU_extensions_init()
{ {
@ -89,7 +95,7 @@ void GPU_extensions_init()
int GPU_extensions_minimum_support() int GPU_extensions_minimum_support()
{ {
return GG.minimumsupport; return !GG.extdisabled && GG.minimumsupport;
} }
int GPU_print_error(char *str) int GPU_print_error(char *str)

@ -693,7 +693,7 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
shr->spec, &shr->spec); shr->spec, &shr->spec);
add_user_list(&mat->lamps, lamp); add_user_list(&mat->lamps, lamp);
add_user_list(&lamp->materials, ma); add_user_list(&lamp->materials, shi->gpumat->ma);
return; return;
} }
@ -702,7 +702,7 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
} }
else if((G.fileflags & G_FILE_GLSL_NO_SHADOWS) && (lamp->mode & LA_ONLYSHADOW)) { else if((G.fileflags & G_FILE_GLSL_NO_SHADOWS) && (lamp->mode & LA_ONLYSHADOW)) {
add_user_list(&mat->lamps, lamp); add_user_list(&mat->lamps, lamp);
add_user_list(&lamp->materials, ma); add_user_list(&lamp->materials, shi->gpumat->ma);
return; return;
} }
else else
@ -755,7 +755,7 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
} }
add_user_list(&mat->lamps, lamp); add_user_list(&mat->lamps, lamp);
add_user_list(&lamp->materials, ma); add_user_list(&lamp->materials, shi->gpumat->ma);
} }
static void material_lights(GPUShadeInput *shi, GPUShadeResult *shr) static void material_lights(GPUShadeInput *shi, GPUShadeResult *shr)
@ -928,7 +928,7 @@ static void do_material_tex(GPUShadeInput *shi)
else if(mtex->texco==TEXCO_OBJECT) else if(mtex->texco==TEXCO_OBJECT)
texco= texco_object; texco= texco_object;
else if(mtex->texco==TEXCO_NORM) else if(mtex->texco==TEXCO_NORM)
texco= texco_norm; texco= orn;
else if(mtex->texco==TEXCO_TANGENT) else if(mtex->texco==TEXCO_TANGENT)
texco= texco_object; texco= texco_object;
else if(mtex->texco==TEXCO_GLOB) else if(mtex->texco==TEXCO_GLOB)
@ -1362,10 +1362,14 @@ static void gpu_lamp_from_blender(Scene *scene, Object *ob, Object *par, Lamp *l
static void gpu_lamp_shadow_free(GPULamp *lamp) static void gpu_lamp_shadow_free(GPULamp *lamp)
{ {
if(lamp->tex) if(lamp->tex) {
GPU_texture_free(lamp->tex); GPU_texture_free(lamp->tex);
if(lamp->fb) lamp->tex= NULL;
}
if(lamp->fb) {
GPU_framebuffer_free(lamp->fb); GPU_framebuffer_free(lamp->fb);
lamp->fb= NULL;
}
} }
GPULamp *GPU_lamp_from_blender(Scene *scene, Object *ob, Object *par) GPULamp *GPU_lamp_from_blender(Scene *scene, Object *ob, Object *par)

@ -48,10 +48,10 @@
static void cineon_conversion_parameters(LogImageByteConversionParameters *params) static void cineon_conversion_parameters(LogImageByteConversionParameters *params)
{ {
params->blackPoint = G.scene->r.cineonblack; params->blackPoint = G.scene?G.scene->r.cineonblack:95;
params->whitePoint = G.scene->r.cineonwhite; params->whitePoint = G.scene?G.scene->r.cineonwhite:685;
params->gamma = G.scene->r.cineongamma; params->gamma = G.scene?G.scene->r.cineongamma:1.7f;
params->doLogarithm = G.scene->r.subimtype & R_CINEON_LOG; params->doLogarithm = G.scene?G.scene->r.subimtype & R_CINEON_LOG:0;
} }
static struct ImBuf *imb_load_dpx_cineon(unsigned char *mem, int use_cineon, int size, int flags) static struct ImBuf *imb_load_dpx_cineon(unsigned char *mem, int use_cineon, int size, int flags)

@ -617,7 +617,7 @@ cineonOpenFromMem(unsigned char *mem, unsigned int size) {
cineon->file = 0; cineon->file = 0;
cineon->reading = 1; cineon->reading = 1;
verbose = 1; verbose = 0;
if (size < sizeof(CineonGenericHeader)) { if (size < sizeof(CineonGenericHeader)) {
if (verbose) d_printf("Not enough data for header!\n"); if (verbose) d_printf("Not enough data for header!\n");
cineonClose(cineon); cineonClose(cineon);

@ -199,7 +199,7 @@ dumpDpxMainHeader(DpxMainHeader* header) {
#endif #endif
} }
static int verbose = 1; static int verbose = 0;
void void
dpxSetVerbose(int verbosity) { dpxSetVerbose(int verbosity) {
verbose = verbosity; verbose = verbosity;

@ -106,8 +106,11 @@ void *libtiff_findsymbol(char *name)
assert(libtiff != NULL); assert(libtiff != NULL);
symbol = PIL_dynlib_find_symbol(libtiff, name); symbol = PIL_dynlib_find_symbol(libtiff, name);
if (symbol == NULL) { if (symbol == NULL) {
printf("libtiff_findsymbol: error %s\n", char *err = PIL_dynlib_get_error_as_string(libtiff);
PIL_dynlib_get_error_as_string(libtiff));
if (err) printf("libtiff_findsymbol: error %s\n",err);
else printf("libtiff_findsymbol: error Unknown.\n");
libtiff = NULL; libtiff = NULL;
G.have_libtiff = (0); G.have_libtiff = (0);
return NULL; return NULL;

@ -1,5 +1,5 @@
/** /**
* $Id: BDR_gpencil.h 14444 2008-04-16 22:40:48Z aligorith $ * $Id$
* *
* ***** BEGIN GPL LICENSE BLOCK ***** * ***** BEGIN GPL LICENSE BLOCK *****
* *

@ -1,5 +1,5 @@
/** /**
* $Id: BIF_drawgpencil.h 14444 2008-04-16 22:40:48Z aligorith $ * $Id$
* *
* ***** BEGIN GPL LICENSE BLOCK ***** * ***** BEGIN GPL LICENSE BLOCK *****
* *

@ -1,5 +1,5 @@
/** /**
* $Id: BIF_keyframing.h 14444 2008-04-16 22:40:48Z aligorith $ * $Id$
* *
* ***** BEGIN GPL LICENSE BLOCK ***** * ***** BEGIN GPL LICENSE BLOCK *****
* *

@ -520,6 +520,7 @@ typedef enum B_CONSTRAINTCHANNEL_FLAG {
/* Rigid-Body Constraint */ /* Rigid-Body Constraint */
#define CONSTRAINT_DRAW_PIVOT 0x40 #define CONSTRAINT_DRAW_PIVOT 0x40
#define CONSTRAINT_DISABLE_LINKED_COLLISION 0x80
/* important: these defines need to match up with PHY_DynamicTypes headerfile */ /* important: these defines need to match up with PHY_DynamicTypes headerfile */
#define CONSTRAINT_RB_BALL 1 #define CONSTRAINT_RB_BALL 1

@ -1,5 +1,5 @@
/** /**
* $Id: DNA_gpencil_types.h 8768 2006-11-07 00:10:37Z aligorith $ * $Id$
* *
* ***** BEGIN GPL LICENSE BLOCK ***** * ***** BEGIN GPL LICENSE BLOCK *****
* *

@ -163,12 +163,12 @@ typedef struct bSensor {
typedef struct bJoystickSensor { typedef struct bJoystickSensor {
char name[32]; char name[32];
short type; char type;
short joyindex; char joyindex;
short flag;
int axis; int axis;
int axisf; int axisf;
int button; int button;
int buttonf;
int hat; int hat;
int hatf; int hatf;
int precision; int precision;
@ -252,6 +252,8 @@ typedef struct bJoystickSensor {
#define BL_SENS_MOUSE_MOUSEOVER 16 #define BL_SENS_MOUSE_MOUSEOVER 16
#define BL_SENS_MOUSE_MOUSEOVER_ANY 32 #define BL_SENS_MOUSE_MOUSEOVER_ANY 32
#define SENS_JOY_ANY_EVENT 1
#define SENS_JOY_BUTTON 0 #define SENS_JOY_BUTTON 0
#define SENS_JOY_BUTTON_PRESSED 0 #define SENS_JOY_BUTTON_PRESSED 0
#define SENS_JOY_BUTTON_RELEASED 1 #define SENS_JOY_BUTTON_RELEASED 1
@ -266,6 +268,7 @@ typedef struct bJoystickSensor {
#define SENS_JOY_HAT 2 #define SENS_JOY_HAT 2
#define SENS_JOY_HAT_DIR 0 #define SENS_JOY_HAT_DIR 0
#define SENS_DELAY_REPEAT 1 #define SENS_DELAY_REPEAT 1
// should match JOYINDEX_MAX in SCA_JoystickDefines.h */ // should match JOYINDEX_MAX in SCA_JoystickDefines.h */
#define SENS_JOY_MAXINDEX 8 #define SENS_JOY_MAXINDEX 8

@ -327,7 +327,8 @@ extern UserDef U; /* from usiblender.c !!!! */
/* tw_flag (transform widget) */ /* tw_flag (transform widget) */
/* gp_settings (Grease Pencil Settings) */ /* gp_settings (Grease Pencil Settings) */
#define GP_PAINT_DOSMOOTH (1<<0) #define GP_PAINT_DOSMOOTH (1<<0)
#define GP_PAINT_DOSIMPLIFY (1<<1)
#endif #endif

@ -479,7 +479,7 @@ static int bpymenu_CreateFromFile( void )
char line[255], w1[255], w2[255], tooltip[255], *tip; char line[255], w1[255], w2[255], tooltip[255], *tip;
char upythondir[FILE_MAX]; char upythondir[FILE_MAX];
char *homedir = NULL; char *homedir = NULL;
int parsing, version, is_userdir; int parsing, version, w2_len, is_userdir;
short group; short group;
BPyMenu *pymenu = NULL; BPyMenu *pymenu = NULL;
@ -554,17 +554,32 @@ will use 'Misc'.\n", w1 );
else if( line[0] == '\n' ) else if( line[0] == '\n' )
continue; continue;
else if( line[0] == '\'' ) { /* menu entry */ else if( line[0] == '\'' ) { /* menu entry */
parsing = /* parsing =
sscanf( line, sscanf( line,
"'%[^']' %d %s %d '%[^']'\n", "'%[^']' %d %s %d '%[^']'\n",
w1, &version, w2, &is_userdir, w1, &version, w2, &is_userdir,
tooltip ); tooltip );
*/
if( parsing <= 0 ) { /* invalid line, get rid of it */ /* previously filenames with spaces were not supported;
* this adds support for that w/o breaking the existing
* few, exotic scripts that parse the Bpymenus file */
parsing = sscanf( line,
"'%[^']' %d %[^'\n] '%[^']'\n",
w1, &version, w2, tooltip );
if( parsing <= 0 ) { /* invalid line, get rid of it */
fgets( line, 255, fp ); fgets( line, 255, fp );
} else if( parsing == 5 ) } else if( parsing == 4 )
tip = tooltip; /* has tooltip */ tip = tooltip; /* has tooltip */
w2_len = strlen(w2);
if( w2[w2_len-1] == ' ') {
w2[w2_len-1] = '\0';
w2_len -= 1;
}
if( w2[w2_len-1] == '1') is_userdir = 1;
else is_userdir = 0;
w2[w2_len-2] = '\0';
pymenu = bpymenu_AddEntry( group, pymenu = bpymenu_AddEntry( group,
( short ) version, ( short ) version,
w1, w2, is_userdir, w1, w2, is_userdir,
@ -693,13 +708,7 @@ void BPyMenu_PrintAllEntries( void )
} }
/* bpymenu_ParseFile: /* bpymenu_ParseFile:
* recursively scans folders looking for scripts to register. * parse a given .py file looking for a proper header.
*
* This function scans the scripts directory looking for .py files with the
* right header and menu info, using that to fill the bpymenu structs.
* is_userdir defines if the script is in the default scripts dir or the
* user defined one (U.pythondir: is_userdir == 1).
* Speed is important.
* *
* The first line of the script must be '#!BPY'. * The first line of the script must be '#!BPY'.
* The header registration lines must appear between the first pair of * The header registration lines must appear between the first pair of

@ -1,7 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
Import ('env') Import ('env')
sources = Split('BPY_interface.c BPY_menus.c') + env.Glob('api2_2x/*.c') sources = env.Glob('*.c') + env.Glob('api2_2x/*.c')
incs = 'api2_2x ../blenkernel ../nodes ../blenlib ../blenloader' incs = 'api2_2x ../blenkernel ../nodes ../blenlib ../blenloader'
incs += ' ../render/extern/include ../radiosity/extern/include' incs += ' ../render/extern/include ../radiosity/extern/include'

@ -923,7 +923,7 @@ AttributeError:
sArmatureError, "You are not allowed to change the .Bones attribute"); sArmatureError, "You are not allowed to change the .Bones attribute");
} }
//------------------------Bone.layerMask (get) //------------------------Armature.layerMask (get)
static PyObject *Armature_getLayerMask(BPy_Armature *self) static PyObject *Armature_getLayerMask(BPy_Armature *self)
{ {
/* do this extra stuff because the short's bits can be negative values */ /* do this extra stuff because the short's bits can be negative values */
@ -931,7 +931,7 @@ static PyObject *Armature_getLayerMask(BPy_Armature *self)
laymask |= self->armature->layer; laymask |= self->armature->layer;
return PyInt_FromLong((int)laymask); return PyInt_FromLong((int)laymask);
} }
//------------------------Bone.layerMask (set) //------------------------Armature.layerMask (set)
static int Armature_setLayerMask(BPy_Armature *self, PyObject *value) static int Armature_setLayerMask(BPy_Armature *self, PyObject *value)
{ {
int laymask; int laymask;
@ -1295,6 +1295,26 @@ static PyObject *M_Armature_New(PyObject * self, PyObject * args)
return (PyObject *)obj; return (PyObject *)obj;
} }
static PyObject *M_Armature_DataSize(PyObject * self, PyObject *args)
{
int t = 0;
int ret = 0;
if( !PyArg_ParseTuple(args, "|i", &t))
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected nothing or an int as argument" );
switch(t) {
case 0:
ret = sizeof(struct bArmature);
break;
default:
ret = sizeof(struct Bone);
break;
}
return PyInt_FromLong(ret);
}
//-------------------MODULE METHODS DEFINITION----------------------------- //-------------------MODULE METHODS DEFINITION-----------------------------
@ -1304,9 +1324,12 @@ static char M_Armature_Get_doc[] = "(name) - return the armature with the name '
static char M_Armature_New_doc[] = "(name) - return a new armature object."; static char M_Armature_New_doc[] = "(name) - return a new armature object.";
static char M_Armature_DataSize_doc[] = "(type) - return sizeof of either Armature (0) or Bone (1).";
struct PyMethodDef M_Armature_methods[] = { struct PyMethodDef M_Armature_methods[] = {
{"Get", M_Armature_Get, METH_VARARGS, M_Armature_Get_doc}, {"Get", M_Armature_Get, METH_VARARGS, M_Armature_Get_doc},
{"New", M_Armature_New, METH_VARARGS, M_Armature_New_doc}, {"New", M_Armature_New, METH_VARARGS, M_Armature_New_doc},
{"DataSize", M_Armature_DataSize, METH_VARARGS, M_Armature_DataSize_doc},
{NULL, NULL, 0, NULL} {NULL, NULL, 0, NULL}
}; };
//------------------VISIBLE PROTOTYPE IMPLEMENTATION----------------------- //------------------VISIBLE PROTOTYPE IMPLEMENTATION-----------------------

@ -41,6 +41,7 @@
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
#include "DNA_ipo_types.h" #include "DNA_ipo_types.h"
#include "DNA_key_types.h" #include "DNA_key_types.h"
#include "DNA_scene_types.h"
#include "BezTriple.h" #include "BezTriple.h"
#include "gen_utils.h" #include "gen_utils.h"
@ -80,6 +81,7 @@ static PyObject *IpoCurve_getExtrapolation( C_IpoCurve * self );
static PyObject *IpoCurve_newgetExtend( C_IpoCurve * self ); static PyObject *IpoCurve_newgetExtend( C_IpoCurve * self );
static int IpoCurve_newsetExtend( C_IpoCurve * self, PyObject * args ); static int IpoCurve_newsetExtend( C_IpoCurve * self, PyObject * args );
static PyObject *IpoCurve_getPoints( C_IpoCurve * self ); static PyObject *IpoCurve_getPoints( C_IpoCurve * self );
static PyObject *IpoCurve_clean( C_IpoCurve * self, PyObject *value );
static PyObject *IpoCurve_evaluate( C_IpoCurve * self, PyObject * args ); static PyObject *IpoCurve_evaluate( C_IpoCurve * self, PyObject * args );
static PyObject *IpoCurve_getDriver( C_IpoCurve * self ); static PyObject *IpoCurve_getDriver( C_IpoCurve * self );
static int IpoCurve_setDriver( C_IpoCurve * self, PyObject * args ); static int IpoCurve_setDriver( C_IpoCurve * self, PyObject * args );
@ -127,6 +129,8 @@ static PyMethodDef C_IpoCurve_methods[] = {
"() - Returns list of all bezTriples of the curve"}, "() - Returns list of all bezTriples of the curve"},
{"evaluate", ( PyCFunction ) IpoCurve_evaluate, METH_VARARGS, {"evaluate", ( PyCFunction ) IpoCurve_evaluate, METH_VARARGS,
"(float) - Evaluate curve at given time"}, "(float) - Evaluate curve at given time"},
{"clean", ( PyCFunction ) IpoCurve_clean, METH_VARARGS,
"(float) - Clean BezTriples using the given threshold value"},
{NULL, NULL, 0, NULL} {NULL, NULL, 0, NULL}
}; };
@ -770,6 +774,29 @@ static PyObject *IpoCurve_evaluate( C_IpoCurve * self, PyObject * args )
} }
/***************************************************************************/
/* Function: IpoCurve_clean( thresh ) */
/* Description: Cleans IPO curve with the (optional) threshold. */
/***************************************************************************/
static PyObject *IpoCurve_clean( C_IpoCurve * self, PyObject * args )
{
float thresh, othresh;
thresh= othresh= G.scene->toolsettings->clean_thresh;
/* expecting float */
if( !PyArg_ParseTuple( args, "|f", &thresh ) )
return ( EXPP_ReturnPyObjError
( PyExc_TypeError, "expected float argument" ) );
/* set IPO-cleaning threshold based on value provided by user (temporarily) */
G.scene->toolsettings->clean_thresh= thresh;
clean_ipo_curve( self->ipocurve );
G.scene->toolsettings->clean_thresh= othresh;
Py_RETURN_NONE;
}
static PyObject *IpoCurve_getDriver( C_IpoCurve * self ) static PyObject *IpoCurve_getDriver( C_IpoCurve * self )
{ {
if( !self->ipocurve->driver ) if( !self->ipocurve->driver )

@ -109,7 +109,7 @@
#define EXPP_MAT_SUBSIZE_MAX 25.0 #define EXPP_MAT_SUBSIZE_MAX 25.0
#define EXPP_MAT_HARD_MIN 1 #define EXPP_MAT_HARD_MIN 1
#define EXPP_MAT_HARD_MAX 255 /* 127 with MODE HALO ON */ #define EXPP_MAT_HARD_MAX 511 /* 127 with MODE HALO ON */
#define EXPP_MAT_HALOSEED_MIN 0 #define EXPP_MAT_HALOSEED_MIN 0
#define EXPP_MAT_HALOSEED_MAX 255 #define EXPP_MAT_HALOSEED_MAX 255
#define EXPP_MAT_NFLARES_MIN 1 #define EXPP_MAT_NFLARES_MIN 1
@ -207,6 +207,7 @@
static PyObject *M_Material_New( PyObject * self, PyObject * args, static PyObject *M_Material_New( PyObject * self, PyObject * args,
PyObject * keywords ); PyObject * keywords );
static PyObject *M_Material_Get( PyObject * self, PyObject * args ); static PyObject *M_Material_Get( PyObject * self, PyObject * args );
static PyObject *M_Material_DataSize(PyObject *unused);
/*****************************************************************************/ /*****************************************************************************/
/* The following string definitions are used for documentation strings. In */ /* The following string definitions are used for documentation strings. In */
@ -231,6 +232,8 @@ struct PyMethodDef M_Material_methods[] = {
M_Material_New_doc}, M_Material_New_doc},
{"Get", M_Material_Get, METH_VARARGS, M_Material_Get_doc}, {"Get", M_Material_Get, METH_VARARGS, M_Material_Get_doc},
{"get", M_Material_Get, METH_VARARGS, M_Material_Get_doc}, {"get", M_Material_Get, METH_VARARGS, M_Material_Get_doc},
{"DataSize", ( PyCFunction ) M_Material_DataSize, METH_NOARGS,
"Get sizeof() of Material"},
{NULL, NULL, 0, NULL} {NULL, NULL, 0, NULL}
}; };
@ -335,6 +338,12 @@ static PyObject *M_Material_Get( PyObject * self, PyObject * args )
} }
} }
static PyObject *M_Material_DataSize(PyObject *unused)
{
return PyInt_FromLong(sizeof(Material));
}
static PyObject *Material_ModesDict( void ) static PyObject *Material_ModesDict( void )
{ {
PyObject *Modes = PyConstant_New( ); PyObject *Modes = PyConstant_New( );

@ -8637,6 +8637,35 @@ static PyObject *M_Mesh_MVert( PyObject * self_unused, PyObject * args )
return PVert_CreatePyObject( &vert ); return PVert_CreatePyObject( &vert );
} }
static PyObject *M_Mesh_DataSize(PyObject * self, PyObject *args)
{
int t = 0;
int ret = 0;
if( !PyArg_ParseTuple(args, "|i", &t))
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected nothing or an int as argument" );
switch(t) {
case 0:
ret = sizeof(Mesh);
break;
case 1:
ret = sizeof(MVert);
break;
case 2:
ret = sizeof(MEdge);
break;
case 3:
ret = sizeof(MFace);
break;
default:
ret = sizeof(Mesh);
break;
}
return PyInt_FromLong(ret);
}
static PyObject *M_Mesh_Modes( PyObject * self_unused, PyObject * args ) static PyObject *M_Mesh_Modes( PyObject * self_unused, PyObject * args )
{ {
int modes = 0; int modes = 0;
@ -8668,6 +8697,8 @@ static struct PyMethodDef M_Mesh_methods[] = {
"Create a new MVert"}, "Create a new MVert"},
{"Mode", (PyCFunction)M_Mesh_Modes, METH_VARARGS, {"Mode", (PyCFunction)M_Mesh_Modes, METH_VARARGS,
"Get/set edit selection mode(s)"}, "Get/set edit selection mode(s)"},
{"DataSize", (PyCFunction)M_Mesh_DataSize, METH_VARARGS,
"Get sizeof() of Mesh (0), MVert (1), MEdge (2) or MFace (3)"},
{NULL, NULL, 0, NULL}, {NULL, NULL, 0, NULL},
}; };

@ -290,6 +290,7 @@ static PyObject *M_Object_New( PyObject * self, PyObject * args );
PyObject *M_Object_Get( PyObject * self, PyObject * args ); PyObject *M_Object_Get( PyObject * self, PyObject * args );
static PyObject *M_Object_GetSelected( PyObject * self ); static PyObject *M_Object_GetSelected( PyObject * self );
static PyObject *M_Object_Duplicate( PyObject * self, PyObject * args, PyObject *kwd); static PyObject *M_Object_Duplicate( PyObject * self, PyObject * args, PyObject *kwd);
static PyObject *M_Object_DataSize( PyObject * self );
/* HELPER FUNCTION FOR PARENTING */ /* HELPER FUNCTION FOR PARENTING */
static PyObject *internal_makeParent(Object *parent, PyObject *py_child, int partype, int noninverse, int fast, int v1, int v2, int v3, char *bonename); static PyObject *internal_makeParent(Object *parent, PyObject *py_child, int partype, int noninverse, int fast, int v1, int v2, int v3, char *bonename);
@ -299,25 +300,27 @@ static PyObject *internal_makeParent(Object *parent, PyObject *py_child, int par
/* In Python these will be written to the console when doing a */ /* In Python these will be written to the console when doing a */
/* Blender.Object.__doc__ */ /* Blender.Object.__doc__ */
/*****************************************************************************/ /*****************************************************************************/
char M_Object_doc[] = "The Blender Object module\n\n\ static char M_Object_doc[] = "The Blender Object module\n\n\
This module provides access to **Object Data** in Blender.\n"; This module provides access to **Object Data** in Blender.\n";
char M_Object_New_doc[] = static char M_Object_New_doc[] =
"(type) - Add a new object of type 'type' in the current scene"; "(type) - Add a new object of type 'type' in the current scene";
char M_Object_Get_doc[] = static char M_Object_Get_doc[] =
"(name) - return the object with the name 'name', returns None if not\ "(name) - return the object with the name 'name', returns None if not\
found.\n\ found.\n\
If 'name' is not specified, it returns a list of all objects in the\n\ If 'name' is not specified, it returns a list of all objects in the\n\
current scene."; current scene.";
char M_Object_GetSelected_doc[] = static char M_Object_GetSelected_doc[] =
"() - Returns a list of selected Objects in the active layer(s)\n\ "() - Returns a list of selected Objects in the active layer(s)\n\
The active object is the first in the list, if visible"; The active object is the first in the list, if visible";
char M_Object_Duplicate_doc[] = static char M_Object_Duplicate_doc[] =
"(linked) - Duplicate all selected, visible objects in the current scene"; "(linked) - Duplicate all selected, visible objects in the current scene";
static char M_Object_DataSize_doc[] =
"() - return the sizeof(Object)";
/*****************************************************************************/ /*****************************************************************************/
/* Python method structure definition for Blender.Object module: */ /* Python method structure definition for Blender.Object module: */
@ -331,6 +334,8 @@ struct PyMethodDef M_Object_methods[] = {
M_Object_GetSelected_doc}, M_Object_GetSelected_doc},
{"Duplicate", ( PyCFunction ) M_Object_Duplicate, METH_VARARGS | METH_KEYWORDS, {"Duplicate", ( PyCFunction ) M_Object_Duplicate, METH_VARARGS | METH_KEYWORDS,
M_Object_Duplicate_doc}, M_Object_Duplicate_doc},
{"DataSize", ( PyCFunction ) M_Object_DataSize, METH_NOARGS,
M_Object_DataSize_doc},
{NULL, NULL, 0, NULL} {NULL, NULL, 0, NULL}
}; };
@ -342,9 +347,8 @@ static int setupSB(Object* ob); /*Make sure Softbody Pointer is initialized */
static int setupPI(Object* ob); static int setupPI(Object* ob);
static PyObject *Object_getParticleSys( BPy_Object * self ); static PyObject *Object_getParticleSys( BPy_Object * self );
/* fixme Object_newParticleSys( self, default-partsys-name ) */
static PyObject *Object_addVertexGroupsFromArmature( BPy_Object * self, PyObject * args); static PyObject *Object_addVertexGroupsFromArmature( BPy_Object * self, PyObject * args);
static PyObject *Object_newParticleSys( BPy_Object * self ); static PyObject *Object_newParticleSys( BPy_Object * self, PyObject * args );
static PyObject *Object_buildParts( BPy_Object * self ); static PyObject *Object_buildParts( BPy_Object * self );
static PyObject *Object_clearIpo( BPy_Object * self ); static PyObject *Object_clearIpo( BPy_Object * self );
static PyObject *Object_clrParent( BPy_Object * self, PyObject * args ); static PyObject *Object_clrParent( BPy_Object * self, PyObject * args );
@ -478,7 +482,7 @@ static PyMethodDef BPy_Object_methods[] = {
/* name, method, flags, doc */ /* name, method, flags, doc */
{"getParticleSystems", ( PyCFunction ) Object_getParticleSys, METH_NOARGS, {"getParticleSystems", ( PyCFunction ) Object_getParticleSys, METH_NOARGS,
"Return a list of particle systems"}, "Return a list of particle systems"},
{"newParticleSystem", ( PyCFunction ) Object_newParticleSys, METH_NOARGS, {"newParticleSystem", ( PyCFunction ) Object_newParticleSys, METH_VARARGS,
"Create and link a new particle system"}, "Create and link a new particle system"},
{"addVertexGroupsFromArmature" , ( PyCFunction ) Object_addVertexGroupsFromArmature, METH_VARARGS, {"addVertexGroupsFromArmature" , ( PyCFunction ) Object_addVertexGroupsFromArmature, METH_VARARGS,
"Add vertex groups from armature using the bone heat method"}, "Add vertex groups from armature using the bone heat method"},
@ -1038,48 +1042,59 @@ static PyObject *M_Object_Duplicate( PyObject * self_unused,
Py_RETURN_NONE; Py_RETURN_NONE;
} }
static PyObject *M_Object_DataSize(PyObject * self)
{
return PyInt_FromLong(sizeof(Object));
}
/*****************************************************************************/ /*****************************************************************************/
/* Python BPy_Object methods: */ /* Python BPy_Object methods: */
/*****************************************************************************/ /*****************************************************************************/
PyObject *Object_getParticleSys( BPy_Object * self ){ PyObject *Object_getParticleSys( BPy_Object * self ){
ParticleSystem *blparticlesys = 0; PyObject *list;
ParticleSystem *psys= NULL;
Object *ob = self->object; Object *ob = self->object;
PyObject *partsyslist,*current; int i= 0;
blparticlesys = ob->particlesystem.first; list = PyList_New( BLI_countlist( &ob->particlesystem ) );
if( !list )
return EXPP_ReturnPyObjError( PyExc_MemoryError,
"PyList_New() failed" );
partsyslist = PyList_New( 0 ); for( psys=ob->particlesystem.first; psys; psys=psys->next )
PyList_SET_ITEM( list, i++, ParticleSys_CreatePyObject( psys, ob ) );
if (!blparticlesys) return list;
return partsyslist;
/* fixme: for(;;) */
current = ParticleSys_CreatePyObject( blparticlesys, ob );
PyList_Append(partsyslist,current);
Py_DECREF(current);
while((blparticlesys = blparticlesys->next)){
current = ParticleSys_CreatePyObject( blparticlesys, ob );
PyList_Append(partsyslist,current);
Py_DECREF(current);
}
return partsyslist;
} }
PyObject *Object_newParticleSys( BPy_Object * self ){ PyObject *Object_newParticleSys( BPy_Object * self, PyObject * args ) {
ParticleSystem *psys = 0; ParticleSystem *psys = 0;
ParticleSystem *rpsys = 0; ParticleSystem *rpsys = 0;
ModifierData *md; ModifierData *md;
ParticleSystemModifierData *psmd; ParticleSystemModifierData *psmd;
Object *ob = self->object; Object *ob = self->object;
/* char *name = NULL; optional name param */ char *name = NULL;
ID *id; ID *id;
int nr; int nr;
id = (ID *)psys_new_settings("PSys", G.main); if( !PyArg_ParseTuple( args, "|s", &name ) )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected a string or nothing" );
if( name ) {
for( id= G.main->particle.first; id; id= id->next ) {
if( !strcmp( name, id->name + 2 ) )
break;
}
if( !id )
return EXPP_ReturnPyObjError( PyExc_AttributeError,
"specified particle system not found" );
else
id->us++;
} else
id = (ID *)psys_new_settings("PSys", G.main);
psys = MEM_callocN(sizeof(ParticleSystem), "particle_system"); psys = MEM_callocN(sizeof(ParticleSystem), "particle_system");
psys->pointcache = BKE_ptcache_add(); psys->pointcache = BKE_ptcache_add();

@ -138,7 +138,7 @@ static PyObject *Part_GetAge( BPy_PartSys * self, PyObject * args );
/*****************************************************************************/ /*****************************************************************************/
/* Python Effect_Type callback function prototypes: */ /* Python Effect_Type callback function prototypes: */
/*****************************************************************************/ /*****************************************************************************/
static PyObject *ParticleSys_repr( void ); static PyObject *ParticleSys_repr( BPy_PartSys * self );
/*****************************************************************************/ /*****************************************************************************/
/* The following string definitions are used for documentation strings. */ /* The following string definitions are used for documentation strings. */
@ -415,13 +415,14 @@ PyTypeObject ParticleSys_Type = {
/*****************************************************************************/ /*****************************************************************************/
/* Function: PARTICLESYS_repr */ /* Function: PARTICLESYS_repr */
/* Description: This is a callback function for the BPy_Effect type. It */ /* Description: This is a callback function for the BPy_PartSys type. It */
/* builds a meaninful string to represent effcte objects. */ /* builds a meaningful string to represent effect objects. */
/*****************************************************************************/ /*****************************************************************************/
static PyObject *ParticleSys_repr( void ) static PyObject *ParticleSys_repr( BPy_PartSys * self )
{ {
return PyString_FromString( "ParticleSys" ); return PyString_FromFormat( "ParticleSys \"%s\"",
self->psys->part->id.name+2 );
} }
/*****************************************************************************/ /*****************************************************************************/

@ -577,8 +577,6 @@ static PyObject * FileAndImageSelector(PyObject * self, PyObject * args, int typ
"\nexpected a callback function (and optionally one or two strings) " "\nexpected a callback function (and optionally one or two strings) "
"as argument(s)" ); "as argument(s)" );
Py_INCREF(pycallback);
/* trick: we move to a spacescript because then the fileselector will properly /* trick: we move to a spacescript because then the fileselector will properly
* unset our SCRIPT_FILESEL flag when the user chooses a file or cancels the * unset our SCRIPT_FILESEL flag when the user chooses a file or cancels the
* selection. This is necessary because when a user cancels, the * selection. This is necessary because when a user cancels, the
@ -605,9 +603,18 @@ static PyObject * FileAndImageSelector(PyObject * self, PyObject * args, int typ
script->lastspace = startspace; script->lastspace = startspace;
sc->script = script; sc->script = script;
} }
if (!script) {
/* should never happen unless we are executed
* from the BGE or somthing really strange like that */
return EXPP_ReturnPyObjError( PyExc_AttributeError,
"Could not allocate a screen for an unknown reason." );
}
Py_INCREF(pycallback);
script->flags |= SCRIPT_FILESEL; script->flags |= SCRIPT_FILESEL;
/* clear any previous callback (nested calls to selector) */ /* clear any previous callback (nested calls to selector) */
if (script->py_browsercallback) { if (script->py_browsercallback) {
Py_DECREF((PyObject *)script->py_browsercallback); Py_DECREF((PyObject *)script->py_browsercallback);

@ -146,11 +146,11 @@ def glBitmap(width, height, xorig, yorig, xmove, ymove, bitmap):
@type width, height: int @type width, height: int
@param width, height: Specify the pixel width and height of the bitmap image. @param width, height: Specify the pixel width and height of the bitmap image.
@type xorig,yorig: float @type xorig, yorig: float
@param xorig,yorig: Specify the location of the origin in the bitmap image. The origin is measured @param xorig, yorig: Specify the location of the origin in the bitmap image. The origin is measured
from the lower left corner of the bitmap, with right and up being the positive axes. from the lower left corner of the bitmap, with right and up being the positive axes.
@type xmove,ymove: float @type xmove, ymove: float
@param xmove,ymove: Specify the x and y offsets to be added to the current raster position after @param xmove, ymove: Specify the x and y offsets to be added to the current raster position after
the bitmap is drawn. the bitmap is drawn.
@type bitmap: Buffer object I{type GL_BYTE} @type bitmap: Buffer object I{type GL_BYTE}
@param bitmap: Specifies the address of the bitmap image. @param bitmap: Specifies the address of the bitmap image.
@ -207,8 +207,8 @@ def glClearAccum(red, green, blue, alpha):
Specify clear values for the accumulation buffer Specify clear values for the accumulation buffer
@see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearaccum.html} @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearaccum.html}
@type red,green,blue,alpha: float @type red, green, blue, alpha: float
@param red,green,blue,alpha: Specify the red, green, blue, and alpha values used when the @param red, green, blue, alpha: Specify the red, green, blue, and alpha values used when the
accumulation buffer is cleared. The initial values are all 0. accumulation buffer is cleared. The initial values are all 0.
""" """
@ -217,8 +217,8 @@ def glClearColor(red, green, blue, alpha):
Specify clear values for the color buffers Specify clear values for the color buffers
@see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearcolor.html} @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/clearcolor.html}
@type red,green,blue,alpha: float @type red, green, blue, alpha: float
@param red,green,blue,alpha: Specify the red, green, blue, and alpha values used when the @param red, green, blue, alpha: Specify the red, green, blue, and alpha values used when the
color buffers are cleared. The initial values are all 0. color buffers are cleared. The initial values are all 0.
""" """
@ -274,8 +274,8 @@ def glColor (red, green, blue, alpha):
Set a new color. Set a new color.
@see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/color.html} @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/color.html}
@type red,green,blue,alpha: Depends on function prototype. @type red, green, blue, alpha: Depends on function prototype.
@param red,green,blue: Specify new red, green, and blue values for the current color. @param red, green, blue: Specify new red, green, and blue values for the current color.
@param alpha: Specifies a new alpha value for the current color. Included only in the @param alpha: Specifies a new alpha value for the current color. Included only in the
four-argument glColor4 commands. (With '4' colors only) four-argument glColor4 commands. (With '4' colors only)
""" """
@ -285,8 +285,8 @@ def glColorMask(red, green, blue, alpha):
Enable and disable writing of frame buffer color components Enable and disable writing of frame buffer color components
@see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/colormask.html} @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/colormask.html}
@type red,green,blue,alpha: int (boolean) @type red, green, blue, alpha: int (boolean)
@param red,green,blue,alpha: Specify whether red, green, blue, and alpha can or cannot be @param red, green, blue, alpha: Specify whether red, green, blue, and alpha can or cannot be
written into the frame buffer. The initial values are all GL_TRUE, indicating that the written into the frame buffer. The initial values are all GL_TRUE, indicating that the
color components can be written. color components can be written.
""" """
@ -308,8 +308,8 @@ def glCopyPixels(x, y, width, height, type):
Copy pixels in the frame buffer Copy pixels in the frame buffer
@see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/copypixels.html} @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/copypixels.html}
@type x,y: int @type x, y: int
@param x,y: Specify the window coordinates of the lower left corner of the rectangular @param x, y: Specify the window coordinates of the lower left corner of the rectangular
region of pixels to be copied. region of pixels to be copied.
@type width, height: int @type width, height: int
@param width,height: Specify the dimensions of the rectangular region of pixels to be copied. @param width,height: Specify the dimensions of the rectangular region of pixels to be copied.
@ -1079,7 +1079,7 @@ def glNormal3 (nx, ny, nz, v):
@param nx, ny, nz: Specify the x, y, and z coordinates of the new current normal. @param nx, ny, nz: Specify the x, y, and z coordinates of the new current normal.
The initial value of the current normal is the unit vector, (0, 0, 1). The initial value of the current normal is the unit vector, (0, 0, 1).
@type v: Buffer object. Depends on function prototype. ('v' prototypes) @type v: Buffer object. Depends on function prototype. ('v' prototypes)
@param v: Specifies a pointer to an array of three elements: the x,y, and z coordinates @param v: Specifies a pointer to an array of three elements: the x, y, and z coordinates
of the new current normal. of the new current normal.
""" """
@ -1290,7 +1290,7 @@ def glRasterPos (x,y,z,w):
@see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rasterpos.html} @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/rasterpos.html}
@type x, y, z, w: Depends on function prototype. (z and w for '3' and '4' prototypes only) @type x, y, z, w: Depends on function prototype. (z and w for '3' and '4' prototypes only)
@param x,y,z,w: Specify the x,y,z, and w object coordinates (if present) for the @param x, y, z, w: Specify the x,y,z, and w object coordinates (if present) for the
raster position. If function prototype ends in 'v' specifies a pointer to an array of two, raster position. If function prototype ends in 'v' specifies a pointer to an array of two,
three, or four elements, specifying x, y, z, and w coordinates, respectively. three, or four elements, specifying x, y, z, and w coordinates, respectively.
@note: @note:
@ -1326,8 +1326,8 @@ def glReadPixels(x, y, width, height, format, type, pixels):
Read a block of pixels from the frame buffer Read a block of pixels from the frame buffer
@see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/readpixels.html} @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/readpixels.html}
@type x,y: int @type x, y: int
@param x,y:Specify the window coordinates of the first pixel that is read @param x, y:Specify the window coordinates of the first pixel that is read
from the frame buffer. This location is the lower left corner of a rectangular from the frame buffer. This location is the lower left corner of a rectangular
block of pixels. block of pixels.
@type width, height: int @type width, height: int
@ -1375,8 +1375,8 @@ def glRotate (angle, x, y, z):
@type angle: Depends on function prototype. @type angle: Depends on function prototype.
@param angle: Specifies the angle of rotation in degrees. @param angle: Specifies the angle of rotation in degrees.
@type x,y,z: Depends on function prototype. @type x, y, z: Depends on function prototype.
@param x,y,z: Specify the x,y, and z coordinates of a vector respectively. @param x, y, z: Specify the x, y, and z coordinates of a vector respectively.
""" """
def glScale (x,y,z): def glScale (x,y,z):
@ -1386,8 +1386,8 @@ def glScale (x,y,z):
Multiply the current matrix by a general scaling matrix Multiply the current matrix by a general scaling matrix
@see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/scale.html} @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/scale.html}
@type x,y,z: Depends on function prototype. @type x, y, z: Depends on function prototype.
@param x,y,z: Specify scale factors along the x,y, and z axes, respectively. @param x, y, z: Specify scale factors along the x, y, and z axes, respectively.
""" """
def glScissor(x,y,width,height): def glScissor(x,y,width,height):
@ -1395,8 +1395,8 @@ def glScissor(x,y,width,height):
Define the scissor box Define the scissor box
@see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/scissor.html} @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/scissor.html}
@type x,y: int @type x, y: int
@param x,y: Specify the lower left corner of the scissor box. Initially (0, 0). @param x, y: Specify the lower left corner of the scissor box. Initially (0, 0).
@type width, height: int @type width, height: int
@param width height: Specify the width and height of the scissor box. When a @param width height: Specify the width and height of the scissor box. When a
GL context is first attached to a window, width and height are set to the GL context is first attached to a window, width and height are set to the
@ -1480,8 +1480,8 @@ def glTexCoord (s,t,r,q,v):
Set the current texture coordinates Set the current texture coordinates
@see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texcoord.html} @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texcoord.html}
@type s,t,r,q: Depends on function prototype. (r and q for '3' and '4' prototypes only) @type s, t, r, q: Depends on function prototype. (r and q for '3' and '4' prototypes only)
@param s,t,r,q: Specify s, t, r, and q texture coordinates. Not all parameters are @param s, t, r, q: Specify s, t, r, and q texture coordinates. Not all parameters are
present in all forms of the command. present in all forms of the command.
@type v: Buffer object. Depends on function prototype. (for 'v' prototypes only) @type v: Buffer object. Depends on function prototype. (for 'v' prototypes only)
@param v: Specifies a pointer to an array of one, two, three, or four elements, @param v: Specifies a pointer to an array of one, two, three, or four elements,
@ -1604,8 +1604,8 @@ def glTranslate (x, y, z):
Multiply the current matrix by a translation matrix Multiply the current matrix by a translation matrix
@see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/translate.html} @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/translate.html}
@type x,y,z: Depends on function prototype. @type x, y, z: Depends on function prototype.
@param x,y,z: Specify the x, y, and z coordinates of a translation vector. @param x, y, z: Specify the x, y, and z coordinates of a translation vector.
""" """
def glVertex (x,y,z,w,v): def glVertex (x,y,z,w,v):
@ -1618,8 +1618,8 @@ def glVertex (x,y,z,w,v):
Specify a vertex Specify a vertex
@see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/vertex.html} @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/vertex.html}
@type x,y,z,w: Depends on function prototype (z and w for '3' and '4' prototypes only) @type x, y, z, w: Depends on function prototype (z and w for '3' and '4' prototypes only)
@param x,y,z,w: Specify x, y, z, and w coordinates of a vertex. Not all parameters @param x, y, z, w: Specify x, y, z, and w coordinates of a vertex. Not all parameters
are present in all forms of the command. are present in all forms of the command.
@type v: Buffer object. Depends of function prototype (for 'v' prototypes only) @type v: Buffer object. Depends of function prototype (for 'v' prototypes only)
@param v: Specifies a pointer to an array of two, three, or four elements. The @param v: Specifies a pointer to an array of two, three, or four elements. The
@ -1632,11 +1632,11 @@ def glViewport(x,y,width,height):
Set the viewport Set the viewport
@see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/viewport.html} @see: U{www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/viewport.html}
@type x,y: int @type x, y: int
@param x,y: Specify the lower left corner of the viewport rectangle, @param x, y: Specify the lower left corner of the viewport rectangle,
in pixels. The initial value is (0,0). in pixels. The initial value is (0,0).
@type width,height: int @type width, height: int
@param width,height: Specify the width and height of the viewport. When a GL context @param width, height: Specify the width and height of the viewport. When a GL context
is first attached to a window, width and height are set to the dimensions of that window. is first attached to a window, width and height are set to the dimensions of that window.
""" """

@ -57,8 +57,8 @@ The valid IpoCurve constants are:
TE_DISTA, TE_MGTYPE, TE_MGH, TE_LACU, TE_OCT, TE_MGOFF, TE_DISTA, TE_MGTYPE, TE_MGH, TE_LACU, TE_OCT, TE_MGOFF,
TE_MGGAIN, TE_NBASE1, TE_NBASE2, TE_COLR, TE_COLG, TE_COLB, TE_MGGAIN, TE_NBASE1, TE_NBASE2, TE_COLR, TE_COLG, TE_COLB,
TE_BRIGHT, TE_CONTRAS TE_BRIGHT, TE_CONTRAS
9. Pose/Action Ipo: PO_LOCX, PO_LOCY, PO_LOCZ, PO_SIZEX, PO_SIZEY, 9. Pose/Action Ipo: PO_LOCX, PO_LOCY, PO_LOCZ, PO_SCALEX, PO_SCALEY,
PO_SIZEZ, PO_QUATW, PO_QUATX, PO_QUATY, PO_QUATZ PO_SCALEZ, PO_QUATW, PO_QUATX, PO_QUATY, PO_QUATZ
10. Sequence Ipo: SQ_FAC 10. Sequence Ipo: SQ_FAC
Shape Key Ipos are handled differently from other Ipos. The user can rename Shape Key Ipos are handled differently from other Ipos. The user can rename

@ -16,7 +16,7 @@ BezTriples.
Example:: Example::
import Blender import Blender
ipo = Blender.Ipo.Get('ObIpo') # retrieves an Ipo object ipo = Blender.Ipo.Get('ObIpo') # retrieves an Ipo object
ipo.name = 'ipo1' # change the Ipo's name ipo.name = 'ipo1' # change the Ipo's name
icu = ipo[Blender.Ipo.OB_LOCX] # request X Location Ipo curve object icu = ipo[Blender.Ipo.OB_LOCX] # request X Location Ipo curve object
if icu != None and len(icu.bezierPoints) > 0: # if curve exists and has BezTriple points if icu != None and len(icu.bezierPoints) > 0: # if curve exists and has BezTriple points
val = icu[2.5] # get the curve's value at time 2.5 val = icu[2.5] # get the curve's value at time 2.5
@ -78,27 +78,27 @@ class IpoCurve:
get the value of the final curve point, read the final point from the get the value of the final curve point, read the final point from the
curve:: curve::
ipo = Blender.Object.Get('Cube').ipo ipo = Blender.Object.Get('Cube').ipo
icu = ipo['LocX'] icu = ipo['LocX']
endtime,endvalue = icu.bezierPoints[-1].pt endtime,endvalue = icu.bezierPoints[-1].pt
@type extend: int @type extend: int
""" """
def __getitem__ (time): def __getitem__ (time):
""" """
Returns the value of the curve at a particular time. Returns the value of the curve at a particular time.
@type time: float @type time: float
@param time: time (Vertex X) on the curve @param time: time (Vertex X) on the curve
@rtype: float @rtype: float
@return: value (Vertex Y) corresponding to the given time @return: value (Vertex Y) corresponding to the given time
""" """
def __setitem__ (time): def __setitem__ (time):
""" """
Sets the value (Vertex Y) of the curve at a particular time. Sets the value (Vertex Y) of the curve at a particular time.
@type time: float @type time: float
@param time: time (Vertex X) on the curve @param time: time (Vertex X) on the curve
""" """
def setExtrapolation(extendmode): def setExtrapolation(extendmode):
""" """
@ -216,6 +216,17 @@ class IpoCurve:
@return: the points of the Ipo curve. @return: the points of the Ipo curve.
""" """
def clean( thresh=0.0000001 ):
"""
Calls the IPO-curve cleaning function on this IpoCurve.
There is no need to recalculate curve manually.
@type thresh: float
@param thresh: The threshold to used to determine if two values are identical.
By default, the IPO-editor tool's value is used.
@rtype: None
@return: None
"""
def evaluate( time ): def evaluate( time ):
""" """
Compute the value of the Ipo curve at a particular time (B{deprecated}). Compute the value of the Ipo curve at a particular time (B{deprecated}).

@ -212,7 +212,7 @@ class Material:
Value is clamped to the range [0.0,100.0]. Value is clamped to the range [0.0,100.0].
@type haloSize: float @type haloSize: float
@ivar hard: Hardness of the specularity. @ivar hard: Hardness of the specularity.
Value is clamped to the range [1,255]. Value is clamped to the range [1,511].
@type hard: int @type hard: int
@ivar ipo: Material Ipo data. @ivar ipo: Material Ipo data.
Contains the Ipo if one is assigned to the object, None otherwise. Setting to None clears the current Ipo. Contains the Ipo if one is assigned to the object, None otherwise. Setting to None clears the current Ipo.

@ -128,11 +128,9 @@ def turbulence (xyz, octaves, hard, basis = NoiseTypes['STDPERLIN'],
@return: the generated turbulence value. @return: the generated turbulence value.
""" """
def vTurbulence (xyz, octaves, hard, basis = NoiseTypes['STDPERLIN'], def vTurbulence (xyz, octaves, hard, basis = NoiseTypes['STDPERLIN'], ampscale = 0.5, freqscale = 2.0):
ampscale = 0.5, freqscale = 2.0):
""" """
Returns general turbulence vector using the optional specified noise basis Returns general turbulence vector using the optional specified noise basis function.
function.
@type xyz: 3-float tuple @type xyz: 3-float tuple
@param xyz: (x,y,z) float values. @param xyz: (x,y,z) float values.
@type octaves: int @type octaves: int

@ -656,9 +656,13 @@ class Object:
Return a list of particle systems linked to this object (see Blender.Particle). Return a list of particle systems linked to this object (see Blender.Particle).
""" """
def newParticleSystem(): def newParticleSystem(name = None):
""" """
Link a new particle system (see Blender.Particle). Link a particle system (see Blender.Particle). If no name is
given, a new particle system is created. If a name is given and a
particle system with that name exists, it is linked to the object.
@type name: string
@param name: The name of the requested Particle system (optional).
""" """
def addVertexGroupsFromArmature(object): def addVertexGroupsFromArmature(object):

@ -131,8 +131,7 @@ class Particle:
Get the particles locations. Get the particles locations.
A list of tuple is returned in particle mode. A list of tuple is returned in particle mode.
A list of list of tuple is returned in hair mode. A list of list of tuple is returned in hair mode.
The tuple is a vector of 3 or 4 floats in world space (x,y,z, The tuple is a vector of 3 or 4 floats in world space (x,y,z, optionally the particle's id).
optionally the particle's id).
@type all: int @type all: int
@param all: if not 0 export all particles (uninitialized (unborn or died)particles exported as None). @param all: if not 0 export all particles (uninitialized (unborn or died)particles exported as None).
@type id: int @type id: int

@ -1228,3 +1228,17 @@ class RenderData:
@rtype: int (if prototype is empty) @rtype: int (if prototype is empty)
@return: Current new map value for the scene. @return: Current new map value for the scene.
""" """
def addRenderLayer():
"""
Add a new render layer to the rendering context, see L{RenderLayer}.
@rtype: RenderLayer
@return: The newly created renderlayer.
"""
def removeRenderLayer(renderlayer):
"""
Remove the specified render layer from the rendering context.
@type renderlayer: L{RenderLayer}
@param renderlayer: must be a L{RenderLayer}
"""

@ -0,0 +1,92 @@
# Blender.Scene.Render.RenderLayer module and the RenderLayer PyType object
"""
The Blender.Scene.Render.RenderLayer submodule.
Scene.Render.RenderLayer
========================
This module provides access to B{Render Layers} in Blender.
Example::
import bpy
sce = bpy.data.scenes.active
render = sce.render
layer = render.addRenderLayer()
render.removeRenderLayer(layer)
"""
class RenderLayer:
"""
The RenderLayer object
======================
@type name: string
@ivar name: Get or set the name for the L{RenderLayer}
@type lightGroup: group
@ivar lightGroup: group of lights
@type enable: bool
@ivar enable: enable this render layer
@type enableZMask: bool
@ivar enableZMask: Only render what's in front of the solid z values
@type enableZMaskAll: bool
@ivar enableZMaskAll: Fill in Z values for solid faces in invisible layers, for masking
@type enableSolid: bool
@ivar enableSolid: Render Solid faces in this Layer
@type enableZTra: bool
@ivar enableZTra: Render Z-Transparent faces in this Layer (On top of Solid and Halos)
@type enableHalo: bool
@ivar enableHalo: Render Halos in this Layer (on top of Solid)
@type enableEdge: bool
@ivar enableEdge: Render Edge-enhance in this Layer (only works for Solid faces)
@type enableSky: bool
@ivar enableSky: Render Sky or backbuffer in this Layer
@type enableStrand: bool
@ivar enableStrand: Render Strands in this Layer
@type layerMask: bool
@ivar layerMask: ...
@type zLayerMask: bool
@ivar zLayerMask: ...
@type passCombined: bool
@ivar passCombined: Deliver full combined RGBA buffer
@type passZ: bool
@ivar passZ: Deliver Z values pass
@type passSpeed: bool
@ivar passSpeed: Deliver Speed Vector pass
@type passNormal: bool
@ivar passNormal: Deliver Normal pass
@type passUV: bool
@ivar passUV: Deliver Texture UV pass
@type passMist: bool
@ivar passMist: Deliver Mist factor pass (0-1)
@type passIndex: bool
@ivar passIndex: Deliver Object Index pass
@type passColor: bool
@ivar passColor: Deliver shade-less Color pass
@type passDiffuse: bool
@ivar passDiffuse: Deliver Diffuse pass
@type passSpecular: bool
@ivar passSpecular: Deliver Specular pass
@type passShadow: bool
@ivar passShadow: Deliver Shadow pass
@type passAO: bool
@ivar passAO: Deliver AO pass
@type passReflect: bool
@ivar passReflect: Deliver Raytraced Reflection pass
@type passRefract: bool
@ivar passRefract: Deliver Raytraced Reflection pass
@type passRadiosity: bool
@ivar passRadiosity: Deliver Radiosity pass
@type passSpecularXOR: bool
@ivar passSpecularXOR: Deliver Specular pass XOR
@type passShadowXOR: bool
@ivar passShadowXOR: Deliver Shadow pass XOR
@type passAOXOR: bool
@ivar passAOXOR: Deliver AO pass XOR
@type passRefractXOR: bool
@ivar passRefractXOR: Deliver Raytraced Reflection pass XOR
@type passRadiosityXOR: bool
@ivar passRadiosityXOR: Deliver Radiosity pass XOR
"""

@ -0,0 +1,28 @@
#!/usr/bin/python
Import ('env')
from optparse import OptionParser
try:
import epydoc
except ImportError:
print "No epydoc install detected, Python API Docs will not be generated "
if epydoc:
from epydoc.docbuilder import build_doc_index
from epydoc import cli
names = env.Glob("source/blender/python/api2_2x/doc/[A-Z]*.py")
docindex = build_doc_index(names)
optvalues = cli.OPTION_DEFAULTS
optvalues["verbose"] = 1
optvalues["target"] = env["BF_DOCDIR"]+"/BPY_API/"
optvalues["url"] = "http://www.blender.org"
optvalues["top"] = "API_intro"
optvalues["name"] = "Blender"
optvalues["noprivate"] = 1
optvalues["noframes"] = 1
optvalues["names"] = names
optparser = OptionParser()
optparser.set_defaults(**optvalues)
(options, args) = optparser.parse_args()
cli.write_html(docindex, options)

@ -143,7 +143,7 @@ class Text:
Retrieve the contents of this Text buffer as a list of strings between Retrieve the contents of this Text buffer as a list of strings between
the start and end lines specified. If end < 0 all lines from start will the start and end lines specified. If end < 0 all lines from start will
be included. be included.
@type start int @type start: int
@param start: Optional index of first line of the span to return @param start: Optional index of first line of the span to return
@type end int @type end int
@param end: Optional index of the line to which the span is taken or @param end: Optional index of the line to which the span is taken or

@ -432,9 +432,9 @@ class Texture:
def setFlags(f1=None, f2=None, f3=None, f4=None): def setFlags(f1=None, f2=None, f3=None, f4=None):
""" """
Set this object's flags. Set this object's flags.
@param f1,f2,f3,f4: Flags to be set (omitted flags are cleared). Can be any of @param f1, f2, f3, f4: Flags to be set (omitted flags are cleared). Can be any of
'FlipBlendXY', 'NegAlpha', 'CheckerOdd', and 'CheckerEven' 'FlipBlendXY', 'NegAlpha', 'CheckerOdd', and 'CheckerEven'
@type f1,f2,f3,f4: string @type f1, f2, f3, f4: string
""" """
def setImage(image): def setImage(image):

@ -7,5 +7,5 @@
# set posix locale so regex works properly for [A-Z]*.py # set posix locale so regex works properly for [A-Z]*.py
LC_ALL=POSIX LC_ALL=POSIX
epydoc -v -o BPY_API --url "http://www.blender.org" --top API_intro \ epydoc --debug -v -o BPY_API --url "http://www.blender.org" --top API_intro \
--name "Blender" --no-private --no-frames [A-Z]*.py --name "Blender" --no-private --no-frames [A-Z]*.py

@ -89,7 +89,8 @@ enum rend_constants {
EXPP_RENDER_ATTR_BAKEMODE, EXPP_RENDER_ATTR_BAKEMODE,
EXPP_RENDER_ATTR_BAKEDIST, EXPP_RENDER_ATTR_BAKEDIST,
EXPP_RENDER_ATTR_BAKENORMALSPACE, EXPP_RENDER_ATTR_BAKENORMALSPACE,
EXPP_RENDER_ATTR_BAKEBIAS EXPP_RENDER_ATTR_BAKEBIAS,
EXPP_RENDER_ATTR_OCRES
}; };
#define EXPP_RENDER_ATTR_CFRA 2 #define EXPP_RENDER_ATTR_CFRA 2
@ -1995,6 +1996,9 @@ static PyObject *RenderData_getIValueAttr( BPy_RenderData *self, void *type )
case EXPP_RENDER_ATTR_BAKENORMALSPACE: case EXPP_RENDER_ATTR_BAKENORMALSPACE:
param = self->renderContext->bake_normal_space; param = self->renderContext->bake_normal_space;
break; break;
case EXPP_RENDER_ATTR_OCRES:
param = self->renderContext->ocres;
break;
default: default:
return EXPP_ReturnPyObjError( PyExc_RuntimeError, return EXPP_ReturnPyObjError( PyExc_RuntimeError,
"undefined type constant in RenderData_setIValueAttrClamp" ); "undefined type constant in RenderData_setIValueAttrClamp" );
@ -2796,6 +2800,10 @@ static PyGetSetDef BPy_RenderData_getseters[] = {
(getter)RenderData_getMapNew, (setter)RenderData_setMapNew, (getter)RenderData_getMapNew, (setter)RenderData_setMapNew,
"New mapping value (in frames)", "New mapping value (in frames)",
NULL}, NULL},
{"octreeResolution",
(getter)RenderData_getIValueAttr, (setter)NULL,
"Resolution for octree",
(void *)EXPP_RENDER_ATTR_OCRES},
{"set", {"set",
(getter)RenderData_getSet, (setter)RenderData_setSet, (getter)RenderData_getSet, (setter)RenderData_setSet,
"Scene link 'set' value", "Scene link 'set' value",
@ -3581,7 +3589,7 @@ static PyGetSetDef BPy_RenderLayer_getseters[] = {
(getter)RenderLayer_getPassBits, (setter)RenderLayer_setPassBits, (getter)RenderLayer_getPassBits, (setter)RenderLayer_setPassBits,
"Deliver Raytraced Reflection pass", "Deliver Raytraced Reflection pass",
(void *)SCE_PASS_REFRACT}, (void *)SCE_PASS_REFRACT},
{"passRadiosiy", {"passRadiosity",
(getter)RenderLayer_getPassBits, (setter)RenderLayer_setPassBits, (getter)RenderLayer_getPassBits, (setter)RenderLayer_setPassBits,
"Deliver Radiosity pass", "Deliver Radiosity pass",
(void *)SCE_PASS_RADIO}, (void *)SCE_PASS_RADIO},
@ -3603,7 +3611,7 @@ static PyGetSetDef BPy_RenderLayer_getseters[] = {
(getter)RenderLayer_getPassXorBits, (setter)RenderLayer_setPassXorBits, (getter)RenderLayer_getPassXorBits, (setter)RenderLayer_setPassXorBits,
"Deliver Raytraced Reflection pass XOR", "Deliver Raytraced Reflection pass XOR",
(void *)SCE_PASS_REFRACT}, (void *)SCE_PASS_REFRACT},
{"passRadiosiyXOR", {"passRadiosityXOR",
(getter)RenderLayer_getPassXorBits, (setter)RenderLayer_setPassXorBits, (getter)RenderLayer_getPassXorBits, (setter)RenderLayer_setPassXorBits,
"Deliver Radiosity pass XOR", "Deliver Radiosity pass XOR",
(void *)SCE_PASS_RADIO}, (void *)SCE_PASS_RADIO},

@ -157,6 +157,7 @@ typedef struct ShadeInput
int xs, ys; /* pixel to be rendered */ int xs, ys; /* pixel to be rendered */
int mask; /* subsample mask */ int mask; /* subsample mask */
float scanco[3]; /* original scanline coordinate without jitter */
int samplenr; /* sample counter, to detect if we should do shadow again */ int samplenr; /* sample counter, to detect if we should do shadow again */
int depth; /* 1 or larger on raytrace shading */ int depth; /* 1 or larger on raytrace shading */

@ -56,7 +56,8 @@ void shade_material_loop(struct ShadeInput *shi, struct ShadeResult *shr);
void shade_input_set_triangle_i(struct ShadeInput *shi, struct ObjectInstanceRen *obi, struct VlakRen *vlr, short i1, short i2, short i3); void shade_input_set_triangle_i(struct ShadeInput *shi, struct ObjectInstanceRen *obi, struct VlakRen *vlr, short i1, short i2, short i3);
void shade_input_set_triangle(struct ShadeInput *shi, volatile int obi, volatile int facenr, int normal_flip); void shade_input_set_triangle(struct ShadeInput *shi, volatile int obi, volatile int facenr, int normal_flip);
void shade_input_copy_triangle(struct ShadeInput *shi, struct ShadeInput *from); void shade_input_copy_triangle(struct ShadeInput *shi, struct ShadeInput *from);
void shade_input_set_viewco(struct ShadeInput *shi, float x, float y, float z); void shade_input_calc_viewco(struct ShadeInput *shi, float x, float y, float z, float *view, float *dxyview, float *co, float *dxco, float *dyco);
void shade_input_set_viewco(struct ShadeInput *shi, float x, float y, float sx, float sy, float z);
void shade_input_set_uv(struct ShadeInput *shi); void shade_input_set_uv(struct ShadeInput *shi);
void shade_input_set_normals(struct ShadeInput *shi); void shade_input_set_normals(struct ShadeInput *shi);
void shade_input_flip_normals(struct ShadeInput *shi); void shade_input_flip_normals(struct ShadeInput *shi);

@ -59,7 +59,7 @@ void sss_add_points(Render *re, float (*co)[3], float (*color)[3], float *area,
void free_sss(struct Render *re); void free_sss(struct Render *re);
int sample_sss(struct Render *re, struct Material *mat, float *co, float *col); int sample_sss(struct Render *re, struct Material *mat, float *co, float *col);
int has_sss_tree(struct Render *re, struct Material *mat); int sss_pass_done(struct Render *re, struct Material *mat);
#endif /*SSS_H*/ #endif /*SSS_H*/

@ -53,7 +53,6 @@ void zbuffer_shadow(struct Render *re, float winmat[][4], struct LampRen *lar, i
void zbuffer_solid(struct RenderPart *pa, struct RenderLayer *rl, void (*fillfunc)(struct RenderPart*, struct ZSpan*, int, void*), void *data); void zbuffer_solid(struct RenderPart *pa, struct RenderLayer *rl, void (*fillfunc)(struct RenderPart*, struct ZSpan*, int, void*), void *data);
unsigned short *zbuffer_transp_shade(struct RenderPart *pa, struct RenderLayer *rl, float *pass, struct ListBase *psmlist); unsigned short *zbuffer_transp_shade(struct RenderPart *pa, struct RenderLayer *rl, float *pass, struct ListBase *psmlist);
void convert_zbuf_to_distbuf(struct RenderPart *pa, struct RenderLayer *rl);
void zbuffer_sss(RenderPart *pa, unsigned int lay, void *handle, void (*func)(void*, int, int, int, int, int)); void zbuffer_sss(RenderPart *pa, unsigned int lay, void *handle, void (*func)(void*, int, int, int, int, int));
int zbuffer_strands_abuf(struct Render *re, struct RenderPart *pa, struct RenderLayer *rl, struct APixstrand *apixbuf, struct ListBase *apsmbase, struct StrandShadeCache *cache); int zbuffer_strands_abuf(struct Render *re, struct RenderPart *pa, struct RenderLayer *rl, struct APixstrand *apixbuf, struct ListBase *apsmbase, struct StrandShadeCache *cache);

@ -1868,7 +1868,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
dosimplify= psys_render_simplify_params(psys, cpa, simplify); dosimplify= psys_render_simplify_params(psys, cpa, simplify);
if(path_nbr) { if(path_nbr && psys->childcache) {
cache = psys->childcache[a-totpart]; cache = psys->childcache[a-totpart];
max_k = (int)cache->steps; max_k = (int)cache->steps;
} }

@ -640,7 +640,7 @@ int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexRe
/* texvec should be the already reflected normal */ /* texvec should be the already reflected normal */
EnvMap *env; EnvMap *env;
ImBuf *ibuf; ImBuf *ibuf;
float fac, vec[3], sco[3], dxts[3], dyts[3], w[3]; float fac, vec[3], sco[3], dxts[3], dyts[3];
int face, face1; int face, face1;
env= tex->env; env= tex->env;
@ -722,15 +722,9 @@ int envmaptex(Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, TexRe
if(fac!=0.0) { if(fac!=0.0) {
fac= 1.0/fac; fac= 1.0/fac;
/* weight contributions based on alpha */ texres->tr= fac*(texres->ta*texres->tr + texr1.ta*texr1.tr + texr2.ta*texr2.tr );
w[0]= texres->ta*fac; texres->tg= fac*(texres->ta*texres->tg + texr1.ta*texr1.tg + texr2.ta*texr2.tg );
w[1]= texr1.ta*fac; texres->tb= fac*(texres->ta*texres->tb + texr1.ta*texr1.tb + texr2.ta*texr2.tb );
w[2]= texr2.ta*fac;
/* interpolate premultiplied result (imagewraposa returns key) */
texres->tr= (w[0]*texres->ta*texres->tr + w[1]*texr1.ta*texr1.tr + w[2]*texr2.ta*texr2.tr);
texres->tg= (w[0]*texres->ta*texres->tg + w[1]*texr1.ta*texr1.tg + w[2]*texr2.ta*texr2.tg);
texres->tb= (w[0]*texres->ta*texres->tb + w[1]*texr1.ta*texr1.tb + w[2]*texr2.ta*texr2.tb);
} }
texres->ta= 1.0; texres->ta= 1.0;
} }

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