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

@ -67,6 +67,7 @@ OPTION(WITH_OPENEXR "Enable OpenEXR Support (http://www.openexr.com)" OFF)
OPTION(WITH_FFMPEG "Enable FFMPeg Support (http://ffmpeg.mplayerhq.hu/)" OFF)
OPTION(WITH_OPENAL "Enable OpenAL Support (http://www.openal.org)" ON)
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)
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")
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")
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_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_INC ${SDL}/include)
SET(SDL_LIB SDL)
@ -347,6 +359,12 @@ IF(APPLE)
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")
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_INC ${SDL}/include)
SET(SDL_LIB SDL)

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

@ -154,7 +154,7 @@ typedef struct elbeemMesh {
short volumeInitType;
/* name of the mesh, mostly for debugging */
char *name;
const char *name;
} elbeemMesh;
// 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...
bool AttributeList::ignoreParameter(string name, string source) {
name=source=(""); // remove warning
name = source = ("");
return false;
}

@ -54,15 +54,84 @@
#define unused_GRID_REGION_END() \
} /* main_region */ \
// end unusedGRID_REGION_END
// -----------------------------------------------------------------------------------
#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
@ -101,9 +170,11 @@
// old loop for COMPRESSGRIDS==0
#define old__GRID_LOOP_START() \
for(int k=kstart;k<kend;++k) { \
for(int j=1;j<mLevel[lev].lSizey-1;++j) { \
for(int i=0;i<mLevel[lev].lSizex-2; ) {

@ -22,6 +22,7 @@
#include <math.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
// hack for MSVC6.0 compiler
#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...
vertices = NULL; triangles = NULL;
normals = NULL; objectId = 0;
time = 0.0;
time = 0.;
#else // ELBEEM_PLUGIN
int pcnt = 0;
// currently not used in blender

@ -15,7 +15,6 @@
#include "solver_interface.h"
#include "particletracer.h"
#include "elbeem.h"
#include <stdlib.h> /* exit(3) - also in linux */
#ifdef _WIN32
#else
@ -69,6 +68,7 @@ SimulationObject::~SimulationObject()
/*! init tree for certain geometry init */
/*****************************************************************************/
void SimulationObject::initGeoTree() {
// unused!! overriden by solver interface
if(mpGlob == NULL) {
errFatal("SimulationObject::initGeoTree error","Requires globals!", SIMWORLD_INITERROR);
return;
@ -80,7 +80,7 @@ void SimulationObject::initGeoTree() {
char treeFlag = (1<<(mGeoInitId+4));
mpGiTree = new ntlTree( 20, 4, // warning - fixed values for depth & maxtriangles here...
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
mpLbm->step();
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;

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

@ -655,6 +655,7 @@ bool LbmFsgrSolver::initializeSolverMemory()
int orgSz = mSizez;
double sizeReduction = 1.0;
double memEstFromFunc = -1.0;
double memEstFine = -1.0;
string memreqStr("");
bool firstMInit = true;
int minitTries=0;
@ -672,7 +673,7 @@ bool LbmFsgrSolver::initializeSolverMemory()
firstMInit=false;
calculateMemreqEstimate( mSizex, mSizey, mSizez,
mMaxRefine, mFarFieldSize, &memEstFromFunc, &memreqStr );
mMaxRefine, mFarFieldSize, &memEstFromFunc, &memEstFine, &memreqStr );
double memLimit;
string memLimStr("-");
@ -685,13 +686,36 @@ bool LbmFsgrSolver::initializeSolverMemory()
memLimit = 16.0* 1024.0*1024.0*1024.0;
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;
mSizex = (int)(orgSx * sizeReduction);
mSizey = (int)(orgSy * sizeReduction);
mSizez = (int)(orgSz * sizeReduction);
debMsgStd("LbmFsgrSolver::initialize",DM_WARNING,"initGridSizes: memory limit exceeded "<<
//memEstFromFunc<<"/"<<memLimit<<", "<<
//memEstFine<<"/"<<maxWinMemChunk<<", "<<
memreqStr<<"/"<<memLimStr<<", "<<
"retrying: "<<PRINT_VEC(mSizex,mSizey,mSizez)<<" org:"<<PRINT_VEC(orgSx,orgSy,orgSz)
, 3 );
@ -778,10 +802,6 @@ bool LbmFsgrSolver::initializeSolverMemory()
mLevel[ mMaxRefine ].simCellSize = mpParam->getCellSize();
mLevel[ mMaxRefine ].lcellfactor = 1.0;
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
mLevel[ mMaxRefine ].mprsCells[0] = new LbmFloat[ rcellSize +4 ];
@ -789,11 +809,34 @@ bool LbmFsgrSolver::initializeSolverMemory()
ownMemCheck += 2 * sizeof(LbmFloat) * (rcellSize+4);
#else // COMPRESSGRIDS==0
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[0] = mLevel[ mMaxRefine ].mprsCells[1]+compressOffset;
ownMemCheck += sizeof(LbmFloat) * (rcellSize +compressOffset +4);
#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;
if(LBMDIM==2) lcfdimFac = 4.0;
for(int i=mMaxRefine-1; i>=0; i--) {

@ -17,7 +17,6 @@
#include "ntl_world.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,
int refine, float farfield,
double *reqret, string *reqstr) {
double *reqret, double *reqretFine, string *reqstr) {
// debug estimation?
const bool debugMemEst = true;
// 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
double memCnt = 0.0;
double ddTotalNum = (double)dTotalNum;
if(reqretFine) *reqretFine = -1.;
double currResx = (double)resx;
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(!useGridComp) {
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);
} else {
double compressOffset = (double)(currResx*currResy*ddTotalNum*2.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);
}
for(int i=refine-1; i>=0; i--) {

@ -21,7 +21,7 @@
#if LBM_USE_GUI==1
#define USE_GLUTILITIES
// for debug display
#include <GL/gl.h>
//#include <GL/gl.h>
#include "../gui/guifuncs.h"
#endif
@ -596,8 +596,10 @@ class LbmSolverInterface
void initGridSizes(int &mSizex, int &mSizey, int &mSizez,
ntlVec3Gfx &mvGeoStart, ntlVec3Gfx &mvGeoEnd,
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,
float farfieldsize, double *reqret, string *reqstr);
float farfieldsize, double *reqret, double *reqretFine, string *reqstr);
//! helper function to convert flag to string (for debuggin)
string convertCellFlagType2String( CellFlagType flag );

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

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

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

@ -9,11 +9,6 @@
#ifndef UTILITIES_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) */
#ifdef ELBEEM_PLUGIN

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

@ -11,6 +11,8 @@ def Error_NoMeshUvActive():
Draw.PupMenu('Error%t|Active object is not a mesh with texface')
def Error_NoMeshMultiresEdit():
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
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
# 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
from struct import *
import re
@ -200,6 +205,8 @@ class FltOut:
def __init__(self, filename):
self.file = open(filename, 'wb')
self.filename = filename
class FileFinder:
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 ])
except: pass
me.faces.extend(faces)
me.faces.extend(faces, smooth = True)
print '\nSkin done in %.4f sec.' % (Blender.sys.time()-time1)

@ -44,6 +44,7 @@ from BPyMathutils import angleToLength
import mesh_solidify
import BPyMessages
reload(BPyMessages)
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 /= len(vusers)
me.faces.delete(1, range(len(me.faces)))
me.faces.extend(new_faces)
@ -245,6 +244,18 @@ def main():
BPyMessages.Error_NoMeshActive()
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.
PREF_THICK = Blender.Draw.Create(0.005)
PREF_SOLID = Blender.Draw.Create(1)
@ -259,16 +270,10 @@ def main():
]
if not Blender.Draw.PupBlock('Solid Wireframe', pup_block):
if is_editmode: Window.EditMode(1)
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)
me = ob_act.getData(mesh=1) # old NMesh api is default
t = sys.time()
# Run the mesh editing function

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

@ -64,8 +64,8 @@ void lattice_deform_verts(struct Object *laOb, struct Object *target,
int numVerts, char *vgroup);
void armature_deform_verts(struct Object *armOb, struct Object *target,
struct DerivedMesh *dm, float (*vertexCos)[3],
float (*defMats)[3][3], int numVerts,
int deformflag, const char *defgrp_name);
float (*defMats)[3][3], int numVerts, int deformflag,
float (*prevCos)[3], const char *defgrp_name);
float (*lattice_getVertexCos(struct Object *ob, int *numVerts_r))[3];
void lattice_applyVertexCos(struct Object *ob, float (*vertexCos)[3]);
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,
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;
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_quaternion = deformflag & ARM_DEF_QUATERNION;
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 i, target_totvert = 0; /* safety for vertexgroup overflow */
int use_dverts = 0;
@ -881,11 +883,12 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm,
for(i = 0; i < numVerts; i++) {
MDeformVert *dvert;
DualQuat sumdq, *dq = NULL;
float *co = vertexCos[i], dco[3];
float *co, dco[3];
float sumvec[3], summat[3][3];
float *vec = NULL, (*smat)[3] = NULL;
float contrib = 0.0f;
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;
if(use_quaternion) {
@ -917,11 +920,22 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm,
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 */
if(armature_weight == 0.0f) continue;
/* get the coord we work on */
co= prevCos?prevCos[i]:vertexCos[i];
/* Apply the object's matrix */
Mat4MulVecfl(premat, co);
@ -1005,6 +1019,15 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm,
/* always, check above code */
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);
@ -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)
{
bActionModifier *amod;
bActionStrip *strip;
bActionStrip *strip, *strip2;
float scene_cfra= G.scene->r.cfra;
int do_modif;
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 */
if(scene_cfra==strip->end && strip->next && strip->next->start==scene_cfra)
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 */
if(icuval!=0.0f && kb->totelem==tot) {
KeyBlock *refb;
float weight, *weights= kb->weights;
poin= basispoin;
reffrom= key->refkey->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];
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(
ModifierData *md, Object *ob, DerivedMesh *derivedData,
float (*vertexCos)[3], int numVerts)
{
LatticeModifierData *lmd = (LatticeModifierData*) md;
modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
lattice_deform_verts(lmd->object, ob, derivedData,
vertexCos, numVerts, lmd->name);
}
@ -4667,8 +4684,16 @@ static void armatureModifier_deformVerts(
{
ArmatureModifierData *amd = (ArmatureModifierData*) md;
modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
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(
@ -4681,7 +4706,7 @@ static void armatureModifier_deformVertsEM(
if(!derivedData) dm = CDDM_from_editmesh(editData, ob->data);
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);
}
@ -4697,7 +4722,7 @@ static void armatureModifier_deformMatricesEM(
if(!derivedData) dm = CDDM_from_editmesh(editData, ob->data);
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);
}
@ -5494,6 +5519,8 @@ static void meshdeformModifier_deformVerts(
else
dm= derivedData;
modifier_vgroup_cache(md, vertexCos); /* if next modifier needs original vertices */
meshdeformModifier_do(md, ob, dm, vertexCos, numVerts);
if(dm != derivedData)

@ -1178,6 +1178,8 @@ void object_make_proxy(Object *ob, Object *target, Object *gob)
VECCOPY(ob->loc, gob->loc);
VECCOPY(ob->rot, gob->rot);
VECCOPY(ob->size, gob->size);
group_tag_recalc(gob->dup_group);
}
else {
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;
Sequence *seq;
MetaStack *ms;
StripElem *se;
int a;
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 */
if(seq->seq3==0) seq->seq3= seq->seq2;
seq->curelem= 0;
seq->plugin= newdataadr(fd, seq->plugin);
seq->effectdata= newdataadr(fd, seq->effectdata);
@ -3274,61 +3271,19 @@ static void direct_link_scene(FileData *fd, Scene *sce)
seq->strip= newdataadr(fd, seq->strip);
if(seq->strip && seq->strip->done==0) {
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->strip->stripdata= newdataadr(fd, seq->strip->stripdata);
se= seq->strip->stripdata;
if(se) {
for(a=0; a<seq->strip->len; a++, se++) {
se->ok= 1;
se->ibuf= 0;
if(seq->type == SEQ_IMAGE ||
seq->type == SEQ_MOVIE ||
seq->type == SEQ_RAM_SOUND ||
seq->type == SEQ_HD_SOUND) {
seq->strip->stripdata = newdataadr(
fd, seq->strip->stripdata);
} else {
seq->strip->stripdata = 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
/* link metastack, slight abuse of structs here, have to restore pointer to internal part in struct */

@ -37,6 +37,7 @@
struct PluginSeq;
struct StripElem;
struct TStripElem;
struct Strip;
struct Sequence;
struct ListBase;
@ -44,9 +45,9 @@ struct Editing;
struct ImBuf;
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 new_stripdata(struct Sequence *seq);
void new_tstripdata(struct Sequence *seq);
void free_sequence(struct Sequence *seq);
void build_seqar(struct ListBase *seqbase, struct Sequence ***seqar, int *totseq);
void free_editing(struct Editing *ed);
@ -57,16 +58,19 @@ void clear_scene_in_allseqs(struct Scene *sce);
int evaluate_seq_frame(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);
struct ImBuf *give_ibuf_seq(int rectx, int recty, int cfra, int chansel);
/* 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 */
void seq_start_threads();
void seq_stop_threads();
void give_ibuf_prefetch_request(int rectx, int recty, int cfra, int chanshown);
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);

@ -116,6 +116,7 @@ typedef struct bArmature {
#define ARM_DEF_ENVELOPE 2
#define ARM_DEF_QUATERNION 4
#define ARM_DEF_B_BONE_REST 8
#define ARM_DEF_INVERT_VGROUP 16
/* armature->pathflag */
#define ARM_PATH_FNUMS (1<<0)

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

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

@ -46,12 +46,15 @@ struct Scene;
typedef struct StripElem {
char name[80];
} StripElem;
typedef struct TStripElem {
struct ImBuf *ibuf;
struct StripElem *se1, *se2, *se3;
struct TStripElem *se1, *se2, *se3;
short ok;
short pad;
int nr;
} StripElem;
} TStripElem;
typedef struct Strip {
struct Strip *next, *prev;
@ -59,6 +62,7 @@ typedef struct Strip {
StripElem *stripdata;
char dir[160];
int orx, ory;
TStripElem *tstripdata;
} Strip;
@ -87,7 +91,6 @@ typedef struct PluginSeq {
/* WATCH IT: first part identical to ID (for use in ipo's) */
typedef struct Sequence {
struct Sequence *next, *prev;
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 */
@ -104,7 +107,6 @@ typedef struct Sequence {
int sfra; /* starting frame according to the timeline of the scene. */
Strip *strip;
StripElem *curelem; /* reference the current frame - value from give_stripelem */
struct Ipo *ipo;
struct Scene *scene;
@ -234,6 +236,9 @@ typedef struct SpeedControlVars {
#define SEQ_COLOR 28
#define SEQ_SPEED 29
#define STRIPELEM_FAILED 0
#define STRIPELEM_OK 1
#define STRIPELEM_META 2
#endif

@ -5004,6 +5004,7 @@ static PyObject *MFaceSeq_extend( BPy_MEdgeSeq * self, PyObject *args,
Mesh *mesh = self->mesh;
int ignore_dups = 0;
PyObject *return_list = NULL;
char flag = ME_FACE_SEL;
/* 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 );
}
}
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 */
@ -5319,7 +5334,7 @@ static PyObject *MFaceSeq_extend( BPy_MEdgeSeq * self, PyObject *args,
tmpface->v3 = tmppair->v[index[2]];
tmpface->v4 = tmppair->v[index[3]];
tmpface->flag = ME_FACE_SEL;
tmpface->flag = flag;
if( return_list ) {
tmp = PyInt_FromLong( mesh->totface );
@ -6409,6 +6424,10 @@ static PyObject *Mesh_removeVertGroup( PyObject * self, PyObject * value )
int nIndex;
bDeformGroup *pGroup;
if( G.obedit )
return EXPP_ReturnPyObjError(PyExc_RuntimeError,
"can't use removeVertGroup() while in edit mode" );
if( !groupStr )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected string argument" );
@ -6431,7 +6450,7 @@ static PyObject *Mesh_removeVertGroup( PyObject * self, PyObject * value )
nIndex++;
object->actdef = (unsigned short)nIndex;
del_defgroup( object );
del_defgroup_in_object_mode( object );
EXPP_allqueue( REDRAWBUTSALL, 1 );
@ -7585,7 +7604,7 @@ static int Mesh_setVerts( BPy_Mesh * self, PyObject * args )
free_mesh( me );
me->mvert = NULL; me->medge = NULL; me->mface = 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;
mesh_update( me );
return 0;

@ -61,6 +61,19 @@
#include "gen_utils.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 */
extern int EXPP_disable_force_draw;
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_GetScreenInfo( PyObject * self, PyObject * args,
PyObject * kwords );
static PyObject *M_Window_GetPivot( PyObject * self );
static PyObject *M_Window_SetPivot( PyObject * self, PyObject * value );
PyObject *Window_Init( void );
@ -287,6 +303,18 @@ Each dictionary has keys:\n\
'win': window type, see Blender.Window.Types dict;\n\
'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: */
/*****************************************************************************/
@ -374,6 +402,10 @@ struct PyMethodDef M_Window_methods[] = {
M_Window_SetScreen_doc},
{"GetScreenInfo", ( PyCFunction ) M_Window_GetScreenInfo,
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}
};
@ -1454,12 +1486,38 @@ static PyObject *M_Window_GetScreenInfo( PyObject * self, PyObject * args,
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 */
/*****************************************************************************/
PyObject *Window_Init( void )
{
PyObject *submodule, *Types, *Qual, *MButs, *dict;
PyObject *submodule, *Types, *Qual, *MButs, *PivotTypes, *dict;
submodule =
Py_InitModule3( "Blender.Window", M_Window_methods,
@ -1472,6 +1530,7 @@ PyObject *Window_Init( void )
Types = PyConstant_New( );
Qual = PyConstant_New( );
MButs = PyConstant_New( );
PivotTypes = PyConstant_New( );
if( Types ) {
BPy_constant *d = ( BPy_constant * ) Types;
@ -1522,5 +1581,16 @@ PyObject *Window_Init( void )
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;
}

@ -115,9 +115,9 @@ class Curve:
@type resolv: int
@ivar width: The Curve Data width [0 - 2].
@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
@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
@ivar loc: The Curve Data location(from the center).
@type loc: list of 3 floats

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

@ -532,6 +532,8 @@ class MTex:
@ivar mtAmb: How texture maps to ambient value
@ivar mtDisp: How texture maps to displacement
@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():

@ -210,6 +210,20 @@ def SetCursorPos (coords):
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):
"""
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++) {
name = PyString_AsString(PyList_GetItem( list, a ));
strncpy(se->name, name, FILE_MAXFILE-1);
se->ok= 1;
se++;
}
@ -179,17 +178,11 @@ static PyObject *NewSeq_internal(ListBase *seqbase, PyObject * args, Scene *sce)
strip->len= totframe;
strip->us= 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 */
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)) {
/* 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);
strip->len= seq->len;
strip->us= 1;
if(seq->len>0) strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
} else {
/* movie, pydata is a path to a movie file */
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)
height += 19;
} else if (md->type==eModifierType_Armature) {
height = 86;
height = 105;
} else if (md->type==eModifierType_Hook) {
HookModifierData *hmd = (HookModifierData*) md;
height = 86;
@ -1978,12 +1978,17 @@ static void draw_modifier(uiBlock *block, Object *ob, ModifierData *md, int *xco
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");
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);
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_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_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) {
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");
@ -2245,7 +2250,7 @@ static void editing_panel_modifiers(Object *ob)
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;
int index= 1;
@ -2255,7 +2260,7 @@ static char *make_key_menu(Key *key)
str= MEM_mallocN(index*40, "key string");
str[0]= 0;
index= 1;
index= startindex;
for (kb = key->block.first; kb; kb=kb->next, index++) {
sprintf (item, "|%s%%x%d", kb->name, index);
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");
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");
strp= make_key_menu(key);
uiDefButS(block, MENU, B_SETKEY, strp, 55,150,20,20, &ob->shapenr, 0, 0, 0, 0, "Browses existing choices or adds NEW");
strp= make_key_menu(key, 1);
uiDefButS(block, MENU, B_SETKEY, strp, 55,150,20,20, &ob->shapenr, 0, 0, 0, 0, "Browse existing choices");
MEM_freeN(strp);
uiDefIconBut(block, BUT, B_NEXTKEY, ICON_TRIA_RIGHT, 75,150,20,20, NULL, 0, 0, 0, 0, "Next Shape Key");
uiClearButLock();
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");
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");
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)
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 */
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_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);
@ -2098,13 +2098,13 @@ static void world_panel_mistaph(World *wrld)
uiBlockSetCol(block, TH_AUTO);
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, "Sqr", 100, 90, 50, 19, &wrld->mistype, 1.0, 2.0, 0, 0, "Mist uses inverse quadratic progression");
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, "Di:",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, "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, "Dist:",10,50,140,19, &wrld->mistdist, 0.0,10000.0, 10, 00, "Specifies the depth of the mist");
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");
uiBlockEndAlign(block);
@ -2384,7 +2384,7 @@ static void lamp_panel_mapto(Object *ob, Lamp *la)
/* TEXTURE OUTPUT */
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_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);
@ -3065,7 +3065,7 @@ static void material_panel_map_to(Material *ma, int from_nodes)
/* TEXTURE OUTPUT */
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_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);

@ -1737,8 +1737,8 @@ static void draw_pose_paths(Object *ob)
CfraElem *ce;
ListBase ak;
float *fp;
int a;
int stepsize, sfra;
int a, stepsize;
int sfra, efra;
if(G.vd->zbuf) glDisable(GL_DEPTH_TEST);
@ -1758,17 +1758,40 @@ static void draw_pose_paths(Object *ob)
pchan->pathef= EFRA;
}
/* get start frame of calculated range */
/* get frame ranges */
sfra= pchan->pathsf;
efra = sfra + pchan->pathlen;
/* draw curve-line of path */
// TODO: show before/after with slight difference in colour intensity
BIF_ThemeColorBlend(TH_WIRE, TH_BACK, 0.7);
if ((CFRA > sfra) && (CFRA < efra)) {
/* Show before/after current frame with slight difference in colour intensity
* This is done in two loops, as there seems to be some problems with changing color
* or something during a loop (noted somewhere in the codebase)
*/
/* before cfra (darker) */
BIF_ThemeColorBlend(TH_WIRE, TH_BACK, 0.2);
glBegin(GL_LINE_STRIP);
for(a=0, fp= pchan->path; a<pchan->pathlen; a++, fp+=3)
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);
/* draw little black point at each frame
@ -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)) {
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) {
glRasterPos3fv(fp);
sprintf(str, " %d\n", (a+sfra));

@ -309,9 +309,25 @@ void image_changed(SpaceImage *sima, Image *image)
return;
/* 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;
} 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) {
tface = CustomData_em_get(&em->fdata, efa->data, CD_MTFACE);
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)
{
SpaceSeq *sseq;
StripElem *se;
struct ImBuf *ibuf;
int x1, y1, rectx, recty;
int free_ibuf = 0;
@ -800,10 +799,18 @@ static void draw_image_seq(ScrArea *sa)
return;
else {
recursive= 1;
if (!U.prefetchframes || (G.f & G_PLAYANIM) == 0) {
ibuf= (ImBuf *)give_ibuf_seq(rectx, recty, (G.scene->r.cfra), sseq->chanshown);
if (special_seq_update) {
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 {
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;
@ -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)
return;
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->len > 1) {
/* CURRENT */
se= (StripElem *)give_stripelem(last_seq, (G.scene->r.cfra));
se= give_stripelem(last_seq, (G.scene->r.cfra));
if(se) {
sprintf(str, "Cur: %s", se->name);
sprintf(str, "Cur: %s%s", last_seq->strip->dir, se->name);
glRasterPos3f(xco, yco, 0.0);
BMF_DrawString(G.font, str);
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);
BMF_DrawString(G.font, str);
xco += xfac*BMF_GetStringWidth(G.font, str) +30.0*xfac;
}
} else { /* single image */
if (last_seq->strip) {
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);
BMF_DrawString(G.font, str);
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 { /* single image */
if (last_seq->strip) {
sprintf(str, "Single: %s len: %d", last_seq->strip->stripdata->name, last_seq->enddisp-last_seq->startdisp);
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) {
@ -966,7 +964,7 @@ static void draw_extra_seqinfo(void)
BMF_DrawString(G.font, str);
}
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) {
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);

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

@ -1077,6 +1077,19 @@ void delete_armature(void)
TEST_EDITARMATURE;
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 */
if (G.obedit->pose) {
bPoseChannel *chan, *next;
@ -1321,13 +1334,19 @@ void auto_align_armature(short mode)
{
bArmature *arm= G.obedit->data;
EditBone *ebone;
EditBone *flipbone = NULL;
float delta[3];
float curmat[3][3];
float *cursor= give_cursor();
for (ebone = G.edbo.first; ebone; ebone=ebone->next) {
if(arm->layer & ebone->layer) {
if (ebone->flag & BONE_SELECTED) {
if (arm->layer & ebone->layer) {
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 */
if (mode == 1) {
/* Z-Axis point towards cursor */
@ -1714,10 +1733,23 @@ void adduplicate_armature(void)
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 */
for (curBone=G.edbo.first; curBone && curBone!=firstDup; curBone=curBone->next){
if(arm->layer & curBone->layer) {
if (curBone->flag & BONE_SELECTED){
if (arm->layer & curBone->layer) {
if (curBone->flag & BONE_SELECTED) {
eBone=MEM_callocN(sizeof(EditBone), "addup_editbone");
eBone->flag |= BONE_SELECTED;
@ -2034,10 +2066,22 @@ void make_bone_parent(void)
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)
{
bArmature *arm= G.obedit->data;
EditBone *ebone;
EditBone *flipbone = NULL;
short val;
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) {
if(arm->layer & ebone->layer) {
if(ebone->flag & BONE_SELECTED) {
if(ebone->parent) {
/* for nice selection */
ebone->parent->flag &= ~(BONE_TIPSEL);
if(val==1) ebone->parent= NULL;
ebone->flag &= ~BONE_CONNECTED;
}
if(arm->flag & ARM_MIRROR_EDIT)
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;
}
/* ugly, needs to be moved to platform specific files - elubie */
#if defined WIN32 || defined __BeOS
#if defined __BeOS
static int fnmatch(const char *pattern, const char *string, int flags)
{
return 0;
}
#elif defined WIN32 && !defined _LIBC
/* use fnmatch included in blenlib */
#include "BLI_fnmatch.h"
#else
#include <fnmatch.h>
#endif

@ -777,7 +777,7 @@ void mouse_select_seq(void)
if (marker) {
int oldflag;
/* select timeline marker */
if ((G.qual & LR_SHIFTKEY)==0) {
if (G.qual & LR_SHIFTKEY) {
oldflag= marker->flag;
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].type & S_IFDIR)==0 ) {
strncpy(se->name, sfile->filelist[a].relname, FILE_MAXFILE-1);
se->ok= 1;
se++;
}
}
@ -993,7 +992,6 @@ static Sequence *sfile_to_sequence(SpaceFile *sfile, int cfra, int machine, int
/* no selected file: */
if(totsel==1 && se==strip->stripdata) {
strncpy(se->name, sfile->file, FILE_MAXFILE-1);
se->ok= 1;
}
/* last active name */
@ -1010,7 +1008,7 @@ static int sfile_to_mv_sequence_load(SpaceFile *sfile, int cfra,
struct anim *anim;
Strip *strip;
StripElem *se;
int totframe, a;
int totframe;
char name[160], rel[160];
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->us= 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 */
if(index<0)
@ -1062,11 +1060,6 @@ static int sfile_to_mv_sequence_load(SpaceFile *sfile, int cfra,
else
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 */
strncpy(last_imagename, seq->strip->dir, FILE_MAXDIR-1);
return(cfra+totframe);
@ -1111,7 +1104,6 @@ static Sequence *sfile_to_ramsnd_sequence(SpaceFile *sfile,
Strip *strip;
StripElem *se;
double totframe;
int a;
char name[160], rel[160];
char str[256];
@ -1157,17 +1149,11 @@ static Sequence *sfile_to_ramsnd_sequence(SpaceFile *sfile,
strip->len= totframe;
strip->us= 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 */
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 */
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;
Strip *strip;
StripElem *se;
int totframe, a;
int totframe;
char name[160], rel[160];
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->us= 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 */
if(index<0)
@ -1232,12 +1218,6 @@ static int sfile_to_hdsnd_sequence_load(SpaceFile *sfile, int cfra,
else
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 */
strncpy(last_sounddir, seq->strip->dir, FILE_MAXDIR-1);
return(cfra+totframe);
@ -2013,7 +1993,7 @@ void change_sequence(void)
last_seq->sfra= sce->r.sfra;
/* 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);
@ -2169,25 +2149,23 @@ void del_seq(void)
static void recurs_dupli_seq(ListBase *old, ListBase *new)
{
Sequence *seq, *seqn;
Sequence *seq;
Sequence *seqn = 0;
Sequence *last_seq = get_last_seq();
StripElem *se;
int a;
seq= old->first;
while(seq) {
seq->tmp= NULL;
if(seq->flag & SELECT) {
if(seq->type==SEQ_META) {
seqn= MEM_dupallocN(seq);
seq->tmp= seqn;
BLI_addtail(new, seqn);
seqn->strip= MEM_dupallocN(seq->strip);
if(seq->len>0) seq->strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
seqn->strip->stripdata = 0;
seqn->strip->tstripdata = 0;
seq->flag &= SEQ_DESEL;
seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL);
@ -2202,8 +2180,8 @@ static void recurs_dupli_seq(ListBase *old, ListBase *new)
BLI_addtail(new, seqn);
seqn->strip= MEM_dupallocN(seq->strip);
if(seq->len>0) seqn->strip->stripdata = MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
seqn->strip->stripdata = 0;
seqn->strip->tstripdata = 0;
seq->flag &= SEQ_DESEL;
seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL);
@ -2214,20 +2192,11 @@ static void recurs_dupli_seq(ListBase *old, ListBase *new)
BLI_addtail(new, seqn);
seqn->strip= MEM_dupallocN(seq->strip);
seqn->strip->stripdata =
MEM_dupallocN(seq->strip->stripdata);
seqn->strip->tstripdata = 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;
seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL);
}
@ -2237,22 +2206,14 @@ static void recurs_dupli_seq(ListBase *old, ListBase *new)
BLI_addtail(new, seqn);
seqn->strip= MEM_dupallocN(seq->strip);
seqn->strip->stripdata =
MEM_dupallocN(seq->strip->stripdata);
seqn->strip->tstripdata = 0;
seqn->anim= 0;
seqn->sound->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;
seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL);
}
@ -2262,36 +2223,29 @@ static void recurs_dupli_seq(ListBase *old, ListBase *new)
BLI_addtail(new, seqn);
seqn->strip= MEM_dupallocN(seq->strip);
seqn->strip->stripdata =
MEM_dupallocN(seq->strip->stripdata);
seqn->strip->tstripdata = 0;
seqn->anim= 0;
seqn->hdaudio = 0;
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;
seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL);
}
else if(seq->type < SEQ_EFFECT) {
} else if(seq->type == SEQ_IMAGE) {
seqn= MEM_dupallocN(seq);
seq->tmp= 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;
seqn->flag &= ~(SEQ_LEFTSEL+SEQ_RIGHTSEL);
}
else {
} else if(seq->type >= SEQ_EFFECT) {
seqn= MEM_dupallocN(seq);
seq->tmp= seqn;
BLI_addtail(new, seqn);
@ -2310,12 +2264,16 @@ static void recurs_dupli_seq(ListBase *old, ListBase *new)
}
seqn->strip= MEM_dupallocN(seq->strip);
if(seq->len>0) seq->strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
seqn->strip->stripdata = 0;
seqn->strip->tstripdata = 0;
seq->flag &= SEQ_DESEL;
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) {
set_last_seq(seqn);
@ -2564,7 +2522,7 @@ void make_meta(void)
seqm->strip= MEM_callocN(sizeof(Strip), "metastrip");
seqm->strip->len= seqm->len;
seqm->strip->us= 1;
if(seqm->len) seqm->strip->stripdata= MEM_callocN(seqm->len*sizeof(StripElem), "metastripdata");
set_meta_stripdata(seqm);
BIF_undo_push("Make Meta Strip, Sequencer");
@ -3496,8 +3454,6 @@ void seq_separate_images(void)
/* new stripdata */
strip_new->stripdata= se_new= MEM_callocN(sizeof(StripElem)*1, "stripelem");
strncpy(se_new->name, se->name, FILE_MAXFILE-1);
se_new->ok= 1;
calc_sequence(seq_new);
seq_new->flag &= ~SEQ_OVERLAP;
if (test_overlap_seq(seq_new)) {

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

@ -917,6 +917,7 @@ void pose_movetolayer(void)
else if (G.obedit) {
/* the check for editbone layer moving needs to occur before posemode one to work */
EditBone *ebo;
EditBone *flipBone;
for (ebo= G.edbo.first; ebo; ebo= ebo->next) {
if (arm->layer & ebo->layer) {
@ -931,8 +932,14 @@ void pose_movetolayer(void)
for (ebo= G.edbo.first; ebo; ebo= ebo->next) {
if (arm->layer & ebo->layer) {
if (ebo->flag & BONE_SELECTED)
if (ebo->flag & BONE_SELECTED) {
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;
void free_stripdata(int len, StripElem *se)
void free_tstripdata(int len, TStripElem *se)
{
StripElem *seo;
TStripElem *seo;
int a;
seo= se;
if (!se) {
return;
}
for(a=0; a<len; a++, se++) {
if(se->ibuf && se->ok!=2) {
if(se->ibuf && se->ok != STRIPELEM_META) {
IMB_freeImBuf(se->ibuf);
se->ibuf = 0;
}
@ -103,18 +106,20 @@ void free_strip(Strip *strip)
}
if(strip->stripdata) {
free_stripdata(strip->len, strip->stripdata);
MEM_freeN(strip->stripdata);
}
free_tstripdata(strip->len, strip->tstripdata);
MEM_freeN(strip);
}
void new_stripdata(Sequence *seq)
void new_tstripdata(Sequence *seq)
{
if(seq->strip) {
if(seq->strip->stripdata) free_stripdata(seq->strip->len, seq->strip->stripdata);
seq->strip->stripdata= 0;
free_tstripdata(seq->strip->len, seq->strip->tstripdata);
seq->strip->tstripdata= 0;
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) {
new_stripdata(seq);
new_tstripdata(seq);
}
}
@ -284,7 +289,7 @@ void calc_sequence(Sequence *seq)
seq->len= max-min;
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;
int x, y;
int early_out;
@ -464,14 +469,13 @@ static void do_effect(int cfra, Sequence *seq, StripElem *se)
return;
}
/* if metastrip: other se's */
if(se->se1->ok==2) se1= se->se1->se1;
if(se->se1->ok == STRIPELEM_META) se1= se->se1->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;
if(se->se3->ok==2) se3= se->se3->se1;
if(se->se3->ok == STRIPELEM_META) se3= se->se3->se1;
else se3= se->se3;
if ( (se1==0 || se2==0 || se3==0)
@ -487,8 +491,7 @@ static void do_effect(int cfra, Sequence *seq, StripElem *se)
return;
}
/* if metastrip: other se's */
if(se->se1->ok==2) se1= se->se1->se1;
if(se->se1->ok == STRIPELEM_META) se1= se->se1->se1;
else se1= se->se1;
if (se1 == 0 || se1->ibuf == 0) {
@ -508,8 +511,7 @@ static void do_effect(int cfra, Sequence *seq, StripElem *se)
return;
}
/* if metastrip: other se's */
if(se->se2->ok==2) se2= se->se2->se1;
if(se->se2->ok == STRIPELEM_META) se2= se->se2->se1;
else se2= se->se2;
if (se2 == 0 || se2->ibuf == 0) {
@ -548,17 +550,11 @@ static void do_effect(int cfra, Sequence *seq, StripElem *se)
se->ibuf);
}
StripElem *give_stripelem(Sequence *seq, int cfra)
static int give_stripelem_index(Sequence *seq, int cfra)
{
Strip *strip;
StripElem *se;
int nr;
strip= seq->strip;
se= strip->stripdata;
if(se==0) return 0;
if(seq->startdisp >cfra || seq->enddisp <= cfra) return 0;
if(seq->startdisp >cfra || seq->enddisp <= cfra) return -1;
if(seq->flag&SEQ_REVERSE_FRAMES) {
/*reverse frame in this sequence */
@ -575,12 +571,50 @@ StripElem *give_stripelem(Sequence *seq, int cfra)
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;
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(
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)
{
Sequence *seq;
StripElem *se;
TStripElem *se;
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 */
se= seqm->strip->stripdata;
for(a=0; a<seqm->len; a++, se++) {
cfra= a+seqm->start;
seq = get_shown_seq_from_metastrip(seqm, cfra);
if (seq) {
se->se1= give_stripelem(seq, cfra);
se->se1= give_tstripelem(seq, cfra);
} else {
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];
if(seq->type == SEQ_META) {
se->ok= 2;
if(se->se1==0) set_meta_stripdata(seq);
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);
}
}
se->ok = STRIPELEM_META;
if(se->se1 == 0) set_meta_stripdata(seq);
if(se->se1) {
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) {
/* 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? */
if(se->ibuf==0
|| (seq->seq1 && se->se1 != seq->seq1->curelem)
|| (seq->seq2 && se->se2 != seq->seq2->curelem)
|| (seq->seq3 && se->se3 != seq->seq3->curelem)) {
if (seq->seq1) se->se1= seq->seq1->curelem;
if (seq->seq2) se->se2= seq->seq2->curelem;
if (seq->seq3) se->se3= seq->seq3->curelem;
if(se->ibuf==NULL) {
if(se->ibuf == 0) {
/* 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);
}
@ -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)) {
IMB_freeImBuf(se->ibuf);
se->ibuf= 0;
se->ok= 1;
se->ok= STRIPELEM_OK;
}
}
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:
no waitcursor */
if((G.f & G_PLAYANIM)==0)
waitcursor(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);
se->ibuf= IMB_loadiffname(name, IB_rect);
if((G.f & G_PLAYANIM)==0)
waitcursor(0);
if(se->ibuf==0) se->ok= 0;
else {
if(se->ibuf == 0) {
se->ok = STRIPELEM_FAILED;
} else {
if(seq->flag & SEQ_MAKE_PREMUL) {
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) {
if(se->ok && se->ibuf==0) {
if(se->ok == STRIPELEM_OK && se->ibuf==0) {
if(seq->anim==0) {
strncpy(name, seq->strip->dir, FILE_MAXDIR-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);
}
if(se->ibuf==0) se->ok= 0;
else {
if(se->ibuf == 0) {
se->ok = STRIPELEM_FAILED;
} else {
if(seq->flag & SEQ_MAKE_PREMUL) {
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_ref(se->ibuf);
IMB_cache_limiter_touch(se->ibuf);
}
}
static void do_build_seq_recursively(Sequence * seq, int cfra);
static void do_effect_seq_recursively(int cfra, Sequence * seq, StripElem *se)
static void do_effect_seq_recursively(Sequence * seq, TStripElem *se, int cfra)
{
float fac, facf;
struct SeqEffectHandle sh = get_sequence_effect(seq);
int early_out;
se->se1 = 0;
se->se2 = 0;
se->se3 = 0;
if(seq->ipo && seq->ipo->curve.first) {
do_seq_ipo(seq);
fac= seq->facf0;
@ -924,79 +976,50 @@ static void do_effect_seq_recursively(int cfra, Sequence * seq, StripElem *se)
/* no input needed */
break;
case 0:
do_build_seq_recursively(seq->seq1, cfra);
do_build_seq_recursively(seq->seq2, cfra);
se->se1 = do_build_seq_recursively(seq->seq1, cfra);
se->se2 = do_build_seq_recursively(seq->seq2, cfra);
if (seq->seq3) {
do_build_seq_recursively(seq->seq3, cfra);
se->se3 = do_build_seq_recursively(seq->seq3, cfra);
}
break;
case 1:
do_build_seq_recursively(seq->seq1, cfra);
se->se1 = do_build_seq_recursively(seq->seq1, cfra);
break;
case 2:
do_build_seq_recursively(seq->seq2, cfra);
se->se2 = do_build_seq_recursively(seq->seq2, cfra);
break;
}
do_build_seq_ibuf(seq, cfra);
do_build_seq_ibuf(seq, se, cfra);
/* children are not needed anymore ... */
switch (early_out) {
case 0:
if (seq->seq1->curelem && seq->seq1->curelem->ibuf)
IMB_cache_limiter_unref(seq->seq1->curelem->ibuf);
if (seq->seq2->curelem && seq->seq2->curelem->ibuf)
IMB_cache_limiter_unref(seq->seq2->curelem->ibuf);
if (seq->seq3) {
if (seq->seq3->curelem && seq->seq3->curelem->ibuf)
IMB_cache_limiter_unref(
seq->seq3->curelem->ibuf);
if (se->se1 && se->se1->ibuf) {
IMB_cache_limiter_unref(se->se1->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;
if (se->se2 && se->se2->ibuf) {
IMB_cache_limiter_unref(se->se2->ibuf);
}
if (se->se3 && se->se3->ibuf) {
IMB_cache_limiter_unref(se->se3->ibuf);
}
}
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) {
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) {
do_effect_seq_recursively(cfra, seq, se);
do_effect_seq_recursively(seq, se, cfra);
} else {
do_build_seq_ibuf(seq, cfra);
}
if(unref_meta && seq->curelem->ibuf) {
IMB_cache_limiter_unref(seq->curelem->ibuf);
do_build_seq_ibuf(seq, se, cfra);
}
}
return se;
}
/* 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;
int nr = cfra - seq->start;
float f_cfra;
int cfra_left;
int cfra_right;
StripElem * se = 0;
StripElem * se1 = 0;
StripElem * se2 = 0;
TStripElem * se = 0;
TStripElem * se1 = 0;
TStripElem * se2 = 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_right = (int) ceil(f_cfra);
se = seq->curelem = give_stripelem(seq, cfra);
se = give_tstripelem(seq, cfra);
if (cfra_left == cfra_right ||
(s->flags & SEQ_SPEED_BLEND) == 0) {
@ -1038,9 +1061,8 @@ static void do_handle_speed_effect(Sequence * seq, int cfra)
}
if (se->ibuf == NULL) {
do_build_seq_recursively_impl(seq->seq1, cfra_left);
se1 = seq->seq1->curelem;
se1 = do_build_seq_recursively_impl(
seq->seq1, cfra_left);
if((se1 && se1->ibuf && se1->ibuf->rect_float))
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) {
do_build_seq_recursively_impl(seq->seq1, cfra_left);
se1 = seq->seq1->curelem;
do_build_seq_recursively_impl(seq->seq1, cfra_right);
se2 = seq->seq1->curelem;
se1 = do_build_seq_recursively_impl(
seq->seq1, cfra_left);
se2 = do_build_seq_recursively_impl(
seq->seq1, cfra_right);
if((se1 && se1->ibuf && se1->ibuf->rect_float))
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);
if (se2 && se2->ibuf)
IMB_cache_limiter_unref(se2->ibuf);
return se;
}
/*
* 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
*
* 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) {
do_handle_speed_effect(seq, cfra);
return do_handle_speed_effect(seq, cfra);
} 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;
Editing *ed;
int count;
ListBase *seqbasep;
TStripElem *se;
ed= G.scene->ed;
if(ed==0) return 0;
@ -1160,18 +1189,44 @@ ImBuf *give_ibuf_seq(int rectx, int recty, int cfra, int chanshown)
return 0;
}
do_build_seq_recursively(seqfirst, cfra);
se = do_build_seq_recursively(seqfirst, cfra);
if(!seqfirst->curelem) {
if(!se) {
return 0;
}
if (seqfirst->curelem->ibuf) {
IMB_cache_limiter_unref(seqfirst->curelem->ibuf);
return se->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 */
@ -1253,12 +1308,8 @@ static void * seq_prefetch_thread(void * This_)
This->running = TRUE;
if (e->cfra >= s_last) {
e->ibuf = give_ibuf_seq(e->rectx, e->recty, e->cfra,
e->chanshown);
}
if (e->ibuf) {
IMB_cache_limiter_ref(e->ibuf);
e->ibuf = give_ibuf_seq_impl(
e->rectx, e->recty, e->cfra, e->chanshown);
}
pthread_mutex_lock(&queue_lock);
@ -1413,7 +1464,7 @@ void seq_wait_for_prefetch_ready()
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;
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 */
static void free_imbuf_strip_elem(StripElem *se)
static void free_imbuf_strip_elem(TStripElem *se)
{
if (se->ibuf) {
if (se->ok != 2)
if (se->ok != STRIPELEM_META && se->ibuf != 0)
IMB_freeImBuf(se->ibuf);
se->ibuf= 0;
se->ok= 1;
se->ok= STRIPELEM_OK;
se->se1= se->se2= se->se3= 0;
}
}
@ -1516,15 +1567,17 @@ void free_imbuf_seq_except(int cfra)
{
Editing *ed= G.scene->ed;
Sequence *seq;
StripElem *se;
TStripElem *se;
int a;
if(ed==0) return;
WHILE_SEQ(&ed->seqbase) {
if(seq->strip) {
for(a=0, se= seq->strip->stripdata; a<seq->len; a++, se++)
if(se!=seq->curelem)
TStripElem * curelem = give_tstripelem(seq, cfra);
for(a=0, se= seq->strip->tstripdata; a<seq->len; a++, se++)
if(se != curelem)
free_imbuf_strip_elem(se);
if(seq->type==SEQ_MOVIE)
@ -1539,15 +1592,17 @@ void free_imbuf_seq()
{
Editing *ed= G.scene->ed;
Sequence *seq;
StripElem *se;
TStripElem *se;
int a;
if(ed==0) return;
WHILE_SEQ(&ed->seqbase) {
if(seq->strip) {
for(a=0, se= seq->strip->stripdata; a<seq->len; a++, se++)
if (seq->strip->tstripdata) {
for(a=0, se= seq->strip->tstripdata; a<seq->len; a++, se++)
free_imbuf_strip_elem(se);
}
if(seq->type==SEQ_MOVIE)
free_anim_seq(seq);
@ -1582,7 +1637,7 @@ static int update_changed_seq_recurs(Sequence *seq, Sequence *changed_seq, int l
{
Sequence *subseq;
int a, free_imbuf = 0;
StripElem *se;
TStripElem *se;
/* 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)
if(update_changed_seq_recurs(subseq, changed_seq, len_change, ibuf_change))
free_imbuf = 1;
free_imbuf = TRUE;
if(seq->seq1)
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(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(update_changed_seq_recurs(seq->seq3, changed_seq, len_change, ibuf_change))
free_imbuf = 1;
free_imbuf = TRUE;
if(free_imbuf) {
if(ibuf_change) {
for(a=0, se= seq->strip->stripdata; a<seq->len; a++, se++)
se= seq->strip->tstripdata;
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);
if(seq->type == SEQ_SPEED) {
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);
if(ibuf) {
if(ibuf->rect_float) {
if (!rr->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="";
if (G.flags & G_RECORDKEYS) {
if(ob->ipoflag & OB_ACTION_OB)
if (ob->ipoflag & OB_ACTION_OB)
actname= "Object";
if(U.uiflag & USER_KEYINSERTAVAI) {
if(ob->ipo || ob->action) {
if (U.uiflag & USER_KEYINSERTAVAI) {
if (ob->ipo || ob->action) {
ID *id= (ID *)(ob);
if (ob->ipo) {
@ -2714,7 +2714,7 @@ void autokeyframe_ob_cb_func(Object *ob, int tmode)
icu= NULL;
}
while(icu) {
while (icu) {
icu->flag &= ~IPO_SELECT;
if (U.uiflag & USER_KEYINSERTNEED)
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) {
if (tmode==TFM_RESIZE) {
insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_SIZE_X);
insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_SIZE_Y);
insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_SIZE_Z);
short doLoc=0, doRot=0, doScale=0;
/* filter the conditions when this happens (assume that curarea->spacetype==SPACE_VIE3D) */
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_Y);
insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_ROT_Z);
}
else if (tmode==TFM_TRANSLATION) {
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 (doScale) {
insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_SIZE_X);
insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_SIZE_Y);
insertkey_smarter(&ob->id, ID_OB, actname, NULL, OB_SIZE_Z);
}
}
else {
@ -2785,7 +2814,7 @@ void autokeyframe_pose_cb_func(Object *ob, int tmode, short targetless_ik)
pchan->bone->flag &= ~BONE_UNKEYED;
/* only insert into available channels? */
if(U.uiflag & USER_KEYINSERTAVAI) {
if (U.uiflag & USER_KEYINSERTAVAI) {
bActionChannel *achan;
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? */
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_Y);
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_X);
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_Y);
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_Y);
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)
EM_automerge(1);
if(t->spacetype == SPACE_ACTION) {
if (t->spacetype == SPACE_ACTION) {
void *data;
short datatype;
@ -2929,7 +2982,7 @@ void special_aftertrans_update(TransInfo *t)
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();
/* cleanup */
@ -2938,21 +2991,21 @@ void special_aftertrans_update(TransInfo *t)
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?
/* resetting slow-parents isn't really necessary when editing sequence ipo's */
if (G.sipo->blocktype==ID_SEQ)
resetslowpar= 0;
}
else if(G.obedit) {
if(t->mode==TFM_BONESIZE || t->mode==TFM_BONE_ENVELOPE)
else if (G.obedit) {
if (t->mode==TFM_BONESIZE || t->mode==TFM_BONE_ENVELOPE)
allqueue(REDRAWBUTSEDIT, 0);
/* table needs to be created for each edit command, since vertices can move etc */
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;
bPose *pose;
bPoseChannel *pchan;
@ -2966,7 +3019,7 @@ void special_aftertrans_update(TransInfo *t)
pose->flag |= POSE_DO_UNLOCK;
/* 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);
else {
/* 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);
/* 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);
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 */
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
ob->recalc= 0; // is set on OK position already by recalcData()
@ -2992,18 +3045,20 @@ void special_aftertrans_update(TransInfo *t)
else
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);
}
else {
base= FIRSTBASE;
while(base) {
while (base) {
if(base->flag & BA_DO_IPO) redrawipo= 1;
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)) {
cloth_free_modifier(modifiers_isClothEnabled(ob));
}
@ -3020,7 +3075,7 @@ void special_aftertrans_update(TransInfo *t)
clear_trans_object_base_flags();
if(redrawipo) {
if (redrawipo) {
allqueue(REDRAWNLA, 0);
allqueue(REDRAWACTION, 0);
allqueue(REDRAWIPO, 0);

@ -175,7 +175,7 @@ void BL_SkinDeformer::Update(void)
for (int v =0; v<m_bmesh->totvert; v++)
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();
/* Update the current frame */