svn merge -r 12607:12653 https://svn.blender.org/svnroot/bf-blender/trunk/blender + add OpenMP for msvc/gcc to scons, cmake and Makefiles (libs + compiler flags are still missing in Makefiles)

This commit is contained in:
Daniel Genrich 2007-11-22 20:28:24 +00:00
commit 638b95634e
62 changed files with 4676 additions and 2034 deletions

@ -65,8 +65,9 @@ OPTION(WITH_ELBEEM "Enable Elbeem (Fluid Simulation)" ON)
OPTION(WITH_QUICKTIME "Enable Quicktime Support" OFF) OPTION(WITH_QUICKTIME "Enable Quicktime Support" OFF)
OPTION(WITH_OPENEXR "Enable OpenEXR Support (http://www.openexr.com)" OFF) OPTION(WITH_OPENEXR "Enable OpenEXR Support (http://www.openexr.com)" OFF)
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(YESIAMSTUPID "Enable execution on 64-bit platforms" OFF) OPTION(YESIAMSTUPID "Enable execution on 64-bit platforms" OFF)
OPTION(WITH_OPENMP "Enable OpenMP (has to be supported by the compiler)" 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")
@ -186,6 +187,12 @@ IF(UNIX)
SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing -DXP_UNIX -Wno-char-subscripts") SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing -DXP_UNIX -Wno-char-subscripts")
IF(WITH_OPENMP)
SET(LLIBS ${LLIBS} gomp)
SET(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "-fopenmp")
SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-fopenmp")
ENDIF(WITH_OPENMP)
SET(PLATFORM_LINKFLAGS "-pthread") SET(PLATFORM_LINKFLAGS "-pthread")
INCLUDE_DIRECTORIES(/usr/include /usr/local/include) INCLUDE_DIRECTORIES(/usr/include /usr/local/include)
@ -270,6 +277,11 @@ IF(WIN32)
SET(CMAKE_C_FLAGS_MINSIZEREL "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /O1 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE) SET(CMAKE_C_FLAGS_MINSIZEREL "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /O1 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /J" CACHE STRING "MSVC MT flags " FORCE)
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /O2 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE) SET(CMAKE_C_FLAGS_RELWITHDEBINFO "/D_CRT_NONSTDC_NO_DEPRECATE /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /wd4800 /wd4244 /wd4305 /O2 /Ob1 /DNDEBUG /EHsc /MT /W3 /nologo /Zi /J" CACHE STRING "MSVC MT flags " FORCE)
IF(WITH_OPENMP)
SET(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "/openmp")
SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "/openmp")
ENDIF(WITH_OPENMP)
SET(SDL ${LIBDIR}/sdl) SET(SDL ${LIBDIR}/sdl)
SET(SDL_INC ${SDL}/include) SET(SDL_INC ${SDL}/include)
SET(SDL_LIB SDL) SET(SDL_LIB SDL)
@ -347,6 +359,12 @@ IF(APPLE)
SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing") SET(PLATFORM_CFLAGS "-pipe -fPIC -funsigned-char -fno-strict-aliasing")
SET(PLATFORM_LINKFLAGS "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Carbon -framework AGL -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework QuickTime") SET(PLATFORM_LINKFLAGS "-fexceptions -framework CoreServices -framework Foundation -framework IOKit -framework AppKit -framework Carbon -framework AGL -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework QuickTime")
IF(WITH_OPENMP)
SET(LLIBS ${LLIBS} gomp)
SET(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "-fopenmp")
SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-fopenmp")
ENDIF(WITH_OPENMP)
SET(SDL ${LIBDIR}/sdl) SET(SDL ${LIBDIR}/sdl)
SET(SDL_INC ${SDL}/include) SET(SDL_INC ${SDL}/include)
SET(SDL_LIB SDL) SET(SDL_LIB SDL)

@ -36,5 +36,9 @@ IF(WINDOWS)
ADD_DEFINITIONS(-DUSE_MSVC6FIXES) ADD_DEFINITIONS(-DUSE_MSVC6FIXES)
ENDIF(WINDOWS) ENDIF(WINDOWS)
IF(WITH_OPENMP)
ADD_DEFINITIONS(-DPARALLEL)
ENDIF(WITH_OPENMP)
BLENDERLIB_NOLIST(bf_elbeem "${SRC}" "${INC}") BLENDERLIB_NOLIST(bf_elbeem "${SRC}" "${INC}")
#, libtype='blender', priority=0 ) #, libtype='blender', priority=0 )

@ -154,7 +154,7 @@ typedef struct elbeemMesh {
short volumeInitType; short volumeInitType;
/* name of the mesh, mostly for debugging */ /* name of the mesh, mostly for debugging */
char *name; const char *name;
} elbeemMesh; } elbeemMesh;
// API functions // API functions

@ -103,7 +103,7 @@ void AttributeList::readMat4Gfx(string name, ntlMat4Gfx defaultValue, string sou
// set that a parameter can be given, and will be ignored... // set that a parameter can be given, and will be ignored...
bool AttributeList::ignoreParameter(string name, string source) { bool AttributeList::ignoreParameter(string name, string source) {
name=source=(""); // remove warning name = source = ("");
return false; return false;
} }

@ -54,15 +54,84 @@
#define unused_GRID_REGION_END() \
} /* main_region */ \
// end unusedGRID_REGION_END
// ----------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------
#else // PARALLEL==1 #else // PARALLEL==1
#include "paraloop.h" //#include "paraloop.h"
#define PERFORM_USQRMAXCHECK USQRMAXCHECK(usqr,ux,uy,uz, calcMaxVlen, calcMxvx,calcMxvy,calcMxvz);
#define LIST_EMPTY(x) calcListEmpty.push_back( x );
#define LIST_FULL(x) calcListFull.push_back( x );
#define FSGR_ADDPART(x) calcListParts.push_back( x );
// parallel region
//was: # pragma omp parallel default(shared)
#if COMPRESSGRIDS!=1
// requires compressed grids...!
ERROR!
#endif
// loop start
#define GRID_REGION_START() \
{ \
\
\
if(mSizez<2) { \
mPanic = 1; \
errFatal("ParaLoop::2D","Not valid...!", SIMWORLD_GENERICERROR); \
} \
\
\
vector<LbmPoint> calcListFull; \
vector<LbmPoint> calcListEmpty; \
vector<ParticleObject> calcListParts; \
LbmFloat calcMxvx, calcMxvy, calcMxvz, calcMaxVlen; \
calcMxvx = calcMxvy = calcMxvz = calcMaxVlen = 0.0; \
calcListEmpty.reserve(mListEmpty.capacity() / omp_get_num_threads() ); \
calcListFull.reserve( mListFull.capacity() / omp_get_num_threads() ); \
calcListParts.reserve(mSizex); \
\
\
const int id = omp_get_thread_num(); \
const int Nthrds = omp_get_num_threads(); \
\
\
\
\
\
int kdir = 1; \
\
int kstart=getForZMinBnd(), kend=getForZMaxBnd(mMaxRefine); \
if(gridLoopBound>0){ kstart=getForZMin1(); kend=getForZMax1(mMaxRefine); } \
LbmFloat *ccel = NULL, *tcel = NULL; \
CellFlagType *pFlagSrc=NULL, *pFlagDst=NULL; \
\
\
if(mLevel[mMaxRefine].setCurr==1) { \
kdir = -1; \
int temp = kend; \
kend = kstart-1; \
kstart = temp-1; \
} \
\
const int Nj = mLevel[mMaxRefine].lSizey; \
int jstart = 0+( id * (Nj / Nthrds) ); \
int jend = 0+( (id+1) * (Nj / Nthrds) ); \
if( ((Nj/Nthrds) *Nthrds) != Nj) { \
errMsg("LbmFsgrSolver","Invalid domain size Nj="<<Nj<<" Nthrds="<<Nthrds); \
} \
\
if(jstart<gridLoopBound) jstart = gridLoopBound; \
if(jend>mLevel[mMaxRefine].lSizey-gridLoopBound) jend = mLevel[mMaxRefine].lSizey-gridLoopBound; \
\
debMsgStd("ParaLoop::OMP",DM_MSG,"Thread:"<<id<<" i:"<<istart<<"-"<<iend<<" j:"<<jstart<<"-"<<jend<<", k:"<<kstart<<"-"<<kend<<" ", 1); \
\
// para GRID LOOP END is parainc3
#endif // PARALLEL==1 #endif // PARALLEL==1
@ -101,9 +170,11 @@
// old loop for COMPRESSGRIDS==0 // old loop for COMPRESSGRIDS==0
#define old__GRID_LOOP_START() \ #define old__GRID_LOOP_START() \
for(int k=kstart;k<kend;++k) { \ for(int k=kstart;k<kend;++k) { \
for(int j=1;j<mLevel[lev].lSizey-1;++j) { \ for(int j=1;j<mLevel[lev].lSizey-1;++j) { \
for(int i=0;i<mLevel[lev].lSizex-2; ) { for(int i=0;i<mLevel[lev].lSizex-2; ) {

@ -22,6 +22,7 @@
#include <math.h> #include <math.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
// hack for MSVC6.0 compiler // hack for MSVC6.0 compiler
#ifdef _MSC_VER #ifdef _MSC_VER

@ -1,50 +0,0 @@
#define PERFORM_USQRMAXCHECK \
_Pragma("omp critical") {\
USQRMAXCHECK(usqr,ux,uy,uz, mMaxVlen, mMxvx,mMxvy,mMxvz); \
} \
#define LIST_EMPTY(x) \
_Pragma("omp critical") {\
mListEmpty.push_back( x ); }
#define LIST_FULL(x) \
_Pragma("omp critical") {\
mListFull.push_back( x ); }
#define FSGR_ADDPART(x) \
_Pragma("omp critical") { \
mpParticles->addFullParticle( x ); } \
#define MAX_THREADS 2
#define GRID_REGION_START() \
{ /* main_region */ \
int kstart=getForZMinBnd(), kend=getForZMaxBnd(mMaxRefine); \
if(gridLoopBound>0){ kstart=getForZMin1(), kend=getForZMax1(mMaxRefine); } \
int kdir = 1; \
const int id=omp_get_thread_num(); \
int jstart = (id*((mLevel[mMaxRefine].lSizey-gridLoopBound) / MAX_THREADS))+gridLoopBound; \
int jend = (id+1)*((mLevel[mMaxRefine].lSizey-gridLoopBound)/ MAX_THREADS); \
if(id+1 == MAX_THREADS) \
{ \
jend = mLevel[mMaxRefine].lSizey-gridLoopBound; \
} \
LbmFloat *ccel = NULL, *tcel = NULL; \
CellFlagType *pFlagSrc=NULL, *pFlagDst=NULL; \
if(mLevel[mMaxRefine].setCurr==1) { \
kdir = -1; \
int temp = kend; \
kend = kstart-1; \
kstart = temp-1; \
temp = id; /* dummy remove warning */ \
} \
// if(jstart<1) jstart = 1;
#define unused_GRID_REGION_END() \
} /* main_region */ \
// end unusedGRID_REGION_END

@ -1,3 +0,0 @@
#pragma omp parallel num_threads(MAX_THREADS) \
reduction(+: calcCurrentMass, calcCurrentVolume, calcCellsFilled, calcCellsEmptied, calcNumUsedCells)

@ -325,7 +325,7 @@ void ParticleTracer::getTriangles(double time, vector<ntlTriangle> *triangles,
// suppress warnings... // suppress warnings...
vertices = NULL; triangles = NULL; vertices = NULL; triangles = NULL;
normals = NULL; objectId = 0; normals = NULL; objectId = 0;
time = 0.0; time = 0.;
#else // ELBEEM_PLUGIN #else // ELBEEM_PLUGIN
int pcnt = 0; int pcnt = 0;
// currently not used in blender // currently not used in blender

@ -15,7 +15,6 @@
#include "solver_interface.h" #include "solver_interface.h"
#include "particletracer.h" #include "particletracer.h"
#include "elbeem.h" #include "elbeem.h"
#include <stdlib.h> /* exit(3) - also in linux */
#ifdef _WIN32 #ifdef _WIN32
#else #else
@ -69,6 +68,7 @@ SimulationObject::~SimulationObject()
/*! init tree for certain geometry init */ /*! init tree for certain geometry init */
/*****************************************************************************/ /*****************************************************************************/
void SimulationObject::initGeoTree() { void SimulationObject::initGeoTree() {
// unused!! overriden by solver interface
if(mpGlob == NULL) { if(mpGlob == NULL) {
errFatal("SimulationObject::initGeoTree error","Requires globals!", SIMWORLD_INITERROR); errFatal("SimulationObject::initGeoTree error","Requires globals!", SIMWORLD_INITERROR);
return; return;
@ -80,7 +80,7 @@ void SimulationObject::initGeoTree() {
char treeFlag = (1<<(mGeoInitId+4)); char treeFlag = (1<<(mGeoInitId+4));
mpGiTree = new ntlTree( 20, 4, // warning - fixed values for depth & maxtriangles here... mpGiTree = new ntlTree( 20, 4, // warning - fixed values for depth & maxtriangles here...
scene, treeFlag ); scene, treeFlag );
exit(1); // unused!? overriden by solver interface // unused!! overriden by solver interface
} }
/*****************************************************************************/ /*****************************************************************************/
@ -310,7 +310,7 @@ void SimulationObject::step( void )
// dont advance for stopped time // dont advance for stopped time
mpLbm->step(); mpLbm->step();
mTime += mpParam->getTimestep(); mTime += mpParam->getTimestep();
//if(mTime>0.001) { errMsg("DEBUG!!!!!!!!","quit mlsu..."); exit(1); } // PROFILE DEBUG TEST! //if(mTime>0.001) { errMsg("DEBUG!!!!!!!!","quit mlsu..."); xit(1); } // PROFILE DEBUG TEST!
} }
if(mpLbm->getPanic()) mPanic = true; if(mpLbm->getPanic()) mPanic = true;

@ -101,7 +101,7 @@
// sirdude fix for solaris // sirdude fix for solaris
#if !defined(linux) && defined(sun) #if !defined(linux) && defined(sun)
#ifndef expf #ifndef expf
#define expf(a) exp((double)(a)) #define expf(x) exp((double)(x))
#endif #endif
#endif #endif

@ -655,6 +655,7 @@ bool LbmFsgrSolver::initializeSolverMemory()
int orgSz = mSizez; int orgSz = mSizez;
double sizeReduction = 1.0; double sizeReduction = 1.0;
double memEstFromFunc = -1.0; double memEstFromFunc = -1.0;
double memEstFine = -1.0;
string memreqStr(""); string memreqStr("");
bool firstMInit = true; bool firstMInit = true;
int minitTries=0; int minitTries=0;
@ -672,7 +673,7 @@ bool LbmFsgrSolver::initializeSolverMemory()
firstMInit=false; firstMInit=false;
calculateMemreqEstimate( mSizex, mSizey, mSizez, calculateMemreqEstimate( mSizex, mSizey, mSizez,
mMaxRefine, mFarFieldSize, &memEstFromFunc, &memreqStr ); mMaxRefine, mFarFieldSize, &memEstFromFunc, &memEstFine, &memreqStr );
double memLimit; double memLimit;
string memLimStr("-"); string memLimStr("-");
@ -685,13 +686,36 @@ bool LbmFsgrSolver::initializeSolverMemory()
memLimit = 16.0* 1024.0*1024.0*1024.0; memLimit = 16.0* 1024.0*1024.0*1024.0;
memLimStr = string("16GB"); memLimStr = string("16GB");
} }
if(memEstFromFunc>memLimit) {
// restrict max. chunk of 1 mem block to 1GB for windos
bool memBlockAllocProblem = false;
double maxWinMemChunk = 1100.*1024.*1024.;
double maxMacMemChunk = 1200.*1024.*1024.;
double maxDefaultMemChunk = 2.*1024.*1024.*1024.;
//std::cerr<<" memEstFine "<< memEstFine <<" maxWin:" <<maxWinMemChunk <<" maxMac:" <<maxMacMemChunk ; // DEBUG
#ifdef WIN32
if(memEstFine> maxWinMemChunk) {
memBlockAllocProblem = true;
}
#endif // WIN32
#ifdef __APPLE__
if(memEstFine> maxMacMemChunk) {
memBlockAllocProblem = true;
}
#endif // Mac
if(sizeof(int)==4 && memEstFine>maxDefaultMemChunk) {
// max memory chunk for 32bit systems 2gig
memBlockAllocProblem = true;
}
if(memEstFromFunc>memLimit || memBlockAllocProblem) {
sizeReduction *= 0.9; sizeReduction *= 0.9;
mSizex = (int)(orgSx * sizeReduction); mSizex = (int)(orgSx * sizeReduction);
mSizey = (int)(orgSy * sizeReduction); mSizey = (int)(orgSy * sizeReduction);
mSizez = (int)(orgSz * sizeReduction); mSizez = (int)(orgSz * sizeReduction);
debMsgStd("LbmFsgrSolver::initialize",DM_WARNING,"initGridSizes: memory limit exceeded "<< debMsgStd("LbmFsgrSolver::initialize",DM_WARNING,"initGridSizes: memory limit exceeded "<<
//memEstFromFunc<<"/"<<memLimit<<", "<< //memEstFromFunc<<"/"<<memLimit<<", "<<
//memEstFine<<"/"<<maxWinMemChunk<<", "<<
memreqStr<<"/"<<memLimStr<<", "<< memreqStr<<"/"<<memLimStr<<", "<<
"retrying: "<<PRINT_VEC(mSizex,mSizey,mSizez)<<" org:"<<PRINT_VEC(orgSx,orgSy,orgSz) "retrying: "<<PRINT_VEC(mSizex,mSizey,mSizez)<<" org:"<<PRINT_VEC(orgSx,orgSy,orgSz)
, 3 ); , 3 );
@ -778,10 +802,6 @@ bool LbmFsgrSolver::initializeSolverMemory()
mLevel[ mMaxRefine ].simCellSize = mpParam->getCellSize(); mLevel[ mMaxRefine ].simCellSize = mpParam->getCellSize();
mLevel[ mMaxRefine ].lcellfactor = 1.0; mLevel[ mMaxRefine ].lcellfactor = 1.0;
LONGINT rcellSize = ((mLevel[mMaxRefine].lSizex*mLevel[mMaxRefine].lSizey*mLevel[mMaxRefine].lSizez) *dTotalNum); LONGINT rcellSize = ((mLevel[mMaxRefine].lSizex*mLevel[mMaxRefine].lSizey*mLevel[mMaxRefine].lSizez) *dTotalNum);
// +4 for safety ?
mLevel[ mMaxRefine ].mprsFlags[0] = new CellFlagType[ rcellSize/dTotalNum +4 ];
mLevel[ mMaxRefine ].mprsFlags[1] = new CellFlagType[ rcellSize/dTotalNum +4 ];
ownMemCheck += 2 * sizeof(CellFlagType) * (rcellSize/dTotalNum +4);
#if COMPRESSGRIDS==0 #if COMPRESSGRIDS==0
mLevel[ mMaxRefine ].mprsCells[0] = new LbmFloat[ rcellSize +4 ]; mLevel[ mMaxRefine ].mprsCells[0] = new LbmFloat[ rcellSize +4 ];
@ -789,11 +809,34 @@ bool LbmFsgrSolver::initializeSolverMemory()
ownMemCheck += 2 * sizeof(LbmFloat) * (rcellSize+4); ownMemCheck += 2 * sizeof(LbmFloat) * (rcellSize+4);
#else // COMPRESSGRIDS==0 #else // COMPRESSGRIDS==0
LONGINT compressOffset = (mLevel[mMaxRefine].lSizex*mLevel[mMaxRefine].lSizey*dTotalNum*2); LONGINT compressOffset = (mLevel[mMaxRefine].lSizex*mLevel[mMaxRefine].lSizey*dTotalNum*2);
// D int tmp = ( (rcellSize +compressOffset +4)/(1024*1024) )*4;
// D printf("Debug MEMMMM excee: %d\n", tmp);
mLevel[ mMaxRefine ].mprsCells[1] = new LbmFloat[ rcellSize +compressOffset +4 ]; mLevel[ mMaxRefine ].mprsCells[1] = new LbmFloat[ rcellSize +compressOffset +4 ];
mLevel[ mMaxRefine ].mprsCells[0] = mLevel[ mMaxRefine ].mprsCells[1]+compressOffset; mLevel[ mMaxRefine ].mprsCells[0] = mLevel[ mMaxRefine ].mprsCells[1]+compressOffset;
ownMemCheck += sizeof(LbmFloat) * (rcellSize +compressOffset +4); ownMemCheck += sizeof(LbmFloat) * (rcellSize +compressOffset +4);
#endif // COMPRESSGRIDS==0 #endif // COMPRESSGRIDS==0
if(!mLevel[ mMaxRefine ].mprsCells[1] || !mLevel[ mMaxRefine ].mprsCells[0]) {
errFatal("LbmFsgrSolver::initialize","Fatal: Couldnt allocate memory (1)! Aborting...",SIMWORLD_INITERROR);
return false;
}
// +4 for safety ?
mLevel[ mMaxRefine ].mprsFlags[0] = new CellFlagType[ rcellSize/dTotalNum +4 ];
mLevel[ mMaxRefine ].mprsFlags[1] = new CellFlagType[ rcellSize/dTotalNum +4 ];
ownMemCheck += 2 * sizeof(CellFlagType) * (rcellSize/dTotalNum +4);
if(!mLevel[ mMaxRefine ].mprsFlags[1] || !mLevel[ mMaxRefine ].mprsFlags[0]) {
errFatal("LbmFsgrSolver::initialize","Fatal: Couldnt allocate memory (2)! Aborting...",SIMWORLD_INITERROR);
#if COMPRESSGRIDS==0
delete[] mLevel[ mMaxRefine ].mprsCells[0];
delete[] mLevel[ mMaxRefine ].mprsCells[1];
#else // COMPRESSGRIDS==0
delete[] mLevel[ mMaxRefine ].mprsCells[1];
#endif // COMPRESSGRIDS==0
return false;
}
LbmFloat lcfdimFac = 8.0; LbmFloat lcfdimFac = 8.0;
if(LBMDIM==2) lcfdimFac = 4.0; if(LBMDIM==2) lcfdimFac = 4.0;
for(int i=mMaxRefine-1; i>=0; i--) { for(int i=mMaxRefine-1; i>=0; i--) {

@ -17,7 +17,6 @@
#include "ntl_world.h" #include "ntl_world.h"
#include "elbeem.h" #include "elbeem.h"
#include <stdlib.h> /* getenv(3) - also in linux */
@ -142,7 +141,7 @@ void initGridSizes(int &sizex, int &sizey, int &sizez,
void calculateMemreqEstimate( int resx,int resy,int resz, void calculateMemreqEstimate( int resx,int resy,int resz,
int refine, float farfield, int refine, float farfield,
double *reqret, string *reqstr) { double *reqret, double *reqretFine, string *reqstr) {
// debug estimation? // debug estimation?
const bool debugMemEst = true; const bool debugMemEst = true;
// COMPRESSGRIDS define is not available here, make sure it matches // COMPRESSGRIDS define is not available here, make sure it matches
@ -150,6 +149,7 @@ void calculateMemreqEstimate( int resx,int resy,int resz,
// make sure we can handle bid numbers here... all double // make sure we can handle bid numbers here... all double
double memCnt = 0.0; double memCnt = 0.0;
double ddTotalNum = (double)dTotalNum; double ddTotalNum = (double)dTotalNum;
if(reqretFine) *reqretFine = -1.;
double currResx = (double)resx; double currResx = (double)resx;
double currResy = (double)resy; double currResy = (double)resy;
@ -159,10 +159,12 @@ void calculateMemreqEstimate( int resx,int resy,int resz,
if(debugMemEst) debMsgStd("calculateMemreqEstimate",DM_MSG,"res:"<<PRINT_VEC(currResx,currResy,currResz)<<" rcellSize:"<<rcellSize<<" mc:"<<memCnt, 10); if(debugMemEst) debMsgStd("calculateMemreqEstimate",DM_MSG,"res:"<<PRINT_VEC(currResx,currResy,currResz)<<" rcellSize:"<<rcellSize<<" mc:"<<memCnt, 10);
if(!useGridComp) { if(!useGridComp) {
memCnt += (double)(sizeof(LbmFloat) * (rcellSize +4.0) *2.0); memCnt += (double)(sizeof(LbmFloat) * (rcellSize +4.0) *2.0);
if(reqretFine) *reqretFine = (double)(sizeof(LbmFloat) * (rcellSize +4.0) *2.0);
if(debugMemEst) debMsgStd("calculateMemreqEstimate",DM_MSG," no-comp, mc:"<<memCnt, 10); if(debugMemEst) debMsgStd("calculateMemreqEstimate",DM_MSG," no-comp, mc:"<<memCnt, 10);
} else { } else {
double compressOffset = (double)(currResx*currResy*ddTotalNum*2.0); double compressOffset = (double)(currResx*currResy*ddTotalNum*2.0);
memCnt += (double)(sizeof(LbmFloat) * (rcellSize+compressOffset +4.0)); memCnt += (double)(sizeof(LbmFloat) * (rcellSize+compressOffset +4.0));
if(reqretFine) *reqretFine = (double)(sizeof(LbmFloat) * (rcellSize+compressOffset +4.0));
if(debugMemEst) debMsgStd("calculateMemreqEstimate",DM_MSG," w-comp, mc:"<<memCnt, 10); if(debugMemEst) debMsgStd("calculateMemreqEstimate",DM_MSG," w-comp, mc:"<<memCnt, 10);
} }
for(int i=refine-1; i>=0; i--) { for(int i=refine-1; i>=0; i--) {

@ -21,7 +21,7 @@
#if LBM_USE_GUI==1 #if LBM_USE_GUI==1
#define USE_GLUTILITIES #define USE_GLUTILITIES
// for debug display // for debug display
#include <GL/gl.h> //#include <GL/gl.h>
#include "../gui/guifuncs.h" #include "../gui/guifuncs.h"
#endif #endif
@ -596,8 +596,10 @@ class LbmSolverInterface
void initGridSizes(int &mSizex, int &mSizey, int &mSizez, void initGridSizes(int &mSizex, int &mSizey, int &mSizez,
ntlVec3Gfx &mvGeoStart, ntlVec3Gfx &mvGeoEnd, ntlVec3Gfx &mvGeoStart, ntlVec3Gfx &mvGeoEnd,
int mMaxRefine, bool parallel); int mMaxRefine, bool parallel);
// return the amount of memory required in total (reqret)
// and for the finest grid only (reqretFine, can be NULL)
void calculateMemreqEstimate(int resx,int resy,int resz, int refine, void calculateMemreqEstimate(int resx,int resy,int resz, int refine,
float farfieldsize, double *reqret, string *reqstr); float farfieldsize, double *reqret, double *reqretFine, string *reqstr);
//! helper function to convert flag to string (for debuggin) //! helper function to convert flag to string (for debuggin)
string convertCellFlagType2String( CellFlagType flag ); string convertCellFlagType2String( CellFlagType flag );

@ -7,11 +7,11 @@
* *
*****************************************************************************/ *****************************************************************************/
#include <stdlib.h> /* rand(3) - also in linux */
#include "solver_class.h" #include "solver_class.h"
#include "solver_relax.h" #include "solver_relax.h"
#include "particletracer.h" #include "particletracer.h"
#include "loop_tools.h" #include "loop_tools.h"
#include <stdlib.h>
/*****************************************************************************/ /*****************************************************************************/
/*! perform a single LBM step */ /*! perform a single LBM step */
@ -375,7 +375,11 @@ LbmFsgrSolver::mainLoop(int lev)
const int gridLoopBound=1; const int gridLoopBound=1;
GRID_REGION_INIT(); GRID_REGION_INIT();
#if PARALLEL==1 #if PARALLEL==1
#include "paraloopstart.h" #pragma omp parallel default(shared) \
reduction(+: \
calcCurrentMass,calcCurrentVolume, \
calcCellsFilled,calcCellsEmptied, \
calcNumUsedCells )
GRID_REGION_START(); GRID_REGION_START();
#else // PARALLEL==1 #else // PARALLEL==1
GRID_REGION_START(); GRID_REGION_START();
@ -1112,7 +1116,11 @@ LbmFsgrSolver::preinitGrids()
GRID_REGION_INIT(); GRID_REGION_INIT();
#if PARALLEL==1 #if PARALLEL==1
#include "paraloopstart.h" #pragma omp parallel default(shared) \
reduction(+: \
calcCurrentMass,calcCurrentVolume, \
calcCellsFilled,calcCellsEmptied, \
calcNumUsedCells )
#endif // PARALLEL==1 #endif // PARALLEL==1
GRID_REGION_START(); GRID_REGION_START();
GRID_LOOP_START(); GRID_LOOP_START();
@ -1145,7 +1153,11 @@ LbmFsgrSolver::standingFluidPreinit()
GRID_REGION_INIT(); GRID_REGION_INIT();
#if PARALLEL==1 #if PARALLEL==1
#include "paraloopstart.h" #pragma omp parallel default(shared) \
reduction(+: \
calcCurrentMass,calcCurrentVolume, \
calcCellsFilled,calcCellsEmptied, \
calcNumUsedCells )
#endif // PARALLEL==1 #endif // PARALLEL==1
GRID_REGION_START(); GRID_REGION_START();

@ -15,8 +15,7 @@
#include "ntl_world.h" #include "ntl_world.h"
#include "simulation_object.h" #include "simulation_object.h"
#include <stdlib.h> /* rand(3) */ #include <stdlib.h>
#include <zlib.h> #include <zlib.h>
#ifndef sqrtf #ifndef sqrtf
#define sqrtf sqrt #define sqrtf sqrt

@ -10,7 +10,6 @@
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <stdlib.h> /* getenv(3), strtol(3) */
#ifdef WIN32 #ifdef WIN32
// for timing // for timing
#include <windows.h> #include <windows.h>
@ -482,7 +481,7 @@ double elbeemEstimateMemreq(int res,
double memreq = -1.0; double memreq = -1.0;
string memreqStr(""); string memreqStr("");
// ignore farfield for now... // ignore farfield for now...
calculateMemreqEstimate(resx,resy,resz, refine, 0., &memreq, &memreqStr ); calculateMemreqEstimate(resx,resy,resz, refine, 0., &memreq, NULL, &memreqStr );
if(retstr) { if(retstr) {
// copy at max. 32 characters // copy at max. 32 characters

@ -9,11 +9,6 @@
#ifndef UTILITIES_H #ifndef UTILITIES_H
#include "ntl_vector3dim.h" #include "ntl_vector3dim.h"
// Solaris requires ieeefp.h for finite(3C)
#if !defined(linux) && defined(sun)
#include <ieeefp.h>
#endif
/* debugging outputs , debug level 0 (off) to 10 (max) */ /* debugging outputs , debug level 0 (off) to 10 (max) */
#ifdef ELBEEM_PLUGIN #ifdef ELBEEM_PLUGIN

@ -364,6 +364,9 @@
<File <File
RelativePath="..\..\..\source\blender\blenlib\intern\fileops.c"> RelativePath="..\..\..\source\blender\blenlib\intern\fileops.c">
</File> </File>
<File
RelativePath="..\..\..\source\blender\blenlib\intern\fnmatch.c">
</File>
<File <File
RelativePath="..\..\..\source\blender\blenlib\intern\freetypefont.c"> RelativePath="..\..\..\source\blender\blenlib\intern\freetypefont.c">
</File> </File>
@ -434,6 +437,9 @@
<File <File
RelativePath="..\..\..\source\blender\blenlib\intern\BLI_fileops.h"> RelativePath="..\..\..\source\blender\blenlib\intern\BLI_fileops.h">
</File> </File>
<File
RelativePath="..\..\..\source\blender\blenlib\BLI_fnmatch.h">
</File>
<File <File
RelativePath="..\..\..\source\blender\blenlib\BLI_ghash.h"> RelativePath="..\..\..\source\blender\blenlib\BLI_ghash.h">
</File> </File>

@ -11,6 +11,8 @@ def Error_NoMeshUvActive():
Draw.PupMenu('Error%t|Active object is not a mesh with texface') Draw.PupMenu('Error%t|Active object is not a mesh with texface')
def Error_NoMeshMultiresEdit(): def Error_NoMeshMultiresEdit():
Draw.PupMenu('Error%t|Unable to complete action with multires enabled') Draw.PupMenu('Error%t|Unable to complete action with multires enabled')
def Error_NoMeshFaces():
Draw.PupMenu('Error%t|Mesh has no faces')
# File I/O messages # File I/O messages
def Error_NoFile(path): def Error_NoFile(path):

File diff suppressed because it is too large Load Diff

@ -17,6 +17,11 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
__bpydoc__ ="""\
File read/write module used by OpenFlight I/O and tool scripts. OpenFlight is a
registered trademark of MultiGen-Paradigm, Inc.
"""
import Blender import Blender
from struct import * from struct import *
import re import re
@ -199,7 +204,9 @@ class FltOut:
self.file.close() self.file.close()
def __init__(self, filename): def __init__(self, filename):
self.file = open(filename, 'wb') self.file = open(filename, 'wb')
self.filename = filename
class FileFinder: class FileFinder:
def add_file_to_search_path(self, filename): def add_file_to_search_path(self, filename):

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -628,7 +628,7 @@ def main():
try: me.faces.delete(1, [ f for f in me.faces if f.sel ]) try: me.faces.delete(1, [ f for f in me.faces if f.sel ])
except: pass except: pass
me.faces.extend(faces) me.faces.extend(faces, smooth = True)
print '\nSkin done in %.4f sec.' % (Blender.sys.time()-time1) print '\nSkin done in %.4f sec.' % (Blender.sys.time()-time1)

@ -44,6 +44,7 @@ from BPyMathutils import angleToLength
import mesh_solidify import mesh_solidify
import BPyMessages import BPyMessages
reload(BPyMessages)
import bpy import bpy
@ -220,8 +221,6 @@ def solid_wire(ob_orig, me_orig, sce, PREF_THICKNESS, PREF_SOLID, PREF_SHARP, PR
co += me.verts[ii].co co += me.verts[ii].co
co /= len(vusers) co /= len(vusers)
me.faces.delete(1, range(len(me.faces))) me.faces.delete(1, range(len(me.faces)))
me.faces.extend(new_faces) me.faces.extend(new_faces)
@ -245,6 +244,18 @@ def main():
BPyMessages.Error_NoMeshActive() BPyMessages.Error_NoMeshActive()
return return
# Saves the editmode state and go's out of
# editmode if its enabled, we cant make
# changes to the mesh data while in editmode.
is_editmode = Window.EditMode()
Window.EditMode(0)
me = ob_act.getData(mesh=1) # old NMesh api is default
if len(me.faces)==0:
BPyMessages.Error_NoMeshFaces()
if is_editmode: Window.EditMode(1)
return
# Create the variables. # Create the variables.
PREF_THICK = Blender.Draw.Create(0.005) PREF_THICK = Blender.Draw.Create(0.005)
PREF_SOLID = Blender.Draw.Create(1) PREF_SOLID = Blender.Draw.Create(1)
@ -259,16 +270,10 @@ def main():
] ]
if not Blender.Draw.PupBlock('Solid Wireframe', pup_block): if not Blender.Draw.PupBlock('Solid Wireframe', pup_block):
if is_editmode: Window.EditMode(1)
return return
# Saves the editmode state and go's out of
# editmode if its enabled, we cant make
# changes to the mesh data while in editmode.
is_editmode = Window.EditMode()
Window.EditMode(0)
Window.WaitCursor(1) Window.WaitCursor(1)
me = ob_act.getData(mesh=1) # old NMesh api is default
t = sys.time() t = sys.time()
# Run the mesh editing function # Run the mesh editing function

@ -103,7 +103,6 @@ def main():
if PREF_ALL_VGROUPS==-1: if PREF_ALL_VGROUPS==-1:
return return
print "sd", PREF_ALL_VGROUPS
Window.WaitCursor(1) Window.WaitCursor(1)
me = ob_act.getData(mesh=1) # old NMesh api is default me = ob_act.getData(mesh=1) # old NMesh api is default
t = sys.time() t = sys.time()

@ -64,8 +64,8 @@ void lattice_deform_verts(struct Object *laOb, struct Object *target,
int numVerts, char *vgroup); int numVerts, char *vgroup);
void armature_deform_verts(struct Object *armOb, struct Object *target, void armature_deform_verts(struct Object *armOb, struct Object *target,
struct DerivedMesh *dm, float (*vertexCos)[3], struct DerivedMesh *dm, float (*vertexCos)[3],
float (*defMats)[3][3], int numVerts, float (*defMats)[3][3], int numVerts, int deformflag,
int deformflag, const char *defgrp_name); float (*prevCos)[3], const char *defgrp_name);
float (*lattice_getVertexCos(struct Object *ob, int *numVerts_r))[3]; float (*lattice_getVertexCos(struct Object *ob, int *numVerts_r))[3];
void lattice_applyVertexCos(struct Object *ob, float (*vertexCos)[3]); void lattice_applyVertexCos(struct Object *ob, float (*vertexCos)[3]);
void lattice_calc_modifiers(struct Object *ob); void lattice_calc_modifiers(struct Object *ob);

@ -790,7 +790,8 @@ static void pchan_bone_deform(bPoseChannel *pchan, float weight, float *vec, Dua
void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm, void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm,
float (*vertexCos)[3], float (*defMats)[3][3], float (*vertexCos)[3], float (*defMats)[3][3],
int numVerts, int deformflag, const char *defgrp_name) int numVerts, int deformflag,
float (*prevCos)[3], const char *defgrp_name)
{ {
bPoseChannel *pchan, **defnrToPC = NULL; bPoseChannel *pchan, **defnrToPC = NULL;
MDeformVert *dverts = NULL; MDeformVert *dverts = NULL;
@ -800,6 +801,7 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm,
int use_envelope = deformflag & ARM_DEF_ENVELOPE; int use_envelope = deformflag & ARM_DEF_ENVELOPE;
int use_quaternion = deformflag & ARM_DEF_QUATERNION; int use_quaternion = deformflag & ARM_DEF_QUATERNION;
int bbone_rest_def = deformflag & ARM_DEF_B_BONE_REST; int bbone_rest_def = deformflag & ARM_DEF_B_BONE_REST;
int invert_vgroup= deformflag & ARM_DEF_INVERT_VGROUP;
int numGroups = 0; /* safety for vertexgroup index overflow */ int numGroups = 0; /* safety for vertexgroup index overflow */
int i, target_totvert = 0; /* safety for vertexgroup overflow */ int i, target_totvert = 0; /* safety for vertexgroup overflow */
int use_dverts = 0; int use_dverts = 0;
@ -881,11 +883,12 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm,
for(i = 0; i < numVerts; i++) { for(i = 0; i < numVerts; i++) {
MDeformVert *dvert; MDeformVert *dvert;
DualQuat sumdq, *dq = NULL; DualQuat sumdq, *dq = NULL;
float *co = vertexCos[i], dco[3]; float *co, dco[3];
float sumvec[3], summat[3][3]; float sumvec[3], summat[3][3];
float *vec = NULL, (*smat)[3] = NULL; float *vec = NULL, (*smat)[3] = NULL;
float contrib = 0.0f; float contrib = 0.0f;
float armature_weight = 1.0f; /* default to 1 if no overall def group */ float armature_weight = 1.0f; /* default to 1 if no overall def group */
float prevco_weight = 1.0f; /* weight for optional cached vertexcos */
int j; int j;
if(use_quaternion) { if(use_quaternion) {
@ -917,11 +920,22 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm,
break; break;
} }
} }
/* hackish: the blending factor can be used for blending with prevCos too */
if(prevCos) {
if(invert_vgroup)
prevco_weight= 1.0f-armature_weight;
else
prevco_weight= armature_weight;
armature_weight= 1.0f;
}
} }
/* check if there's any point in calculating for this vert */ /* check if there's any point in calculating for this vert */
if(armature_weight == 0.0f) continue; if(armature_weight == 0.0f) continue;
/* get the coord we work on */
co= prevCos?prevCos[i]:vertexCos[i];
/* Apply the object's matrix */ /* Apply the object's matrix */
Mat4MulVecfl(premat, co); Mat4MulVecfl(premat, co);
@ -1005,6 +1019,15 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm,
/* always, check above code */ /* always, check above code */
Mat4MulVecfl(postmat, co); Mat4MulVecfl(postmat, co);
/* interpolate with previous modifier position using weight group */
if(prevCos) {
float mw= 1.0f - prevco_weight;
vertexCos[i][0]= prevco_weight*vertexCos[i][0] + mw*co[0];
vertexCos[i][1]= prevco_weight*vertexCos[i][1] + mw*co[1];
vertexCos[i][2]= prevco_weight*vertexCos[i][2] + mw*co[2];
}
} }
if(dualquats) MEM_freeN(dualquats); if(dualquats) MEM_freeN(dualquats);
@ -1865,12 +1888,42 @@ static void where_is_ik_bone(bPoseChannel *pchan, float ik_mat[][3]) // nr = t
static void do_strip_modifiers(Object *armob, Bone *bone, bPoseChannel *pchan) static void do_strip_modifiers(Object *armob, Bone *bone, bPoseChannel *pchan)
{ {
bActionModifier *amod; bActionModifier *amod;
bActionStrip *strip; bActionStrip *strip, *strip2;
float scene_cfra= G.scene->r.cfra; float scene_cfra= G.scene->r.cfra;
int do_modif;
for (strip=armob->nlastrips.first; strip; strip=strip->next) { for (strip=armob->nlastrips.first; strip; strip=strip->next) {
if(scene_cfra>=strip->start && scene_cfra<=strip->end) { do_modif=0;
if (scene_cfra>=strip->start && scene_cfra<=strip->end)
do_modif=1;
if ((scene_cfra > strip->end) && (strip->flag & ACTSTRIP_HOLDLASTFRAME)) {
do_modif=1;
/* if there are any other strips active, ignore modifiers for this strip -
* 'hold' option should only hold action modifiers if there are
* no other active strips */
for (strip2=strip->next; strip2; strip2=strip2->next) {
if (strip2 == strip) continue;
if (scene_cfra>=strip2->start && scene_cfra<=strip2->end) {
if (!(strip2->flag & ACTSTRIP_MUTE))
do_modif=0;
}
}
/* if there are any later, activated, strips with 'hold' set, they take precedence,
* so ignore modifiers for this strip */
for (strip2=strip->next; strip2; strip2=strip2->next) {
if (scene_cfra < strip2->start) continue;
if ((strip2->flag & ACTSTRIP_HOLDLASTFRAME) && !(strip2->flag & ACTSTRIP_MUTE)) {
do_modif=0;
}
}
}
if (do_modif) {
/* temporal solution to prevent 2 strips accumulating */ /* temporal solution to prevent 2 strips accumulating */
if(scene_cfra==strip->end && strip->next && strip->next->start==scene_cfra) if(scene_cfra==strip->end && strip->next && strip->next->start==scene_cfra)
continue; continue;

@ -680,11 +680,15 @@ static void do_rel_key(int start, int end, int tot, char *basispoin, Key *key, i
/* only with value, and no difference allowed */ /* only with value, and no difference allowed */
if(icuval!=0.0f && kb->totelem==tot) { if(icuval!=0.0f && kb->totelem==tot) {
KeyBlock *refb;
float weight, *weights= kb->weights; float weight, *weights= kb->weights;
poin= basispoin; poin= basispoin;
reffrom= key->refkey->data;
from= kb->data; from= kb->data;
/* reference now can be any block */
refb= BLI_findlink(&key->block, kb->relative);
if(refb==NULL) continue;
reffrom= refb->data;
poin+= start*ofs[0]; poin+= start*ofs[0];
reffrom+= key->elemsize*start; // key elemsize yes! reffrom+= key->elemsize*start; // key elemsize yes!

@ -241,12 +241,29 @@ static void latticeModifier_updateDepgraph(ModifierData *md, DagForest *forest,
} }
} }
static void modifier_vgroup_cache(ModifierData *md, float (*vertexCos)[3])
{
md= md->next;
if(md) {
if(md->type==eModifierType_Armature) {
ArmatureModifierData *amd = (ArmatureModifierData*) md;
if(amd->multi)
amd->prevCos= MEM_dupallocN(vertexCos);
}
/* lattice/mesh modifier too */
}
}
static void latticeModifier_deformVerts( static void latticeModifier_deformVerts(
ModifierData *md, Object *ob, DerivedMesh *derivedData, ModifierData *md, Object *ob, DerivedMesh *derivedData,
float (*vertexCos)[3], int numVerts) float (*vertexCos)[3], int numVerts)
{ {
LatticeModifierData *lmd = (LatticeModifierData*) md; LatticeModifierData *lmd = (LatticeModifierData*) md;
modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
lattice_deform_verts(lmd->object, ob, derivedData, lattice_deform_verts(lmd->object, ob, derivedData,
vertexCos, numVerts, lmd->name); vertexCos, numVerts, lmd->name);
} }
@ -4667,8 +4684,16 @@ static void armatureModifier_deformVerts(
{ {
ArmatureModifierData *amd = (ArmatureModifierData*) md; ArmatureModifierData *amd = (ArmatureModifierData*) md;
modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
armature_deform_verts(amd->object, ob, derivedData, vertexCos, NULL, armature_deform_verts(amd->object, ob, derivedData, vertexCos, NULL,
numVerts, amd->deformflag, amd->defgrp_name); numVerts, amd->deformflag,
amd->prevCos, amd->defgrp_name);
/* free cache */
if(amd->prevCos) {
MEM_freeN(amd->prevCos);
amd->prevCos= NULL;
}
} }
static void armatureModifier_deformVertsEM( static void armatureModifier_deformVertsEM(
@ -4681,7 +4706,7 @@ static void armatureModifier_deformVertsEM(
if(!derivedData) dm = CDDM_from_editmesh(editData, ob->data); if(!derivedData) dm = CDDM_from_editmesh(editData, ob->data);
armature_deform_verts(amd->object, ob, dm, vertexCos, NULL, numVerts, armature_deform_verts(amd->object, ob, dm, vertexCos, NULL, numVerts,
amd->deformflag, amd->defgrp_name); amd->deformflag, NULL, amd->defgrp_name);
if(!derivedData) dm->release(dm); if(!derivedData) dm->release(dm);
} }
@ -4697,7 +4722,7 @@ static void armatureModifier_deformMatricesEM(
if(!derivedData) dm = CDDM_from_editmesh(editData, ob->data); if(!derivedData) dm = CDDM_from_editmesh(editData, ob->data);
armature_deform_verts(amd->object, ob, dm, vertexCos, defMats, numVerts, armature_deform_verts(amd->object, ob, dm, vertexCos, defMats, numVerts,
amd->deformflag, amd->defgrp_name); amd->deformflag, NULL, amd->defgrp_name);
if(!derivedData) dm->release(dm); if(!derivedData) dm->release(dm);
} }
@ -5494,6 +5519,8 @@ static void meshdeformModifier_deformVerts(
else else
dm= derivedData; dm= derivedData;
modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
meshdeformModifier_do(md, ob, dm, vertexCos, numVerts); meshdeformModifier_do(md, ob, dm, vertexCos, numVerts);
if(dm != derivedData) if(dm != derivedData)

@ -1178,6 +1178,8 @@ void object_make_proxy(Object *ob, Object *target, Object *gob)
VECCOPY(ob->loc, gob->loc); VECCOPY(ob->loc, gob->loc);
VECCOPY(ob->rot, gob->rot); VECCOPY(ob->rot, gob->rot);
VECCOPY(ob->size, gob->size); VECCOPY(ob->size, gob->size);
group_tag_recalc(gob->dup_group);
} }
else { else {
VECCOPY(ob->loc, target->loc); VECCOPY(ob->loc, target->loc);

@ -0,0 +1,69 @@
/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@prep.ai.mit.edu.
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, 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. */
#ifndef _FNMATCH_H
#define _FNMATCH_H 1
#ifdef __cplusplus
extern "C" {
#endif
#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
#undef __P
#define __P(protos) protos
#else /* Not C++ or ANSI C. */
#undef __P
#define __P(protos) ()
/* We can get away without defining `const' here only because in this file
it is used only inside the prototype for `fnmatch', which is elided in
non-ANSI C where `const' is problematical. */
#endif /* C++ or ANSI C. */
/* We #undef these before defining them because some losing systems
(HP-UX A.08.07 for example) define these in <unistd.h>. */
#undef FNM_PATHNAME
#undef FNM_NOESCAPE
#undef FNM_PERIOD
/* Bits set in the FLAGS argument to `fnmatch'. */
#define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */
#define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */
#define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */
#if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_GNU_SOURCE)
#define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */
#define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */
#define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */
#endif
/* Value returned by `fnmatch' if STRING does not match PATTERN. */
#define FNM_NOMATCH 1
/* Match STRING against the filename pattern PATTERN,
returning zero if it matches, FNM_NOMATCH if not. */
extern int fnmatch __P ((const char *__pattern, const char *__string,
int __flags));
#ifdef __cplusplus
}
#endif
#endif /* fnmatch.h */

@ -0,0 +1,250 @@
/* Copyright (C) 1991, 1992, 1993, 1996, 1997 Free Software Foundation, Inc.
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, 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. */
#ifdef WIN32
#if HAVE_CONFIG_H
# include <config.h>
#endif
/* Enable GNU extensions in fnmatch.h. */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
#include <errno.h>
#include <BLI_fnmatch.h>
#include <ctype.h>
/* Comment out all this code if we are using the GNU C Library, and are not
actually compiling the library itself. This code is part of the GNU C
Library, but also included in many other GNU distributions. Compiling
and linking in this code is a waste when using the GNU C library
(especially if it is a shared library). Rather than having every GNU
program understand `configure --with-gnu-libc' and omit the object files,
it is simpler to just do this in the source for each such file. */
#if defined _LIBC || !defined __GNU_LIBRARY__
# if defined STDC_HEADERS || !defined isascii
# define ISASCII(c) 1
# else
# define ISASCII(c) isascii(c)
# endif
# define ISUPPER(c) (ISASCII (c) && isupper (c))
# ifndef errno
extern int errno;
# endif
/* Match STRING against the filename pattern PATTERN, returning zero if
it matches, nonzero if not. */
int
fnmatch (const char *pattern, const char *string, int flags)
{
register const char *p = pattern, *n = string;
register char c;
/* Note that this evaluates C many times. */
# define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c) : (c))
while ((c = *p++) != '\0')
{
c = FOLD (c);
switch (c)
{
case '?':
if (*n == '\0')
return FNM_NOMATCH;
else if ((flags & FNM_FILE_NAME) && *n == '/')
return FNM_NOMATCH;
else if ((flags & FNM_PERIOD) && *n == '.' &&
(n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/')))
return FNM_NOMATCH;
break;
case '\\':
if (!(flags & FNM_NOESCAPE))
{
c = *p++;
if (c == '\0')
/* Trailing \ loses. */
return FNM_NOMATCH;
c = FOLD (c);
}
if (FOLD (*n) != c)
return FNM_NOMATCH;
break;
case '*':
if ((flags & FNM_PERIOD) && *n == '.' &&
(n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/')))
return FNM_NOMATCH;
for (c = *p++; c == '?' || c == '*'; c = *p++)
{
if ((flags & FNM_FILE_NAME) && *n == '/')
/* A slash does not match a wildcard under FNM_FILE_NAME. */
return FNM_NOMATCH;
else if (c == '?')
{
/* A ? needs to match one character. */
if (*n == '\0')
/* There isn't another character; no match. */
return FNM_NOMATCH;
else
/* One character of the string is consumed in matching
this ? wildcard, so *??? won't match if there are
less than three characters. */
++n;
}
}
if (c == '\0')
return 0;
{
char c1 = (!(flags & FNM_NOESCAPE) && c == '\\') ? *p : c;
c1 = FOLD (c1);
for (--p; *n != '\0'; ++n)
if ((c == '[' || FOLD (*n) == c1) &&
fnmatch (p, n, flags & ~FNM_PERIOD) == 0)
return 0;
return FNM_NOMATCH;
}
case '[':
{
/* Nonzero if the sense of the character class is inverted. */
register int not;
if (*n == '\0')
return FNM_NOMATCH;
if ((flags & FNM_PERIOD) && *n == '.' &&
(n == string || ((flags & FNM_FILE_NAME) && n[-1] == '/')))
return FNM_NOMATCH;
not = (*p == '!' || *p == '^');
if (not)
++p;
c = *p++;
for (;;)
{
register char cstart = c, cend = c;
if (!(flags & FNM_NOESCAPE) && c == '\\')
{
if (*p == '\0')
return FNM_NOMATCH;
cstart = cend = *p++;
}
cstart = cend = FOLD (cstart);
if (c == '\0')
/* [ (unterminated) loses. */
return FNM_NOMATCH;
c = *p++;
c = FOLD (c);
if ((flags & FNM_FILE_NAME) && c == '/')
/* [/] can never match. */
return FNM_NOMATCH;
if (c == '-' && *p != ']')
{
cend = *p++;
if (!(flags & FNM_NOESCAPE) && cend == '\\')
cend = *p++;
if (cend == '\0')
return FNM_NOMATCH;
cend = FOLD (cend);
c = *p++;
}
if (FOLD (*n) >= cstart && FOLD (*n) <= cend)
goto matched;
if (c == ']')
break;
}
if (!not)
return FNM_NOMATCH;
break;
matched:;
/* Skip the rest of the [...] that already matched. */
while (c != ']')
{
if (c == '\0')
/* [... (unterminated) loses. */
return FNM_NOMATCH;
c = *p++;
if (!(flags & FNM_NOESCAPE) && c == '\\')
{
if (*p == '\0')
return FNM_NOMATCH;
/* XXX 1003.2d11 is unclear if this is right. */
++p;
}
}
if (not)
return FNM_NOMATCH;
}
break;
default:
if (c != FOLD (*n))
return FNM_NOMATCH;
}
++n;
}
if (*n == '\0')
return 0;
if ((flags & FNM_LEADING_DIR) && *n == '/')
/* The FNM_LEADING_DIR flag says that "foo*" matches "foobar/frobozz". */
return 0;
return FNM_NOMATCH;
# undef FOLD
}
#endif /* _LIBC or not __GNU_LIBRARY__. */
#else
static void BLI_FNMATCH_C_IS_EMPTY_FOR_UNIX(void)
{
/*intentionally empty*/
}
#endif /* WIN32 */

@ -3226,7 +3226,6 @@ static void direct_link_scene(FileData *fd, Scene *sce)
Editing *ed; Editing *ed;
Sequence *seq; Sequence *seq;
MetaStack *ms; MetaStack *ms;
StripElem *se;
int a; int a;
sce->theDag = NULL; sce->theDag = NULL;
@ -3262,8 +3261,6 @@ static void direct_link_scene(FileData *fd, Scene *sce)
/* a patch: after introduction of effects with 3 input strips */ /* a patch: after introduction of effects with 3 input strips */
if(seq->seq3==0) seq->seq3= seq->seq2; if(seq->seq3==0) seq->seq3= seq->seq2;
seq->curelem= 0;
seq->plugin= newdataadr(fd, seq->plugin); seq->plugin= newdataadr(fd, seq->plugin);
seq->effectdata= newdataadr(fd, seq->effectdata); seq->effectdata= newdataadr(fd, seq->effectdata);
@ -3274,59 +3271,17 @@ static void direct_link_scene(FileData *fd, Scene *sce)
seq->strip= newdataadr(fd, seq->strip); seq->strip= newdataadr(fd, seq->strip);
if(seq->strip && seq->strip->done==0) { if(seq->strip && seq->strip->done==0) {
seq->strip->done= 1; seq->strip->done= 1;
seq->strip->tstripdata = 0;
/* standard: strips from effects/metas are not written, but are mallocced */ if(seq->type == SEQ_IMAGE ||
seq->type == SEQ_MOVIE ||
if(seq->type==SEQ_IMAGE) { seq->type == SEQ_RAM_SOUND ||
seq->strip->stripdata= newdataadr(fd, seq->strip->stripdata); seq->type == SEQ_HD_SOUND) {
se= seq->strip->stripdata; seq->strip->stripdata = newdataadr(
if(se) { fd, seq->strip->stripdata);
for(a=0; a<seq->strip->len; a++, se++) { } else {
se->ok= 1; seq->strip->stripdata = 0;
se->ibuf= 0;
}
}
} }
else if(seq->type==SEQ_MOVIE) {
/* only first stripelem is in file */
se= newdataadr(fd, seq->strip->stripdata);
if(se) {
seq->strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
*seq->strip->stripdata= *se;
MEM_freeN(se);
se= seq->strip->stripdata;
for(a=0; a<seq->strip->len; a++, se++) {
se->ok= 1;
se->ibuf= 0;
se->nr= a + 1;
}
}
}
else if(seq->type==SEQ_RAM_SOUND
|| seq->type == SEQ_HD_SOUND) {
/* only first stripelem is in file */
se= newdataadr(fd, seq->strip->stripdata);
if(se) {
seq->strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
*seq->strip->stripdata= *se;
MEM_freeN(se);
se= seq->strip->stripdata;
for(a=0; a<seq->strip->len; a++, se++) {
se->ok= 2; /* why? */
se->ibuf= 0;
se->nr= a + 1;
}
}
}
else if(seq->len>0)
seq->strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
} }
} }
END_SEQ END_SEQ

@ -37,6 +37,7 @@
struct PluginSeq; struct PluginSeq;
struct StripElem; struct StripElem;
struct TStripElem;
struct Strip; struct Strip;
struct Sequence; struct Sequence;
struct ListBase; struct ListBase;
@ -44,9 +45,9 @@ struct Editing;
struct ImBuf; struct ImBuf;
struct Scene; struct Scene;
void free_stripdata(int len, struct StripElem *se); void free_tstripdata(int len, struct TStripElem *se);
void free_strip(struct Strip *strip); void free_strip(struct Strip *strip);
void new_stripdata(struct Sequence *seq); void new_tstripdata(struct Sequence *seq);
void free_sequence(struct Sequence *seq); void free_sequence(struct Sequence *seq);
void build_seqar(struct ListBase *seqbase, struct Sequence ***seqar, int *totseq); void build_seqar(struct ListBase *seqbase, struct Sequence ***seqar, int *totseq);
void free_editing(struct Editing *ed); void free_editing(struct Editing *ed);
@ -57,17 +58,20 @@ void clear_scene_in_allseqs(struct Scene *sce);
int evaluate_seq_frame(int cfra); int evaluate_seq_frame(int cfra);
struct StripElem *give_stripelem(struct Sequence *seq, int cfra); struct StripElem *give_stripelem(struct Sequence *seq, int cfra);
struct TStripElem *give_tstripelem(struct Sequence *seq, int cfra);
void set_meta_stripdata(struct Sequence *seqm); void set_meta_stripdata(struct Sequence *seqm);
struct ImBuf *give_ibuf_seq(int rectx, int recty, int cfra, int chansel); struct ImBuf *give_ibuf_seq(int rectx, int recty, int cfra, int chansel);
/* chansel: render this channel. Default=0 (renders end result)*/ /* chansel: render this channel. Default=0 (renders end result)*/
struct ImBuf *give_ibuf_seq_direct(int rectx, int recty, int cfra,
struct Sequence * seq);
/* sequence prefetch API */ /* sequence prefetch API */
void seq_start_threads(); void seq_start_threads();
void seq_stop_threads(); void seq_stop_threads();
void give_ibuf_prefetch_request(int rectx, int recty, int cfra, int chanshown); void give_ibuf_prefetch_request(int rectx, int recty, int cfra, int chanshown);
void seq_wait_for_prefetch_ready(); void seq_wait_for_prefetch_ready();
struct ImBuf * give_ibuf_threaded(int rectx, int recty, int cfra, struct ImBuf * give_ibuf_seq_threaded(int rectx, int recty, int cfra,
int chanshown); int chanshown);
void free_imbuf_seq_except(int cfra); void free_imbuf_seq_except(int cfra);

@ -112,10 +112,11 @@ typedef struct bArmature {
#define ARM_ENVELOPE 3 #define ARM_ENVELOPE 3
/* armature->deformflag */ /* armature->deformflag */
#define ARM_DEF_VGROUP 1 #define ARM_DEF_VGROUP 1
#define ARM_DEF_ENVELOPE 2 #define ARM_DEF_ENVELOPE 2
#define ARM_DEF_QUATERNION 4 #define ARM_DEF_QUATERNION 4
#define ARM_DEF_B_BONE_REST 8 #define ARM_DEF_B_BONE_REST 8
#define ARM_DEF_INVERT_VGROUP 16
/* armature->pathflag */ /* armature->pathflag */
#define ARM_PATH_FNUMS (1<<0) #define ARM_PATH_FNUMS (1<<0)

@ -44,8 +44,8 @@ typedef struct KeyBlock {
float pos; float pos;
float curval; float curval;
short type, adrcode; short type, adrcode, relative, pad1; /* relative == 0 means first key is reference */
int totelem; int totelem, pad2;
void *data; void *data;
float *weights; float *weights;

@ -316,9 +316,10 @@ typedef struct WaveModifierData {
typedef struct ArmatureModifierData { typedef struct ArmatureModifierData {
ModifierData modifier; ModifierData modifier;
short deformflag, pad1; /* deformflag replaces armature->deformflag */ short deformflag, multi; /* deformflag replaces armature->deformflag */
int pad2; int pad2;
struct Object *object; struct Object *object;
float *prevCos; /* stored input of previous modifier, for vertexgroup blending */
char defgrp_name[32]; char defgrp_name[32];
} ArmatureModifierData; } ArmatureModifierData;

@ -46,12 +46,15 @@ struct Scene;
typedef struct StripElem { typedef struct StripElem {
char name[80]; char name[80];
} StripElem;
typedef struct TStripElem {
struct ImBuf *ibuf; struct ImBuf *ibuf;
struct StripElem *se1, *se2, *se3; struct TStripElem *se1, *se2, *se3;
short ok; short ok;
short pad; short pad;
int nr; int nr;
} StripElem; } TStripElem;
typedef struct Strip { typedef struct Strip {
struct Strip *next, *prev; struct Strip *next, *prev;
@ -59,6 +62,7 @@ typedef struct Strip {
StripElem *stripdata; StripElem *stripdata;
char dir[160]; char dir[160];
int orx, ory; int orx, ory;
TStripElem *tstripdata;
} Strip; } Strip;
@ -87,7 +91,6 @@ typedef struct PluginSeq {
/* WATCH IT: first part identical to ID (for use in ipo's) */ /* WATCH IT: first part identical to ID (for use in ipo's) */
typedef struct Sequence { typedef struct Sequence {
struct Sequence *next, *prev; struct Sequence *next, *prev;
void *tmp; /* tmp var for copying, and tagging for linked selection */ void *tmp; /* tmp var for copying, and tagging for linked selection */
void *lib; /* needed (to be like ipo), else it will raise libdata warnings, this should never be used */ void *lib; /* needed (to be like ipo), else it will raise libdata warnings, this should never be used */
@ -104,7 +107,6 @@ typedef struct Sequence {
int sfra; /* starting frame according to the timeline of the scene. */ int sfra; /* starting frame according to the timeline of the scene. */
Strip *strip; Strip *strip;
StripElem *curelem; /* reference the current frame - value from give_stripelem */
struct Ipo *ipo; struct Ipo *ipo;
struct Scene *scene; struct Scene *scene;
@ -234,6 +236,9 @@ typedef struct SpeedControlVars {
#define SEQ_COLOR 28 #define SEQ_COLOR 28
#define SEQ_SPEED 29 #define SEQ_SPEED 29
#define STRIPELEM_FAILED 0
#define STRIPELEM_OK 1
#define STRIPELEM_META 2
#endif #endif

@ -5004,6 +5004,7 @@ static PyObject *MFaceSeq_extend( BPy_MEdgeSeq * self, PyObject *args,
Mesh *mesh = self->mesh; Mesh *mesh = self->mesh;
int ignore_dups = 0; int ignore_dups = 0;
PyObject *return_list = NULL; PyObject *return_list = NULL;
char flag = ME_FACE_SEL;
/* before we try to add faces, add edges; if it fails; exit */ /* before we try to add faces, add edges; if it fails; exit */
@ -5034,6 +5035,20 @@ static PyObject *MFaceSeq_extend( BPy_MEdgeSeq * self, PyObject *args,
return_list = PyList_New( 0 ); return_list = PyList_New( 0 );
} }
} }
res = PyDict_GetItemString( keywds, "smooth" );
if (res) {
switch( PyObject_IsTrue( res ) ) {
case 0:
break;
case -1:
return EXPP_ReturnPyObjError( PyExc_TypeError,
"keyword argument \"smooth\" expected True/False or 0/1" );
default:
flag |= ME_SMOOTH;
}
}
} }
/* make sure we get a tuple of sequences of something */ /* make sure we get a tuple of sequences of something */
@ -5319,7 +5334,7 @@ static PyObject *MFaceSeq_extend( BPy_MEdgeSeq * self, PyObject *args,
tmpface->v3 = tmppair->v[index[2]]; tmpface->v3 = tmppair->v[index[2]];
tmpface->v4 = tmppair->v[index[3]]; tmpface->v4 = tmppair->v[index[3]];
tmpface->flag = ME_FACE_SEL; tmpface->flag = flag;
if( return_list ) { if( return_list ) {
tmp = PyInt_FromLong( mesh->totface ); tmp = PyInt_FromLong( mesh->totface );
@ -6409,6 +6424,10 @@ static PyObject *Mesh_removeVertGroup( PyObject * self, PyObject * value )
int nIndex; int nIndex;
bDeformGroup *pGroup; bDeformGroup *pGroup;
if( G.obedit )
return EXPP_ReturnPyObjError(PyExc_RuntimeError,
"can't use removeVertGroup() while in edit mode" );
if( !groupStr ) if( !groupStr )
return EXPP_ReturnPyObjError( PyExc_TypeError, return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected string argument" ); "expected string argument" );
@ -6431,7 +6450,7 @@ static PyObject *Mesh_removeVertGroup( PyObject * self, PyObject * value )
nIndex++; nIndex++;
object->actdef = (unsigned short)nIndex; object->actdef = (unsigned short)nIndex;
del_defgroup( object ); del_defgroup_in_object_mode( object );
EXPP_allqueue( REDRAWBUTSALL, 1 ); EXPP_allqueue( REDRAWBUTSALL, 1 );
@ -7585,7 +7604,7 @@ static int Mesh_setVerts( BPy_Mesh * self, PyObject * args )
free_mesh( me ); free_mesh( me );
me->mvert = NULL; me->medge = NULL; me->mface = NULL; me->mvert = NULL; me->medge = NULL; me->mface = NULL;
me->mtface = NULL; me->dvert = NULL; me->mcol = NULL; me->mtface = NULL; me->dvert = NULL; me->mcol = NULL;
me->msticky = NULL; me->mat = NULL; me->bb = NULL; me->msticky = NULL; me->mat = NULL; me->bb = NULL; me->mselect = NULL;
me->totvert = me->totedge = me->totface = me->totcol = 0; me->totvert = me->totedge = me->totface = me->totcol = 0;
mesh_update( me ); mesh_update( me );
return 0; return 0;

@ -61,6 +61,19 @@
#include "gen_utils.h" #include "gen_utils.h"
#include "Armature.h" #include "Armature.h"
/* Pivot Types
-0 for Bounding Box Center; \n\
-1 for 3D Cursor\n\
-2 for Individual Centers\n\
-3 for Median Point\n\
-4 for Active Object"; */
#define PIVOT_BOUNDBOX 0
#define PIVOT_CURSOR 1
#define PIVOT_INDIVIDUAL 2
#define PIVOT_MEDIAN 3
#define PIVOT_ACTIVE 4
/* See Draw.c */ /* See Draw.c */
extern int EXPP_disable_force_draw; extern int EXPP_disable_force_draw;
extern void setcameratoview3d(void); extern void setcameratoview3d(void);
@ -106,6 +119,9 @@ static PyObject *M_Window_GetScreens( PyObject * self );
static PyObject *M_Window_SetScreen( PyObject * self, PyObject * value ); static PyObject *M_Window_SetScreen( PyObject * self, PyObject * value );
static PyObject *M_Window_GetScreenInfo( PyObject * self, PyObject * args, static PyObject *M_Window_GetScreenInfo( PyObject * self, PyObject * args,
PyObject * kwords ); PyObject * kwords );
static PyObject *M_Window_GetPivot( PyObject * self );
static PyObject *M_Window_SetPivot( PyObject * self, PyObject * value );
PyObject *Window_Init( void ); PyObject *Window_Init( void );
@ -287,6 +303,18 @@ Each dictionary has keys:\n\
'win': window type, see Blender.Window.Types dict;\n\ 'win': window type, see Blender.Window.Types dict;\n\
'id': area's id."; 'id': area's id.";
static char M_Window_SetPivot_doc[] =
"(Pivot) - Set Pivot Mode for 3D Viewport:\n\
Options are: \n\
-PivotTypes.BOUNDBOX for Bounding Box Center; \n\
-PivotTypes.CURSOR for 3D Cursor\n\
-PivotTypes.INDIVIDUAL for Individual Centers\n\
-PivotTypes.MEDIAN for Median Point\n\
-PivotTypes.ACTIVE for Active Object";
static char M_Window_GetPivot_doc[] =
"Return the pivot for the active 3d window";
/*****************************************************************************/ /*****************************************************************************/
/* Python method structure definition for Blender.Window module: */ /* Python method structure definition for Blender.Window module: */
/*****************************************************************************/ /*****************************************************************************/
@ -374,6 +402,10 @@ struct PyMethodDef M_Window_methods[] = {
M_Window_SetScreen_doc}, M_Window_SetScreen_doc},
{"GetScreenInfo", ( PyCFunction ) M_Window_GetScreenInfo, {"GetScreenInfo", ( PyCFunction ) M_Window_GetScreenInfo,
METH_VARARGS | METH_KEYWORDS, M_Window_GetScreenInfo_doc}, METH_VARARGS | METH_KEYWORDS, M_Window_GetScreenInfo_doc},
{"GetPivot", ( PyCFunction ) M_Window_GetPivot, METH_NOARGS,
M_Window_GetPivot_doc},
{"SetPivot", ( PyCFunction ) M_Window_SetPivot, METH_O,
M_Window_SetPivot_doc},
{NULL, NULL, 0, NULL} {NULL, NULL, 0, NULL}
}; };
@ -1454,12 +1486,38 @@ static PyObject *M_Window_GetScreenInfo( PyObject * self, PyObject * args,
return list; return list;
} }
static PyObject *M_Window_GetPivot( PyObject * self )
{
if (G.vd) {
return PyInt_FromLong( G.vd->around );
}
Py_RETURN_NONE;
}
static PyObject *M_Window_SetPivot( PyObject * self, PyObject * value)
{
short pivot;
if (G.vd) {
pivot = (short)PyInt_AsLong( value );
if ( pivot > 4 || pivot < 0 )
return EXPP_ReturnPyObjError( PyExc_AttributeError,
"Expected a constant from Window.PivotTypes" );
G.vd->around = pivot;
}
Py_RETURN_NONE;
}
/*****************************************************************************/ /*****************************************************************************/
/* Function: Window_Init */ /* Function: Window_Init */
/*****************************************************************************/ /*****************************************************************************/
PyObject *Window_Init( void ) PyObject *Window_Init( void )
{ {
PyObject *submodule, *Types, *Qual, *MButs, *dict; PyObject *submodule, *Types, *Qual, *MButs, *PivotTypes, *dict;
submodule = submodule =
Py_InitModule3( "Blender.Window", M_Window_methods, Py_InitModule3( "Blender.Window", M_Window_methods,
@ -1472,6 +1530,7 @@ PyObject *Window_Init( void )
Types = PyConstant_New( ); Types = PyConstant_New( );
Qual = PyConstant_New( ); Qual = PyConstant_New( );
MButs = PyConstant_New( ); MButs = PyConstant_New( );
PivotTypes = PyConstant_New( );
if( Types ) { if( Types ) {
BPy_constant *d = ( BPy_constant * ) Types; BPy_constant *d = ( BPy_constant * ) Types;
@ -1522,5 +1581,16 @@ PyObject *Window_Init( void )
PyModule_AddObject( submodule, "MButs", MButs ); PyModule_AddObject( submodule, "MButs", MButs );
} }
if( PivotTypes ) {
BPy_constant *d = ( BPy_constant * ) PivotTypes;
PyConstant_Insert(d, "BOUNDBOX", PyInt_FromLong( PIVOT_BOUNDBOX ) );
PyConstant_Insert(d, "CURSOR", PyInt_FromLong( PIVOT_CURSOR ) );
PyConstant_Insert(d, "MEDIAN", PyInt_FromLong( PIVOT_MEDIAN ) );
PyConstant_Insert(d, "ACTIVE", PyInt_FromLong( PIVOT_ACTIVE ) );
PyConstant_Insert(d, "INDIVIDUAL", PyInt_FromLong( PIVOT_INDIVIDUAL ) );
PyModule_AddObject( submodule, "PivotTypes", PivotTypes );
}
return submodule; return submodule;
} }

@ -115,9 +115,9 @@ class Curve:
@type resolv: int @type resolv: int
@ivar width: The Curve Data width [0 - 2]. @ivar width: The Curve Data width [0 - 2].
@type width: float @type width: float
@ivar ext1: The Curve Data extent1 (for bevels). @ivar ext1: The Curve Data extent1 Called "Extrude" in the user interface (for bevels only).
@type ext1: float @type ext1: float
@ivar ext2: The Curve Data extent2 (for bevels). @ivar ext2: The Curve Data extent2 - Called "Bevel Depth" in the user interface (for bevels only).
@type ext2: float @type ext2: float
@ivar loc: The Curve Data location(from the center). @ivar loc: The Curve Data location(from the center).
@type loc: list of 3 floats @type loc: list of 3 floats

@ -153,13 +153,13 @@ class Text3d:
@param width: The new text3d's width value. @param width: The new text3d's width value.
""" """
def getgetExtrudeDepth(): def getExtrudeDepth():
""" """
Get the text3d's ext1 value. Get the text3d's ext1 value.
@rtype: float @rtype: float
""" """
def setgetExtrudeDepth(ext1): def setExtrudeDepth(ext1):
""" """
Set the text3d's ext1 value. Set the text3d's ext1 value.
@rtype: None @rtype: None

@ -532,6 +532,8 @@ class MTex:
@ivar mtAmb: How texture maps to ambient value @ivar mtAmb: How texture maps to ambient value
@ivar mtDisp: How texture maps to displacement @ivar mtDisp: How texture maps to displacement
@ivar mtWarp: How texture maps to warp @ivar mtWarp: How texture maps to warp
@ivar uvlayer: The name of the UV Layer this texture is mapped to (when left blank uses render layer)
@type uvlayer: string
""" """
def getIpo(): def getIpo():

@ -210,6 +210,20 @@ def SetCursorPos (coords):
can be done with L{Redraw}. can be done with L{Redraw}.
""" """
def GetPivot ():
"""
Get the pivot for the active 3D view.
@rtype: int
@return: constant - Window.PivotTypes
"""
def SetPivot (pivot):
"""
Set the pivot on the active 3D view.
@type pivot: int
@param pivot: constant - Window.PivotTypes
"""
def WaitCursor (bool): def WaitCursor (bool):
""" """
Set cursor to wait or back to normal mode. Set cursor to wait or back to normal mode.

@ -156,7 +156,6 @@ static PyObject *NewSeq_internal(ListBase *seqbase, PyObject * args, Scene *sce)
for(a=0; a<seq->len; a++) { for(a=0; a<seq->len; a++) {
name = PyString_AsString(PyList_GetItem( list, a )); name = PyString_AsString(PyList_GetItem( list, a ));
strncpy(se->name, name, FILE_MAXFILE-1); strncpy(se->name, name, FILE_MAXFILE-1);
se->ok= 1;
se++; se++;
} }
@ -179,17 +178,11 @@ static PyObject *NewSeq_internal(ListBase *seqbase, PyObject * args, Scene *sce)
strip->len= totframe; strip->len= totframe;
strip->us= 1; strip->us= 1;
strncpy(strip->dir, sound->name, FILE_MAXDIR-1); strncpy(strip->dir, sound->name, FILE_MAXDIR-1);
strip->stripdata= se= MEM_callocN(totframe*sizeof(StripElem), "stripelem"); strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem");
/* name sound in first strip */ /* name sound in first strip */
strncpy(se->name, sound->name, FILE_MAXFILE-1); strncpy(se->name, sound->name, FILE_MAXFILE-1);
for(a=1; a<=totframe; a++, se++) {
se->ok= 2; /* why? */
se->ibuf= 0;
se->nr= a;
}
} else if (BPy_Scene_Check(py_data)) { } else if (BPy_Scene_Check(py_data)) {
/* scene */ /* scene */
Scene *sce = ((BPy_Scene *)py_data)->scene; Scene *sce = ((BPy_Scene *)py_data)->scene;
@ -205,8 +198,6 @@ static PyObject *NewSeq_internal(ListBase *seqbase, PyObject * args, Scene *sce)
sizeof(seq->name) - 2); sizeof(seq->name) - 2);
strip->len= seq->len; strip->len= seq->len;
strip->us= 1; strip->us= 1;
if(seq->len>0) strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
} else { } else {
/* movie, pydata is a path to a movie file */ /* movie, pydata is a path to a movie file */
char *name = PyString_AsString ( py_data ); char *name = PyString_AsString ( py_data );

@ -1647,7 +1647,7 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco
if(wmd->flag & MOD_WAVE_NORM) if(wmd->flag & MOD_WAVE_NORM)
height += 19; height += 19;
} else if (md->type==eModifierType_Armature) { } else if (md->type==eModifierType_Armature) {
height = 86; height = 105;
} else if (md->type==eModifierType_Hook) { } else if (md->type==eModifierType_Hook) {
HookModifierData *hmd = (HookModifierData*) md; HookModifierData *hmd = (HookModifierData*) md;
height = 86; height = 86;
@ -1978,12 +1978,17 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco
ArmatureModifierData *amd = (ArmatureModifierData*) md; ArmatureModifierData *amd = (ArmatureModifierData*) md;
uiDefIDPoinBut(block, modifier_testArmatureObj, ID_OB, B_CHANGEDEP, "Ob: ", lx, (cy-=19), buttonWidth,19, &amd->object, "Armature object to deform with"); uiDefIDPoinBut(block, modifier_testArmatureObj, ID_OB, B_CHANGEDEP, "Ob: ", lx, (cy-=19), buttonWidth,19, &amd->object, "Armature object to deform with");
but=uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ", lx, (cy-=19), buttonWidth,19, &amd->defgrp_name, 0.0, 31.0, 0, 0, "Vertex Group name to control overall armature influence"); but=uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ", lx, (cy-=19), buttonWidth-40,19, &amd->defgrp_name, 0.0, 31.0, 0, 0, "Vertex Group name to control overall armature influence");
uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)ob); uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)ob);
uiDefButBitS(block, TOG, ARM_DEF_INVERT_VGROUP, B_ARM_RECALCDATA, "Inv", lx+buttonWidth-40,cy, 40, 20, &amd->deformflag, 0, 0, 0, 0, "Invert vertex group influence");
uiDefButBitS(block, TOG, ARM_DEF_VGROUP, B_ARM_RECALCDATA, "Vert.Groups", lx,cy-=19,buttonWidth/2,20, &amd->deformflag, 0, 0, 0, 0, "Enable VertexGroups defining deform"); uiDefButBitS(block, TOG, ARM_DEF_VGROUP, B_ARM_RECALCDATA, "Vert.Groups", lx,cy-=19,buttonWidth/2,20, &amd->deformflag, 0, 0, 0, 0, "Enable VertexGroups defining deform");
uiDefButBitS(block, TOG, ARM_DEF_ENVELOPE, B_ARM_RECALCDATA, "Envelopes", lx+buttonWidth/2,cy,(buttonWidth + 1)/2,20, &amd->deformflag, 0, 0, 0, 0, "Enable Bone Envelopes defining deform"); uiDefButBitS(block, TOG, ARM_DEF_ENVELOPE, B_ARM_RECALCDATA, "Envelopes", lx+buttonWidth/2,cy,(buttonWidth + 1)/2,20, &amd->deformflag, 0, 0, 0, 0, "Enable Bone Envelopes defining deform");
uiDefButBitS(block, TOG, ARM_DEF_QUATERNION, B_ARM_RECALCDATA, "Quaternion", lx,(cy-=19),buttonWidth/2,20, &amd->deformflag, 0, 0, 0, 0, "Enable deform rotation interpolation with Quaternions"); uiDefButBitS(block, TOG, ARM_DEF_QUATERNION, B_ARM_RECALCDATA, "Quaternion", lx,(cy-=19),buttonWidth/2,20, &amd->deformflag, 0, 0, 0, 0, "Enable deform rotation interpolation with Quaternions");
uiDefButBitS(block, TOG, ARM_DEF_B_BONE_REST, B_ARM_RECALCDATA, "B-Bone Rest", lx+buttonWidth/2,cy,(buttonWidth + 1)/2,20, &amd->deformflag, 0, 0, 0, 0, "Make B-Bones deform already in rest position"); uiDefButBitS(block, TOG, ARM_DEF_B_BONE_REST, B_ARM_RECALCDATA, "B-Bone Rest", lx+buttonWidth/2,cy,(buttonWidth + 1)/2,20, &amd->deformflag, 0, 0, 0, 0, "Make B-Bones deform already in rest position");
uiDefButS(block, TOG, B_ARM_RECALCDATA, "MultiModifier", lx,cy-=19, buttonWidth, 20, &amd->multi, 0, 0, 0, 0, "Use same input as previous modifier, and mix results using overall vgroup");
} else if (md->type==eModifierType_Hook) { } else if (md->type==eModifierType_Hook) {
HookModifierData *hmd = (HookModifierData*) md; HookModifierData *hmd = (HookModifierData*) md;
uiDefButF(block, NUM, B_MODIFIER_RECALC, "Falloff: ", lx, (cy-=19), buttonWidth,19, &hmd->falloff, 0.0, 100.0, 100, 0, "If not zero, the distance from hook where influence ends"); uiDefButF(block, NUM, B_MODIFIER_RECALC, "Falloff: ", lx, (cy-=19), buttonWidth,19, &hmd->falloff, 0.0, 100.0, 100, 0, "If not zero, the distance from hook where influence ends");
@ -2245,7 +2250,7 @@ static void editing_panel_modifiers(Object *ob)
if(yco < 0) uiNewPanelHeight(block, 204-yco); if(yco < 0) uiNewPanelHeight(block, 204-yco);
} }
static char *make_key_menu(Key *key) static char *make_key_menu(Key *key, int startindex)
{ {
KeyBlock *kb; KeyBlock *kb;
int index= 1; int index= 1;
@ -2255,7 +2260,7 @@ static char *make_key_menu(Key *key)
str= MEM_mallocN(index*40, "key string"); str= MEM_mallocN(index*40, "key string");
str[0]= 0; str[0]= 0;
index= 1; index= startindex;
for (kb = key->block.first; kb; kb=kb->next, index++) { for (kb = key->block.first; kb; kb=kb->next, index++) {
sprintf (item, "|%s%%x%d", kb->name, index); sprintf (item, "|%s%%x%d", kb->name, index);
strcat(str, item); strcat(str, item);
@ -2301,9 +2306,10 @@ static void editing_panel_shapes(Object *ob)
uiDefIconButBitS(block, TOG, OB_SHAPE_LOCK, B_LOCKKEY, icon, 10,150,25,20, &ob->shapeflag, 0, 0, 0, 0, "Always show the current Shape for this Object"); uiDefIconButBitS(block, TOG, OB_SHAPE_LOCK, B_LOCKKEY, icon, 10,150,25,20, &ob->shapeflag, 0, 0, 0, 0, "Always show the current Shape for this Object");
uiSetButLock(G.obedit==ob, "Unable to perform in EditMode"); uiSetButLock(G.obedit==ob, "Unable to perform in EditMode");
uiDefIconBut(block, BUT, B_PREVKEY, ICON_TRIA_LEFT, 35,150,20,20, NULL, 0, 0, 0, 0, "Previous Shape Key"); uiDefIconBut(block, BUT, B_PREVKEY, ICON_TRIA_LEFT, 35,150,20,20, NULL, 0, 0, 0, 0, "Previous Shape Key");
strp= make_key_menu(key); strp= make_key_menu(key, 1);
uiDefButS(block, MENU, B_SETKEY, strp, 55,150,20,20, &ob->shapenr, 0, 0, 0, 0, "Browses existing choices or adds NEW"); uiDefButS(block, MENU, B_SETKEY, strp, 55,150,20,20, &ob->shapenr, 0, 0, 0, 0, "Browse existing choices");
MEM_freeN(strp); MEM_freeN(strp);
uiDefIconBut(block, BUT, B_NEXTKEY, ICON_TRIA_RIGHT, 75,150,20,20, NULL, 0, 0, 0, 0, "Next Shape Key"); uiDefIconBut(block, BUT, B_NEXTKEY, ICON_TRIA_RIGHT, 75,150,20,20, NULL, 0, 0, 0, 0, "Next Shape Key");
uiClearButLock(); uiClearButLock();
uiDefBut(block, TEX, B_NAMEKEY, "", 95, 150, 190, 20, kb->name, 0.0, 31.0, 0, 0, "Current Shape Key name"); uiDefBut(block, TEX, B_NAMEKEY, "", 95, 150, 190, 20, kb->name, 0.0, 31.0, 0, 0, "Current Shape Key name");
@ -2317,9 +2323,14 @@ static void editing_panel_shapes(Object *ob)
uiDefButF(block, NUM, B_REDR, "Max ", 235,120, 75, 20, &kb->slidermax, -10.0, 10.0, 100, 1, "Maximum for slider"); uiDefButF(block, NUM, B_REDR, "Max ", 235,120, 75, 20, &kb->slidermax, -10.0, 10.0, 100, 1, "Maximum for slider");
uiBlockEndAlign(block); uiBlockEndAlign(block);
} }
if(key->type && ob->shapenr!=1) if(key->type && ob->shapenr!=1) {
uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ", 10, 90, 150,19, &kb->vgroup, 0.0, 31.0, 0, 0, "Vertex Weight Group name, to blend with Basis Shape"); uiDefBut(block, TEX, B_MODIFIER_RECALC, "VGroup: ", 10, 90, 150,19, &kb->vgroup, 0.0, 31.0, 0, 0, "Vertex Weight Group name, to blend with Basis Shape");
strp= make_key_menu(key, 0);
uiDefButS(block, MENU, B_MODIFIER_RECALC, strp, 160, 90, 150,19, &kb->relative, 0.0, 0.0, 0, 0, "Shape used as a relative key");
MEM_freeN(strp);
}
if(key->type==0) if(key->type==0)
uiDefButS(block, NUM, B_DIFF, "Slurph:", 10, 60, 150, 19, &(key->slurph), -500.0, 500.0, 0, 0, "Creates a delay in amount of frames in applying keypositions, first vertex goes first"); uiDefButS(block, NUM, B_DIFF, "Slurph:", 10, 60, 150, 19, &(key->slurph), -500.0, 500.0, 0, 0, "Creates a delay in amount of frames in applying keypositions, first vertex goes first");

@ -1953,7 +1953,7 @@ static void world_panel_mapto(World *wrld)
/* TEXTURE OUTPUT */ /* TEXTURE OUTPUT */
uiBlockBeginAlign(block); uiBlockBeginAlign(block);
uiDefButBitS(block, TOG, MTEX_STENCIL, B_WORLDPRV, "Stencil", 10,125,45,19, &(mtex->texflag), 0, 0, 0, 0, "Sets the texture mapping to stencil mode"); uiDefButBitS(block, TOG, MTEX_STENCIL, B_WORLDPRV, "Stencil", 10,125,45,19, &(mtex->texflag), 0, 0, 0, 0, "Use this texture as a blending value on the next texture");
uiDefButBitS(block, TOG, MTEX_NEGATIVE, B_WORLDPRV, "Neg", 55,125,30,19, &(mtex->texflag), 0, 0, 0, 0, "Inverts the values of the texture to reverse its effect"); uiDefButBitS(block, TOG, MTEX_NEGATIVE, B_WORLDPRV, "Neg", 55,125,30,19, &(mtex->texflag), 0, 0, 0, 0, "Inverts the values of the texture to reverse its effect");
uiDefButBitS(block, TOG, MTEX_RGBTOINT, B_WORLDPRV, "No RGB", 85,125,60,19, &(mtex->texflag), 0, 0, 0, 0, "Converts texture RGB values to intensity (gray) values"); uiDefButBitS(block, TOG, MTEX_RGBTOINT, B_WORLDPRV, "No RGB", 85,125,60,19, &(mtex->texflag), 0, 0, 0, 0, "Converts texture RGB values to intensity (gray) values");
uiBlockEndAlign(block); uiBlockEndAlign(block);
@ -2098,13 +2098,13 @@ static void world_panel_mistaph(World *wrld)
uiBlockSetCol(block, TH_AUTO); uiBlockSetCol(block, TH_AUTO);
uiBlockBeginAlign(block); uiBlockBeginAlign(block);
uiDefButS(block, ROW, B_WORLDPRV2, "Qua", 10, 90, 40, 19, &wrld->mistype, 1.0, 0.0, 0, 0, "Mist uses quadratic progression"); uiDefButS(block, ROW, B_WORLDPRV2, "Quad", 10, 90, 40, 19, &wrld->mistype, 1.0, 0.0, 0, 0, "Mist uses quadratic progression");
uiDefButS(block, ROW, B_WORLDPRV2, "Lin", 50, 90, 50, 19, &wrld->mistype, 1.0, 1.0, 0, 0, "Mist uses linear progression"); uiDefButS(block, ROW, B_WORLDPRV2, "Lin", 50, 90, 50, 19, &wrld->mistype, 1.0, 1.0, 0, 0, "Mist uses linear progression");
uiDefButS(block, ROW, B_WORLDPRV2, "Sqr", 100, 90, 50, 19, &wrld->mistype, 1.0, 2.0, 0, 0, "Mist uses inverse quadratic progression"); uiDefButS(block, ROW, B_WORLDPRV2, "Sqr", 100, 90, 50, 19, &wrld->mistype, 1.0, 2.0, 0, 0, "Mist uses inverse quadratic progression");
uiBlockBeginAlign(block); uiBlockBeginAlign(block);
uiDefButF(block, NUM,B_WORLDPRV2, "Sta:",10,70,140,19, &wrld->miststa, 0.0, 10000.0, 10, 0, "Specifies the starting distance of the mist"); uiDefButF(block, NUM,B_WORLDPRV2, "Start:",10,70,140,19, &wrld->miststa, 0.0, 10000.0, 10, 0, "Specifies the starting distance of the mist");
uiDefButF(block, NUM,B_WORLDPRV2, "Di:",10,50,140,19, &wrld->mistdist, 0.0,10000.0, 10, 00, "Specifies the depth of the mist"); uiDefButF(block, NUM,B_WORLDPRV2, "Dist:",10,50,140,19, &wrld->mistdist, 0.0,10000.0, 10, 00, "Specifies the depth of the mist");
uiDefButF(block, NUM,B_WORLDPRV2,"Hi:", 10,30,140,19, &wrld->misthi,0.0,100.0, 10, 0, "Specifies the factor for a less dense mist with increasing height"); uiDefButF(block, NUM,B_WORLDPRV2,"Height:", 10,30,140,19, &wrld->misthi,0.0,100.0, 10, 0, "Specifies the factor for a less dense mist with increasing height");
uiDefButF(block, NUMSLI, B_WORLDPRV2, "Misi ", 10,10,140,19, &(wrld->misi), 0., 1.0, 0, 0, "Sets the mist intensity"); uiDefButF(block, NUMSLI, B_WORLDPRV2, "Misi ", 10,10,140,19, &(wrld->misi), 0., 1.0, 0, 0, "Sets the mist intensity");
uiBlockEndAlign(block); uiBlockEndAlign(block);
@ -2384,7 +2384,7 @@ static void lamp_panel_mapto(Object *ob, Lamp *la)
/* TEXTURE OUTPUT */ /* TEXTURE OUTPUT */
uiBlockBeginAlign(block); uiBlockBeginAlign(block);
uiDefButBitS(block, TOG, MTEX_STENCIL, B_LAMPPRV, "Stencil", 10,125,45,19, &(mtex->texflag), 0, 0, 0, 0, "Sets the texture mapping to stencil mode"); uiDefButBitS(block, TOG, MTEX_STENCIL, B_LAMPPRV, "Stencil", 10,125,45,19, &(mtex->texflag), 0, 0, 0, 0, "Use this texture as a blending value on the next texture");
uiDefButBitS(block, TOG, MTEX_NEGATIVE, B_LAMPPRV, "Neg", 55,125,30,19, &(mtex->texflag), 0, 0, 0, 0, "Inverts the values of the texture to reverse its effect"); uiDefButBitS(block, TOG, MTEX_NEGATIVE, B_LAMPPRV, "Neg", 55,125,30,19, &(mtex->texflag), 0, 0, 0, 0, "Inverts the values of the texture to reverse its effect");
uiDefButBitS(block, TOG, MTEX_RGBTOINT, B_LAMPPRV, "No RGB", 85,125,60,19, &(mtex->texflag), 0, 0, 0, 0, "Converts texture RGB values to intensity (gray) values"); uiDefButBitS(block, TOG, MTEX_RGBTOINT, B_LAMPPRV, "No RGB", 85,125,60,19, &(mtex->texflag), 0, 0, 0, 0, "Converts texture RGB values to intensity (gray) values");
uiBlockEndAlign(block); uiBlockEndAlign(block);
@ -3065,7 +3065,7 @@ static void material_panel_map_to(Material *ma, int from_nodes)
/* TEXTURE OUTPUT */ /* TEXTURE OUTPUT */
uiBlockBeginAlign(block); uiBlockBeginAlign(block);
uiDefButBitS(block, TOG, MTEX_STENCIL, B_MATPRV, "Stencil", 10,125,45,19, &(mtex->texflag), 0, 0, 0, 0, "Sets the texture mapping to stencil mode"); uiDefButBitS(block, TOG, MTEX_STENCIL, B_MATPRV, "Stencil", 10,125,45,19, &(mtex->texflag), 0, 0, 0, 0, "Use this texture as a blending value on the next texture");
uiDefButBitS(block, TOG, MTEX_NEGATIVE, B_MATPRV, "Neg", 55,125,30,19, &(mtex->texflag), 0, 0, 0, 0, "Inverts the values of the texture to reverse its effect"); uiDefButBitS(block, TOG, MTEX_NEGATIVE, B_MATPRV, "Neg", 55,125,30,19, &(mtex->texflag), 0, 0, 0, 0, "Inverts the values of the texture to reverse its effect");
uiDefButBitS(block, TOG,MTEX_RGBTOINT, B_MATPRV, "No RGB", 85,125,60,19, &(mtex->texflag), 0, 0, 0, 0, "Converts texture RGB values to intensity (gray) values"); uiDefButBitS(block, TOG,MTEX_RGBTOINT, B_MATPRV, "No RGB", 85,125,60,19, &(mtex->texflag), 0, 0, 0, 0, "Converts texture RGB values to intensity (gray) values");
uiBlockEndAlign(block); uiBlockEndAlign(block);

@ -1737,8 +1737,8 @@ static void draw_pose_paths(Object *ob)
CfraElem *ce; CfraElem *ce;
ListBase ak; ListBase ak;
float *fp; float *fp;
int a; int a, stepsize;
int stepsize, sfra; int sfra, efra;
if(G.vd->zbuf) glDisable(GL_DEPTH_TEST); if(G.vd->zbuf) glDisable(GL_DEPTH_TEST);
@ -1758,16 +1758,39 @@ static void draw_pose_paths(Object *ob)
pchan->pathef= EFRA; pchan->pathef= EFRA;
} }
/* get start frame of calculated range */ /* get frame ranges */
sfra= pchan->pathsf; sfra= pchan->pathsf;
efra = sfra + pchan->pathlen;
/* draw curve-line of path */ /* draw curve-line of path */
// TODO: show before/after with slight difference in colour intensity if ((CFRA > sfra) && (CFRA < efra)) {
BIF_ThemeColorBlend(TH_WIRE, TH_BACK, 0.7); /* Show before/after current frame with slight difference in colour intensity
glBegin(GL_LINE_STRIP); * This is done in two loops, as there seems to be some problems with changing color
for(a=0, fp= pchan->path; a<pchan->pathlen; a++, fp+=3) * or something during a loop (noted somewhere in the codebase)
glVertex3fv(fp); */
glEnd();
/* before cfra (darker) */
BIF_ThemeColorBlend(TH_WIRE, TH_BACK, 0.2);
glBegin(GL_LINE_STRIP);
for (a=0, fp=pchan->path; (sfra+a)<=CFRA; a++, fp+=3)
glVertex3fv(fp);
glEnd();
/* after cfra (lighter) - backtrack a bit so that we don't have gaps */
BIF_ThemeColorBlend(TH_WIRE, TH_BONE_POSE, 0.7);
glBegin(GL_LINE_STRIP);
for (--a, fp-=3; a<pchan->pathlen; a++, fp+=3)
glVertex3fv(fp);
glEnd();
}
else {
/* show both directions with same intensity (cfra somewhere else) */
BIF_ThemeColorBlend(TH_WIRE, TH_BACK, 0.7);
glBegin(GL_LINE_STRIP);
for (a=0, fp= pchan->path; a<pchan->pathlen; a++, fp+=3)
glVertex3fv(fp);
glEnd();
}
glPointSize(1.0); glPointSize(1.0);
@ -1791,7 +1814,7 @@ static void draw_pose_paths(Object *ob)
for(a=0, fp= pchan->path; a<pchan->pathlen; a+=stepsize, fp+=(stepsize*3)) { for(a=0, fp= pchan->path; a<pchan->pathlen; a+=stepsize, fp+=(stepsize*3)) {
char str[32]; char str[32];
/* only draw framenum if several consecutive highlighted points occur on same point */ /* only draw framenum if several consecutive highlighted points don't occur on same point */
if (a == 0) { if (a == 0) {
glRasterPos3fv(fp); glRasterPos3fv(fp);
sprintf(str, " %d\n", (a+sfra)); sprintf(str, " %d\n", (a+sfra));

@ -309,9 +309,25 @@ void image_changed(SpaceImage *sima, Image *image)
return; return;
/* skip assigning these procedural images... */ /* skip assigning these procedural images... */
if(image && (image->type==IMA_TYPE_R_RESULT || image->type==IMA_TYPE_COMPOSITE)) {; if(image && (image->type==IMA_TYPE_R_RESULT || image->type==IMA_TYPE_COMPOSITE)) {
return; return;
} else if (EM_texFaceCheck()) { } else if ((G.obedit) &&
(G.obedit->type == OB_MESH) &&
(G.editMesh) &&
(G.editMesh->faces.first)
) {
/* Add a UV layer if there is none, editmode only */
if ( !CustomData_has_layer(&G.editMesh->fdata, CD_MTFACE) ) {
EM_add_data_layer(&em->fdata, CD_MTFACE);
CustomData_set_layer_active(&em->fdata, CD_MTFACE, 0); /* always zero because we have no other UV layers */
change = 1; /* so we update the object, incase no faces are selected */
/* BIF_undo_push("New UV Texture"); - undo should be done by whatever changes the image */
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWBUTSEDIT, 0);
}
for (efa= em->faces.first; efa; efa= efa->next) { for (efa= em->faces.first; efa; efa= efa->next) {
tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE); tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
if (efa->h==0 && efa->f & SELECT) { if (efa->h==0 && efa->f & SELECT) {

@ -775,7 +775,6 @@ void set_special_seq_update(int val)
static void draw_image_seq(ScrArea *sa) static void draw_image_seq(ScrArea *sa)
{ {
SpaceSeq *sseq; SpaceSeq *sseq;
StripElem *se;
struct ImBuf *ibuf; struct ImBuf *ibuf;
int x1, y1, rectx, recty; int x1, y1, rectx, recty;
int free_ibuf = 0; int free_ibuf = 0;
@ -800,10 +799,18 @@ static void draw_image_seq(ScrArea *sa)
return; return;
else { else {
recursive= 1; recursive= 1;
if (!U.prefetchframes || (G.f & G_PLAYANIM) == 0) { if (special_seq_update) {
ibuf= (ImBuf *)give_ibuf_seq(rectx, recty, (G.scene->r.cfra), sseq->chanshown); ibuf= give_ibuf_seq_direct(
rectx, recty, (G.scene->r.cfra),
special_seq_update);
} else if (!U.prefetchframes || (G.f & G_PLAYANIM) == 0) {
ibuf= (ImBuf *)give_ibuf_seq(
rectx, recty, (G.scene->r.cfra),
sseq->chanshown);
} else { } else {
ibuf= (ImBuf *)give_ibuf_threaded(rectx, recty, (G.scene->r.cfra), sseq->chanshown); ibuf= (ImBuf *)give_ibuf_seq_threaded(
rectx, recty, (G.scene->r.cfra),
sseq->chanshown);
} }
recursive= 0; recursive= 0;
@ -815,16 +822,6 @@ static void draw_image_seq(ScrArea *sa)
} }
} }
if(special_seq_update) {
se = special_seq_update->curelem;
if(se) {
if(se->ok==2) {
if(se->se1)
ibuf= se->se1->ibuf;
}
else ibuf= se->ibuf;
}
}
if(ibuf==NULL) if(ibuf==NULL)
return; return;
if(ibuf->rect_float && ibuf->rect==NULL) if(ibuf->rect_float && ibuf->rect==NULL)
@ -917,9 +914,9 @@ static void draw_extra_seqinfo(void)
if(last_seq->type==SEQ_IMAGE) { if(last_seq->type==SEQ_IMAGE) {
if (last_seq->len > 1) { if (last_seq->len > 1) {
/* CURRENT */ /* CURRENT */
se= (StripElem *)give_stripelem(last_seq, (G.scene->r.cfra)); se= give_stripelem(last_seq, (G.scene->r.cfra));
if(se) { if(se) {
sprintf(str, "Cur: %s", se->name); sprintf(str, "Cur: %s%s", last_seq->strip->dir, se->name);
glRasterPos3f(xco, yco, 0.0); glRasterPos3f(xco, yco, 0.0);
BMF_DrawString(G.font, str); BMF_DrawString(G.font, str);
xco += xfac*BMF_GetStringWidth(G.font, str) +10.0*xfac; xco += xfac*BMF_GetStringWidth(G.font, str) +10.0*xfac;
@ -937,21 +934,22 @@ static void draw_extra_seqinfo(void)
glRasterPos3f(xco, yco, 0.0); glRasterPos3f(xco, yco, 0.0);
BMF_DrawString(G.font, str); BMF_DrawString(G.font, str);
xco += xfac*BMF_GetStringWidth(G.font, str) +30.0*xfac; xco += xfac*BMF_GetStringWidth(G.font, str) +30.0*xfac;
/* orig size */
sprintf(str, "OrigSize: %d x %d", last_seq->strip->orx, last_seq->strip->ory);
glRasterPos3f(xco, yco, 0.0);
BMF_DrawString(G.font, str);
xco += xfac*BMF_GetStringWidth(G.font, str) +30.0*xfac;
} }
} else { /* single image */ } else { /* single image */
if (last_seq->strip) { if (last_seq->strip) {
sprintf(str, "Single: %s len: %d", last_seq->strip->stripdata->name, last_seq->enddisp-last_seq->startdisp); sprintf(str, "Single: %s%s len: %d", last_seq->strip->dir, last_seq->strip->stripdata->name, last_seq->enddisp-last_seq->startdisp);
glRasterPos3f(xco, yco, 0.0); glRasterPos3f(xco, yco, 0.0);
BMF_DrawString(G.font, str); BMF_DrawString(G.font, str);
xco += xfac*BMF_GetStringWidth(G.font, str) +30.0*xfac; xco += xfac*BMF_GetStringWidth(G.font, str) +30.0*xfac;
} }
} }
/* orig size */
if(last_seq->strip) {
sprintf(str, "OrigSize: %d x %d", last_seq->strip->orx, last_seq->strip->ory);
glRasterPos3f(xco, yco, 0.0);
BMF_DrawString(G.font, str);
xco += xfac*BMF_GetStringWidth(G.font, str) +30.0*xfac;
}
} }
else if(last_seq->type==SEQ_MOVIE) { else if(last_seq->type==SEQ_MOVIE) {
@ -966,7 +964,7 @@ static void draw_extra_seqinfo(void)
BMF_DrawString(G.font, str); BMF_DrawString(G.font, str);
} }
else if(last_seq->type==SEQ_SCENE) { else if(last_seq->type==SEQ_SCENE) {
se= (StripElem *)give_stripelem(last_seq, (G.scene->r.cfra)); TStripElem * se= give_tstripelem(last_seq, (G.scene->r.cfra));
if(se && last_seq->scene) { if(se && last_seq->scene) {
sprintf(str, "Cur: %d First: %d Last: %d", last_seq->sfra+se->nr, last_seq->sfra, last_seq->sfra+last_seq->len-1); sprintf(str, "Cur: %d First: %d Last: %d", last_seq->sfra+se->nr, last_seq->sfra, last_seq->sfra+last_seq->len-1);
glRasterPos3f(xco, yco, 0.0); glRasterPos3f(xco, yco, 0.0);

@ -1221,7 +1221,7 @@ void snap_sel_to_grid()
} }
ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK); ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK);
/* autokeyframing */ /* auto-keyframing */
autokeyframe_pose_cb_func(ob, TFM_TRANSLATION, 0); autokeyframe_pose_cb_func(ob, TFM_TRANSLATION, 0);
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
} }
@ -1334,7 +1334,7 @@ void snap_sel_to_curs()
} }
ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK); ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK);
/* autokeyframing */ /* auto-keyframing */
autokeyframe_pose_cb_func(ob, TFM_TRANSLATION, 0); autokeyframe_pose_cb_func(ob, TFM_TRANSLATION, 0);
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
} }
@ -1686,7 +1686,7 @@ void snap_to_center()
} }
} }
/* autokeyframing */ /* auto-keyframing */
ob->pose->flag |= POSE_DO_UNLOCK; ob->pose->flag |= POSE_DO_UNLOCK;
autokeyframe_pose_cb_func(ob, TFM_TRANSLATION, 0); autokeyframe_pose_cb_func(ob, TFM_TRANSLATION, 0);
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);

@ -1077,6 +1077,19 @@ void delete_armature(void)
TEST_EDITARMATURE; TEST_EDITARMATURE;
if (okee("Erase selected bone(s)")==0) return; if (okee("Erase selected bone(s)")==0) return;
/* Select mirrored bones */
if (arm->flag & ARM_MIRROR_EDIT) {
for (curBone=G.edbo.first; curBone; curBone=curBone->next) {
if (arm->layer & curBone->layer) {
if (curBone->flag & BONE_SELECTED) {
next = armature_bone_get_mirrored(curBone);
if (next)
next->flag |= BONE_SELECTED;
}
}
}
}
/* First erase any associated pose channel */ /* First erase any associated pose channel */
if (G.obedit->pose) { if (G.obedit->pose) {
bPoseChannel *chan, *next; bPoseChannel *chan, *next;
@ -1321,13 +1334,19 @@ void auto_align_armature(short mode)
{ {
bArmature *arm= G.obedit->data; bArmature *arm= G.obedit->data;
EditBone *ebone; EditBone *ebone;
EditBone *flipbone = NULL;
float delta[3]; float delta[3];
float curmat[3][3]; float curmat[3][3];
float *cursor= give_cursor(); float *cursor= give_cursor();
for (ebone = G.edbo.first; ebone; ebone=ebone->next) { for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
if(arm->layer & ebone->layer) { if (arm->layer & ebone->layer) {
if (ebone->flag & BONE_SELECTED) { if (arm->flag & ARM_MIRROR_EDIT)
flipbone = armature_bone_get_mirrored(ebone);
if ((ebone->flag & BONE_SELECTED) ||
(flipbone && flipbone->flag & BONE_SELECTED))
{
/* specific method used to calculate roll depends on mode */ /* specific method used to calculate roll depends on mode */
if (mode == 1) { if (mode == 1) {
/* Z-Axis point towards cursor */ /* Z-Axis point towards cursor */
@ -1714,10 +1733,23 @@ void adduplicate_armature(void)
countall(); // flushes selection! countall(); // flushes selection!
/* Select mirrored bones */
if (arm->flag & ARM_MIRROR_EDIT) {
for (curBone=G.edbo.first; curBone; curBone=curBone->next) {
if (arm->layer & curBone->layer) {
if (curBone->flag & BONE_SELECTED) {
eBone = armature_bone_get_mirrored(curBone);
if (eBone)
eBone->flag |= BONE_SELECTED;
}
}
}
}
/* Find the selected bones and duplicate them as needed */ /* Find the selected bones and duplicate them as needed */
for (curBone=G.edbo.first; curBone && curBone!=firstDup; curBone=curBone->next){ for (curBone=G.edbo.first; curBone && curBone!=firstDup; curBone=curBone->next){
if(arm->layer & curBone->layer) { if (arm->layer & curBone->layer) {
if (curBone->flag & BONE_SELECTED){ if (curBone->flag & BONE_SELECTED) {
eBone=MEM_callocN(sizeof(EditBone), "addup_editbone"); eBone=MEM_callocN(sizeof(EditBone), "addup_editbone");
eBone->flag |= BONE_SELECTED; eBone->flag |= BONE_SELECTED;
@ -2034,10 +2066,22 @@ void make_bone_parent(void)
return; return;
} }
static void editbone_clear_parent(EditBone *ebone, int mode)
{
if (ebone->parent) {
/* for nice selection */
ebone->parent->flag &= ~(BONE_TIPSEL);
}
if(mode==1) ebone->parent= NULL;
ebone->flag &= ~BONE_CONNECTED;
}
void clear_bone_parent(void) void clear_bone_parent(void)
{ {
bArmature *arm= G.obedit->data; bArmature *arm= G.obedit->data;
EditBone *ebone; EditBone *ebone;
EditBone *flipbone = NULL;
short val; short val;
val= pupmenu("Clear Parent%t|Clear Parent%x1|Disconnect Bone%x2"); val= pupmenu("Clear Parent%t|Clear Parent%x1|Disconnect Bone%x2");
@ -2046,13 +2090,13 @@ void clear_bone_parent(void)
for (ebone = G.edbo.first; ebone; ebone=ebone->next) { for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
if(arm->layer & ebone->layer) { if(arm->layer & ebone->layer) {
if(ebone->flag & BONE_SELECTED) { if(ebone->flag & BONE_SELECTED) {
if(ebone->parent) {
/* for nice selection */
ebone->parent->flag &= ~(BONE_TIPSEL);
if(val==1) ebone->parent= NULL; if(arm->flag & ARM_MIRROR_EDIT)
ebone->flag &= ~BONE_CONNECTED; flipbone = armature_bone_get_mirrored(ebone);
}
if (flipbone)
editbone_clear_parent(flipbone, val);
editbone_clear_parent(ebone, val);
} }
} }
} }
@ -3179,3 +3223,4 @@ void transform_armature_mirror_update(void)

@ -117,12 +117,14 @@ static int imasel_has_func(SpaceImaSel *simasel)
return 0; return 0;
} }
/* ugly, needs to be moved to platform specific files - elubie */ #if defined __BeOS
#if defined WIN32 || defined __BeOS
static int fnmatch(const char *pattern, const char *string, int flags) static int fnmatch(const char *pattern, const char *string, int flags)
{ {
return 0; return 0;
} }
#elif defined WIN32 && !defined _LIBC
/* use fnmatch included in blenlib */
#include "BLI_fnmatch.h"
#else #else
#include <fnmatch.h> #include <fnmatch.h>
#endif #endif

@ -777,7 +777,7 @@ void mouse_select_seq(void)
if (marker) { if (marker) {
int oldflag; int oldflag;
/* select timeline marker */ /* select timeline marker */
if ((G.qual & LR_SHIFTKEY)==0) { if (G.qual & LR_SHIFTKEY) {
oldflag= marker->flag; oldflag= marker->flag;
deselect_markers(0, 0); deselect_markers(0, 0);
@ -985,7 +985,6 @@ static Sequence *sfile_to_sequence(SpaceFile *sfile, int cfra, int machine, int
if(sfile->filelist[a].flags & ACTIVE) { if(sfile->filelist[a].flags & ACTIVE) {
if( (sfile->filelist[a].type & S_IFDIR)==0 ) { if( (sfile->filelist[a].type & S_IFDIR)==0 ) {
strncpy(se->name, sfile->filelist[a].relname, FILE_MAXFILE-1); strncpy(se->name, sfile->filelist[a].relname, FILE_MAXFILE-1);
se->ok= 1;
se++; se++;
} }
} }
@ -993,7 +992,6 @@ static Sequence *sfile_to_sequence(SpaceFile *sfile, int cfra, int machine, int
/* no selected file: */ /* no selected file: */
if(totsel==1 && se==strip->stripdata) { if(totsel==1 && se==strip->stripdata) {
strncpy(se->name, sfile->file, FILE_MAXFILE-1); strncpy(se->name, sfile->file, FILE_MAXFILE-1);
se->ok= 1;
} }
/* last active name */ /* last active name */
@ -1010,7 +1008,7 @@ static int sfile_to_mv_sequence_load(SpaceFile *sfile, int cfra,
struct anim *anim; struct anim *anim;
Strip *strip; Strip *strip;
StripElem *se; StripElem *se;
int totframe, a; int totframe;
char name[160], rel[160]; char name[160], rel[160];
char str[FILE_MAXDIR+FILE_MAXFILE]; char str[FILE_MAXDIR+FILE_MAXFILE];
@ -1054,7 +1052,7 @@ static int sfile_to_mv_sequence_load(SpaceFile *sfile, int cfra,
strip->len= totframe; strip->len= totframe;
strip->us= 1; strip->us= 1;
strncpy(strip->dir, name, FILE_MAXDIR-1); strncpy(strip->dir, name, FILE_MAXDIR-1);
strip->stripdata= se= MEM_callocN(totframe*sizeof(StripElem), "stripelem"); strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem");
/* name movie in first strip */ /* name movie in first strip */
if(index<0) if(index<0)
@ -1062,11 +1060,6 @@ static int sfile_to_mv_sequence_load(SpaceFile *sfile, int cfra,
else else
strncpy(se->name, sfile->filelist[index].relname, FILE_MAXFILE-1); strncpy(se->name, sfile->filelist[index].relname, FILE_MAXFILE-1);
for(a=1; a<=totframe; a++, se++) {
se->ok= 1;
se->nr= a;
}
/* last active name */ /* last active name */
strncpy(last_imagename, seq->strip->dir, FILE_MAXDIR-1); strncpy(last_imagename, seq->strip->dir, FILE_MAXDIR-1);
return(cfra+totframe); return(cfra+totframe);
@ -1111,7 +1104,6 @@ static Sequence *sfile_to_ramsnd_sequence(SpaceFile *sfile,
Strip *strip; Strip *strip;
StripElem *se; StripElem *se;
double totframe; double totframe;
int a;
char name[160], rel[160]; char name[160], rel[160];
char str[256]; char str[256];
@ -1157,17 +1149,11 @@ static Sequence *sfile_to_ramsnd_sequence(SpaceFile *sfile,
strip->len= totframe; strip->len= totframe;
strip->us= 1; strip->us= 1;
strncpy(strip->dir, name, FILE_MAXDIR-1); strncpy(strip->dir, name, FILE_MAXDIR-1);
strip->stripdata= se= MEM_callocN(totframe*sizeof(StripElem), "stripelem"); strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem");
/* name sound in first strip */ /* name sound in first strip */
strncpy(se->name, sfile->file, FILE_MAXFILE-1); strncpy(se->name, sfile->file, FILE_MAXFILE-1);
for(a=1; a<=totframe; a++, se++) {
se->ok= 2; /* why? */
se->ibuf= 0;
se->nr= a;
}
/* last active name */ /* last active name */
strncpy(last_sounddir, seq->strip->dir, FILE_MAXDIR-1); strncpy(last_sounddir, seq->strip->dir, FILE_MAXDIR-1);
@ -1181,7 +1167,7 @@ static int sfile_to_hdsnd_sequence_load(SpaceFile *sfile, int cfra,
struct hdaudio *hdaudio; struct hdaudio *hdaudio;
Strip *strip; Strip *strip;
StripElem *se; StripElem *se;
int totframe, a; int totframe;
char name[160], rel[160]; char name[160], rel[160];
char str[FILE_MAXDIR+FILE_MAXFILE]; char str[FILE_MAXDIR+FILE_MAXFILE];
@ -1224,7 +1210,7 @@ static int sfile_to_hdsnd_sequence_load(SpaceFile *sfile, int cfra,
strip->len= totframe; strip->len= totframe;
strip->us= 1; strip->us= 1;
strncpy(strip->dir, name, FILE_MAXDIR-1); strncpy(strip->dir, name, FILE_MAXDIR-1);
strip->stripdata= se= MEM_callocN(totframe*sizeof(StripElem), "stripelem"); strip->stripdata= se= MEM_callocN(sizeof(StripElem), "stripelem");
/* name movie in first strip */ /* name movie in first strip */
if(index<0) if(index<0)
@ -1232,12 +1218,6 @@ static int sfile_to_hdsnd_sequence_load(SpaceFile *sfile, int cfra,
else else
strncpy(se->name, sfile->filelist[index].relname, FILE_MAXFILE-1); strncpy(se->name, sfile->filelist[index].relname, FILE_MAXFILE-1);
for(a=1; a<=totframe; a++, se++) {
se->ok= 2;
se->ibuf = 0;
se->nr= a;
}
/* last active name */ /* last active name */
strncpy(last_sounddir, seq->strip->dir, FILE_MAXDIR-1); strncpy(last_sounddir, seq->strip->dir, FILE_MAXDIR-1);
return(cfra+totframe); return(cfra+totframe);
@ -2013,7 +1993,7 @@ void change_sequence(void)
last_seq->sfra= sce->r.sfra; last_seq->sfra= sce->r.sfra;
/* bad code to change seq->len? update_changed_seq_and_deps() expects the strip->len to be OK */ /* bad code to change seq->len? update_changed_seq_and_deps() expects the strip->len to be OK */
new_stripdata(last_seq); new_tstripdata(last_seq);
update_changed_seq_and_deps(last_seq, 1, 1); update_changed_seq_and_deps(last_seq, 1, 1);
@ -2169,25 +2149,23 @@ void del_seq(void)
static void recurs_dupli_seq(ListBase *old, ListBase *new) static void recurs_dupli_seq(ListBase *old, ListBase *new)
{ {
Sequence *seq, *seqn; Sequence *seq;
Sequence *seqn = 0;
Sequence *last_seq = get_last_seq(); Sequence *last_seq = get_last_seq();
StripElem *se;
int a;
seq= old->first; seq= old->first;
while(seq) { while(seq) {
seq->tmp= NULL; seq->tmp= NULL;
if(seq->flag & SELECT) { if(seq->flag & SELECT) {
if(seq->type==SEQ_META) { if(seq->type==SEQ_META) {
seqn= MEM_dupallocN(seq); seqn= MEM_dupallocN(seq);
seq->tmp= seqn; seq->tmp= seqn;
BLI_addtail(new, seqn); BLI_addtail(new, seqn);
seqn->strip= MEM_dupallocN(seq->strip); seqn->strip= MEM_dupallocN(seq->strip);
seqn->strip->stripdata = 0;
if(seq->len>0) seq->strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem"); seqn->strip->tstripdata = 0;
seq->flag &= SEQ_DESEL; seq->flag &= SEQ_DESEL;
seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL); seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL);
@ -2202,8 +2180,8 @@ static void recurs_dupli_seq(ListBase *old, ListBase *new)
BLI_addtail(new, seqn); BLI_addtail(new, seqn);
seqn->strip= MEM_dupallocN(seq->strip); seqn->strip= MEM_dupallocN(seq->strip);
seqn->strip->stripdata = 0;
if(seq->len>0) seqn->strip->stripdata = MEM_callocN(seq->len*sizeof(StripElem), "stripelem"); seqn->strip->tstripdata = 0;
seq->flag &= SEQ_DESEL; seq->flag &= SEQ_DESEL;
seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL); seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL);
@ -2214,20 +2192,11 @@ static void recurs_dupli_seq(ListBase *old, ListBase *new)
BLI_addtail(new, seqn); BLI_addtail(new, seqn);
seqn->strip= MEM_dupallocN(seq->strip); seqn->strip= MEM_dupallocN(seq->strip);
seqn->strip->stripdata =
MEM_dupallocN(seq->strip->stripdata);
seqn->strip->tstripdata = 0;
seqn->anim= 0; seqn->anim= 0;
if(seqn->len>0) {
seqn->strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
/* copy first elem */
*seqn->strip->stripdata= *seq->strip->stripdata;
se= seqn->strip->stripdata;
a= seq->len;
while(a--) {
se->ok= 1;
se++;
}
}
seq->flag &= SEQ_DESEL; seq->flag &= SEQ_DESEL;
seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL); seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL);
} }
@ -2237,22 +2206,14 @@ static void recurs_dupli_seq(ListBase *old, ListBase *new)
BLI_addtail(new, seqn); BLI_addtail(new, seqn);
seqn->strip= MEM_dupallocN(seq->strip); seqn->strip= MEM_dupallocN(seq->strip);
seqn->strip->stripdata =
MEM_dupallocN(seq->strip->stripdata);
seqn->strip->tstripdata = 0;
seqn->anim= 0; seqn->anim= 0;
seqn->sound->id.us++; seqn->sound->id.us++;
if(seqn->ipo) seqn->ipo->id.us++; if(seqn->ipo) seqn->ipo->id.us++;
if(seqn->len>0) {
seqn->strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
/* copy first elem */
*seqn->strip->stripdata= *seq->strip->stripdata;
se= seqn->strip->stripdata;
a= seq->len;
while(a--) {
se->ok= 1;
se++;
}
}
seq->flag &= SEQ_DESEL; seq->flag &= SEQ_DESEL;
seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL); seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL);
} }
@ -2262,36 +2223,29 @@ static void recurs_dupli_seq(ListBase *old, ListBase *new)
BLI_addtail(new, seqn); BLI_addtail(new, seqn);
seqn->strip= MEM_dupallocN(seq->strip); seqn->strip= MEM_dupallocN(seq->strip);
seqn->strip->stripdata =
MEM_dupallocN(seq->strip->stripdata);
seqn->strip->tstripdata = 0;
seqn->anim= 0; seqn->anim= 0;
seqn->hdaudio = 0; seqn->hdaudio = 0;
if(seqn->ipo) seqn->ipo->id.us++; if(seqn->ipo) seqn->ipo->id.us++;
if(seqn->len>0) {
seqn->strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
/* copy first elem */
*seqn->strip->stripdata= *seq->strip->stripdata;
se= seqn->strip->stripdata;
a= seq->len;
while(a--) {
se->ok= 1;
se++;
}
}
seq->flag &= SEQ_DESEL; seq->flag &= SEQ_DESEL;
seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL); seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL);
} } else if(seq->type == SEQ_IMAGE) {
else if(seq->type < SEQ_EFFECT) {
seqn= MEM_dupallocN(seq); seqn= MEM_dupallocN(seq);
seq->tmp= seqn; seq->tmp= seqn;
BLI_addtail(new, seqn); BLI_addtail(new, seqn);
seqn->strip->us++; seqn->strip= MEM_dupallocN(seq->strip);
seqn->strip->stripdata =
MEM_dupallocN(seq->strip->stripdata);
seqn->strip->tstripdata = 0;
seq->flag &= SEQ_DESEL; seq->flag &= SEQ_DESEL;
seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL); seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL);
} } else if(seq->type >= SEQ_EFFECT) {
else {
seqn= MEM_dupallocN(seq); seqn= MEM_dupallocN(seq);
seq->tmp= seqn; seq->tmp= seqn;
BLI_addtail(new, seqn); BLI_addtail(new, seqn);
@ -2310,12 +2264,16 @@ static void recurs_dupli_seq(ListBase *old, ListBase *new)
} }
seqn->strip= MEM_dupallocN(seq->strip); seqn->strip= MEM_dupallocN(seq->strip);
seqn->strip->stripdata = 0;
if(seq->len>0) seq->strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem"); seqn->strip->tstripdata = 0;
seq->flag &= SEQ_DESEL; seq->flag &= SEQ_DESEL;
seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL); seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL);
} else {
fprintf(stderr, "Aiiiiekkk! sequence type not "
"handled in duplicate!\nExpect a crash"
" now...\n");
} }
if (seq == last_seq) { if (seq == last_seq) {
set_last_seq(seqn); set_last_seq(seqn);
@ -2564,7 +2522,7 @@ void make_meta(void)
seqm->strip= MEM_callocN(sizeof(Strip), "metastrip"); seqm->strip= MEM_callocN(sizeof(Strip), "metastrip");
seqm->strip->len= seqm->len; seqm->strip->len= seqm->len;
seqm->strip->us= 1; seqm->strip->us= 1;
if(seqm->len) seqm->strip->stripdata= MEM_callocN(seqm->len*sizeof(StripElem), "metastripdata");
set_meta_stripdata(seqm); set_meta_stripdata(seqm);
BIF_undo_push("Make Meta Strip, Sequencer"); BIF_undo_push("Make Meta Strip, Sequencer");
@ -3496,8 +3454,6 @@ void seq_separate_images(void)
/* new stripdata */ /* new stripdata */
strip_new->stripdata= se_new= MEM_callocN(sizeof(StripElem)*1, "stripelem"); strip_new->stripdata= se_new= MEM_callocN(sizeof(StripElem)*1, "stripelem");
strncpy(se_new->name, se->name, FILE_MAXFILE-1); strncpy(se_new->name, se->name, FILE_MAXFILE-1);
se_new->ok= 1;
calc_sequence(seq_new); calc_sequence(seq_new);
seq_new->flag &= ~SEQ_OVERLAP; seq_new->flag &= ~SEQ_OVERLAP;
if (test_overlap_seq(seq_new)) { if (test_overlap_seq(seq_new)) {

@ -116,11 +116,14 @@
#include "FTF_Api.h" #include "FTF_Api.h"
#endif #endif
#if defined WIN32 || defined __BeOS #if defined __BeOS
static int fnmatch(const char *pattern, const char *string, int flags) static int fnmatch(const char *pattern, const char *string, int flags)
{ {
return 0; return 0;
} }
#elif defined WIN32 && !defined _LIBC
/* use fnmatch included in blenlib */
#include "BLI_fnmatch.h"
#else #else
#include <fnmatch.h> #include <fnmatch.h>
#endif #endif

@ -917,6 +917,7 @@ void pose_movetolayer(void)
else if (G.obedit) { else if (G.obedit) {
/* the check for editbone layer moving needs to occur before posemode one to work */ /* the check for editbone layer moving needs to occur before posemode one to work */
EditBone *ebo; EditBone *ebo;
EditBone *flipBone;
for (ebo= G.edbo.first; ebo; ebo= ebo->next) { for (ebo= G.edbo.first; ebo; ebo= ebo->next) {
if (arm->layer & ebo->layer) { if (arm->layer & ebo->layer) {
@ -931,8 +932,14 @@ void pose_movetolayer(void)
for (ebo= G.edbo.first; ebo; ebo= ebo->next) { for (ebo= G.edbo.first; ebo; ebo= ebo->next) {
if (arm->layer & ebo->layer) { if (arm->layer & ebo->layer) {
if (ebo->flag & BONE_SELECTED) if (ebo->flag & BONE_SELECTED) {
ebo->layer= lay; ebo->layer= lay;
if (arm->flag & ARM_MIRROR_EDIT) {
flipBone = armature_bone_get_mirrored(ebo);
if (flipBone)
flipBone->layer = lay;
}
}
} }
} }

@ -75,15 +75,18 @@
int seqrectx, seqrecty; int seqrectx, seqrecty;
void free_stripdata(int len, StripElem *se) void free_tstripdata(int len, TStripElem *se)
{ {
StripElem *seo; TStripElem *seo;
int a; int a;
seo= se; seo= se;
if (!se) {
return;
}
for(a=0; a<len; a++, se++) { for(a=0; a<len; a++, se++) {
if(se->ibuf && se->ok!=2) { if(se->ibuf && se->ok != STRIPELEM_META) {
IMB_freeImBuf(se->ibuf); IMB_freeImBuf(se->ibuf);
se->ibuf = 0; se->ibuf = 0;
} }
@ -103,18 +106,20 @@ void free_strip(Strip *strip)
} }
if(strip->stripdata) { if(strip->stripdata) {
free_stripdata(strip->len, strip->stripdata); MEM_freeN(strip->stripdata);
} }
free_tstripdata(strip->len, strip->tstripdata);
MEM_freeN(strip); MEM_freeN(strip);
} }
void new_stripdata(Sequence *seq) void new_tstripdata(Sequence *seq)
{ {
if(seq->strip) { if(seq->strip) {
if(seq->strip->stripdata) free_stripdata(seq->strip->len, seq->strip->stripdata); free_tstripdata(seq->strip->len, seq->strip->tstripdata);
seq->strip->stripdata= 0; seq->strip->tstripdata= 0;
seq->strip->len= seq->len; seq->strip->len= seq->len;
if(seq->len>0) seq->strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelems");
} }
} }
@ -265,7 +270,7 @@ void calc_sequence(Sequence *seq)
} }
if(seq->strip && seq->len!=seq->strip->len) { if(seq->strip && seq->len!=seq->strip->len) {
new_stripdata(seq); new_tstripdata(seq);
} }
} }
@ -284,7 +289,7 @@ void calc_sequence(Sequence *seq)
seq->len= max-min; seq->len= max-min;
if(seq->strip && seq->len!=seq->strip->len) { if(seq->strip && seq->len!=seq->strip->len) {
new_stripdata(seq); new_tstripdata(seq);
} }
} }
} }
@ -426,9 +431,9 @@ static void multibuf(ImBuf *ibuf, float fmul)
} }
} }
static void do_effect(int cfra, Sequence *seq, StripElem *se) static void do_effect(int cfra, Sequence *seq, TStripElem *se)
{ {
StripElem *se1, *se2, *se3; TStripElem *se1, *se2, *se3;
float fac, facf; float fac, facf;
int x, y; int x, y;
int early_out; int early_out;
@ -464,14 +469,13 @@ static void do_effect(int cfra, Sequence *seq, StripElem *se)
return; return;
} }
/* if metastrip: other se's */ if(se->se1->ok == STRIPELEM_META) se1= se->se1->se1;
if(se->se1->ok==2) se1= se->se1->se1;
else se1= se->se1; else se1= se->se1;
if(se->se2->ok==2) se2= se->se2->se1; if(se->se2->ok == STRIPELEM_META) se2= se->se2->se1;
else se2= se->se2; else se2= se->se2;
if(se->se3->ok==2) se3= se->se3->se1; if(se->se3->ok == STRIPELEM_META) se3= se->se3->se1;
else se3= se->se3; else se3= se->se3;
if ( (se1==0 || se2==0 || se3==0) if ( (se1==0 || se2==0 || se3==0)
@ -487,8 +491,7 @@ static void do_effect(int cfra, Sequence *seq, StripElem *se)
return; return;
} }
/* if metastrip: other se's */ if(se->se1->ok == STRIPELEM_META) se1= se->se1->se1;
if(se->se1->ok==2) se1= se->se1->se1;
else se1= se->se1; else se1= se->se1;
if (se1 == 0 || se1->ibuf == 0) { if (se1 == 0 || se1->ibuf == 0) {
@ -508,8 +511,7 @@ static void do_effect(int cfra, Sequence *seq, StripElem *se)
return; return;
} }
/* if metastrip: other se's */ if(se->se2->ok == STRIPELEM_META) se2= se->se2->se1;
if(se->se2->ok==2) se2= se->se2->se1;
else se2= se->se2; else se2= se->se2;
if (se2 == 0 || se2->ibuf == 0) { if (se2 == 0 || se2->ibuf == 0) {
@ -548,17 +550,11 @@ static void do_effect(int cfra, Sequence *seq, StripElem *se)
se->ibuf); se->ibuf);
} }
StripElem *give_stripelem(Sequence *seq, int cfra) static int give_stripelem_index(Sequence *seq, int cfra)
{ {
Strip *strip;
StripElem *se;
int nr; int nr;
strip= seq->strip; if(seq->startdisp >cfra || seq->enddisp <= cfra) return -1;
se= strip->stripdata;
if(se==0) return 0;
if(seq->startdisp >cfra || seq->enddisp <= cfra) return 0;
if(seq->flag&SEQ_REVERSE_FRAMES) { if(seq->flag&SEQ_REVERSE_FRAMES) {
/*reverse frame in this sequence */ /*reverse frame in this sequence */
@ -575,12 +571,50 @@ StripElem *give_stripelem(Sequence *seq, int cfra)
nr -= (int)fmod((double)nr, (double)seq->strobe); nr -= (int)fmod((double)nr, (double)seq->strobe);
} }
se+= nr; /* don't get confused by the increment, this is the same as strip->stripdata[nr], which works on some compilers...*/ return nr;
}
TStripElem *give_tstripelem(Sequence *seq, int cfra)
{
TStripElem *se;
int nr;
se = seq->strip->tstripdata;
if (se == 0 && seq->len > 0) {
int i;
se = seq->strip->tstripdata = MEM_callocN(
seq->len*sizeof(TStripElem), "tstripelems");
for (i = 0; i < seq->len; i++) {
se[i].ok = STRIPELEM_OK;
}
}
nr = give_stripelem_index(seq, cfra);
if (nr == -1) return 0;
if (se == 0) return 0;
se+= nr;
se->nr= nr; se->nr= nr;
return se; return se;
} }
StripElem *give_stripelem(Sequence *seq, int cfra)
{
StripElem *se;
int nr;
se = seq->strip->stripdata;
nr = give_stripelem_index(seq, cfra);
if (nr == -1) return 0;
if (se == 0) return 0;
se += nr;
return se;
}
static int evaluate_seq_frame_gen( static int evaluate_seq_frame_gen(
Sequence ** seq_arr, ListBase *seqbase, int cfra) Sequence ** seq_arr, ListBase *seqbase, int cfra)
{ {
@ -664,36 +698,57 @@ static Sequence * get_shown_seq_from_metastrip(Sequence * seqm, int cfra)
void set_meta_stripdata(Sequence *seqm) void set_meta_stripdata(Sequence *seqm)
{ {
Sequence *seq; Sequence *seq;
StripElem *se; TStripElem *se;
int a, cfra; int a, cfra;
se= seqm->strip->tstripdata;
if (se == 0 && seqm->len > 0) {
int i;
se = seqm->strip->tstripdata = MEM_callocN(
seqm->len*sizeof(TStripElem), "tstripelems");
for (i = 0; i < seqm->len; i++) {
se[i].ok = STRIPELEM_META;
}
}
/* sets all ->se1 pointers in stripdata, to read the ibuf from it */ /* sets all ->se1 pointers in stripdata, to read the ibuf from it */
se= seqm->strip->stripdata;
for(a=0; a<seqm->len; a++, se++) { for(a=0; a<seqm->len; a++, se++) {
cfra= a+seqm->start; cfra= a+seqm->start;
seq = get_shown_seq_from_metastrip(seqm, cfra); seq = get_shown_seq_from_metastrip(seqm, cfra);
if (seq) { if (seq) {
se->se1= give_stripelem(seq, cfra); se->se1= give_tstripelem(seq, cfra);
} else { } else {
se->se1= 0; se->se1= 0;
} }
} }
} }
static void do_build_seq_ibuf(Sequence * seq, int cfra) static TStripElem* do_build_seq_recursively(Sequence * seq, int cfra);
static void do_build_seq_ibuf(Sequence * seq, TStripElem *se, int cfra)
{ {
StripElem *se = seq->curelem;
char name[FILE_MAXDIR+FILE_MAXFILE]; char name[FILE_MAXDIR+FILE_MAXFILE];
if(seq->type == SEQ_META) { if(seq->type == SEQ_META) {
se->ok= 2; if(seq->seqbase.first) {
if(se->se1==0) set_meta_stripdata(seq); Sequence * seqmshown=
get_shown_seq_from_metastrip(seq, cfra);
if (seqmshown) {
if(cfra< seq->start)
do_build_seq_recursively(seqmshown, seq->start);
else if(cfra> seq->start+seq->len-1)
do_build_seq_recursively(seqmshown, seq->start + seq->len-1);
else do_build_seq_recursively(seqmshown, cfra);
}
}
se->ok = STRIPELEM_META;
if(se->se1 == 0) set_meta_stripdata(seq);
if(se->se1) { if(se->se1) {
se->ibuf= se->se1->ibuf; se->ibuf= se->se1->ibuf;
} }
} else if(seq->type == SEQ_RAM_SOUND || seq->type == SEQ_HD_SOUND) {
se->ok= 2;
} else if(seq->type & SEQ_EFFECT) { } else if(seq->type & SEQ_EFFECT) {
/* test if image is too small or discarded from cache: reload */ /* test if image is too small or discarded from cache: reload */
@ -706,22 +761,13 @@ static void do_build_seq_ibuf(Sequence * seq, int cfra)
/* should the effect be recalculated? */ /* should the effect be recalculated? */
if(se->ibuf==0 if(se->ibuf == 0) {
|| (seq->seq1 && se->se1 != seq->seq1->curelem) /* if one of two first inputs are rectfloat, output is float too */
|| (seq->seq2 && se->se2 != seq->seq2->curelem) if((se->se1 && se->se1->ibuf && se->se1->ibuf->rect_float) ||
|| (seq->seq3 && se->se3 != seq->seq3->curelem)) { (se->se2 && se->se2->ibuf && se->se2->ibuf->rect_float))
if (seq->seq1) se->se1= seq->seq1->curelem; se->ibuf= IMB_allocImBuf((short)seqrectx, (short)seqrecty, 32, IB_rectfloat, 0);
if (seq->seq2) se->se2= seq->seq2->curelem; else
if (seq->seq3) se->se3= seq->seq3->curelem; se->ibuf= IMB_allocImBuf((short)seqrectx, (short)seqrecty, 32, IB_rect, 0);
if(se->ibuf==NULL) {
/* if one of two first inputs are rectfloat, output is float too */
if((se->se1 && se->se1->ibuf && se->se1->ibuf->rect_float) ||
(se->se2 && se->se2->ibuf && se->se2->ibuf->rect_float))
se->ibuf= IMB_allocImBuf((short)seqrectx, (short)seqrecty, 32, IB_rectfloat, 0);
else
se->ibuf= IMB_allocImBuf((short)seqrectx, (short)seqrecty, 32, IB_rect, 0);
}
do_effect(cfra, seq, se); do_effect(cfra, seq, se);
} }
@ -743,27 +789,30 @@ static void do_build_seq_ibuf(Sequence * seq, int cfra)
if(se->ibuf->x < seqrectx || se->ibuf->y < seqrecty || !(se->ibuf->rect || se->ibuf->rect_float)) { if(se->ibuf->x < seqrectx || se->ibuf->y < seqrecty || !(se->ibuf->rect || se->ibuf->rect_float)) {
IMB_freeImBuf(se->ibuf); IMB_freeImBuf(se->ibuf);
se->ibuf= 0; se->ibuf= 0;
se->ok= 1; se->ok= STRIPELEM_OK;
} }
} }
if(seq->type==SEQ_IMAGE) { if(seq->type==SEQ_IMAGE) {
if(se->ok && se->ibuf==0) { if(se->ok == STRIPELEM_OK && se->ibuf==0) {
StripElem * s_elem = give_stripelem(seq, cfra);
/* if playanim or render: /* if playanim or render:
no waitcursor */ no waitcursor */
if((G.f & G_PLAYANIM)==0) if((G.f & G_PLAYANIM)==0)
waitcursor(1); waitcursor(1);
strncpy(name, seq->strip->dir, FILE_MAXDIR-1); strncpy(name, seq->strip->dir, FILE_MAXDIR-1);
strncat(name, se->name, FILE_MAXFILE); strncat(name, s_elem->name, FILE_MAXFILE);
BLI_convertstringcode(name, G.sce, G.scene->r.cfra); BLI_convertstringcode(name, G.sce, G.scene->r.cfra);
se->ibuf= IMB_loadiffname(name, IB_rect); se->ibuf= IMB_loadiffname(name, IB_rect);
if((G.f & G_PLAYANIM)==0) if((G.f & G_PLAYANIM)==0)
waitcursor(0); waitcursor(0);
if(se->ibuf==0) se->ok= 0; if(se->ibuf == 0) {
else { se->ok = STRIPELEM_FAILED;
} else {
if(seq->flag & SEQ_MAKE_PREMUL) { if(seq->flag & SEQ_MAKE_PREMUL) {
if(se->ibuf->depth==32 && se->ibuf->zbuf==0) converttopremul(se->ibuf); if(se->ibuf->depth==32 && se->ibuf->zbuf==0) converttopremul(se->ibuf);
} }
@ -778,7 +827,7 @@ static void do_build_seq_ibuf(Sequence * seq, int cfra)
} }
} }
else if(seq->type==SEQ_MOVIE) { else if(seq->type==SEQ_MOVIE) {
if(se->ok && se->ibuf==0) { if(se->ok == STRIPELEM_OK && se->ibuf==0) {
if(seq->anim==0) { if(seq->anim==0) {
strncpy(name, seq->strip->dir, FILE_MAXDIR-1); strncpy(name, seq->strip->dir, FILE_MAXDIR-1);
strncat(name, seq->strip->stripdata->name, FILE_MAXFILE-1); strncat(name, seq->strip->stripdata->name, FILE_MAXFILE-1);
@ -791,8 +840,9 @@ static void do_build_seq_ibuf(Sequence * seq, int cfra)
se->ibuf = IMB_anim_absolute(seq->anim, se->nr); se->ibuf = IMB_anim_absolute(seq->anim, se->nr);
} }
if(se->ibuf==0) se->ok= 0; if(se->ibuf == 0) {
else { se->ok = STRIPELEM_FAILED;
} else {
if(seq->flag & SEQ_MAKE_PREMUL) { if(seq->flag & SEQ_MAKE_PREMUL) {
if(se->ibuf->depth==32) converttopremul(se->ibuf); if(se->ibuf->depth==32) converttopremul(se->ibuf);
} }
@ -893,21 +943,23 @@ static void do_build_seq_ibuf(Sequence * seq, int cfra)
} }
} }
if (se->ibuf) { if (se->ibuf && seq->type != SEQ_META) {
IMB_cache_limiter_insert(se->ibuf); IMB_cache_limiter_insert(se->ibuf);
IMB_cache_limiter_ref(se->ibuf); IMB_cache_limiter_ref(se->ibuf);
IMB_cache_limiter_touch(se->ibuf); IMB_cache_limiter_touch(se->ibuf);
} }
} }
static void do_build_seq_recursively(Sequence * seq, int cfra); static void do_effect_seq_recursively(Sequence * seq, TStripElem *se, int cfra)
static void do_effect_seq_recursively(int cfra, Sequence * seq, StripElem *se)
{ {
float fac, facf; float fac, facf;
struct SeqEffectHandle sh = get_sequence_effect(seq); struct SeqEffectHandle sh = get_sequence_effect(seq);
int early_out; int early_out;
se->se1 = 0;
se->se2 = 0;
se->se3 = 0;
if(seq->ipo && seq->ipo->curve.first) { if(seq->ipo && seq->ipo->curve.first) {
do_seq_ipo(seq); do_seq_ipo(seq);
fac= seq->facf0; fac= seq->facf0;
@ -924,79 +976,50 @@ static void do_effect_seq_recursively(int cfra, Sequence * seq, StripElem *se)
/* no input needed */ /* no input needed */
break; break;
case 0: case 0:
do_build_seq_recursively(seq->seq1, cfra); se->se1 = do_build_seq_recursively(seq->seq1, cfra);
do_build_seq_recursively(seq->seq2, cfra); se->se2 = do_build_seq_recursively(seq->seq2, cfra);
if (seq->seq3) { if (seq->seq3) {
do_build_seq_recursively(seq->seq3, cfra); se->se3 = do_build_seq_recursively(seq->seq3, cfra);
} }
break; break;
case 1: case 1:
do_build_seq_recursively(seq->seq1, cfra); se->se1 = do_build_seq_recursively(seq->seq1, cfra);
break; break;
case 2: case 2:
do_build_seq_recursively(seq->seq2, cfra); se->se2 = do_build_seq_recursively(seq->seq2, cfra);
break; break;
} }
do_build_seq_ibuf(seq, cfra); do_build_seq_ibuf(seq, se, cfra);
/* children are not needed anymore ... */ /* children are not needed anymore ... */
switch (early_out) { if (se->se1 && se->se1->ibuf) {
case 0: IMB_cache_limiter_unref(se->se1->ibuf);
if (seq->seq1->curelem && seq->seq1->curelem->ibuf) }
IMB_cache_limiter_unref(seq->seq1->curelem->ibuf); if (se->se2 && se->se2->ibuf) {
if (seq->seq2->curelem && seq->seq2->curelem->ibuf) IMB_cache_limiter_unref(se->se2->ibuf);
IMB_cache_limiter_unref(seq->seq2->curelem->ibuf); }
if (seq->seq3) { if (se->se3 && se->se3->ibuf) {
if (seq->seq3->curelem && seq->seq3->curelem->ibuf) IMB_cache_limiter_unref(se->se3->ibuf);
IMB_cache_limiter_unref(
seq->seq3->curelem->ibuf);
}
break;
case 1:
if (seq->seq1->curelem && seq->seq1->curelem->ibuf)
IMB_cache_limiter_unref(seq->seq1->curelem->ibuf);
break;
case 2:
if (seq->seq2->curelem && seq->seq2->curelem->ibuf)
IMB_cache_limiter_unref(seq->seq2->curelem->ibuf);
break;
} }
} }
static void do_build_seq_recursively_impl(Sequence * seq, int cfra) static TStripElem* do_build_seq_recursively_impl(Sequence * seq, int cfra)
{ {
StripElem *se; TStripElem *se;
se = seq->curelem = give_stripelem(seq, cfra); se = give_tstripelem(seq, cfra);
if(se) { if(se) {
int unref_meta = FALSE;
if(seq->seqbase.first) {
Sequence * seqmshown= get_shown_seq_from_metastrip(seq, cfra);
if (seqmshown) {
if(cfra< seq->start)
do_build_seq_recursively(seqmshown, seq->start);
else if(cfra> seq->start+seq->len-1)
do_build_seq_recursively(seqmshown, seq->start + seq->len-1);
else do_build_seq_recursively(seqmshown, cfra);
unref_meta = TRUE;
}
}
if (seq->type & SEQ_EFFECT) { if (seq->type & SEQ_EFFECT) {
do_effect_seq_recursively(cfra, seq, se); do_effect_seq_recursively(seq, se, cfra);
} else { } else {
do_build_seq_ibuf(seq, cfra); do_build_seq_ibuf(seq, se, cfra);
}
if(unref_meta && seq->curelem->ibuf) {
IMB_cache_limiter_unref(seq->curelem->ibuf);
} }
} }
return se;
} }
/* FIXME: /* FIXME:
@ -1007,16 +1030,16 @@ instead of faking using the blend code below...
*/ */
static void do_handle_speed_effect(Sequence * seq, int cfra) static TStripElem* do_handle_speed_effect(Sequence * seq, int cfra)
{ {
SpeedControlVars * s = (SpeedControlVars *)seq->effectdata; SpeedControlVars * s = (SpeedControlVars *)seq->effectdata;
int nr = cfra - seq->start; int nr = cfra - seq->start;
float f_cfra; float f_cfra;
int cfra_left; int cfra_left;
int cfra_right; int cfra_right;
StripElem * se = 0; TStripElem * se = 0;
StripElem * se1 = 0; TStripElem * se1 = 0;
StripElem * se2 = 0; TStripElem * se2 = 0;
sequence_effect_speed_rebuild_map(seq, 0); sequence_effect_speed_rebuild_map(seq, 0);
@ -1025,7 +1048,7 @@ static void do_handle_speed_effect(Sequence * seq, int cfra)
cfra_left = (int) floor(f_cfra); cfra_left = (int) floor(f_cfra);
cfra_right = (int) ceil(f_cfra); cfra_right = (int) ceil(f_cfra);
se = seq->curelem = give_stripelem(seq, cfra); se = give_tstripelem(seq, cfra);
if (cfra_left == cfra_right || if (cfra_left == cfra_right ||
(s->flags & SEQ_SPEED_BLEND) == 0) { (s->flags & SEQ_SPEED_BLEND) == 0) {
@ -1038,9 +1061,8 @@ static void do_handle_speed_effect(Sequence * seq, int cfra)
} }
if (se->ibuf == NULL) { if (se->ibuf == NULL) {
do_build_seq_recursively_impl(seq->seq1, cfra_left); se1 = do_build_seq_recursively_impl(
seq->seq1, cfra_left);
se1 = seq->seq1->curelem;
if((se1 && se1->ibuf && se1->ibuf->rect_float)) if((se1 && se1->ibuf && se1->ibuf->rect_float))
se->ibuf= IMB_allocImBuf((short)seqrectx, (short)seqrecty, 32, IB_rectfloat, 0); se->ibuf= IMB_allocImBuf((short)seqrectx, (short)seqrecty, 32, IB_rectfloat, 0);
@ -1072,11 +1094,10 @@ static void do_handle_speed_effect(Sequence * seq, int cfra)
} }
if (se->ibuf == NULL) { if (se->ibuf == NULL) {
do_build_seq_recursively_impl(seq->seq1, cfra_left); se1 = do_build_seq_recursively_impl(
se1 = seq->seq1->curelem; seq->seq1, cfra_left);
do_build_seq_recursively_impl(seq->seq1, cfra_right); se2 = do_build_seq_recursively_impl(
se2 = seq->seq1->curelem; seq->seq1, cfra_right);
if((se1 && se1->ibuf && se1->ibuf->rect_float)) if((se1 && se1->ibuf && se1->ibuf->rect_float))
se->ibuf= IMB_allocImBuf((short)seqrectx, (short)seqrecty, 32, IB_rectfloat, 0); se->ibuf= IMB_allocImBuf((short)seqrectx, (short)seqrecty, 32, IB_rectfloat, 0);
@ -1110,35 +1131,43 @@ static void do_handle_speed_effect(Sequence * seq, int cfra)
IMB_cache_limiter_unref(se1->ibuf); IMB_cache_limiter_unref(se1->ibuf);
if (se2 && se2->ibuf) if (se2 && se2->ibuf)
IMB_cache_limiter_unref(se2->ibuf); IMB_cache_limiter_unref(se2->ibuf);
return se;
} }
/* /*
* build all ibufs recursively * build all ibufs recursively
* *
* if successfull, seq->curelem->ibuf contains the (referenced!) imbuf * if successfull, the returned TStripElem contains the (referenced!) imbuf
* that means: you _must_ call * that means: you _must_ call
* *
* IMB_cache_limiter_unref(seq->curelem->ibuf); * IMB_cache_limiter_unref(rval);
* *
* if seq->curelem exists! * if rval != 0
* *
*/ */
static void do_build_seq_recursively(Sequence * seq, int cfra) static TStripElem* do_build_seq_recursively(Sequence * seq, int cfra)
{ {
if (seq->type == SEQ_SPEED) { if (seq->type == SEQ_SPEED) {
do_handle_speed_effect(seq, cfra); return do_handle_speed_effect(seq, cfra);
} else { } else {
do_build_seq_recursively_impl(seq, cfra); return do_build_seq_recursively_impl(seq, cfra);
} }
} }
ImBuf *give_ibuf_seq(int rectx, int recty, int cfra, int chanshown) /*
* returned ImBuf is refed!
* you have to unref after usage!
*/
static ImBuf *give_ibuf_seq_impl(int rectx, int recty, int cfra, int chanshown)
{ {
Sequence *seqfirst=0; Sequence *seqfirst=0;
Editing *ed; Editing *ed;
int count; int count;
ListBase *seqbasep; ListBase *seqbasep;
TStripElem *se;
ed= G.scene->ed; ed= G.scene->ed;
if(ed==0) return 0; if(ed==0) return 0;
@ -1160,18 +1189,44 @@ ImBuf *give_ibuf_seq(int rectx, int recty, int cfra, int chanshown)
return 0; return 0;
} }
do_build_seq_recursively(seqfirst, cfra); se = do_build_seq_recursively(seqfirst, cfra);
if(!seqfirst->curelem) { if(!se) {
return 0; return 0;
} }
if (seqfirst->curelem->ibuf) { return se->ibuf;
IMB_cache_limiter_unref(seqfirst->curelem->ibuf); }
ImBuf *give_ibuf_seq_direct(int rectx, int recty, int cfra,
Sequence * seq)
{
TStripElem* se;
seqrectx= rectx; /* bad bad global! */
seqrecty= recty;
se = do_build_seq_recursively(seq, cfra);
if(!se) {
return 0;
} }
return seqfirst->curelem->ibuf; if (se->ibuf) {
IMB_cache_limiter_unref(se->ibuf);
}
return se->ibuf;
}
ImBuf *give_ibuf_seq(int rectx, int recty, int cfra, int chanshown)
{
ImBuf* i = give_ibuf_seq_impl(rectx, recty, cfra, chanshown);
if (i) {
IMB_cache_limiter_unref(i);
}
return i;
} }
/* threading api */ /* threading api */
@ -1253,12 +1308,8 @@ static void * seq_prefetch_thread(void * This_)
This->running = TRUE; This->running = TRUE;
if (e->cfra >= s_last) { if (e->cfra >= s_last) {
e->ibuf = give_ibuf_seq(e->rectx, e->recty, e->cfra, e->ibuf = give_ibuf_seq_impl(
e->chanshown); e->rectx, e->recty, e->cfra, e->chanshown);
}
if (e->ibuf) {
IMB_cache_limiter_ref(e->ibuf);
} }
pthread_mutex_lock(&queue_lock); pthread_mutex_lock(&queue_lock);
@ -1413,7 +1464,7 @@ void seq_wait_for_prefetch_ready()
fprintf(stderr, "SEQ-THREAD: prefetch done\n"); fprintf(stderr, "SEQ-THREAD: prefetch done\n");
} }
ImBuf * give_ibuf_threaded(int rectx, int recty, int cfra, int chanshown) ImBuf * give_ibuf_seq_threaded(int rectx, int recty, int cfra, int chanshown)
{ {
PrefetchQueueElem * e = 0; PrefetchQueueElem * e = 0;
int found_something = FALSE; int found_something = FALSE;
@ -1493,13 +1544,13 @@ ImBuf * give_ibuf_threaded(int rectx, int recty, int cfra, int chanshown)
/* Functions to free imbuf and anim data on changes */ /* Functions to free imbuf and anim data on changes */
static void free_imbuf_strip_elem(StripElem *se) static void free_imbuf_strip_elem(TStripElem *se)
{ {
if (se->ibuf) { if (se->ibuf) {
if (se->ok != 2) if (se->ok != STRIPELEM_META && se->ibuf != 0)
IMB_freeImBuf(se->ibuf); IMB_freeImBuf(se->ibuf);
se->ibuf= 0; se->ibuf= 0;
se->ok= 1; se->ok= STRIPELEM_OK;
se->se1= se->se2= se->se3= 0; se->se1= se->se2= se->se3= 0;
} }
} }
@ -1516,15 +1567,17 @@ void free_imbuf_seq_except(int cfra)
{ {
Editing *ed= G.scene->ed; Editing *ed= G.scene->ed;
Sequence *seq; Sequence *seq;
StripElem *se; TStripElem *se;
int a; int a;
if(ed==0) return; if(ed==0) return;
WHILE_SEQ(&ed->seqbase) { WHILE_SEQ(&ed->seqbase) {
if(seq->strip) { if(seq->strip) {
for(a=0, se= seq->strip->stripdata; a<seq->len; a++, se++) TStripElem * curelem = give_tstripelem(seq, cfra);
if(se!=seq->curelem)
for(a=0, se= seq->strip->tstripdata; a<seq->len; a++, se++)
if(se != curelem)
free_imbuf_strip_elem(se); free_imbuf_strip_elem(se);
if(seq->type==SEQ_MOVIE) if(seq->type==SEQ_MOVIE)
@ -1539,15 +1592,17 @@ void free_imbuf_seq()
{ {
Editing *ed= G.scene->ed; Editing *ed= G.scene->ed;
Sequence *seq; Sequence *seq;
StripElem *se; TStripElem *se;
int a; int a;
if(ed==0) return; if(ed==0) return;
WHILE_SEQ(&ed->seqbase) { WHILE_SEQ(&ed->seqbase) {
if(seq->strip) { if(seq->strip) {
for(a=0, se= seq->strip->stripdata; a<seq->len; a++, se++) if (seq->strip->tstripdata) {
free_imbuf_strip_elem(se); for(a=0, se= seq->strip->tstripdata; a<seq->len; a++, se++)
free_imbuf_strip_elem(se);
}
if(seq->type==SEQ_MOVIE) if(seq->type==SEQ_MOVIE)
free_anim_seq(seq); free_anim_seq(seq);
@ -1582,7 +1637,7 @@ static int update_changed_seq_recurs(Sequence *seq, Sequence *changed_seq, int l
{ {
Sequence *subseq; Sequence *subseq;
int a, free_imbuf = 0; int a, free_imbuf = 0;
StripElem *se; TStripElem *se;
/* recurs downwards to see if this seq depends on the changed seq */ /* recurs downwards to see if this seq depends on the changed seq */
@ -1594,24 +1649,27 @@ static int update_changed_seq_recurs(Sequence *seq, Sequence *changed_seq, int l
for(subseq=seq->seqbase.first; subseq; subseq=subseq->next) for(subseq=seq->seqbase.first; subseq; subseq=subseq->next)
if(update_changed_seq_recurs(subseq, changed_seq, len_change, ibuf_change)) if(update_changed_seq_recurs(subseq, changed_seq, len_change, ibuf_change))
free_imbuf = 1; free_imbuf = TRUE;
if(seq->seq1) if(seq->seq1)
if(update_changed_seq_recurs(seq->seq1, changed_seq, len_change, ibuf_change)) if(update_changed_seq_recurs(seq->seq1, changed_seq, len_change, ibuf_change))
free_imbuf = 1; free_imbuf = TRUE;
if(seq->seq2 && (seq->seq2 != seq->seq1)) if(seq->seq2 && (seq->seq2 != seq->seq1))
if(update_changed_seq_recurs(seq->seq2, changed_seq, len_change, ibuf_change)) if(update_changed_seq_recurs(seq->seq2, changed_seq, len_change, ibuf_change))
free_imbuf = 1; free_imbuf = TRUE;
if(seq->seq3 && (seq->seq3 != seq->seq1) && (seq->seq3 != seq->seq2)) if(seq->seq3 && (seq->seq3 != seq->seq1) && (seq->seq3 != seq->seq2))
if(update_changed_seq_recurs(seq->seq3, changed_seq, len_change, ibuf_change)) if(update_changed_seq_recurs(seq->seq3, changed_seq, len_change, ibuf_change))
free_imbuf = 1; free_imbuf = TRUE;
if(free_imbuf) { if(free_imbuf) {
if(ibuf_change) { if(ibuf_change) {
for(a=0, se= seq->strip->stripdata; a<seq->len; a++, se++) se= seq->strip->tstripdata;
free_imbuf_strip_elem(se); if (se) {
for(a=0; a<seq->len; a++, se++)
free_imbuf_strip_elem(se);
}
if(seq->type==SEQ_MOVIE) if(seq->type == SEQ_MOVIE)
free_anim_seq(seq); free_anim_seq(seq);
if(seq->type == SEQ_SPEED) { if(seq->type == SEQ_SPEED) {
sequence_effect_speed_rebuild_map(seq, 1); sequence_effect_speed_rebuild_map(seq, 1);
@ -1646,7 +1704,6 @@ void do_render_seq(RenderResult *rr, int cfra)
ibuf= give_ibuf_seq(rr->rectx, rr->recty, cfra, 0); ibuf= give_ibuf_seq(rr->rectx, rr->recty, cfra, 0);
if(ibuf) { if(ibuf) {
if(ibuf->rect_float) { if(ibuf->rect_float) {
if (!rr->rectf) if (!rr->rectf)
rr->rectf= MEM_mallocN(4*sizeof(float)*rr->rectx*rr->recty, "render_seq rectf"); rr->rectf= MEM_mallocN(4*sizeof(float)*rr->rectx*rr->recty, "render_seq rectf");

@ -2694,11 +2694,11 @@ void autokeyframe_ob_cb_func(Object *ob, int tmode)
char *actname=""; char *actname="";
if (G.flags & G_RECORDKEYS) { if (G.flags & G_RECORDKEYS) {
if(ob->ipoflag & OB_ACTION_OB) if (ob->ipoflag & OB_ACTION_OB)
actname= "Object"; actname= "Object";
if(U.uiflag & USER_KEYINSERTAVAI) { if (U.uiflag & USER_KEYINSERTAVAI) {
if(ob->ipo || ob->action) { if (ob->ipo || ob->action) {
ID *id= (ID *)(ob); ID *id= (ID *)(ob);
if (ob->ipo) { if (ob->ipo) {
@ -2714,7 +2714,7 @@ void autokeyframe_ob_cb_func(Object *ob, int tmode)
icu= NULL; icu= NULL;
} }
while(icu) { while (icu) {
icu->flag &= ~IPO_SELECT; icu->flag &= ~IPO_SELECT;
if (U.uiflag & USER_KEYINSERTNEED) if (U.uiflag & USER_KEYINSERTNEED)
insertkey_smarter(id, ID_OB, actname, NULL, icu->adrcode); insertkey_smarter(id, ID_OB, actname, NULL, icu->adrcode);
@ -2725,20 +2725,49 @@ void autokeyframe_ob_cb_func(Object *ob, int tmode)
} }
} }
else if (U.uiflag & USER_KEYINSERTNEED) { else if (U.uiflag & USER_KEYINSERTNEED) {
if (tmode==TFM_RESIZE) { short doLoc=0, doRot=0, doScale=0;
insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_SIZE_X);
insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_SIZE_Y); /* filter the conditions when this happens (assume that curarea->spacetype==SPACE_VIE3D) */
insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_SIZE_Z); if (tmode == TFM_TRANSLATION) {
doLoc = 1;
} }
else if (tmode==TFM_ROTATION) { else if (tmode == TFM_ROTATION) {
if (G.vd->around == V3D_ACTIVE) {
if (ob != OBACT)
doLoc = 1;
}
else if (G.vd->around == V3D_CURSOR)
doLoc = 1;
if ((G.vd->flag & V3D_ALIGN)==0)
doRot = 1;
}
else if (tmode == TFM_RESIZE) {
if (G.vd->around == V3D_ACTIVE) {
if (ob != OBACT)
doLoc = 1;
}
else if (G.vd->around == V3D_CURSOR)
doLoc = 1;
if ((G.vd->flag & V3D_ALIGN)==0)
doScale = 1;
}
if (doLoc) {
insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_LOC_X);
insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_LOC_Y);
insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_LOC_Z);
}
if (doRot) {
insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_ROT_X); insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_ROT_X);
insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_ROT_Y); insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_ROT_Y);
insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_ROT_Z); insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_ROT_Z);
} }
else if (tmode==TFM_TRANSLATION) { if (doScale) {
insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_LOC_X); insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_SIZE_X);
insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_LOC_Y); insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_SIZE_Y);
insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_LOC_Z); insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_SIZE_Z);
} }
} }
else { else {
@ -2785,7 +2814,7 @@ void autokeyframe_pose_cb_func(Object *ob, int tmode, short targetless_ik)
pchan->bone->flag &= ~BONE_UNKEYED; pchan->bone->flag &= ~BONE_UNKEYED;
/* only insert into available channels? */ /* only insert into available channels? */
if(U.uiflag & USER_KEYINSERTAVAI) { if (U.uiflag & USER_KEYINSERTAVAI) {
bActionChannel *achan; bActionChannel *achan;
for (achan = act->chanbase.first; achan; achan=achan->next){ for (achan = act->chanbase.first; achan; achan=achan->next){
@ -2803,18 +2832,42 @@ void autokeyframe_pose_cb_func(Object *ob, int tmode, short targetless_ik)
} }
/* only insert keyframe if needed? */ /* only insert keyframe if needed? */
else if (U.uiflag & USER_KEYINSERTNEED) { else if (U.uiflag & USER_KEYINSERTNEED) {
if ((tmode==TFM_TRANSLATION) && (targetless_ik==0)) { short doLoc=0, doRot=0, doScale=0;
/* filter the conditions when this happens (assume that curarea->spacetype==SPACE_VIE3D) */
if (tmode == TFM_TRANSLATION) {
if (targetless_ik)
doRot= 1;
else
doLoc = 1;
}
else if (tmode == TFM_ROTATION) {
if (ELEM(G.vd->around, V3D_CURSOR, V3D_ACTIVE))
doLoc = 1;
if ((G.vd->flag & V3D_ALIGN)==0)
doRot = 1;
}
else if (tmode == TFM_RESIZE) {
if (ELEM(G.vd->around, V3D_CURSOR, V3D_ACTIVE))
doLoc = 1;
if ((G.vd->flag & V3D_ALIGN)==0)
doScale = 1;
}
if (doLoc) {
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_X); insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_X);
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_Y); insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_Y);
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_Z); insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_Z);
} }
if ((tmode==TFM_ROTATION) || ((tmode==TFM_TRANSLATION) && targetless_ik)) { if (doRot) {
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_W); insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_W);
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_X); insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_X);
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_Y); insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_Y);
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_Z); insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_Z);
} }
if (tmode==TFM_RESIZE) { if (doScale) {
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_X); insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_X);
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_Y); insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_Y);
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_Z); insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_Z);
@ -2889,7 +2942,7 @@ void special_aftertrans_update(TransInfo *t)
if (t->spacetype==SPACE_VIEW3D) if (t->spacetype==SPACE_VIEW3D)
EM_automerge(1); EM_automerge(1);
if(t->spacetype == SPACE_ACTION) { if (t->spacetype == SPACE_ACTION) {
void *data; void *data;
short datatype; short datatype;
@ -2929,7 +2982,7 @@ void special_aftertrans_update(TransInfo *t)
DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA); DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);
} }
} }
else if(t->spacetype == SPACE_NLA) { else if (t->spacetype == SPACE_NLA) {
synchronize_action_strips(); synchronize_action_strips();
/* cleanup */ /* cleanup */
@ -2938,21 +2991,21 @@ void special_aftertrans_update(TransInfo *t)
recalc_all_ipos(); // bad recalc_all_ipos(); // bad
} }
else if(t->spacetype == SPACE_IPO) { else if (t->spacetype == SPACE_IPO) {
// FIXME! is there any code from the old transform_ipo that needs to be added back? // FIXME! is there any code from the old transform_ipo that needs to be added back?
/* resetting slow-parents isn't really necessary when editing sequence ipo's */ /* resetting slow-parents isn't really necessary when editing sequence ipo's */
if (G.sipo->blocktype==ID_SEQ) if (G.sipo->blocktype==ID_SEQ)
resetslowpar= 0; resetslowpar= 0;
} }
else if(G.obedit) { else if (G.obedit) {
if(t->mode==TFM_BONESIZE || t->mode==TFM_BONE_ENVELOPE) if (t->mode==TFM_BONESIZE || t->mode==TFM_BONE_ENVELOPE)
allqueue(REDRAWBUTSEDIT, 0); allqueue(REDRAWBUTSEDIT, 0);
/* table needs to be created for each edit command, since vertices can move etc */ /* table needs to be created for each edit command, since vertices can move etc */
mesh_octree_table(G.obedit, NULL, 'e'); mesh_octree_table(G.obedit, NULL, 'e');
} }
else if( (t->flag & T_POSE) && t->poseobj) { else if ((t->flag & T_POSE) && (t->poseobj)) {
bArmature *arm; bArmature *arm;
bPose *pose; bPose *pose;
bPoseChannel *pchan; bPoseChannel *pchan;
@ -2966,7 +3019,7 @@ void special_aftertrans_update(TransInfo *t)
pose->flag |= POSE_DO_UNLOCK; pose->flag |= POSE_DO_UNLOCK;
/* if target-less IK grabbing, we calculate the pchan transforms and clear flag */ /* if target-less IK grabbing, we calculate the pchan transforms and clear flag */
if(!cancelled && t->mode==TFM_TRANSLATION) if (!cancelled && t->mode==TFM_TRANSLATION)
targetless_ik= apply_targetless_ik(ob); targetless_ik= apply_targetless_ik(ob);
else { else {
/* not forget to clear the auto flag */ /* not forget to clear the auto flag */
@ -2976,15 +3029,15 @@ void special_aftertrans_update(TransInfo *t)
} }
} }
if(t->mode==TFM_TRANSLATION) if (t->mode==TFM_TRANSLATION)
pose_grab_with_ik_clear(ob); pose_grab_with_ik_clear(ob);
/* automatic inserting of keys and unkeyed tagging - only if transform wasn't cancelled (or TFM_DUMMY) */ /* automatic inserting of keys and unkeyed tagging - only if transform wasn't cancelled (or TFM_DUMMY) */
if(!cancelled && (t->mode != TFM_DUMMY)) { if (!cancelled && (t->mode != TFM_DUMMY)) {
autokeyframe_pose_cb_func(ob, t->mode, targetless_ik); autokeyframe_pose_cb_func(ob, t->mode, targetless_ik);
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
} }
else if(arm->flag & ARM_DELAYDEFORM) { else if (arm->flag & ARM_DELAYDEFORM) {
/* old optimize trick... this enforces to bypass the depgraph */ /* old optimize trick... this enforces to bypass the depgraph */
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
ob->recalc= 0; // is set on OK position already by recalcData() ob->recalc= 0; // is set on OK position already by recalcData()
@ -2992,18 +3045,20 @@ void special_aftertrans_update(TransInfo *t)
else else
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA); DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
if(t->mode==TFM_BONESIZE || t->mode==TFM_BONE_ENVELOPE) if (t->mode==TFM_BONESIZE || t->mode==TFM_BONE_ENVELOPE)
allqueue(REDRAWBUTSEDIT, 0); allqueue(REDRAWBUTSEDIT, 0);
} }
else { else {
base= FIRSTBASE; base= FIRSTBASE;
while(base) {
while (base) {
if(base->flag & BA_DO_IPO) redrawipo= 1; if(base->flag & BA_DO_IPO) redrawipo= 1;
ob= base->object; ob= base->object;
if(modifiers_isSoftbodyEnabled(ob)) ob->softflag |= OB_SB_REDO; if (modifiers_isSoftbodyEnabled(ob)) ob->softflag |= OB_SB_REDO;
else if(modifiers_isClothEnabled(ob)) { else if(modifiers_isClothEnabled(ob)) {
cloth_free_modifier(modifiers_isClothEnabled(ob)); cloth_free_modifier(modifiers_isClothEnabled(ob));
} }
@ -3020,7 +3075,7 @@ void special_aftertrans_update(TransInfo *t)
clear_trans_object_base_flags(); clear_trans_object_base_flags();
if(redrawipo) { if (redrawipo) {
allqueue(REDRAWNLA, 0); allqueue(REDRAWNLA, 0);
allqueue(REDRAWACTION, 0); allqueue(REDRAWACTION, 0);
allqueue(REDRAWIPO, 0); allqueue(REDRAWIPO, 0);

@ -175,7 +175,7 @@ void BL_SkinDeformer::Update(void)
for (int v =0; v<m_bmesh->totvert; v++) for (int v =0; v<m_bmesh->totvert; v++)
VECCOPY(m_transverts[v], m_bmesh->mvert[v].co); VECCOPY(m_transverts[v], m_bmesh->mvert[v].co);
armature_deform_verts( par_arma, m_objMesh, NULL, m_transverts, NULL, m_bmesh->totvert, ARM_DEF_VGROUP, NULL ); armature_deform_verts( par_arma, m_objMesh, NULL, m_transverts, NULL, m_bmesh->totvert, ARM_DEF_VGROUP, NULL, NULL );
RecalcNormals(); RecalcNormals();
/* Update the current frame */ /* Update the current frame */