env['WITH_BF_YAFRAY'] = False
env['WITH_BF_REDCODE'] = False
env['WITH_BF_FTGL'] = False
+ env['WITH_BF_DDS'] = False
+ env['WITH_BF_ZLIB'] = False
+ env['WITH_BF_SDL'] = False
+ env['WITH_BF_JPEG'] = False
+ env['WITH_BF_PNG'] = False
+ env['WITH_BF_ODE'] = False
+ env['WITH_BF_BULLET'] = False
+ env['WITH_BF_BINRELOC'] = False
+ env['BF_BUILDINFO'] = False
+ env['BF_NO_ELBEEM'] = True
+
+
# lastly we check for root_build_dir ( we should not do before, otherwise we might do wrong builddir
#B.root_build_dir = B.arguments.get('BF_BUILDDIR', '..'+os.sep+'build'+os.sep+platform+os.sep)
source=[dp+os.sep+f for f in df]
scriptinstall.append(env.Install(dir=dir,source=source))
+#-- icons
+if env['OURPLATFORM']=='linux2':
+ iconlist = []
+ icontargetlist = []
+
+ for tp, tn, tf in os.walk('release/freedesktop/icons'):
+ if 'CVS' in tn:
+ tn.remove('CVS')
+ if '.svn' in tn:
+ tn.remove('.svn')
+ for f in tf:
+ print ">>>", env['BF_INSTALLDIR'], tp, f
+ iconlist.append(tp+os.sep+f)
+ icontargetlist.append(env['BF_INSTALLDIR']+tp[19:]+os.sep+f)
+
+ iconinstall = []
+ for targetdir,srcfile in zip(icontargetlist, iconlist):
+ td, tf = os.path.split(targetdir)
+ iconinstall.append(env.Install(dir=td, source=srcfile))
+
#-- plugins
pluglist = []
plugtargetlist = []
if env['OURPLATFORM']=='darwin':
allinstall = [blenderinstall, plugininstall, textinstall]
+elif env['OURPLATFORM']=='linux2':
+ allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall, iconinstall]
else:
allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall]
//
btDbvtBroadphase::btDbvtBroadphase(btOverlappingPairCache* paircache)
{
-m_deferedcollide = false;
+m_deferedcollide = true;//false;
m_needcleanup = true;
m_releasepaircache = (paircache!=0)?false:true;
m_prediction = 1/(btScalar)2;
btScalar radius0 = sphere0->getRadius();
btScalar radius1 = sphere1->getRadius();
- //m_manifoldPtr->clearManifold(); //don't do this, it disables warmstarting
+#ifdef CLEAR_MANIFOLD
+ m_manifoldPtr->clearManifold(); //don't do this, it disables warmstarting
+#endif
///iff distance positive, don't generate a new contact
if ( len > (radius0+radius1))
{
+#ifndef CLEAR_MANIFOLD
+ resultOut->refreshContactPoints();
+#endif //CLEAR_MANIFOLD
return;
}
///distance (negative means penetration)
resultOut->addContactPoint(normalOnSurfaceB,pos1,dist);
- //no resultOut->refreshContactPoints(); needed, because of clearManifold (all points are new)
+#ifndef CLEAR_MANIFOLD
+ resultOut->refreshContactPoints();
+#endif //CLEAR_MANIFOLD
}
}
+
+void btConvexHullShape::setLocalScaling(const btVector3& scaling)
+{
+ m_localScaling = scaling;
+ recalcLocalAabb();
+}
+
void btConvexHullShape::addPoint(const btPoint3& point)
{
m_points.push_back(point);
virtual void getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const;
virtual bool isInside(const btPoint3& pt,btScalar tolerance) const;
-
+ ///in case we receive negative scaling
+ virtual void setLocalScaling(const btVector3& scaling);
};
void btConvexInternalShape::setLocalScaling(const btVector3& scaling)
{
- m_localScaling = scaling;
+ m_localScaling = scaling.absolute();
}
btScaledTriangleCallback scaledCallback(callback,m_localScaling);
btVector3 invLocalScaling(1.f/m_localScaling.getX(),1.f/m_localScaling.getY(),1.f/m_localScaling.getZ());
- btVector3 scaledAabbMin = aabbMin * invLocalScaling;
- btVector3 scaledAabbMax = aabbMax * invLocalScaling;
+ btVector3 scaledAabbMin,scaledAabbMax;
+
+ ///support negative scaling
+ scaledAabbMin[0] = m_localScaling.getX() >= 0. ? aabbMin[0] * invLocalScaling[0] : aabbMax[0] * invLocalScaling[0];
+ scaledAabbMin[1] = m_localScaling.getY() >= 0. ? aabbMin[1] * invLocalScaling[1] : aabbMax[1] * invLocalScaling[1];
+ scaledAabbMin[2] = m_localScaling.getZ() >= 0. ? aabbMin[2] * invLocalScaling[2] : aabbMax[2] * invLocalScaling[2];
+
+ scaledAabbMax[0] = m_localScaling.getX() <= 0. ? aabbMin[0] * invLocalScaling[0] : aabbMax[0] * invLocalScaling[0];
+ scaledAabbMax[1] = m_localScaling.getY() <= 0. ? aabbMin[1] * invLocalScaling[1] : aabbMax[1] * invLocalScaling[1];
+ scaledAabbMax[2] = m_localScaling.getZ() <= 0. ? aabbMin[2] * invLocalScaling[2] : aabbMax[2] * invLocalScaling[2];
+
+
m_bvhTriMeshShape->processAllTriangles(&scaledCallback,scaledAabbMin,scaledAabbMax);
}
{
btVector3 localAabbMin = m_bvhTriMeshShape->getLocalAabbMin();
btVector3 localAabbMax = m_bvhTriMeshShape->getLocalAabbMax();
- localAabbMin *= m_localScaling;
- localAabbMax *= m_localScaling;
+
+ btVector3 tmpLocalAabbMin = localAabbMin * m_localScaling;
+ btVector3 tmpLocalAabbMax = localAabbMax * m_localScaling;
+
+ localAabbMin[0] = (m_localScaling.getX() >= 0.) ? tmpLocalAabbMin[0] : tmpLocalAabbMax[0];
+ localAabbMin[1] = (m_localScaling.getY() >= 0.) ? tmpLocalAabbMin[1] : tmpLocalAabbMax[1];
+ localAabbMin[2] = (m_localScaling.getZ() >= 0.) ? tmpLocalAabbMin[2] : tmpLocalAabbMax[2];
+ localAabbMax[0] = (m_localScaling.getX() <= 0.) ? tmpLocalAabbMin[0] : tmpLocalAabbMax[0];
+ localAabbMax[1] = (m_localScaling.getY() <= 0.) ? tmpLocalAabbMin[1] : tmpLocalAabbMax[1];
+ localAabbMax[2] = (m_localScaling.getZ() <= 0.) ? tmpLocalAabbMin[2] : tmpLocalAabbMax[2];
btVector3 localHalfExtents = btScalar(0.5)*(localAabbMax-localAabbMin);
btScalar margin = m_bvhTriMeshShape->getMargin();
else:
defs = 'NO_SOUND'
+if not env['WITH_BF_SDL']:
+ defs += ' DISABLE_SDL'
+
env.BlenderLib ('bf_soundsystem', sources, Split(incs), Split(defs), libtype=['core','player'], priority = [20,140] )
void SND_SDLCDDevice::init()
{
+#ifdef DISABLE_SDL
+ fprintf(stderr, "Blender compiled without SDL, no CDROM support\n");
+ return;
+#else
if (SDL_InitSubSystem(SDL_INIT_CDROM))
{
fprintf(stderr, "Error initializing CDROM\n");
/* Did if open? Check if cdrom is NULL */
if(!m_cdrom)
{
- fprintf(stderr, "Couldn't open drive: %s", SDL_GetError());
+ fprintf(stderr, "Couldn't open drive: %s\n", SDL_GetError());
return;
}
+#endif
}
SND_SDLCDDevice::~SND_SDLCDDevice()
{
+#ifndef DISABLE_SDL
StopCD();
SDL_CDClose(m_cdrom);
+#endif
}
void SND_SDLCDDevice::NextFrame()
{
+#ifndef DISABLE_SDL
m_frame++;
m_frame &= 127;
}
}
+#endif
}
void SND_SDLCDDevice::PlayCD(int track)
{
+#ifndef DISABLE_SDL
if ( m_cdrom && CD_INDRIVE(SDL_CDStatus(m_cdrom)) ) {
SDL_CDPlayTracks(m_cdrom, track-1, 0, track, 0);
m_cdplaying = true;
m_cdtrack = track;
}
+#endif
}
void SND_SDLCDDevice::PauseCD(bool pause)
{
+#ifndef DISABLE_SDL
if (!m_cdrom)
return;
SDL_CDPause(m_cdrom);
else
SDL_CDResume(m_cdrom);
+#endif
}
void SND_SDLCDDevice::StopCD()
{
+#ifndef DISABLE_SDL
if (m_cdrom)
SDL_CDStop(m_cdrom);
m_cdplaying = false;
+#endif
}
void SND_SDLCDDevice::SetCDPlaymode(int playmode)
unsigned char * dst = dst_;
while (count--) {
- *dst++ = table[(*src++ << 8) | *dst];
- *dst++ = table[(*src++ << 8) | *dst];
- *dst++ = table[(*src++ << 8) | *dst];
+ *dst = table[(*src++ << 8) | *dst]; dst++;
+ *dst = table[(*src++ << 8) | *dst]; dst++;
+ *dst = table[(*src++ << 8) | *dst]; dst++;
*dst++ = *src++;
}
if ob != None:
# Clone the object - duplicate it, clean the clone, and create an ipo curve for the clone
myob = duplicateLinked(ob) #clone it
- myob.name= usrObjectNamePrefix + ob.getName()
+ myob.setName(usrObjectNamePrefix + ob.getName())
removeConstraintsOb(myob) #my object is a free man
deLinkOb('Ipo',myob) #kids, it's not nice to share. you've been lied to
if ob.getType() != ARMATURE: # baking armatures is based on bones, not object
global __CONSOLE_LINE_OFFSET__
__CONSOLE_LINE_OFFSET__ = 0
+cmdBuffer = [] # dosnt need to be global
+
'''
# Generic Blender functions
def getActScriptWinRect():
return compile(filedata, filename, 'exec')
# Writes command line data to a blender text file.
-def writeCmdData(cmdLineList, type):
- if type == 3:
- typeList = [0,1,2, 3, None] # all
- else:
- typeList = [type] # so we can use athe lists 'in' methiod
-
+def writeCmdData(type):
newText = Text.New('command_output.py', 1)
- for myCmd in cmdLineList:
- if myCmd.type in typeList: # user input
- newText.write('%s\n' % myCmd.cmd)
+ if type == 3: newText.write('\n'.join( [ myCmd.cmd for myCmd in cmdBuffer ] ))
+ else: newText.write('\n'.join( [ myCmd.cmd for myCmd in cmdBuffer if myCmd.type is type] ))
Draw.PupMenu('%s written' % newText.name)
-def insertCmdData(cmdBuffer):
+def insertCmdData():
texts = list(bpy.data.texts)
textNames = [tex.name for tex in texts]
if textNames:
# Insert Char into the cammand line
def insCh(ch): # Instert a char
- global cmdBuffer
global cursor
# Later account for a cursor variable
cmdBuffer[-1].cmd = ('%s%s%s' % ( cmdBuffer[-1].cmd[:cursor], ch, cmdBuffer[-1].cmd[cursor:]))
# Define Complex Key Actions #
#------------------------------------------------------------------------------#
def actionEnterKey():
- global histIndex, cursor, cmdBuffer
+ global histIndex, cursor
def getIndent(string):
# Gather white space to add in the previous line
# Clear the output based on __LINE_HISTORY__
if len(cmdBuffer) > __LINE_HISTORY__:
- cmdBuffer = cmdBuffer[-__LINE_HISTORY__:]
+ cmdBuffer[:__LINE_HISTORY__] = []
histIndex = cursor = -1 # Reset cursor and history
def actionUpKey():
- global histIndex, cmdBuffer
+ global histIndex
if abs(histIndex)+1 >= len(cmdBuffer):
histIndex = -1
+
+ # When wrapping allow 1 plank lines
+ if cmdBuffer[-1].cmd != ' ':
+ cmdBuffer[-1].cmd = ' '
+ return
+
histIndex_orig = histIndex
histIndex -= 1
cmdBuffer[-1].cmd = cmdBuffer[histIndex].cmd
def actionDownKey():
- global histIndex, cmdBuffer
+ global histIndex
if histIndex >= -2:
histIndex = -len(cmdBuffer)
+
+ # When wrapping allow 1 plank lines
+ if cmdBuffer[-1].cmd != ' ':
+ cmdBuffer[-1].cmd = ' '
+ return
+
histIndex_orig = histIndex
histIndex += 1
while (cmdBuffer[histIndex].type != 0 and histIndex != -2) or \
def actionRightMouse():
global __FONT_SIZE__
- choice = Draw.PupMenu('Console Menu%t|Write Input Data (white)|Write Output Data (blue)|Write Error Data (red)|Write All Text|%l|Insert Blender text|%l|Font Size|%l|Quit')
+ choice = Draw.PupMenu('Console Menu%t|Write Input Data (white)|Write Output Data (blue)|Write Error Data (red)|Write All Text|%l|Insert Blender text|%l|Font Size|%l|Clear Output|Quit')
if choice == 1:
- writeCmdData(cmdBuffer, 0) # type 0 user
+ writeCmdData(0) # type 0 user
elif choice == 2:
- writeCmdData(cmdBuffer, 1) # type 1 user output
+ writeCmdData(1) # type 1 user output
elif choice == 3:
- writeCmdData(cmdBuffer, 2) # type 2 errors
+ writeCmdData(2) # type 2 errors
elif choice == 4:
- writeCmdData(cmdBuffer, 3) # All
+ writeCmdData(3) # All
elif choice == 6:
- insertCmdData(cmdBuffer) # Insert text from Blender and run it.
+ insertCmdData() # Insert text from Blender and run it.
elif choice == 8:
# Fontsize.
font_choice = Draw.PupMenu('Font Size%t|Large|Normal|Small|Tiny')
elif font_choice == 4:
__FONT_SIZE__ = 0
Draw.Redraw()
-
- elif choice == 10: # Exit
+ elif choice == 10: # Clear all output
+ cmdBuffer[:] = [cmd for cmd in cmdBuffer if cmd.type == 0] # keep user input
+ Draw.Redraw()
+ elif choice == 11: # Exit
Draw.Exit()
# Print Startup lines, add __bpydoc__ to the console startup.
-cmdBuffer = []
for l in __bpydoc__.split('<br>'):
cmdBuffer.append( cmdLine(l, 1, None) )
def standard_imports():
# Write local to global __CONSOLE_VAR_DICT__ for reuse,
+
+ exec('%s%s' % ('__CONSOLE_VAR_DICT__["bpy"]=', 'bpy'))
+ exec('%s%s' % ('__CONSOLE_VAR_DICT__["Blender"]=', 'Blender'))
+
for ls in (dir(), dir(Blender)):
for __TMP_VAR_NAME__ in ls:
# Execute the local > global coversion.
exec('%s%s' % ('__CONSOLE_VAR_DICT__[__TMP_VAR_NAME__]=', __TMP_VAR_NAME__))
- exec('%s%s' % ('__CONSOLE_VAR_DICT__["bpy"]=', 'bpy'))
+ # Add dummy imports to input so output scripts to a text file work as expected
+ cmdBuffer.append(cmdLine('import bpy', 0, 1))
+ cmdBuffer.append(cmdLine('import Blender', 0, 1)) # pretend we have been executed, as we kindof have.
+ cmdBuffer.append(cmdLine('from Blender import *', 0, 1))
if scriptDir and console_autoexec:
include_console(console_autoexec) # pass the blender module
/* scene.c */
#include "DNA_sequence_types.h"
void free_editing(struct Editing *ed); // scenes and sequences problem...
-void BPY_do_all_scripts (short int event);
+void BPY_do_all_scripts (short int event, short int anim);
int BPY_call_importloader(char *name);
struct MemFile;
#define BLENDER_VERSION 247
-#define BLENDER_SUBVERSION 2
+#define BLENDER_SUBVERSION 4
#define BLENDER_MINVERSION 245
#define BLENDER_MINSUBVERSION 15
void copy_properties(struct ListBase *lbn, struct ListBase *lbo);
void init_property(struct bProperty *prop);
struct bProperty *new_property(int type);
-struct bProperty *get_property(struct Object *ob, char *name);
+struct bProperty *get_ob_property(struct Object *ob, char *name);
+void set_ob_property(struct Object *ob, struct bProperty *propc);
int compare_property(struct bProperty *prop, char *str);
void set_property(struct bProperty *prop, char *str);
void add_property(struct bProperty *prop, char *str);
#define AVG2(x, y) ( 0.5 * ((x) + (y)) )
+#define FTOCHAR(val) (val<=0.0f)? 0 : ((val>(1.0f-0.5f/255.0f))? 255 : (char)((255.0f*val)+0.5f))
+
#define VECCOPY(v1,v2) {*(v1)= *(v2); *(v1+1)= *(v2+1); *(v1+2)= *(v2+2);}
#define VECCOPY2D(v1,v2) {*(v1)= *(v2); *(v1+1)= *(v2+1);}
#define QUATCOPY(v1,v2) {*(v1)= *(v2); *(v1+1)= *(v2+1); *(v1+2)= *(v2+2); *(v1+3)= *(v2+3);}
defs += ' WITH_QUICKTIME'
incs += ' ' + env['BF_QUICKTIME_INC']
-defs += ' WITH_CCGSUBSURF'
+if env['BF_NO_ELBEEM'] == 1:
+ defs += ' DISABLE_ELBEEM'
if env['WITH_BF_PLAYER']:
SConscript(['bad_level_call_stubs/SConscript'])
/* scene.c */
#include "DNA_sequence_types.h"
void free_editing(struct Editing *ed){} // scenes and sequences problem...
-void BPY_do_all_scripts (short int event){}
+void BPY_do_all_scripts (short int event, short int anim){}
/*editmesh_lib.c*/
void EM_select_face(struct EditFace *efa, int sel) {}
static float stridechannel_frame(Object *ob, float sizecorr, bActionStrip *strip, Path *path, float pathdist, float *stride_offset)
{
bAction *act= strip->act;
- char *name= strip->stridechannel;
+ const char *name= strip->stridechannel;
bActionChannel *achan= get_action_channel(act, name);
int stride_axis= strip->stride_axis;
rgba[0]= rgba[1]= rgba[2]= rgba[3]= 1.0f;
}
-#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.0f*val))
void brush_imbuf_new(Brush *brush, short flt, short texfall, int size, ImBuf **outbuf)
{
vecout[2]= curvemap_evaluateF(cumap->cm+2, fac);
}
-#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.0f*val))
void curvemapping_do_ibuf(CurveMapping *cumap, ImBuf *ibuf)
{
{
bPythonConstraint *data= con->data;
- if ((G.f & G_DOSCRIPTLINKS) && VALID_CONS_TARGET(ct)) {
+ if (VALID_CONS_TARGET(ct)) {
/* special exception for curves - depsgraph issues */
if (ct->tar->type == OB_CURVE) {
Curve *cu= ct->tar->data;
* this matrix if it needs to do so
*/
constraint_target_to_mat4(ct->tar, ct->subtarget, ct->matrix, CONSTRAINT_SPACE_WORLD, ct->space, con->headtail);
- BPY_pyconstraint_target(data, ct);
+
+ /* only execute target calculation if allowed */
+ if (G.f & G_DOSCRIPTLINKS)
+ BPY_pyconstraint_target(data, ct);
}
else if (ct)
Mat4One(ct->matrix);
{
bPythonConstraint *data= con->data;
+ /* only evaluate in python if we're allowed to do so */
if ((G.f & G_DOSCRIPTLINKS)==0) return;
/* currently removed, until I this can be re-implemented for multiple targets */
bevp->y= bp->vec[1];
bevp->z= bp->vec[2];
bevp->alfa= bp->alfa;
- bevp->f1= 1;
+ bevp->f1= SELECT;
bevp++;
bp++;
}
/* indicate with handlecodes double points */
if(prevbezt->h1==prevbezt->h2) {
- if(prevbezt->h1==0 || prevbezt->h1==HD_VECT) bevp->f1= 1;
+ if(prevbezt->h1==0 || prevbezt->h1==HD_VECT) bevp->f1= SELECT;
}
else {
- if(prevbezt->h1==0 || prevbezt->h1==HD_VECT) bevp->f1= 1;
- else if(prevbezt->h2==0 || prevbezt->h2==HD_VECT) bevp->f1= 1;
+ if(prevbezt->h1==0 || prevbezt->h1==HD_VECT) bevp->f1= SELECT;
+ else if(prevbezt->h2==0 || prevbezt->h2==HD_VECT) bevp->f1= SELECT;
}
v1= data;
bezt= nu->bezt;
a= nu->pntsu;
while(a--) {
- if(bezt->f1 || bezt->f3) {
- if(bezt->f1) bezt->h1= code;
- if(bezt->f3) bezt->h2= code;
+ if((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) {
+ if(bezt->f1 & SELECT) bezt->h1= code;
+ if(bezt->f3 & SELECT) bezt->h2= code;
if(bezt->h1!=bezt->h2) {
if ELEM(bezt->h1, HD_ALIGN, HD_AUTO) bezt->h1= HD_FREE;
if ELEM(bezt->h2, HD_ALIGN, HD_AUTO) bezt->h2= HD_FREE;
bezt= nu->bezt;
a= nu->pntsu;
while(a--) {
- if(bezt->f1 && bezt->h1) ok= 1;
- if(bezt->f3 && bezt->h2) ok= 1;
+ if((bezt->f1 & SELECT) && bezt->h1) ok= 1;
+ if((bezt->f3 & SELECT) && bezt->h2) ok= 1;
if(ok) break;
bezt++;
}
bezt= nu->bezt;
a= nu->pntsu;
while(a--) {
- if(bezt->f1) bezt->h1= ok;
- if(bezt->f3 ) bezt->h2= ok;
+ if(bezt->f1 & SELECT) bezt->h1= ok;
+ if(bezt->f3 & SELECT) bezt->h2= ok;
bezt++;
}
return node;
}
-void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, char *name)
+static void dag_add_parent_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, char *name)
{
- DagAdjList *itA = fob1->child;
+ DagAdjList *itA = fob2->parent;
while (itA) { /* search if relation exist already */
- if (itA->node == fob2) {
+ if (itA->node == fob1) {
itA->type |= rel;
itA->count += 1;
return;
}
/* create new relation and insert at head. MALLOC alert! */
itA = MEM_mallocN(sizeof(DagAdjList),"DAG adj list");
- itA->node = fob2;
+ itA->node = fob1;
itA->type = rel;
itA->count = 1;
- itA->next = fob1->child;
+ itA->next = fob2->parent;
itA->name = name;
- fob1->child = itA;
+ fob2->parent = itA;
}
-static void dag_add_parent_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, char *name)
+void dag_add_relation(DagForest *forest, DagNode *fob1, DagNode *fob2, short rel, char *name)
{
- DagAdjList *itA = fob2->parent;
+ DagAdjList *itA = fob1->child;
+ /* parent relation is for cycle checking */
+ dag_add_parent_relation(forest, fob1, fob2, rel, name);
+
while (itA) { /* search if relation exist already */
- if (itA->node == fob1) {
+ if (itA->node == fob2) {
itA->type |= rel;
itA->count += 1;
return;
}
/* create new relation and insert at head. MALLOC alert! */
itA = MEM_mallocN(sizeof(DagAdjList),"DAG adj list");
- itA->node = fob1;
+ itA->node = fob2;
itA->type = rel;
itA->count = 1;
- itA->next = fob2->parent;
+ itA->next = fob1->child;
itA->name = name;
- fob2->parent = itA;
+ fob1->child = itA;
}
static char *dag_node_name(DagNode *node)
printf("\n");
}
+static int dag_node_recurs_level(DagNode *node, int level)
+{
+ DagAdjList *itA;
+ int newlevel;
+
+ node->color= DAG_BLACK; /* done */
+ newlevel= ++level;
+
+ for(itA= node->parent; itA; itA= itA->next) {
+ if(itA->node->color==DAG_WHITE) {
+ itA->node->ancestor_count= dag_node_recurs_level(itA->node, level);
+ newlevel= MAX2(newlevel, level+itA->node->ancestor_count);
+ }
+ else
+ newlevel= MAX2(newlevel, level+itA->node->ancestor_count);
+ }
+
+ return newlevel;
+}
+
+static void dag_check_cycle(DagForest *dag)
+{
+ DagNode *node;
+ DagAdjList *itA;
+
+ /* tag nodes unchecked */
+ for(node = dag->DagNode.first; node; node= node->next)
+ node->color= DAG_WHITE;
+
+ for(node = dag->DagNode.first; node; node= node->next) {
+ if(node->color==DAG_WHITE) {
+ node->ancestor_count= dag_node_recurs_level(node, 0);
+ }
+ }
+
+ /* check relations, and print errors */
+ for(node = dag->DagNode.first; node; node= node->next) {
+ for(itA= node->parent; itA; itA= itA->next) {
+ if(itA->node->ancestor_count > node->ancestor_count) {
+ if(node->ob && itA->node->ob) {
+ printf("Dependency cycle detected:\n");
+ dag_node_print_dependency_cycle(dag, itA->node, node, itA->name);
+ }
+ }
+ }
+ }
+
+ /* parent relations are only needed for cycle checking, so free now */
+ for(node = dag->DagNode.first; node; node= node->next) {
+ while (node->parent) {
+ itA = node->parent->next;
+ MEM_freeN(node->parent);
+ node->parent = itA;
+ }
+ }
+}
+
/*
* MainDAG is the DAG of all objects in current scene
* used only for drawing there is one also in each scene
build_dag(sce, DAG_RL_ALL_BUT_DATA);
+ dag_check_cycle(sce->theDag);
+
nqueue = queue_create(DAGQUEUEALLOC);
for(node = sce->theDag->DagNode.first; node; node= node->next) {
/* ******************* DAG FOR ARMATURE POSE ***************** */
-static int node_recurs_level(DagNode *node, int level)
-{
- DagAdjList *itA;
- int newlevel;
-
- node->color= DAG_BLACK; /* done */
- newlevel= ++level;
-
- for(itA= node->parent; itA; itA= itA->next) {
- if(itA->node->color==DAG_WHITE) {
- itA->node->ancestor_count= node_recurs_level(itA->node, level);
- newlevel= MAX2(newlevel, level+itA->node->ancestor_count);
- }
- else
- newlevel= MAX2(newlevel, level+itA->node->ancestor_count);
- }
-
- return newlevel;
-}
-
-static void pose_check_cycle(DagForest *dag)
-{
- DagNode *node;
- DagAdjList *itA;
-
- /* tag nodes unchecked */
- for(node = dag->DagNode.first; node; node= node->next)
- node->color= DAG_WHITE;
-
- for(node = dag->DagNode.first; node; node= node->next) {
- if(node->color==DAG_WHITE) {
- node->ancestor_count= node_recurs_level(node, 0);
- }
- }
-
- /* check relations, and print errors */
- for(node = dag->DagNode.first; node; node= node->next) {
- for(itA= node->parent; itA; itA= itA->next) {
- if(itA->node->ancestor_count > node->ancestor_count) {
- bPoseChannel *pchan= (bPoseChannel *)node->ob;
- bPoseChannel *parchan= (bPoseChannel *)itA->node->ob;
-
- if(pchan && parchan) {
- printf("Cycle detected:\n");
- dag_node_print_dependency_cycle(dag, itA->node, node, itA->name);
- }
- }
- }
- }
-}
-
/* we assume its an armature with pose */
void DAG_pose_sort(Object *ob)
{
if(pchan->parent) {
node2 = dag_get_node(dag, pchan->parent);
dag_add_relation(dag, node2, node, 0, "Parent Relation");
- dag_add_parent_relation(dag, node2, node, 0, "Parent Relation");
addtoroot = 0;
}
for (con = pchan->constraints.first; con; con=con->next) {
if(target) {
node2 = dag_get_node(dag, target);
dag_add_relation(dag, node2, node, 0, "Ipo Driver");
- dag_add_parent_relation(dag, node2, node, 0, "Ipo Driver");
/* uncommented this line, results in dependencies
* not being added properly for this constraint,
if (target) {
node2= dag_get_node(dag, target);
dag_add_relation(dag, node2, node, 0, "IK Constraint");
- dag_add_parent_relation(dag, node2, node, 0, "IK Constraint");
if (con->type==CONSTRAINT_TYPE_KINEMATIC) {
bKinematicConstraint *data = (bKinematicConstraint *)con->data;
while (parchan) {
node3= dag_get_node(dag, parchan);
dag_add_relation(dag, node2, node3, 0, "IK Constraint");
- dag_add_parent_relation(dag, node2, node3, 0, "IK Constraint");
segcount++;
if (segcount==data->rootbone || segcount>255) break; // 255 is weak
}
if (addtoroot == 1 ) {
dag_add_relation(dag, rootnode, node, 0, "Root Bone Relation");
- dag_add_parent_relation(dag, rootnode, node, 0, "Root Bone Relation");
}
}
- pose_check_cycle(dag);
+ dag_check_cycle(dag);
/* now we try to sort... */
tempbase.first= tempbase.last= NULL;
for(base= G.scene->base.first; base; base= base->next) {
ob= base->object;
- freedisplist(&ob->disp);
+
+ if(ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL))
+ freedisplist(&ob->disp);
+
if(base->lay & G.scene->lay) {
/* Metaballs have standard displist at the Object */
if(ob->type==OB_MBALL) shadeDispList(base);
int p=0;
for(; p<psys->totpart; p++, pa++)
- pa->flag = PARS_NO_DISP;
+ pa->flag |= PARS_NO_DISP;
}
/* reset children */
for(re=psys->reactevents.first; re; re=re->next){
birth=0;
if(part->from==PART_FROM_PARTICLE){
- if(pa->num==re->pa_num){
+ if(pa->num==re->pa_num && pa->alive==PARS_UNBORN){
if(re->event==PART_EVENT_NEAR){
ParticleData *tpa = re->psys->particles+re->pa_num;
float pa_time=tpa->time + pa->foffset*tpa->lifetime;
- if(re->time > pa_time){
- pa->alive=PARS_ALIVE;
+ if(re->time >= pa_time){
pa->time=pa_time;
pa->dietime=pa->time+pa->lifetime;
}
}
else{
- if(pa->alive==PARS_UNBORN){
- pa->alive=PARS_ALIVE;
- pa->time=re->time;
- pa->dietime=pa->time+pa->lifetime;
- }
+ pa->time=re->time;
+ pa->dietime=pa->time+pa->lifetime;
}
}
}
dist=VecLenf(pa->state.co, re->state.co);
if(dist <= re->size){
if(pa->alive==PARS_UNBORN){
- pa->alive=PARS_ALIVE;
pa->time=re->time;
pa->dietime=pa->time+pa->lifetime;
birth=1;
if(through == 0 && (part->flag & PART_DIE_ON_COL || pd->flag & PDEFLE_KILL_PART)) {
pa->alive = PARS_DYING;
pa->dietime = pa->state.time + (cfra - pa->state.time) * dt;
+
+ /* we have to add this for dying particles too so that reactors work correctly */
+ VECADDFAC(co, co, col.nor, (through ? -0.0001f : 0.0001f));
+
VECCOPY(state->co, co);
VecLerpf(state->vel, pa->state.vel, state->vel, dt);
QuatInterpol(state->rot, pa->state.rot, state->rot, dt);
pa_dfra = dfra;
pa_dtime = dtime;
+ /* we need to calculate this once again because reactions might have changed pa->time */
+ birthtime = pa->time + pa->loop * pa->lifetime;
dietime = birthtime + pa->lifetime;
- if(birthtime < cfra && birthtime >= psys->cfra){
+ if(birthtime <= cfra && birthtime >= psys->cfra){
/* particle is born some time between this and last step*/
pa->alive = PARS_ALIVE;
pa_dfra = cfra - birthtime;
}
}
- push_reaction(ob,psys,p,PART_EVENT_NEAR,key);
-
if(pa->alive == PARS_DYING){
push_reaction(ob,psys,p,PART_EVENT_DEATH,key);
}
else
key->time=cfra;
+
+ push_reaction(ob,psys,p,PART_EVENT_NEAR,key);
}
}
}
void copy_properties(ListBase *lbn, ListBase *lbo)
{
bProperty *prop, *propn;
-
- lbn->first= lbn->last= 0;
+ free_properties( lbn ); /* incase we are copying to an object with props */
prop= lbo->first;
while(prop) {
propn= copy_property(prop);
return prop;
}
-bProperty *get_property(Object *ob, char *name)
+bProperty *get_ob_property(Object *ob, char *name)
{
bProperty *prop;
return NULL;
}
+void set_ob_property(Object *ob, bProperty *propc)
+{
+ bProperty *prop;
+ prop= get_ob_property(ob, propc->name);
+ if(prop) {
+ free_property(prop);
+ BLI_remlink(&ob->prop, prop);
+ }
+ BLI_addtail(&ob->prop, copy_property(propc));
+}
+
/* negative: prop is smaller
* positive: prop is larger
*/
/* no full animation update, this to enable render code to work (render code calls own animation updates) */
/* do we need FRAMECHANGED in set_scene? */
-// if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_FRAMECHANGED);
+// if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_FRAMECHANGED, 0);
}
/* called from creator.c */
/* object ipos are calculated in where_is_object */
do_all_data_ipos();
- if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_FRAMECHANGED);
-
+ if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_FRAMECHANGED, 0);
+
/* sets first, we allow per definition current scene to have dependencies on sets */
for(sce= sce->set; sce; sce= sce->set)
scene_update(sce, lay);
float sasqrt(float fac);
int FloatCompare(float *v1, float *v2, float limit);
+int FloatCompare4(float *v1, float *v2, float limit);
float FloatLerpf(float target, float origin, float fac);
float CalcNormFloat(float *v1, float *v2, float *v3, float *n);
/* in util.c */
#ifdef WITH_ICONV
-void BLI_string_to_utf8(char *original, char *utf_8, char *code);
+void BLI_string_to_utf8(char *original, char *utf_8, const char *code);
#endif
/**
return 0;
}
+int FloatCompare4( float *v1, float *v2, float limit)
+{
+
+ if( fabs(v1[0]-v2[0])<limit ) {
+ if( fabs(v1[1]-v2[1])<limit ) {
+ if( fabs(v1[2]-v2[2])<limit ) {
+ if( fabs(v1[3]-v2[3])<limit ) return 1;
+ }
+ }
+ }
+ return 0;
+}
+
float FloatLerpf( float target, float origin, float fac)
{
return (fac*target) + (1.0f-fac)*origin;
int err;
/* if lib is NULL reset the last error code */
+ err= GetLastError();
if (!lib) {
SetLastError(ERROR_SUCCESS);
- return NULL;
+ err = ERROR_SUCCESS;
}
- err= GetLastError();
if (err) {
static char buf[1024];
return buf;
}
- return NULL;
+ return "unrecognized error";
}
void PIL_dynlib_close(PILdynlib *lib) {
unsigned int hash;
Entry *e= malloc(sizeof(*e));
- if (v1<v0) v0 ^= v1 ^= v0 ^= v1;
- hash = EDGEHASH(v0,v1)%eh->nbuckets;
+ if (v1<v0) {
+ v0 ^= v1;
+ v1 ^= v0;
+ v0 ^= v1;
+ }
+ hash = EDGEHASH(v0,v1)%eh->nbuckets;
e->v0 = v0;
e->v1 = v1;
unsigned int hash;
Entry *e;
- if (v1<v0) v0 ^= v1 ^= v0 ^= v1;
+ if (v1<v0) {
+ v0 ^= v1;
+ v1 ^= v0;
+ v0 ^= v1;
+ }
hash = EDGEHASH(v0,v1)%eh->nbuckets;
for (e= eh->buckets[hash]; e; e= e->next)
if (v0==e->v0 && v1==e->v1)
break;
lcode = charcode;
}
-
- err = FT_Select_Charmap( face, FT_ENCODING_UNICODE );
return vfd;
}
#include "iconv.h"
#include "localcharset.h"
-void BLI_string_to_utf8(char *original, char *utf_8, char *code)
+void BLI_string_to_utf8(char *original, char *utf_8, const char *code)
{
size_t inbytesleft=strlen(original);
size_t outbytesleft=512;
#include "BKE_object.h"
#include "BKE_particle.h"
#include "BKE_pointcache.h"
-#include "BKE_property.h" // for get_property
+#include "BKE_property.h" // for get_ob_property
#include "BKE_sca.h" // for init_actuator
#include "BKE_scene.h"
#include "BKE_softbody.h" // sbNew()
while (act) {
if(act->type==ACT_IPO) {
ia= act->data;
- prop= get_property(ob, ia->name);
+ prop= get_ob_property(ob, ia->name);
if(prop) {
ia->type= ACT_IPO_FROM_PROP;
}
}
}
+ if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 3)){
+ Object *ob;
+ for(ob = main->object.first; ob; ob= ob->id.next) {
+ // Starting from subversion 3, ACTOR is a separate feature.
+ // Before it was conditioning all the other dynamic flags
+ if (!(ob->gameflag & OB_ACTOR))
+ ob->gameflag &= ~(OB_GHOST|OB_DYNAMIC|OB_RIGID_BODY|OB_SOFT_BODY|OB_COLLISION_RESPONSE);
+ }
+ }
+
+ if (main->versionfile < 247 || (main->versionfile == 247 && main->subversionfile < 4)){
+ Scene *sce= main->scene.first;
+ while(sce) {
+ if(sce->frame_step==0)
+ sce->frame_step= 1;
+ sce= sce->id.next;
+ }
+ }
+
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */
- only for fragment shaders now
- must call texture bind before setting a texture as uniform! */
-GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, GPUShader *lib);
-GPUShader *GPU_shader_create_lib(const char *code);
+GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, const char *libcode); /*GPUShader *lib);*/
+/*GPUShader *GPU_shader_create_lib(const char *code);*/
void GPU_shader_free(GPUShader *shader);
void GPU_shader_bind(GPUShader *shader);
* These are stored in a hash for lookup when creating a material. */
static GHash *FUNCTION_HASH= NULL;
-static char *FUNCTION_PROTOTYPES= NULL;
-static GPUShader *FUNCTION_LIB= NULL;
+/*static char *FUNCTION_PROTOTYPES= NULL;
+static GPUShader *FUNCTION_LIB= NULL;*/
static int gpu_str_prefix(char *str, char *prefix)
{
}
}
+#if 0
static char *gpu_generate_function_prototyps(GHash *hash)
{
DynStr *ds = BLI_dynstr_new();
return prototypes;
}
+#endif
GPUFunction *GPU_lookup_function(char *name)
{
if(!FUNCTION_HASH) {
FUNCTION_HASH = BLI_ghash_new(BLI_ghashutil_strhash, BLI_ghashutil_strcmp);
gpu_parse_functions_string(FUNCTION_HASH, datatoc_gpu_shader_material_glsl);
- FUNCTION_PROTOTYPES = gpu_generate_function_prototyps(FUNCTION_HASH);
- FUNCTION_LIB = GPU_shader_create_lib(datatoc_gpu_shader_material_glsl);
+ /*FUNCTION_PROTOTYPES = gpu_generate_function_prototyps(FUNCTION_HASH);
+ FUNCTION_LIB = GPU_shader_create_lib(datatoc_gpu_shader_material_glsl);*/
}
return (GPUFunction*)BLI_ghash_lookup(FUNCTION_HASH, name);
BLI_ghash_free(FUNCTION_HASH, NULL, (GHashValFreeFP)MEM_freeN);
FUNCTION_HASH = NULL;
}
- if(FUNCTION_PROTOTYPES) {
+ /*if(FUNCTION_PROTOTYPES) {
MEM_freeN(FUNCTION_PROTOTYPES);
FUNCTION_PROTOTYPES = NULL;
- }
- if(FUNCTION_LIB) {
+ }*/
+ /*if(FUNCTION_LIB) {
GPU_shader_free(FUNCTION_LIB);
FUNCTION_LIB = NULL;
- }
+ }*/
}
/* GLSL code generation */
DynStr *ds = BLI_dynstr_new();
char *code;
- BLI_dynstr_append(ds, FUNCTION_PROTOTYPES);
+ /*BLI_dynstr_append(ds, FUNCTION_PROTOTYPES);*/
codegen_set_unique_ids(nodes);
codegen_print_uniforms_functions(ds, nodes);
GPUPass *pass;
char *vertexcode, *fragmentcode;
- if(!FUNCTION_LIB) {
+ /*if(!FUNCTION_LIB) {
GPU_nodes_free(nodes);
return NULL;
- }
+ }*/
/* prune unused nodes */
gpu_nodes_prune(nodes, outlink);
/* generate code and compile with opengl */
fragmentcode = code_generate_fragment(nodes, outlink->output, name);
vertexcode = code_generate_vertex(nodes);
- shader = GPU_shader_create(vertexcode, fragmentcode, FUNCTION_LIB);
+ shader = GPU_shader_create(vertexcode, fragmentcode, datatoc_gpu_shader_material_glsl); /*FUNCTION_LIB);*/
MEM_freeN(fragmentcode);
MEM_freeN(vertexcode);
#include "BKE_image.h"
#include "BKE_global.h"
+#include "BKE_utildefines.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
int depth; /* is a depth texture? */
};
-#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.0f*val))
static unsigned char *GPU_texture_convert_pixels(int length, float *fpixels)
{
unsigned char *pixels, *p;
fprintf(stderr, "%s\n", log);
}
-GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, GPUShader *lib)
+GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, /*GPUShader *lib,*/ const char *libcode)
{
GLint status;
GLcharARB log[5000];
+ const char *fragsource[2];
GLsizei length = 0;
+ GLint count;
GPUShader *shader;
if (!GLEW_ARB_vertex_shader || !GLEW_ARB_fragment_shader)
}
if(fragcode) {
+ count = 0;
+ if(libcode) fragsource[count++] = libcode;
+ if(fragcode) fragsource[count++] = fragcode;
+
glAttachObjectARB(shader->object, shader->fragment);
- glShaderSourceARB(shader->fragment, 1, (const char**)&fragcode, NULL);
+ glShaderSourceARB(shader->fragment, count, fragsource, NULL);
glCompileShaderARB(shader->fragment);
glGetObjectParameterivARB(shader->fragment, GL_OBJECT_COMPILE_STATUS_ARB, &status);
}
}
- if(lib && lib->lib)
- glAttachObjectARB(shader->object, lib->lib);
+ /*if(lib && lib->lib)
+ glAttachObjectARB(shader->object, lib->lib);*/
glLinkProgramARB(shader->object);
glGetObjectParameterivARB(shader->object, GL_OBJECT_LINK_STATUS_ARB, &status);
return shader;
}
+#if 0
GPUShader *GPU_shader_create_lib(const char *code)
{
GLint status;
return shader;
}
+#endif
void GPU_shader_bind(GPUShader *shader)
{
#include "IMB_imbuf.h"
#include "IMB_allocimbuf.h"
#include "IMB_divers.h"
+#include "BKE_utildefines.h"
void imb_checkncols(struct ImBuf *ibuf)
{
}
}
-#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.99f*val))
void IMB_rect_from_float(struct ImBuf *ibuf)
{
#include "IMB_imbuf.h"
#include "IMB_allocimbuf.h"
+#include "BKE_utildefines.h"
/* blend modes */
}
}
-/* maybe we should use BKE_utildefines.h */
-#define FTOCHAR(val) (val<=0.0f ? 0: (val>=1.0f ? 255: (char)(255.99f*val)))
-#define CLAMP(a, b, c) if((a)<(b)) (a)=(b); else if((a)>(c)) (a)=(c)
-#define SWAP(type, a, b) { type sw_ap; sw_ap=(a); (a)=(b); (b)=sw_ap; }
void buf_rectfill_area(unsigned char *rect, float *rectf, int width, int height, float *col, int x1, int y1, int x2, int y2)
{
struct Sequence* find_nearest_seq(int *hand);
int insert_gap(int gap, int cfra);
void make_meta(void);
+void select_single_seq(struct Sequence *seq, int deselect_all);
void select_channel_direction(struct Sequence *test,int lr);
void select_more_seq(void);
void select_less_seq(void);
short idcode; // from TreeStore id
short xend; // width of item display, for select
char *name;
- void *directdata; // Armature Bones, Base, ...
+ void *directdata; // Armature Bones, Base, Sequence, Strip...
} TreeElement;
/* TreeElement->flag */
#define TSE_LINKED_LAMP 23
#define TSE_POSEGRP_BASE 24
#define TSE_POSEGRP 25
+#define TSE_SEQUENCE 26
+#define TSE_SEQ_STRIP 27
+#define TSE_SEQUENCE_DUP 28
/* outliner search flags */
#define OL_FIND 0
#define F_CFRA ((float)(G.scene->r.cfra))
#define SFRA (G.scene->r.sfra)
#define EFRA (G.scene->r.efra)
+#define STFRA (G.scene->frame_step)
#define PSFRA ((G.scene->r.psfra != 0)? (G.scene->r.psfra): (G.scene->r.sfra))
#define PEFRA ((G.scene->r.psfra != 0)? (G.scene->r.pefra): (G.scene->r.efra))
#define FRA2TIME(a) ((((double) G.scene->r.frs_sec_base) * (a)) / G.scene->r.frs_sec)
/* for curve objects in editmode that can have hidden handles - may use for IPO's later */
#define BEZSELECTED_HIDDENHANDLES(bezt) ((G.f & G_HIDDENHANDLES) ? (bezt)->f2 & SELECT : BEZSELECTED(bezt))
+#define BEZ_SEL(bezt) { (bezt)->f1 |= SELECT; (bezt)->f2 |= SELECT; (bezt)->f3 |= SELECT; }
+#define BEZ_DESEL(bezt) { (bezt)->f1 &= ~SELECT; (bezt)->f2 &= ~SELECT; (bezt)->f3 &= ~SELECT; }
+#define BEZ_INVSEL(bezt) { (bezt)->f1 ^= SELECT; (bezt)->f2 ^= SELECT; (bezt)->f3 ^= SELECT; }
+
/* psfont */
#define FNT_PDRAW 1
#define FNT_HAEBERLI 2
struct CharInfo curinfo;
} Curve;
-typedef struct IpoDriver {
- struct Object *ob;
- short blocktype, adrcode, type, flag;
- char name[128]; /* bone or constraint(?), or python expression here */
-} IpoDriver;
-
-/* temp? we store more bone names in 1 driver... */
-#define DRIVER_NAME_OFFS 32
-
-typedef struct IpoCurve {
- struct IpoCurve *next, *prev;
-
- struct BPoint *bp; /* are these even used anywhere? */
- struct BezTriple *bezt; /* array of BezTriples (sizeof(BezTriple)*totvert. i.e. keyframes */
-
- rctf maxrct, totrct; /* bounding boxes */
-
- short blocktype, adrcode, vartype; /* blocktype= ipo-blocktype; adrcode= type of ipo-curve; vartype= 'format' of data */
- short totvert; /* total number of BezTriples (i.e. keyframes) on curve */
- short ipo, extrap; /* interpolation and extrapolation modes */
- short flag, rt; /* flag= settings; rt= ??? */
- float ymin, ymax; /* minimum/maximum y-extents for curve */
- unsigned int bitmask; /* ??? */
-
- float slide_min, slide_max; /* minimum/maximum values for sliders (in action editor) */
- float curval; /* value of ipo-curve for current frame */
-
- IpoDriver *driver; /* pointer to ipo-driver for this curve */
-
-} IpoCurve;
-
/* **************** CURVE ********************* */
/* texflag */
#define CU_UNDERLINE 4
#define CU_WRAP 8 /* wordwrap occured here */
-/* *************** driver ****************** */
-
-/* driver->type */
-#define IPO_DRIVER_TYPE_NORMAL 0
-#define IPO_DRIVER_TYPE_PYTHON 1
-
-/* driver->flag */
-/* invalid flag: currently only used for buggy pydriver expressions: */
-#define IPO_DRIVER_FLAG_INVALID 1
-
#endif
*
* The Original Code is: all of this file.
*
- * Contributor(s): none yet.
+ * Contributor(s): Joshua Leung
*
* ***** END GPL LICENSE BLOCK *****
*/
#define DNA_IPO_TYPES_H
#include "DNA_listBase.h"
+#include "DNA_curve_types.h"
#include "DNA_vec_types.h"
#include "DNA_ID.h"
+/* -------------------------- Type Defines --------------------------- */
+
+/* sometimes used - mainly for GE/Ketsji */
+typedef short IPO_Channel;
+
+
+/* --- IPO Curve Driver --- */
+
+/* IPO Curve Driver */
+typedef struct IpoDriver {
+ struct Object *ob; /* target/driver ob */
+ short blocktype, adrcode; /* sub-channel to use */
+
+ short type, flag; /* driver settings */
+ char name[128]; /* bone, or python expression here */
+} IpoDriver;
+
+/* --- IPO Curve --- */
+
+/* IPO Curve */
+typedef struct IpoCurve {
+ struct IpoCurve *next, *prev;
+
+ struct BPoint *bp; /* array of BPoints (sizeof(BPoint)*totvert) - i.e. baked/imported data */
+ struct BezTriple *bezt; /* array of BezTriples (sizeof(BezTriple)*totvert) - i.e. user-editable keyframes */
+
+ rctf maxrct, totrct; /* bounding boxes */
+
+ short blocktype, adrcode, vartype; /* blocktype= ipo-blocktype; adrcode= type of ipo-curve; vartype= 'format' of data */
+ short totvert; /* total number of BezTriples (i.e. keyframes) on curve */
+ short ipo, extrap; /* interpolation and extrapolation modes */
+ short flag, rt; /* flag= settings; rt= ??? */
+ float ymin, ymax; /* minimum/maximum y-extents for curve */
+ unsigned int bitmask; /* ??? */
+
+ float slide_min, slide_max; /* minimum/maximum values for sliders (in action editor) */
+ float curval; /* value of ipo-curve for current frame */
+
+ IpoDriver *driver; /* pointer to ipo-driver for this curve */
+} IpoCurve;
+
+/* --- ID-Datablock --- */
+
/* IPO Data-Block */
typedef struct Ipo {
ID id;
short muteipo, pad; /* muteipo: either 0 or 1 (whether ipo block is muted) */
} Ipo;
-/* NOTE: IpoCurve struct is defined in DNA_curve_types.h, not in here... */
-
-/* sometimes used */
-typedef short IPO_Channel;
+/* ----------- adrcodes (for matching ipo-curves to data) ------------- */
/* defines: are these duped or new? */
-
#define IPOBUTY 17
#define TOB_IPO 1
#define IPO_DISPBITS 2
#define IPO_DISPTIME 3
-/* ******************** */
+/* ********** Object (ID_OB) ********** */
#define OB_TOTIPO 30
#define OB_TOTNAM 30
#define OB_ROT_DIFF 100
-/* ******************** */
+/* ********** Material (ID_MA) ********** */
#define MA_TOTIPO 40
#define MA_TOTNAM 26
#define MAP_VARF 13
#define MAP_DISP 14
-/* ******************** */
+/* ********** Texture (ID_TE) ********** */
#define TE_TOTIPO 26
#define TE_TOTNAM 26
#define TE_BRIGHT 25
#define TE_CONTRA 26
-/* ******************** */
+/* ******** Sequence (ID_SEQ) ********** */
#define SEQ_TOTIPO 1
#define SEQ_TOTNAM 1
#define SEQ_FAC1 1
-/* ******************** */
+/* ********* Curve (ID_CU) *********** */
#define CU_TOTIPO 1
#define CU_TOTNAM 1
#define CU_SPEED 1
-/* ******************** */
+/* ********* ShapeKey (ID_KE) *********** */
#define KEY_TOTIPO 64
#define KEY_TOTNAM 64
#define KEY_SPEED 0
#define KEY_NR 1
-/* ******************** */
+/* ********* World (ID_WO) *********** */
#define WO_TOTIPO 29
#define WO_TOTNAM 16
#define WO_STARDIST 15
#define WO_STARSIZE 16
-/* ******************** */
+/* ********** Lamp (ID_LA) ********** */
#define LA_TOTIPO 21
#define LA_TOTNAM 10
#define LA_QUAD2 9
#define LA_HALOINT 10
-/* ******************** */
+/* ********* Camera (ID_CA) ************ */
-/* yafray: totipo & totnam +2 because of added curves */
#define CAM_TOTIPO 7
#define CAM_TOTNAM 7
#define CAM_SHIFT_X 6
#define CAM_SHIFT_Y 7
-/* ******************** */
+/* ********* Sound (ID_SO) *********** */
#define SND_TOTIPO 4
#define SND_TOTNAM 4
#define SND_PANNING 3
#define SND_ATTEN 4
-/* ******************** */
+/* ******* PoseChannel (ID_PO) ********* */
-#define AC_TOTIPO 10 /* __NLA */
+#define AC_TOTIPO 10
#define AC_TOTNAM 10
#define AC_LOC_X 1
#define AC_QUAT_Y 27
#define AC_QUAT_Z 28
-/* ******************** */
-#define CO_TOTIPO 2 /* Constraint Ipos */
+/* ******** Constraint (ID_CO) ********** */
+
+#define CO_TOTIPO 2
#define CO_TOTNAM 2
#define CO_ENFORCE 1
#define CO_HEADTAIL 2
-/*
-#define CO_TIME 2
-#define CO_OFFSET_X 3
-#define CO_OFFSET_Y 4
-#define CO_OFFSET_Z 5
-#define CO_ORIENT_X 6
-#define CO_ORIENT_Y 7
-#define CO_ORIENT_Z 8
-#define CO_ROLL 9
-*/
-/* ******************** */
-/* fluidsim ipos NT */
+/* ****** FluidSim (ID_FLUIDSIM) ****** */
#define FLUIDSIM_TOTIPO 13
#define FLUIDSIM_TOTNAM 13
/* ******************** */
/* particle ipos */
+
+/* ******* Particle (ID_PA) ******** */
#define PART_TOTIPO 25
#define PART_TOTNAM 25
#define PART_PD2_FMAXD 25
-/* these are IpoCurve specific */
-/* **************** IPO ********************* */
+/* -------------------- Defines: Flags and Types ------------------ */
+
+/* ----- IPO Curve Defines ------- */
/* icu->vartype */
#define IPO_CHAR 0
#define IPO_FLOAT 4
#define IPO_DOUBLE 5
#define IPO_FLOAT_DEGR 6
+
/* very special case, in keys */
#define IPO_BEZTRIPLE 100
#define IPO_BPOINT 101
#define IPO_CONST 0
#define IPO_LIN 1
#define IPO_BEZ 2
-#define IPO_MIXED 3 /* not used yet */
+ /* not used yet */
+#define IPO_MIXED 3
/* icu->extrap */
#define IPO_HORIZ 0
#define IPO_PROTECT 64
#define IPO_MUTE 128
+/* ---------- IPO Drivers ----------- */
+
+/* offset in driver->name for finding second posechannel for rot-diff */
+#define DRIVER_NAME_OFFS 32
+
+/* driver->type */
+#define IPO_DRIVER_TYPE_NORMAL 0
+#define IPO_DRIVER_TYPE_PYTHON 1
+
+/* driver->flag */
+ /* invalid flag: currently only used for buggy pydriver expressions */
+#define IPO_DRIVER_FLAG_INVALID (1<<0)
+
#endif
short colormodel, totex;
float r, g, b, k;
+ float shdwr, shdwg, shdwb, shdwpad;
float energy, dist, spotsize, spotblend;
float haint;
/* Since it is used with LOCAL lamp, can't use LA_SHAD */
#define LA_YF_SOFT 16384
#define LA_LAYER_SHADOW 32768
+#define LA_SHAD_TEX (1<<16)
/* layer_shadow */
#define LA_LAYER_SHADOW_BOTH 0
/* mapto */
#define LAMAP_COL 1
+#define LAMAP_SHAD 2
#endif /* DNA_LAMP_TYPES_H */
/* Sculptmode data */
struct SculptData sculptdata;
+
+ /* frame step. */
+ int frame_step;
+ int pad;
} Scene;
#define SO_LIBRARIES 7
#define SO_VERSE_SESSION 8
#define SO_VERSE_MS 9
+#define SO_SEQUENCE 10
/* SpaceOops->storeflag */
#define SO_TREESTORE_CLEANUP 1
void BPY_clear_bad_scriptlinks( struct Text *byebye );
int BPY_has_onload_script( void );
- void BPY_do_all_scripts( short event );
+ void BPY_do_all_scripts( short event, short anim );
int BPY_check_all_scriptlinks( struct Text *text );
void BPY_do_pyscript( struct ID *id, short event );
void BPY_free_scriptlink( struct ScriptLink *slink );
int BPY_has_spacehandler(struct Text *text, struct ScrArea *sa);
void BPY_screen_free_spacehandlers(struct bScreen *sc);
int BPY_do_spacehandlers(struct ScrArea *sa, unsigned short event,
- unsigned short space_event);
+ short eventValue, unsigned short space_event);
void BPY_pydriver_update(void);
float BPY_pydriver_eval(struct IpoDriver *driver);
* For the scene, only the current active scene the scripts are
* executed (if any).
*****************************************************************************/
-void BPY_do_all_scripts( short event )
+void BPY_do_all_scripts( short event, short anim )
{
+ /* during stills rendering we disable FRAMECHANGED events */
+ static char disable_frame_changed = 0;
+
+ if ((event == SCRIPT_FRAMECHANGED) && disable_frame_changed)
+ return;
+
DoAllScriptsFromList( &( G.main->object ), event );
DoAllScriptsFromList( &( G.main->lamp ), event );
DoAllScriptsFromList( &( G.main->camera ), event );
* "import sys; sys.setcheckinterval(sys.maxint)" */
if (event == SCRIPT_RENDER) {
_Py_CheckInterval = PyInt_GetMax();
+ if (!anim)
+ disable_frame_changed = 1;
}
else if (event == SCRIPT_POSTRENDER) {
_Py_CheckInterval = 100; /* Python default */
+ disable_frame_changed = 0;
}
return;
}
int BPY_do_spacehandlers( ScrArea *sa, unsigned short event,
- unsigned short space_event )
+ short eventValue, unsigned short space_event )
{
ScriptLink *scriptlink;
int retval = 0;
PyDict_SetItemString(g_blenderdict, "bylink", Py_True);
/* unlike normal scriptlinks, here Blender.link is int (space event type) */
EXPP_dict_set_item_str(g_blenderdict, "link", PyInt_FromLong(space_event));
- /* note: DRAW space_events set event to 0 */
+ /* note: DRAW space_events set event and val to 0 */
EXPP_dict_set_item_str(g_blenderdict, "event", PyInt_FromLong(event));
+ EXPP_dict_set_item_str(g_blenderdict, "eventValue", PyInt_FromLong(eventValue));
/* now run all assigned space handlers for this space and space_event */
for( index = 0; index < scriptlink->totscript; index++ ) {
#include "BKE_utildefines.h"
#include "BLI_blenlib.h"
#include "BLI_arithb.h" /* for M_PI */
+#include "DNA_userdef_types.h"
#include "BSE_editipo.h"
#include "BIF_keyframing.h"
#include "BIF_space.h"
static PyObject *Camera_insertIpoKey( BPy_Camera * self, PyObject * args )
{
- int key = 0;
+ int key = 0, flag = 0;
if( !PyArg_ParseTuple( args, "i", &( key ) ) )
return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
"expected int argument" ) );
-
+
+ /* flag should be initialised with the 'autokeying' flags like for normal keying */
+ if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED;
+
if (key == IPOKEY_LENS){
- insertkey((ID *)self->camera, ID_CA, NULL, NULL, CAM_LENS, 0);
+ insertkey((ID *)self->camera, ID_CA, NULL, NULL, CAM_LENS, flag);
}
else if (key == IPOKEY_CLIPPING){
- insertkey((ID *)self->camera, ID_CA, NULL, NULL, CAM_STA, 0);
- insertkey((ID *)self->camera, ID_CA, NULL, NULL, CAM_END, 0);
+ insertkey((ID *)self->camera, ID_CA, NULL, NULL, CAM_STA, flag);
+ insertkey((ID *)self->camera, ID_CA, NULL, NULL, CAM_END, flag);
}
allspace(REMAKEIPO, 0);
#define EXPP_IPOCURVE_H
#include <Python.h>
-#include "DNA_curve_types.h" /* declaration of IpoCurve */
+#include "DNA_ipo_types.h" /* declaration of IpoCurve */
/*****************************************************************************/
/* Python C_IpoCurve structure definition: */
#include "gen_utils.h"
#include "gen_library.h"
#include "BKE_utildefines.h"
+#include "DNA_userdef_types.h"
#include "MEM_guardedalloc.h"
/*****************************************************************************/
static PyObject *Lamp_insertIpoKey( BPy_Lamp * self, PyObject * args )
{
- int key = 0, map;
+ int key = 0, flag = 0, map;
if( !PyArg_ParseTuple( args, "i", &( key ) ) )
return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
map = texchannel_to_adrcode(self->lamp->texact);
+ /* flag should be initialised with the 'autokeying' flags like for normal keying */
+ if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED;
+
if (key == IPOKEY_RGB ) {
- insertkey((ID *)self->lamp, ID_LA, NULL, NULL, LA_COL_R, 0);
- insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_COL_G, 0);
- insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_COL_B, 0);
+ insertkey((ID *)self->lamp, ID_LA, NULL, NULL, LA_COL_R, flag);
+ insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_COL_G, flag);
+ insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_COL_B, flag);
}
if (key == IPOKEY_ENERGY ) {
- insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_ENERGY, 0);
+ insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_ENERGY, flag);
}
if (key == IPOKEY_SPOTSIZE ) {
- insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_SPOTSI, 0);
+ insertkey((ID *)self->lamp, ID_LA, NULL, NULL,LA_SPOTSI, flag);
}
if (key == IPOKEY_OFFSET ) {
- insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_OFS_X, 0);
- insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_OFS_Y, 0);
- insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_OFS_Z, 0);
+ insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_OFS_X, flag);
+ insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_OFS_Y, flag);
+ insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_OFS_Z, flag);
}
if (key == IPOKEY_SIZE ) {
- insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_SIZE_X, 0);
- insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_SIZE_Y, 0);
- insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_SIZE_Z, 0);
+ insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_SIZE_X, flag);
+ insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_SIZE_Y, flag);
+ insertkey((ID *)self->lamp, ID_LA, NULL, NULL, map+MAP_SIZE_Z, flag);
}
allspace(REMAKEIPO, 0);
#include "DNA_space_types.h"
#include "DNA_material_types.h"
+#include "DNA_userdef_types.h"
#include "BKE_main.h"
#include "BKE_global.h"
#include "BKE_library.h"
static PyObject *Material_insertIpoKey( BPy_Material * self, PyObject * args )
{
- int key = 0, map;
+ int key = 0, flag = 0, map;
if( !PyArg_ParseTuple( args, "i", &( key ) ) )
return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
map = texchannel_to_adrcode(self->material->texact);
+ /* flag should be initialised with the 'autokeying' flags like for normal keying */
+ if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED;
+
if(key==IPOKEY_RGB || key==IPOKEY_ALLCOLOR) {
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_R, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_G, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_B, 0);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_R, flag);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_G, flag);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_COL_B, flag);
}
if(key==IPOKEY_ALPHA || key==IPOKEY_ALLCOLOR) {
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_ALPHA, 0);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_ALPHA, flag);
}
if(key==IPOKEY_HALOSIZE || key==IPOKEY_ALLCOLOR) {
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_HASIZE, 0);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_HASIZE, flag);
}
if(key==IPOKEY_MODE || key==IPOKEY_ALLCOLOR) {
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_MODE, 0);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_MODE, flag);
}
if(key==IPOKEY_ALLCOLOR) {
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_R, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_G, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_B, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_REF, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_EMIT, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_AMB, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_HARD, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_MODE, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_TRANSLU, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_ADD, 0);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_R, flag);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_G, flag);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC_B, flag);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_REF, flag);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_EMIT, flag);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_AMB, flag);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_SPEC, flag);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_HARD, flag);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_MODE, flag);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_TRANSLU, flag);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_ADD, flag);
}
if(key==IPOKEY_ALLMIRROR) {
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_RAYM, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESMIR, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESMIRI, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESTRA, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESTRAI, 0);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_RAYM, flag);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESMIR, flag);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESMIRI, flag);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESTRA, flag);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, MA_FRESTRAI, flag);
}
if(key==IPOKEY_OFS || key==IPOKEY_ALLMAPPING) {
- insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_X, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_Y, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_Z, 0);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_X, flag);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_Y, flag);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_OFS_Z, flag);
}
if(key==IPOKEY_SIZE || key==IPOKEY_ALLMAPPING) {
- insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_X, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_Y, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_Z, 0);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_X, flag);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_Y, flag);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_SIZE_Z, flag);
}
if(key==IPOKEY_ALLMAPPING) {
- insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_R, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_G, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_B, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_DVAR, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_COLF, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_NORF, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_VARF, 0);
- insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_DISP, 0);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_R, flag);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_G, flag);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_B, flag);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_DVAR, flag);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_COLF, flag);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_NORF, flag);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_VARF, flag);
+ insertkey((ID *)self->material, ID_MA, NULL, NULL, map+MAP_DISP, flag);
}
allspace(REMAKEIPO, 0);
static PyObject *Object_insertIpoKey( BPy_Object * self, PyObject * args )
{
Object *ob= self->object;
- int key = 0;
+ int key = 0, flag = 0;
char *actname= NULL;
if( !PyArg_ParseTuple( args, "i", &key ) )
if(ob->ipoflag & OB_ACTION_OB)
actname= "Object";
+ /* flag should be initialised with the 'autokeying' flags like for normal keying */
+ if (IS_AUTOKEY_FLAG(AUTOMATKEY)) flag |= INSERTKEY_MATRIX;
+ if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED;
+
if (key == IPOKEY_LOC || key == IPOKEY_LOCROT || key == IPOKEY_LOCROTSIZE){
- insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_X, 0);
- insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_Y, 0);
- insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_Z, 0);
+ insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_X, flag);
+ insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_Y, flag);
+ insertkey((ID *)ob, ID_OB, actname, NULL,OB_LOC_Z, flag);
}
if (key == IPOKEY_ROT || key == IPOKEY_LOCROT || key == IPOKEY_LOCROTSIZE){
- insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_X, 0);
- insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_Y, 0);
- insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_Z, 0);
+ insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_X, flag);
+ insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_Y, flag);
+ insertkey((ID *)ob, ID_OB, actname, NULL,OB_ROT_Z, flag);
}
if (key == IPOKEY_SIZE || key == IPOKEY_LOCROTSIZE ){
- insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_X, 0);
- insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_Y, 0);
- insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_Z, 0);
+ insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_X, flag);
+ insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_Y, flag);
+ insertkey((ID *)ob, ID_OB, actname, NULL,OB_SIZE_Z, flag);
}
if (key == IPOKEY_LAYER ){
- insertkey((ID *)ob, ID_OB, actname, NULL,OB_LAY, 0);
+ insertkey((ID *)ob, ID_OB, actname, NULL,OB_LAY, flag);
}
if (key == IPOKEY_PI_STRENGTH ){
- insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_FSTR, 0);
+ insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_FSTR, flag);
} else if (key == IPOKEY_PI_FALLOFF ){
- insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_FFALL, 0);
+ insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_FFALL, flag);
} else if (key == IPOKEY_PI_SURFACEDAMP ){
- insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_SDAMP, 0);
+ insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_SDAMP, flag);
} else if (key == IPOKEY_PI_RANDOMDAMP ){
- insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_RDAMP, 0);
+ insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_RDAMP, flag);
} else if (key == IPOKEY_PI_PERM ){
- insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_PERM, 0);
+ insertkey((ID *)ob, ID_OB, actname, NULL, OB_PD_PERM, flag);
}
allspace(REMAKEIPO, 0);
BPy_Action *sourceact;
char *chanName;
int actframe;
+ int flag=0;
/* for doing the time trick, similar to editaction bake_action_with_client() */
/* XXX: must check chanName actually exists, otherwise segfaults! */
//achan = get_action_channel(sourceact->action, chanName);
-
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_X, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Y, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Z, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_X, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Y, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Z, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_W, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_X, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Y, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Z, 0);
+
+ /* flag should be initialised with the 'autokeying' flags like for normal keying */
+ if (IS_AUTOKEY_FLAG(AUTOMATKEY)) flag |= INSERTKEY_MATRIX;
+ if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED;
+
+ insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_X, flag);
+ insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Y, flag);
+ insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Z, flag);
+ insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_X, flag);
+ insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Y, flag);
+ insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Z, flag);
+ insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_W, flag);
+ insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_X, flag);
+ insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Y, flag);
+ insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Z, flag);
G.scene->r.cfra = oldframe;
static PyObject *Object_insertCurrentPoseKey( BPy_Object * self, PyObject * args )
{
Object *ob= self->object;
+ int flag = 0;
char *chanName;
/* for doing the time trick, similar to editaction bake_action_with_client() */
/* XXX: must check chanName actually exists, otherwise segfaults! */
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_X, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Y, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Z, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_X, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Y, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Z, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_W, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_X, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Y, 0);
- insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Z, 0);
+ /* flag should be initialised with the 'autokeying' flags like for normal keying */
+ if (IS_AUTOKEY_FLAG(AUTOMATKEY)) flag |= INSERTKEY_MATRIX;
+ if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED;
+
+ insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_X, flag);
+ insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Y, flag);
+ insertkey(&ob->id, ID_PO, chanName, NULL, AC_LOC_Z, flag);
+ insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_X, flag);
+ insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Y, flag);
+ insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_Z, flag);
+ insertkey(&ob->id, ID_PO, chanName, NULL, AC_QUAT_W, flag);
+ insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_X, flag);
+ insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Y, flag);
+ insertkey(&ob->id, ID_PO, chanName, NULL, AC_SIZE_Z, flag);
G.scene->r.cfra = oldframe;
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected a string" );
- prop = get_property( self->object, prop_name );
+ prop = get_ob_property( self->object, prop_name );
if( prop )
return Property_CreatePyObject( prop );
char *prop_type = NULL;
short type = -1;
BPy_Property *py_prop = NULL;
- int argslen = PyObject_Length( args );
+ int argslen = PyTuple_Size( args );
if( argslen == 3 || argslen == 2 ) {
if( !PyArg_ParseTuple( args, "sO|s", &prop_name, &prop_data,
py_prop->property = NULL;
}
} else {
- prop = get_property( self->object, prop_name );
+ prop = get_ob_property( self->object, prop_name );
if( prop ) {
BLI_remlink( &self->object->prop, prop );
free_property( prop );
PyObject * args )
{
PyObject *dest;
+ Object *dest_ob;
bProperty *prop = NULL;
bProperty *propn = NULL;
if( !PyArg_ParseTuple( args, "O!", &Object_Type, &dest ) )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected an Object" );
-
+
+ if (dest == (PyObject *)self) {
+ Py_RETURN_NONE;
+ }
+ dest_ob = ( ( BPy_Object * ) dest )->object;
+
/*make a copy of all its properties*/
prop = self->object->prop.first;
while( prop ) {
- propn = copy_property( prop );
- BLI_addtail( &( ( BPy_Object * ) dest )->object->prop, propn );
+ set_ob_property( dest_ob, prop );
prop = prop->next;
}
Py_RETURN_NONE;
}
+static PyObject *Object_getColor( BPy_Object *self, void *type )
+{
+ return Py_BuildValue( "(ffff)", self->object->col[0], self->object->col[1], self->object->col[2], self->object->col[3] );
+}
+
+static int Object_setColor( BPy_Object *self, PyObject *value )
+{
+ int i;
+ float color[4];
+ struct Object *object = self->object;
+
+ value = PySequence_Tuple( value );
+
+ if( !value || !PyArg_ParseTuple( value, "ffff", &color[0], &color[1], &color[2], &color[3] ) ) {
+ Py_XDECREF( value );
+ return EXPP_ReturnIntError( PyExc_TypeError,
+ "expected a list or tuple of 3 floats" );
+ }
+
+ Py_DECREF( value );
+
+ for( i = 0; i < 4; ++i ) {
+ object->col[i] = MAX2(MIN2(color[i], 1.0), 0);
+ }
+ return 0;
+}
+
/* __copy__() */
static PyObject *Object_copy(BPy_Object * self)
{
(getter)Object_getDrawModeBits, (setter)Object_setDrawModeBits,
"Transparent materials for the active object (mesh only) enabled",
(void *)OB_DRAWTRANSP},
-
+ {"color",
+ (getter)Object_getColor, (setter)Object_setColor,
+ "Object color used by the game engine and optionally for materials",
+ NULL},
{"enableNLAOverride",
(getter)Object_getNLAflagBits, (setter)Object_setNLAflagBits,
"Toggles Action-NLA based animation",
{
PyObject *parent_object = NULL;
PyObject *constants = NULL, *item = NULL;
- int frame = 1, oldframe, length, x, numeric_value = 0, oldflag, no_ipo_update = 0;
+ int frame = 1, oldframe, length, x, numeric_value = 0, oldflag, no_ipo_update = 0, flag = 0;
bPoseChannel *pchan = NULL;
if (!PyArg_ParseTuple(args, "O!i|Oi", &Object_Type, &parent_object, &frame, &constants, &no_ipo_update ))
goto AttributeError;
- /* incase we ever have a value other then 1 for fast */
- if (no_ipo_update)
- no_ipo_update = 1;
+ /* flag should be initialised with the 'autokeying' flags like for normal keying */
+ if (no_ipo_update) flag |= INSERTKEY_FAST;
+ if (IS_AUTOKEY_FLAG(AUTOMATKEY)) flag |= INSERTKEY_MATRIX;
+ if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED;
//verify that this pchannel is part of the object->pose
for (pchan = ((BPy_Object*)parent_object)->object->pose->chanbase.first;
//insert the pose keys
if (self->posechannel->flag & POSE_ROT){
insertkey(&((BPy_Object*)parent_object)->object->id,
- ID_PO, self->posechannel->name, NULL, AC_QUAT_X, no_ipo_update);
+ ID_PO, self->posechannel->name, NULL, AC_QUAT_X, flag);
insertkey(&((BPy_Object*)parent_object)->object->id,
- ID_PO, self->posechannel->name, NULL, AC_QUAT_Y, no_ipo_update);
+ ID_PO, self->posechannel->name, NULL, AC_QUAT_Y, flag);
insertkey(&((BPy_Object*)parent_object)->object->id,
- ID_PO, self->posechannel->name, NULL, AC_QUAT_Z, no_ipo_update);
+ ID_PO, self->posechannel->name, NULL, AC_QUAT_Z, flag);
insertkey(&((BPy_Object*)parent_object)->object->id,
- ID_PO, self->posechannel->name, NULL, AC_QUAT_W, no_ipo_update);
+ ID_PO, self->posechannel->name, NULL, AC_QUAT_W, flag);
}
if (self->posechannel->flag & POSE_LOC){
insertkey(&((BPy_Object*)parent_object)->object->id,
- ID_PO, self->posechannel->name, NULL, AC_LOC_X, no_ipo_update);
+ ID_PO, self->posechannel->name, NULL, AC_LOC_X, flag);
insertkey(&((BPy_Object*)parent_object)->object->id,
- ID_PO, self->posechannel->name, NULL, AC_LOC_Y, no_ipo_update);
+ ID_PO, self->posechannel->name, NULL, AC_LOC_Y, flag);
insertkey(&((BPy_Object*)parent_object)->object->id,
- ID_PO, self->posechannel->name, NULL, AC_LOC_Z, no_ipo_update);
+ ID_PO, self->posechannel->name, NULL, AC_LOC_Z, flag);
}
if (self->posechannel->flag & POSE_SIZE){
insertkey(&((BPy_Object*)parent_object)->object->id,
- ID_PO, self->posechannel->name, NULL, AC_SIZE_X, no_ipo_update);
+ ID_PO, self->posechannel->name, NULL, AC_SIZE_X, flag);
insertkey(&((BPy_Object*)parent_object)->object->id,
- ID_PO, self->posechannel->name, NULL, AC_SIZE_Y, no_ipo_update);
+ ID_PO, self->posechannel->name, NULL, AC_SIZE_Y, flag);
insertkey(&((BPy_Object*)parent_object)->object->id,
- ID_PO, self->posechannel->name, NULL, AC_SIZE_Z, no_ipo_update);
+ ID_PO, self->posechannel->name, NULL, AC_SIZE_Z, flag);
}
//flip the frame back
if( !PyArg_ParseTuple( args, "|s", &name ) )
return ( EXPP_ReturnPyObjError( PyExc_TypeError,
"expected string argument (or nothing)" ) );
-
+
scene_iter = G.main->scene.first;
if( name ) { /* (name) - Search scene by name */
PyObject *wanted_scene = NULL;
- while( ( scene_iter ) && ( wanted_scene == NULL ) ) {
-
- if( strcmp( name, scene_iter->id.name + 2 ) == 0 )
- wanted_scene =
- Scene_CreatePyObject( scene_iter );
-
- scene_iter = scene_iter->id.next;
+ for(;scene_iter; scene_iter = scene_iter->id.next) {
+ if( strcmp( name, scene_iter->id.name + 2 ) == 0 ) {
+ wanted_scene = Scene_CreatePyObject( scene_iter );
+ break;
+ }
}
if( wanted_scene == NULL ) { /* Requested scene doesn't exist */
return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
"couldn't create PyList" ) );
- while( scene_iter ) {
+ for(; scene_iter; scene_iter = scene_iter->id.next, index++) {
pyobj = Scene_CreatePyObject( scene_iter );
if( !pyobj ) {
Py_DECREF(sce_pylist);
- return ( EXPP_ReturnPyObjError
- ( PyExc_MemoryError,
- "couldn't create PyString" ) );
+ return NULL; /* Scene_CreatePyObject sets an error */
}
PyList_SET_ITEM( sce_pylist, index, pyobj );
-
- scene_iter = scene_iter->id.next;
- index++;
}
return sce_pylist;
#define EXPP_TEXT_MODE_FOLLOW TXT_FOLLOW
+/* checks for the group being removed */
+#define TEXT_DEL_CHECK_PY(bpy_text) if (!(bpy_text->text)) return ( EXPP_ReturnPyObjError( PyExc_RuntimeError, "Text has been removed" ) )
+#define TEXT_DEL_CHECK_INT(bpy_text) if (!(bpy_text->text)) return ( EXPP_ReturnIntError( PyExc_RuntimeError, "Text has been removed" ) )
+
/*****************************************************************************/
/* Python API function prototypes for the Text module. */
/*****************************************************************************/
static PyObject *Text_suggest( BPy_Text * self, PyObject * args );
static PyObject *Text_showDocs( BPy_Text * self, PyObject * args );
+static void text_reset_internal( BPy_Text * self ); /* internal func */
+
/*****************************************************************************/
/* Python BPy_Text methods table: */
/*****************************************************************************/
"couldn't create BPy_Text PyObject" );
pytxt->text = txt;
- pytxt->iol = NULL;
- pytxt->ioc = -1;
+ text_reset_internal(pytxt);
return ( PyObject * ) pytxt;
}
/*****************************************************************************/
static PyObject *Text_getFilename( BPy_Text * self )
{
+ TEXT_DEL_CHECK_PY(self);
if( self->text->name )
return PyString_FromString( self->text->name );
{ /* text->nlines isn't updated in Blender (?) */
int nlines = 0;
TextLine *line;
-
+
+ TEXT_DEL_CHECK_PY(self);
+
line = self->text->lines.first;
while( line ) { /* so we have to count them ourselves */
{
int oldstate;
- if( !self->text )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This object isn't linked to a Blender Text Object" );
+ TEXT_DEL_CHECK_PY(self);
oldstate = txt_get_undostate( );
txt_set_undostate( 1 );
Py_RETURN_NONE;
}
-static PyObject *Text_reset( BPy_Text * self )
+static void text_reset_internal( BPy_Text * self )
{
self->iol = NULL;
self->ioc = -1;
+}
+static PyObject *Text_reset( BPy_Text * self )
+{
+ text_reset_internal(self);
Py_RETURN_NONE;
}
{
PyObject *tmpstr;
- if( !self->text )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This object isn't linked to a Blender Text Object" );
+ TEXT_DEL_CHECK_PY(self);
/* Reset */
if (!self->iol && self->ioc == -1) {
char *str = PyString_AsString(value);
int oldstate;
- if( !self->text )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This object isn't linked to a Blender Text Object" );
-
if( !str )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected string argument" );
+ TEXT_DEL_CHECK_PY(self);
+
oldstate = txt_get_undostate( );
txt_insert_buf( self->text, str );
txt_move_eof( self->text, 0 );
txt_set_undostate( oldstate );
- Text_reset( self );
+ text_reset_internal( self );
Py_RETURN_NONE;
}
char *str = PyString_AsString(value);
int oldstate;
- if( !self->text )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This object isn't linked to a Blender Text Object" );
-
if( !str )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected string argument" );
+
+ TEXT_DEL_CHECK_PY(self);
oldstate = txt_get_undostate( );
txt_insert_buf( self->text, str );
txt_set_undostate( oldstate );
- Text_reset( self );
+ text_reset_internal( self );
Py_RETURN_NONE;
}
int num = PyInt_AsLong(value);
int oldstate;
- if( !self->text )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This object isn't linked to a Blender Text Object" );
-
- if( !num )
+ TEXT_DEL_CHECK_PY(self);
+
+ /* zero num is invalid and -1 is an error value */
+ if( !num || (num==-1 && PyErr_Occurred()))
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected non-zero int argument" );
}
txt_set_undostate( oldstate );
- Text_reset( self );
+ text_reset_internal( self );
Py_RETURN_NONE;
}
int ival;
char *attr;
+ TEXT_DEL_CHECK_PY(self);
+
if( !PyArg_ParseTuple( args, "si", &attr, &ival ) )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected a string and an int as arguments" );
PyObject *list, *tmpstr;
int start=0, end=-1, i;
- if( !self->text )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This object isn't linked to a Blender Text Object" );
+ TEXT_DEL_CHECK_PY(self);
if( !PyArg_ParseTuple( args, "|ii", &start, &end ) )
return EXPP_ReturnPyObjError( PyExc_TypeError,
TextLine *linep;
int row, col;
+ TEXT_DEL_CHECK_PY(self);
+
text = self->text;
- if( !text )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This object isn't linked to a Blender Text Object" );
for (row=0,linep=text->lines.first; linep!=text->curl; linep=linep->next)
row++;
int row, col;
SpaceText *st;
- if (!self->text)
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "This object isn't linked to a Blender Text Object");
+ TEXT_DEL_CHECK_PY(self);
if (!PyArg_ParseTuple(args, "ii", &row, &col))
return EXPP_ReturnPyObjError(PyExc_TypeError,
TextLine *linep;
int row, col;
+ TEXT_DEL_CHECK_PY(self);
+
text = self->text;
- if( !text )
- return EXPP_ReturnPyObjError( PyExc_RuntimeError,
- "This object isn't linked to a Blender Text Object" );
for (row=0,linep=text->lines.first; linep!=text->sell; linep=linep->next)
row++;
int row, col;
SpaceText *st;
- if (!self->text)
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "This object isn't linked to a Blender Text Object");
+ TEXT_DEL_CHECK_PY(self);
if (!PyArg_ParseTuple(args, "ii", &row, &col))
return EXPP_ReturnPyObjError(PyExc_TypeError,
Text *text;
char color[4];
+ TEXT_DEL_CHECK_PY(self);
+
text = self->text;
- if (!text)
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "This object isn't linked to a Blender Text Object");
if (!PyArg_ParseTuple(args, "i(iii)i", &group, &r, &g, &b, &flags))
return EXPP_ReturnPyObjError(PyExc_TypeError,
char *prefix = NULL, *name, type;
SpaceText *st;
- if (!self->text)
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "This object isn't linked to a Blender Text Object");
+ TEXT_DEL_CHECK_PY(self);
/* Parse args for a list of strings/tuples */
if (!PyArg_ParseTuple(args, "O!|s", &PyList_Type, &list, &prefix))
{
char *docs;
SpaceText *st;
-
- if (!self->text)
- return EXPP_ReturnPyObjError(PyExc_RuntimeError,
- "This object isn't linked to a Blender Text Object");
+
+ TEXT_DEL_CHECK_PY(self);
if (!PyArg_ParseTuple(args, "s", &docs))
return EXPP_ReturnPyObjError( PyExc_TypeError,
/*****************************************************************************/
static PyObject *Text_getMode(BPy_Text * self)
{
+ TEXT_DEL_CHECK_PY(self);
return PyInt_FromLong( self->text->flags );
}
#include "World.h" /*This must come first*/
#include "DNA_scene_types.h" /* for G.scene */
+#include "DNA_userdef_types.h"
#include "BKE_global.h"
#include "BKE_world.h"
#include "BKE_main.h"
static PyObject *World_insertIpoKey( BPy_World * self, PyObject * args )
{
- int key = 0, map;
+ int key = 0, flag = 0, map;
if( !PyArg_ParseTuple( args, "i", &( key ) ) )
return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
map = texchannel_to_adrcode(self->world->texact);
+ /* flag should be initialised with the 'autokeying' flags like for normal keying */
+ if (IS_AUTOKEY_FLAG(INSERTNEEDED)) flag |= INSERTKEY_NEEDED;
+
if(key == IPOKEY_ZENITH) {
- insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_ZEN_R, 0);
- insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_ZEN_G, 0);
- insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_ZEN_B, 0);
+ insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_ZEN_R, flag);
+ insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_ZEN_G, flag);
+ insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_ZEN_B, flag);
}
if(key == IPOKEY_HORIZON) {
- insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_HOR_R, 0);
- insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_HOR_G, 0);
- insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_HOR_B, 0);
+ insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_HOR_R, flag);
+ insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_HOR_G, flag);
+ insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_HOR_B, flag);
}
if(key == IPOKEY_MIST) {
- insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISI, 0);
- insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISTDI, 0);
- insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISTSTA, 0);
- insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISTHI, 0);
+ insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISI, flag);
+ insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISTDI, flag);
+ insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISTSTA, flag);
+ insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_MISTHI, flag);
}
if(key == IPOKEY_STARS) {
- insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STAR_R, 0);
- insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STAR_G, 0);
- insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STAR_B, 0);
- insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STARDIST, 0);
- insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STARSIZE, 0);
+ insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STAR_R, flag);
+ insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STAR_G, flag);
+ insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STAR_B, flag);
+ insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STARDIST, flag);
+ insertkey((ID *)self->world, ID_WO, NULL, NULL, WO_STARSIZE, flag);
}
if(key == IPOKEY_OFFSET) {
- insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_OFS_X, 0);
- insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_OFS_Y, 0);
- insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_OFS_Z, 0);
+ insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_OFS_X, flag);
+ insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_OFS_Y, flag);
+ insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_OFS_Z, flag);
}
if(key == IPOKEY_SIZE) {
- insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_SIZE_X, 0);
- insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_SIZE_Y, 0);
- insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_SIZE_Z, 0);
+ insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_SIZE_X, flag);
+ insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_SIZE_Y, flag);
+ insertkey((ID *)self->world, ID_WO, NULL, NULL, map+MAP_SIZE_Z, flag);
}
allspace(REMAKEIPO, 0);
- L{World}
- L{sys<Sys>}
+ Additional information:
+ -----------------------
+ - L{API_related}:
+ - Calling scripts from command line
+ - Script links and space handlers
+ - How to register scripts in menus
+ - Recommended ways to document and support configuration options
+
Introduction:
=============
import Blender
from Blender import Draw
evt = Blender.event
+ val = Blender.eventValue
return_it = False
if evt == Draw.LEFTMOUSE:
elif evt == Draw.AKEY:
print "Swallowing an 'a' character"
else:
- print "Let the 3D View itself process this event:", evt
+ print "Let the 3D View itself process this event: %d with value %d" % (evt, val)
return_it = True
# if Blender should not process itself the passed event:
tells what space this handler belongs to and the handler's type
(EVENT, DRAW);
- B{event}:
- - EVENT handlers: an input event (check keys and mouse events in L{Draw})
- to be processed or ignored.
+ - EVENT handlers: an input event (check keys and mouse events in
+ L{Draw}) to be processed or ignored;
+ - DRAW handlers: 0 always;
+ - B{eventValue}:
+ - EVENT handlers: the event value, it indicates mouse button or key
+ presses (since we don't pass releases) as 1 and mouse movements
+ (Draw.MOUSE.X and Draw.MOUSE.Y) as the current x or y coordinate,
+ for example;
- DRAW handlers: 0 always.
B{Guidelines (important)}:
"""
The main Blender module.
-B{New}: L{Run}, L{UpdateMenus}, new options to L{Get}, L{ShowHelp},
-L{SpaceHandlers} dictionary.
+B{New}: new var L{eventValue} for space handlers, L{Run}, L{UpdateMenus},
+new options to L{Get}, L{ShowHelp}, L{SpaceHandlers} dictionary.
L{UnpackModes} dictionary.
Blender
- for normal L{GUI<Draw.Register>} scripts I{during the events callback},
it holds the ascii value of the current event, if it is a valid one.
Users interested in this should also check the builtin 'ord' and 'chr'
- Python functions.
+ Python functions.
+@type eventValue: int
+@var eventValue: used only for EVENT space handlers, it holds the event value:
+ - for mouse button and key presses it's 1, for mouse movement
+ (Draw.MOUSEX and Draw.MOUSEY) it has the new x or y coordinate, resp.
@type mode: string
@var mode: Blender's current mode:
- 'interactive': normal mode, with an open window answering to user input;
@ivar transp: Enable transparent materials for the active object
(mesh only). Also see B{TRANSP} bit in L{drawMode} attribute.
@type transp: boolean
+ @ivar color: Object color used by the game engine and optionally for materials, 4 floats for RGBA object color.
+ @type color: tuple of 4 floats between 0 and 1
@ivar drawMode: The object's drawing mode bitfield.
See L{DrawModes} constant dict for values.
@type drawMode: int
set_scene( oldsce );
}
else { /* background mode (blender -b file.blend -P script) */
- int slink_flag = 0;
Render *re= RE_NewRender(G.scene->id.name);
int end_frame = G.scene->r.efra;
G.scene->r.efra = G.scene->r.sfra;
- if (G.f & G_DOSCRIPTLINKS) {
- BPY_do_all_scripts(SCRIPT_RENDER);
- G.f &= ~G_DOSCRIPTLINKS; /* avoid FRAMECHANGED events*/
- slink_flag = 1;
- }
+ if (G.f & G_DOSCRIPTLINKS)
+ BPY_do_all_scripts(SCRIPT_RENDER, 0);
tstate = PyEval_SaveThread();
- RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra);
+ RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra, G.scene->frame_step);
- if (slink_flag) {
- G.f |= G_DOSCRIPTLINKS;
- BPY_do_all_scripts(SCRIPT_POSTRENDER);
- }
+ BPY_do_all_scripts(SCRIPT_POSTRENDER, 0);
G.scene->r.efra = end_frame;
}
"start frame must be less or equal to end frame");
if (G.f & G_DOSCRIPTLINKS)
- BPY_do_all_scripts(SCRIPT_RENDER);
+ BPY_do_all_scripts(SCRIPT_RENDER, 1);
tstate = PyEval_SaveThread();
- RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra);
+ RE_BlenderAnim(re, G.scene, G.scene->r.sfra, G.scene->r.efra, G.scene->frame_step);
if (G.f & G_DOSCRIPTLINKS)
- BPY_do_all_scripts(SCRIPT_POSTRENDER);
+ BPY_do_all_scripts(SCRIPT_POSTRENDER, 1);
}
PyEval_RestoreThread(tstate);
/* only RE_NewRender() needed, main Blender render calls */
void RE_BlenderFrame(struct Render *re, struct Scene *scene, int frame);
-void RE_BlenderAnim(struct Render *re, struct Scene *scene, int sfra, int efra);
+void RE_BlenderAnim(struct Render *re, struct Scene *scene, int sfra, int efra, int tfra);
void RE_ReadRenderResult(struct Scene *scene, struct Scene *scenode);
void RE_WriteRenderResult(RenderResult *rr, char *filename, int compress);
short type;
int mode;
float r, g, b, k;
+ float shdwr, shdwg, shdwb;
float energy, haint;
int lay;
float spotsi,spotbl;
void do_halo_tex(struct HaloRen *har, float xn, float yn, float *colf);
void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, float *blend, int skyflag);
void do_material_tex(struct ShadeInput *shi);
-void do_lamp_tex(LampRen *la, float *lavec, struct ShadeInput *shi, float *colf);
+void do_lamp_tex(LampRen *la, float *lavec, struct ShadeInput *shi, float *colf, int effect);
void init_render_textures(Render *re);
lar->r= lar->energy*la->r;
lar->g= lar->energy*la->g;
lar->b= lar->energy*la->b;
+ lar->shdwr= la->shdwr;
+ lar->shdwg= la->shdwg;
+ lar->shdwb= la->shdwb;
lar->k= la->k;
// area
for(c=0; c<MAX_MTEX; c++) {
if(la->mtex[c] && la->mtex[c]->tex) {
- lar->mode |= LA_TEXTURE;
+ if (la->mtex[c]->mapto & LAMAP_COL)
+ lar->mode |= LA_TEXTURE;
+ if (la->mtex[c]->mapto & LAMAP_SHAD)
+ lar->mode |= LA_SHAD_TEX;
if(G.rendering) {
if(re->osa) {
#include "DNA_scene_types.h"
#include "DNA_userdef_types.h"
+#include "BKE_utildefines.h"
#include "BKE_global.h"
#include "BKE_image.h"
#include "BKE_main.h"
}
}
-#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.0f*val))
/* caller is responsible for allocating rect in correct size! */
void RE_ResultGet32(Render *re, unsigned int *rect)
{
}
/* saves images to disk */
-void RE_BlenderAnim(Render *re, Scene *scene, int sfra, int efra)
+void RE_BlenderAnim(Render *re, Scene *scene, int sfra, int efra, int tfra)
{
bMovieHandle *mh= BKE_get_movie_handle(scene->r.imtype);
+ unsigned int lay;
int cfrao= scene->r.cfra;
+ int nfra;
/* do not fully call for each frame, it initializes & pops output window */
if(!render_initialize_from_scene(re, scene, 0))
}
}
} else {
- for(scene->r.cfra= sfra; scene->r.cfra<=efra; scene->r.cfra++) {
+ for(nfra= sfra, scene->r.cfra= sfra; scene->r.cfra<=efra; scene->r.cfra++) {
char name[FILE_MAX];
/* only border now, todo: camera lens. (ton) */
render_initialize_from_scene(re, scene, 1);
-
+
+ if(nfra!=scene->r.cfra) {
+ /*
+ * Skip this frame, but update for physics and particles system.
+ * From convertblender.c:
+ * in localview, lamps are using normal layers, objects only local bits.
+ */
+ if(scene->lay & 0xFF000000)
+ lay= scene->lay & 0xFF000000;
+ else
+ lay= scene->lay;
+
+ scene_update_for_newframe(scene, lay);
+ continue;
+ }
+
if (scene->r.mode & (R_NO_OVERWRITE | R_TOUCH) ) {
BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype);
}
break;
}
+ nfra+= tfra;
}
}
VECCOPY(shi.co, rco);
shi.osatex= 0;
- do_lamp_tex(lar, lv, &shi, lacol);
+ do_lamp_tex(lar, lv, &shi, lacol, LA_TEXTURE);
}
if(lar->type==LA_SPOT) {
GroupObject *go;
LampRen *lar;
RenderLayer *rlpp[RE_MAX_OSA];
-
- int totsample, fullsample, sample;
- int x, y,od;
- short first_lamp;
- float *zrect;
- float *rgbrect;
- float rgb[3]={0};
- float tmp_rgb[3];
- float fac;
- float facm;
+ int totsample;
+ int x, y, od= 0;
- fac = 0.5;
- facm = 1.0 - fac;
-
totsample= get_sample_layers(pa, rl, rlpp);
- fullsample= (totsample > 1);
/* check that z pass is enabled */
if(pa->rectz==NULL) return;
if(zpass==NULL) return;
/* check for at least one sun lamp that its atmosphere flag is is enabled */
- first_lamp = 1;
for(go=R.lights.first; go; go= go->next) {
lar= go->lampren;
- if(lar->type==LA_SUN && lar->sunsky &&
- (lar->sunsky->effect_type & LA_SUN_EFFECT_AP)){
- first_lamp = 0;
+ if(lar->type==LA_SUN && lar->sunsky && (lar->sunsky->effect_type & LA_SUN_EFFECT_AP))
break;
- }
}
/* do nothign and return if there is no sun lamp */
- if(first_lamp)
+ if(go==NULL)
return;
- zrect = zpass->rect;
- rgbrect = rl->rectf;
- od=0;
- /* for each x,y and sun lamp*/
+ /* for each x,y and each sample, and each sun lamp*/
for(y=pa->disprect.ymin; y<pa->disprect.ymax; y++) {
- for(x=pa->disprect.xmin; x<pa->disprect.xmax; x++, zrect++, od++) {
+ for(x=pa->disprect.xmin; x<pa->disprect.xmax; x++, od++) {
+ int sample;
- first_lamp = 1;
- for(go=R.lights.first; go; go= go->next) {
- lar= go->lampren;
- if(lar->type==LA_SUN && lar->sunsky)
+ for(sample=0; sample<totsample; sample++) {
+ float *zrect= RE_RenderLayerGetPass(rlpp[sample], SCE_PASS_Z) + od;
+ float *rgbrect = rlpp[sample]->rectf + 4*od;
+ float rgb[3];
+ int done= 0;
+
+ for(go=R.lights.first; go; go= go->next) {
+
- {
- /* if it's sky continue and don't apply atmosphere effect on it */
- if(*zrect >= 9.9e10){
- continue;
- }
-
- if(lar->sunsky->effect_type & LA_SUN_EFFECT_AP){
- VECCOPY(tmp_rgb, (float*)(rgbrect+4*od));
-
- shadeAtmPixel(lar->sunsky, tmp_rgb, x, y, *zrect);
+ lar= go->lampren;
+ if(lar->type==LA_SUN && lar->sunsky) {
- if(first_lamp){
- VECCOPY(rgb, tmp_rgb);
- first_lamp = 0;
+ /* if it's sky continue and don't apply atmosphere effect on it */
+ if(*zrect >= 9.9e10 || rgbrect[3]==0.0f) {
+ continue;
}
- else{
- rgb[0] = facm*rgb[0] + fac*tmp_rgb[0];
- rgb[1] = facm*rgb[1] + fac*tmp_rgb[1];
- rgb[2] = facm*rgb[2] + fac*tmp_rgb[2];
+
+ if((lar->sunsky->effect_type & LA_SUN_EFFECT_AP)) {
+ float tmp_rgb[3];
+
+ VECCOPY(tmp_rgb, rgbrect);
+ if(rgbrect[3]!=1.0f) { /* de-premul */
+ float div= 1.0f/rgbrect[3];
+ VECMUL(tmp_rgb, div);
+ }
+ shadeAtmPixel(lar->sunsky, tmp_rgb, x, y, *zrect);
+ if(rgbrect[3]!=1.0f) { /* premul */
+ VECMUL(tmp_rgb, rgbrect[3]);
+ }
+
+ if(done==0) {
+ VECCOPY(rgb, tmp_rgb);
+ done = 1;
+ }
+ else{
+ rgb[0] = 0.5f*rgb[0] + 0.5f*tmp_rgb[0];
+ rgb[1] = 0.5f*rgb[1] + 0.5f*tmp_rgb[1];
+ rgb[2] = 0.5f*rgb[2] + 0.5f*tmp_rgb[2];
+ }
}
}
}
- }
- /* if at least for one sun lamp aerial perspective was applied*/
- if(first_lamp==0)
- {
- if(fullsample) {
- for(sample=0; sample<totsample; sample++) {
- VECCOPY((float*)(rlpp[sample]->rectf + od*4), rgb);
- }
- }
- else {
- VECCOPY((float*)(rgbrect+4*od), rgb);
+ /* if at least for one sun lamp aerial perspective was applied*/
+ if(done) {
+ VECCOPY(rgbrect, rgb);
}
}
}
}
}
+ /* sun/sky */
+ if(rl->layflag & SCE_LAY_SKY)
+ atm_tile(pa, rl);
+
/* sky before edge */
if(rl->layflag & SCE_LAY_SKY)
sky_tile(pa, rl);
if(R.r.mode & R_EDGE)
edge_enhance_add(pa, rl->rectf, edgerect);
- /* sun/sky */
- if(rl->layflag & SCE_LAY_SKY)
- atm_tile(pa, rl);
-
if(rl->passflag & SCE_PASS_VECTOR)
reset_sky_speed(pa, rl);
}
}
+ /* sun/sky */
+ if(rl->layflag & SCE_LAY_SKY)
+ atm_tile(pa, rl);
+
/* sky before edge */
if(rl->layflag & SCE_LAY_SKY)
sky_tile(pa, rl);
edge_enhance_add(pa, rl->rectf, edgerect);
}
- /* sun/sky */
- if(rl->layflag & SCE_LAY_SKY)
- atm_tile(pa, rl);
-
if(rl->passflag & SCE_PASS_VECTOR)
reset_sky_speed(pa, rl);
/* ************************* bake ************************ */
-#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.0f*val))
typedef struct BakeShade {
ShadeSample ssamp;
{
Material *ma= shi->mat;
VlakRen *vlr= shi->vlr;
- float lv[3], lampdist, lacol[3], shadfac[4];
+ float lv[3], lampdist, lacol[3], shadfac[4], lashdw[3];
float i, is, i_noshad, inp, *vn, *view, vnor[3], phongcorr=1.0f;
float visifac;
lacol[1]= lar->g;
lacol[2]= lar->b;
- if(lar->mode & LA_TEXTURE) do_lamp_tex(lar, lv, shi, lacol);
+ lashdw[0]= lar->shdwr;
+ lashdw[1]= lar->shdwg;
+ lashdw[2]= lar->shdwb;
+
+ if(lar->mode & LA_TEXTURE) do_lamp_tex(lar, lv, shi, lacol, LA_TEXTURE);
+ if(lar->mode & LA_SHAD_TEX) do_lamp_tex(lar, lv, shi, lashdw, LA_SHAD_TEX);
/* tangent case; calculate fake face normal, aligned with lampvector */
/* note, vnor==vn is used as tangent trigger for buffer shadow */
if((lar->mode & LA_ONLYSHADOW) && i>0.0) {
shadfac[3]= i*lar->energy*(1.0f-shadfac[3]);
- shr->shad[0] -= shadfac[3]*shi->r;
- shr->shad[1] -= shadfac[3]*shi->g;
- shr->shad[2] -= shadfac[3]*shi->b;
+ shr->shad[0] -= shadfac[3]*shi->r*(1.0f-lashdw[0]);
+ shr->shad[1] -= shadfac[3]*shi->g*(1.0f-lashdw[1]);
+ shr->shad[2] -= shadfac[3]*shi->b*(1.0f-lashdw[2]);
- shr->spec[0] -= shadfac[3]*shi->specr;
- shr->spec[1] -= shadfac[3]*shi->specg;
- shr->spec[2] -= shadfac[3]*shi->specb;
+ shr->spec[0] -= shadfac[3]*shi->specr*(1.0f-lashdw[0]);
+ shr->spec[1] -= shadfac[3]*shi->specg*(1.0f-lashdw[1]);
+ shr->spec[2] -= shadfac[3]*shi->specb*(1.0f-lashdw[2]);
return;
}
else
add_to_diffuse(shr->shad, shi, is, i*lacol[0], i*lacol[1], i*lacol[2]);
}
+ /* add light for colored shadow */
+ if (i_noshad>i && !(lashdw[0]==0 && lashdw[1]==0 && lashdw[2]==0)) {
+ add_to_diffuse(shr->shad, shi, is, lashdw[0]*(i_noshad-i)*lacol[0], lashdw[1]*(i_noshad-i)*lacol[1], lashdw[2]*(i_noshad-i)*lacol[2]);
+ }
if(i_noshad>0.0f) {
if(passflag & (SCE_PASS_DIFFUSE|SCE_PASS_SHADOW)) {
if(ma->mode & MA_SHADOW_TRA)
/* ------------------------------------------------------------------------- */
/* colf supposed to be initialized with la->r,g,b */
-void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf)
+void do_lamp_tex(LampRen *la, float *lavec, ShadeInput *shi, float *colf, int effect)
{
Object *ob;
MTex *mtex;
}
/* mapping */
- if(mtex->mapto & LAMAP_COL) {
+ if(((mtex->mapto & LAMAP_COL) && (effect & LA_TEXTURE))||((mtex->mapto & LAMAP_SHAD) && (effect & LA_SHAD_TEX))) {
float col[3];
if(rgb==0) {
# TODO buildinfo
if env['BF_BUILDINFO'] == 1:
defs.append('NAN_BUILDINFO')
-
+
+if env['BF_NO_ELBEEM'] == 1:
+ defs.append('DISABLE_ELBEEM')
+
+if env['WITH_BF_SDL'] == 0:
+ defs.append('DISABLE_SDL')
+
if (env['BF_SPLIT_SRC'] == 1) and (env['OURPLATFORM'] == 'win32-mingw'):
for i in range(numlibs):
env.BlenderLib ( libname = 'src%d' % (i), sources = subsources[i], includes = Split(incs), defines = defs, libtype=['core', 'intern'], priority = [5, 25] )
}
}
+static uiBlock *advanced_bullet_menu(void *arg_ob)
+{
+ uiBlock *block;
+ Object *ob = arg_ob;
+ short yco = 65, xco = 0;
+
+ block= uiNewBlock(&curarea->uiblocks, "advanced_bullet_options", UI_EMBOSS, UI_HELV, curarea->win);
+ /* use this for a fake extra empy space around the buttons */
+ uiDefBut(block, LABEL, 0, "", -5, -10, 255, 100, NULL, 0, 0, 0, 0, "");
+
+ uiDefButBitI(block, TOG, OB_ACTOR, 0, "Sensor actor",
+ xco, yco, 118, 19, &ob->gameflag, 0, 0, 0, 0,
+ "Objects that are detected by the Near and Radar sensor");
+
+ if (ob->gameflag & OB_DYNAMIC) {
+ uiDefButBitI(block, TOG, OB_COLLISION_RESPONSE, 0, "No sleeping",
+ xco+=120, yco, 118, 19, &ob->gameflag, 0, 0, 0, 0,
+ "Disable auto (de)activation");
+ }
+
+ yco -= 25;
+ xco = 0;
+ if (ob->gameflag & OB_DYNAMIC) {
+ if (ob->margin < 0.001f)
+ ob->margin = 0.06f;
+ uiDefButF(block, NUM, 0, "Margin",
+ xco, yco, 118, 19, &ob->margin, 0.001, 1.0, 1, 0,
+ "Collision margin");
+ } else {
+ uiDefButF(block, NUM, 0, "Margin",
+ xco, yco, 118, 19, &ob->margin, 0.0, 1.0, 1, 0,
+ "Collision margin");
+ }
+
+ uiBlockSetDirection(block, UI_TOP);
+
+ return block;
+}
+
void buttons_bullet(uiBlock *block, Object *ob)
{
uiBut *but;
/* determine the body_type setting based on flags */
if (!(ob->gameflag & OB_COLLISION))
ob->body_type = OB_BODY_TYPE_NO_COLLISION;
- else if (!(ob->gameflag & OB_DYNAMIC) || !(ob->gameflag & OB_DYNAMIC))
+ else if (!(ob->gameflag & OB_DYNAMIC))
ob->body_type = OB_BODY_TYPE_STATIC;
else if (!(ob->gameflag & (OB_RIGID_BODY|OB_SOFT_BODY)))
ob->body_type = OB_BODY_TYPE_DYNAMIC;
else
ob->body_type = OB_BODY_TYPE_SOFT;
- uiBlockBeginAlign(block);
but = uiDefButS(block, MENU, REDRAWVIEW3D,
"Object type%t|No collision%x0|Static%x1|Dynamic%x2|Rigid body%x3|Soft body%x4",
- 10, 205, 150, 19, &ob->body_type, 0, 0, 0, 0, "Selects the type of physical representation of the object");
+ 10, 205, 120, 19, &ob->body_type, 0, 0, 0, 0, "Selects the type of physical representation");
uiButSetFunc(but, check_body_type, but, ob);
if (ob->gameflag & OB_COLLISION) {
- but = uiDefButBitI(block, TOG, OB_ACTOR, B_REDR, "Actor",
- 160,205,55,19, &ob->gameflag, 0, 0, 0, 0,
- "Objects that are detected by the Near and Radar sensor");
- uiButSetFunc(but, check_actor, but, &ob->gameflag);
-
- uiDefButBitI(block, TOG, OB_GHOST, B_REDR, "Ghost", 215,205,55,19,
+
+ uiBlockSetCol(block, TH_BUT_SETTING1);
+ uiDefBlockBut(block, advanced_bullet_menu, ob,
+ "Advanced Settings",
+ 200, 205, 150, 20, "Display collision advanced settings");
+ uiBlockSetCol(block, TH_BUT_SETTING2);
+
+ uiBlockBeginAlign(block);
+ uiDefButBitI(block, TOG, OB_GHOST, 0, "Ghost", 10, 182, 60, 19,
&ob->gameflag, 0, 0, 0, 0,
"Objects that don't restitute collisions (like a ghost)");
+ if ((ob->gameflag & OB_DYNAMIC) || ((ob->gameflag & OB_BOUNDS) && (ob->boundtype == OB_BOUND_SPHERE))) {
+ uiDefButF(block, NUM, REDRAWVIEW3D, "Radius:", 70, 182, 140, 19,
+ &ob->inertia, 0.01, 10.0, 10, 2,
+ "Bounding sphere radius, not used for other bounding shapes");
+ }
if(ob->gameflag & OB_DYNAMIC) {
- uiDefButBitI(block, TOG, OB_COLLISION_RESPONSE, B_REDR, "No sleeping", 270,205,80,19,
- &ob->gameflag, 0, 0, 0, 0,
- "Disable auto (de)activation");
- uiDefButF(block, NUM, B_DIFF, "Mass:", 10, 185, 170, 19,
+ uiDefButF(block, NUM, B_DIFF, "Mass:", 210, 182, 140, 19,
&ob->mass, 0.01, 10000.0, 10, 2,
"The mass of the Object");
- uiDefButF(block, NUM, REDRAWVIEW3D, "Radius:", 180, 185, 170, 19,
- &ob->inertia, 0.01, 10.0, 10, 2,
- "Bounding sphere radius, not used for other bounding shapes");
- uiDefButF(block, NUMSLI, B_DIFF, "Damp ", 10, 165, 150, 19,
+ uiDefButF(block, NUMSLI, B_DIFF, "Damp ", 10, 162, 150, 19,
&ob->damping, 0.0, 1.0, 10, 0,
"General movement damping");
- uiDefButF(block, NUMSLI, B_DIFF, "RotDamp ", 160, 165, 190, 19,
+ uiDefButF(block, NUMSLI, B_DIFF, "RotDamp ", 160, 162, 190, 19,
&ob->rdamping, 0.0, 1.0, 10, 0,
"General rotation damping");
}
uiBlockEndAlign(block);
uiBlockBeginAlign(block);
- if ((ob->gameflag & (OB_ACTOR|OB_DYNAMIC)) == (OB_ACTOR|OB_DYNAMIC)) {
- if (ob->margin < 0.001f)
- ob->margin = 0.06f;
- uiDefButF(block, NUM, B_DIFF, "Margin", 10, 105, 105, 19,
- &ob->margin, 0.001, 1.0, 1, 0,
- "Collision margin");
- } else {
- uiDefButF(block, NUM, B_DIFF, "Margin", 10, 105, 105, 19,
- &ob->margin, 0.0, 1.0, 1, 0,
- "Collision margin");
- }
- uiDefButBitI(block, TOG, OB_BOUNDS, B_REDR, "Bounds", 115, 105, 55, 19,
- &ob->gameflag, 0, 0,0, 0,
+ uiDefButBitI(block, TOG, OB_BOUNDS, B_REDR, "Bounds", 10, 105, 80, 19,
+ &ob->gameflag, 0, 0, 0, 0,
"Specify a bounds object for physics");
if (ob->gameflag & OB_BOUNDS) {
uiDefButS(block, MENU, REDRAWVIEW3D, "Boundary Display%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Convex Hull%x5|Static Mesh%x4",
//almost ready to enable this one: uiDefButS(block, MENU, REDRAWVIEW3D, "Boundary Display%t|Box%x0|Sphere%x1|Cylinder%x2|Cone%x3|Convex Hull Polytope%x5|Static TriangleMesh %x4|Dynamic Mesh %x5|",
- 170, 105, 105, 19, &ob->boundtype, 0, 0, 0, 0, "Selects the collision type");
- uiDefButBitI(block, TOG, OB_CHILD, B_REDR, "Compound", 275,105,75,19,
+ 90, 105, 150, 19, &ob->boundtype, 0, 0, 0, 0, "Selects the collision type");
+ uiDefButBitI(block, TOG, OB_CHILD, B_REDR, "Compound", 240,105,110,19,
&ob->gameflag, 0, 0, 0, 0,
"Add Children");
}
uiBlockEndAlign(block);
uiBlockSetCol(block, TH_AUTO);
- uiDefBut(block, BUT,B_PLAYANIM, "PLAY",692,40,94,33, 0, 0, 0, 0, 0, "Play rendered images/avi animation (Ctrl+F11), (Play Hotkeys: A-Noskip, P-PingPong)");
- uiDefButS(block, NUM, B_RTCHANGED, "rt:",789,40,95,33, &G.rt, -1000.0, 1000.0, 0, 0, "General testing/debug button");
+ uiDefBut(block, BUT,B_PLAYANIM, "PLAY",692,50,94,33, 0, 0, 0, 0, 0, "Play rendered images/avi animation (Ctrl+F11), (Play Hotkeys: A-Noskip, P-PingPong)");
+ uiDefButS(block, NUM, B_RTCHANGED, "rt:",789,50,95,33, &G.rt, -1000.0, 1000.0, 0, 0, "General testing/debug button");
uiBlockBeginAlign(block);
- uiDefButI(block, NUM,REDRAWSEQ,"Sta:",692,10,94,24, &G.scene->r.sfra,1.0,MAXFRAMEF, 0, 0, "The start frame of the animation (inclusive)");
- uiDefButI(block, NUM,REDRAWSEQ,"End:",789,10,95,24, &G.scene->r.efra,SFRA,MAXFRAMEF, 0, 0, "The end frame of the animation (inclusive)");
+ uiDefButI(block, NUM,REDRAWSEQ,"Sta:",692,20,94,24, &G.scene->r.sfra,1.0,MAXFRAMEF, 0, 0, "The start frame of the animation (inclusive)");
+ uiDefButI(block, NUM,REDRAWSEQ,"End:",789,20,95,24, &G.scene->r.efra,SFRA,MAXFRAMEF, 0, 0, "The end frame of the animation (inclusive)");
+ uiDefButI(block, NUM,REDRAWSEQ,"Step:",692,0,192,18, &G.scene->frame_step, 1.0, MAXFRAMEF, 0, 0, "Frame Step");
uiBlockEndAlign(block);
}
uiDefButF(block, NUMSLI, B_LAMPPRV, "DVar ", 10,10,135,19, &(mtex->def_var), 0.0, 1.0, 0, 0, "Value to use for Ref, Spec, Amb, Emit, Alpha, RayMir, TransLu and Hard");
/* MAP TO */
- uiDefButBitS(block, TOG, MAP_COL, B_LAMPPRV, "Col", 10,180,135,19, &(mtex->mapto), 0, 0, 0, 0, "Lets the texture affect the basic color of the lamp");
+ uiBlockBeginAlign(block);
+ uiDefButBitS(block, TOG, LAMAP_COL, B_LAMPPRV, "Col", 10,180,135,19, &(mtex->mapto), 0, 0, 0, 0, "Lets the texture affect the basic color of the lamp");
+ uiDefButBitS(block, TOG, LAMAP_SHAD, B_LAMPPRV, "Shadow", 146,180,135,19, &(mtex->mapto), 0, 0, 0, 0, "Lets the texture affect the shadow color of the lamp");
+ uiBlockEndAlign(block);
uiBlockBeginAlign(block);
uiDefButS(block, MENU, B_LAMPPRV, mapto_blendtype_pup(),155,125,155,19, &(mtex->blendtype), 0, 0, 0, 0, "Texture blending mode");
uiDefButBitI(block, TOG, LA_LAYER_SHADOW, B_LAMPPRV,"Layer", 10,90,80,19,&la->mode, 0, 0, 0, 0, "Causes only objects on the same layer to cast shadows");
uiBlockEndAlign(block);
+ if(ELEM4(la->type, LA_AREA, LA_SPOT, LA_SUN, LA_LOCAL) && ((la->mode & LA_SHAD_RAY)||(la->mode & LA_SHAD_BUF))) {
+ uiBlockBeginAlign(block);
+ uiDefButF(block, COL, 0, "Shadow ", 10,90,80,19,&la->shdwr, 0, 0, 0, B_COLLAMP, "Sets the shadow color; default is black (RGB 0,0,0)");
+ uiBlockEndAlign(block);
+ }
+
if(la->type==LA_SPOT) {
uiBlockBeginAlign(block);
uiDefButBitI(block, TOG, LA_SQUARE, B_LAMPREDRAW,"Square", 10,60,80,19,&la->mode, 0, 0, 0, 0, "Sets square spotbundles");
glVertex2fv(fp+3); glVertex2fv(fp+6);
glEnd();
}
- else if( (bezt->f1 & 1)==sel) {
+ else if( (bezt->f1 & SELECT)==sel) {
fp= bezt->vec[0];
cpack(col[bezt->h1]);
MFace *mf, *mface= me->mface;
MTFace *tface= me->mtface;
MCol *mcol= me->mcol; /* why does mcol exist? */
- bProperty *prop = get_property(ob, "Text");
+ bProperty *prop = get_ob_property(ob, "Text");
GPUVertexAttribs gattribs;
int a, totface= me->totface;
dm->drawFacesTex(dm, draw_tface__set_draw);
/* draw game engine text hack */
- if(get_property(ob, "Text"))
+ if(get_ob_property(ob, "Text"))
draw_mesh_text(ob, 0);
draw_textured_end();
glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
dm->drawFacesGLSL(dm, GPU_enable_material);
- if(get_property(ob, "Text"))
+ if(get_ob_property(ob, "Text"))
draw_mesh_text(ob, 1);
GPU_disable_material();
}
if(dt<OB_SHADED) {
- if((ob->gameflag & OB_ACTOR) && (ob->gameflag & OB_DYNAMIC)) {
+ if(/*(ob->gameflag & OB_ACTOR) &&*/ (ob->gameflag & OB_DYNAMIC)) {
float tmat[4][4], imat[4][4], vec[3];
vec[0]= vec[1]= vec[2]= 0.0;
/* run any view3d draw handler script links */
if (sa->scriptlink.totscript)
- BPY_do_spacehandlers(sa, 0, SPACEHANDLER_VIEW3D_DRAW);
+ BPY_do_spacehandlers(sa, 0, 0, SPACEHANDLER_VIEW3D_DRAW);
/* run scene redraw script links */
if((G.f & G_DOSCRIPTLINKS) && G.scene->scriptlink.totscript &&
/* from selected channels */
for (ale= act_data.first; ale; ale= ale->next) {
- Ipo *ipo_src=NULL, *ipo_dst=ale->key_data;
+ Ipo *ipo_src=NULL;
bActionChannel *achan;
IpoCurve *ico, *icu;
BezTriple *bezt;
}
/* this shouldn't happen, but it might */
- if (ELEM(NULL, ipo_src, ipo_dst))
+ if (ipo_src == NULL)
continue;
/* loop over curves, pasting keyframes */
for (ico= ipo_src->curve.first; ico; ico= ico->next) {
- icu= verify_ipocurve((ID*)ob, ico->blocktype, actname, conname, "", ico->adrcode, 1);
+ icu= verify_ipocurve((ID*)ob, ico->blocktype, actname, conname, NULL, ico->adrcode, 1);
if (icu) {
/* just start pasting, with the the first keyframe on the current frame, and so on */
{
char str[30];
- if (bp && (bp->f1&1)) {
+ if (bp && (bp->f1 & SELECT)) {
sprintf(str,"%2.2f", bp->vec[3]);
cpack(0x737373);
if((nu->type & 7)==CU_BEZIER) {
/* which bezpoint? */
if(bezt== nu->bezt) { /* first */
- bezt->f1= bezt->f2= bezt->f3= 0;
+ BEZ_DESEL(bezt);
newbezt =
(BezTriple*)MEM_callocN((nu->pntsu+1) * sizeof(BezTriple), "addvert_Nurb");
memcpy(newbezt+1, bezt, nu->pntsu*sizeof(BezTriple));
*newbezt= *bezt;
- newbezt->f1= newbezt->f2= newbezt->f3= SELECT;
+ BEZ_SEL(newbezt);
if(newbezt->h1 >= 0) newbezt->h2= newbezt->h1;
else newbezt->h2= newbezt->h1= HD_ALIGN; /* does this ever happen? */
VECCOPY(temp, bezt->vec[1]);
bezt= newbezt+1;
}
else if(bezt== (nu->bezt+nu->pntsu-1)) { /* last */
- bezt->f1= bezt->f2= bezt->f3= 0;
+ BEZ_DESEL(bezt);
newbezt =
(BezTriple*)MEM_callocN((nu->pntsu+1) * sizeof(BezTriple), "addvert_Nurb");
memcpy(newbezt, nu->bezt, nu->pntsu*sizeof(BezTriple));
MEM_freeN(nu->bezt);
nu->bezt= newbezt;
newbezt+= nu->pntsu;
- newbezt->f1= newbezt->f2= newbezt->f3= SELECT;
+ BEZ_SEL(newbezt);
if(newbezt->h1 >= 0) newbezt->h2= newbezt->h1;
else newbezt->h2= newbezt->h1= HD_ALIGN; /* does this ever happen? */
bezt= nu->bezt+nu->pntsu-1;
for(a=0; a<G.sipo->totipo; a++) {
if(ik->data[a]) {
if(ik->flag & 1) {
- ik->data[a]->f1 |= SELECT;
- ik->data[a]->f2 |= SELECT;
- ik->data[a]->f3 |= SELECT;
+ BEZ_SEL(ik->data[a]);
}
else {
- ik->data[a]->f1 &= ~SELECT;
- ik->data[a]->f2 &= ~SELECT;
- ik->data[a]->f3 &= ~SELECT;
+ BEZ_DESEL(ik->data[a]);
}
}
}
if(ei->disptype!=IPO_DISPBITS && ei->icu->ipo==IPO_BEZ) {
/* middle points get an advantage */
temp= -3+abs(mval[0]- sco[0][0])+ abs(mval[1]- sco[0][1]);
- if( bezt1->f1 & 1) temp+=5;
+ if( bezt1->f1 & SELECT) temp+=5;
if(temp<dist) {
hpoint= 0;
*bezt= bezt1;
if(bezt) {
if(hand==1) {
if(BEZSELECTED(bezt)) {
- bezt->f1= bezt->f2= bezt->f3= 0;
+ BEZ_DESEL(bezt);
}
else {
- bezt->f1= bezt->f2= bezt->f3= SELECT;
+ BEZ_SEL(bezt);
}
}
else if(hand==0) {
- if(bezt->f1 & SELECT) bezt->f1= 0;
+ if(bezt->f1 & SELECT) bezt->f1 &= ~SELECT;
else bezt->f1= SELECT;
}
else {
- if(bezt->f3 & SELECT) bezt->f3= 0;
+ if(bezt->f3 & SELECT) bezt->f3 &= ~SELECT;
else bezt->f3= SELECT;
}
}
if(bezt) {
if(hand==1) {
- bezt->f1|= SELECT; bezt->f2|= SELECT; bezt->f3|= SELECT;
+ BEZ_SEL(bezt);
}
else if(hand==0) bezt->f1 |= SELECT;
else bezt->f3 |= SELECT;
while(b--) {
*beztn= *bezt;
if(bezt->f2 & SELECT) {
- beztn->f1= beztn->f2= beztn->f3= 0;
+ BEZ_DESEL(beztn);
beztn++;
*beztn= *bezt;
}
if(ik->data[a]) {
bezt= ik->data[a];
if(sel) {
- bezt->f1 |= SELECT;
- bezt->f2 |= SELECT;
- bezt->f3 |= SELECT;
+ BEZ_SEL(bezt);
}
else {
- bezt->f1 &= ~SELECT;
- bezt->f2 &= ~SELECT;
- bezt->f3 &= ~SELECT;
+ BEZ_DESEL(bezt);
}
}
}
icu= icu->next;
}
-
- ik= lb->first;
- while(ik) {
- /* map ipo-keys for drawing/editing if scaled ipo */
- if (NLA_IPO_SCALED) {
+ if (NLA_IPO_SCALED) {
+ for (ik= lb->first; ik; ik= ik->next) {
+ /* map ipo-keys for drawing/editing if scaled ipo */
ik->val= get_action_frame_inv(OBACT, ik->val);
}
-
- ik= ik->next;
}
}
for (icu=ipo->curve.first; icu; icu=icu->next){
for (i=0; i<icu->totvert; i++){
/* If a key is selected */
- if (icu->bezt[i].f2 & 1){
+ if (icu->bezt[i].f2 & SELECT){
/* Expand the list */
newbezt = MEM_callocN(sizeof(BezTriple) * (icu->totvert+1), "beztriple");
memcpy (newbezt, icu->bezt, sizeof(BezTriple) * (i+1));
MEM_freeN (icu->bezt);
icu->bezt=newbezt;
/* Unselect the current key*/
- icu->bezt[i].f1 &= ~ 1;
- icu->bezt[i].f2 &= ~ 1;
- icu->bezt[i].f3 &= ~ 1;
+ BEZ_DESEL(&icu->bezt[i]);
i++;
/* Select the copied key */
- icu->bezt[i].f1 |= 1;
- icu->bezt[i].f2 |= 1;
- icu->bezt[i].f3 |= 1;
-
+ BEZ_SEL(&icu->bezt[i]);
}
}
}
b= ei->icu->totvert;
while(b--) {
if(totipo_vertsel) {
- bezt->f1= bezt->f2= bezt->f3= 0;
+ BEZ_DESEL(bezt);
}
else {
- bezt->f1= bezt->f2= bezt->f3= SELECT;
+ BEZ_SEL(bezt);
}
bezt++;
}
bezt= ei->icu->bezt;
b= ei->icu->totvert;
while(b--) {
- bezt->f1= bezt->f2= bezt->f3= 0;
+ BEZ_SEL(bezt);
bezt++;
}
}
int select_bezier_add(BezTriple *bezt)
{
/* Select the bezier triple */
- bezt->f1 |= SELECT;
- bezt->f2 |= SELECT;
- bezt->f3 |= SELECT;
+ BEZ_SEL(bezt);
return 0;
}
int select_bezier_subtract(BezTriple *bezt)
{
/* Deselect the bezier triple */
- bezt->f1 &= ~SELECT;
- bezt->f2 &= ~SELECT;
- bezt->f3 &= ~SELECT;
+ BEZ_DESEL(bezt);
return 0;
}
/* is a handle selected? If so
* set it to type auto
*/
- if(bezt->f1 || bezt->f3) {
- if(bezt->f1) bezt->h1= 1; /* the secret code for auto */
- if(bezt->f3) bezt->h2= 1;
+ if((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) {
+ if(bezt->f1 & SELECT) bezt->h1= 1; /* the secret code for auto */
+ if(bezt->f3 & SELECT) bezt->h2= 1;
/* if the handles are not of the same type, set them
* to type free
/* is a handle selected? If so
* set it to type vector
*/
- if(bezt->f1 || bezt->f3) {
- if(bezt->f1) bezt->h1= 2; /* the code for vector */
- if(bezt->f3) bezt->h2= 2;
+ if((bezt->f1 & SELECT) || (bezt->f3 & SELECT)) {
+ if(bezt->f1 & SELECT) bezt->h1= 2; /* the code for vector */
+ if(bezt->f3 & SELECT) bezt->h2= 2;
/* if the handles are not of the same type, set them
* to type free
/* queries whether the handle should be set
* to type 'free' (I think)
*/
- if(bezt->f1 && bezt->h1) return 1;
- if(bezt->f3 && bezt->h2) return 1;
+ if((bezt->f1 & SELECT) && bezt->h1) return 1;
+ if((bezt->f3 & SELECT) && bezt->h2) return 1;
return 0;
}
{
/* Sets selected bezier handles to type 'free'
*/
- if(bezt->f1) bezt->h1= HD_FREE;
- if(bezt->f3) bezt->h2= HD_FREE;
+ if(bezt->f1 & SELECT) bezt->h1= HD_FREE;
+ if(bezt->f3 & SELECT) bezt->h2= HD_FREE;
return 0;
}
{
/* Sets selected bezier handles to type 'align'
*/
- if(bezt->f1) bezt->h1= HD_ALIGN;
- if(bezt->f3) bezt->h2= HD_ALIGN;
+ if(bezt->f1 & SELECT) bezt->h1= HD_ALIGN;
+ if(bezt->f3 & SELECT) bezt->h2= HD_ALIGN;
return 0;
}
select_proj_ipo(&rectf, val);
}
else {
+ int selflag= (val==LEFTMOUSE) ? SELECT : 0;
ei= G.sipo->editipo;
for(a=0; a<G.sipo->totipo; a++, ei++) {
b= ei->icu->totvert;
bezt= ei->icu->bezt;
while(b--) {
- int bit= (val==LEFTMOUSE);
-
if(BLI_in_rctf(&rectf, bezt->vec[0][0], bezt->vec[0][1]))
- bezt->f1 = (bezt->f1&~SELECT) | bit;
+ bezt->f1 = selflag ? (bezt->f1 | SELECT) : (bezt->f1 & ~SELECT);
if(BLI_in_rctf(&rectf, bezt->vec[1][0], bezt->vec[1][1]))
- bezt->f2 = (bezt->f2&~SELECT) | bit;
+ bezt->f2 = selflag ? (bezt->f2 | SELECT) : (bezt->f2 & ~SELECT);
if(BLI_in_rctf(&rectf, bezt->vec[2][0], bezt->vec[2][1]))
- bezt->f3 = (bezt->f3&~SELECT) | bit;
+ bezt->f3 = selflag ? (bezt->f3 | SELECT) : (bezt->f3 & ~SELECT);
bezt++;
}
for (icu=ipo->curve.first; icu; icu=icu->next){
for (i=0; i<icu->totvert; i++){
if (sel == 2) {
- icu->bezt[i].f1^=1;
- icu->bezt[i].f2^=1;
- icu->bezt[i].f3^=1;
+ BEZ_INVSEL(&icu->bezt[i]);
}
else if (sel == 1){
- icu->bezt[i].f1|=1;
- icu->bezt[i].f2|=1;
- icu->bezt[i].f3|=1;
+ BEZ_SEL(&icu->bezt[i]);
}
else{
- icu->bezt[i].f1&=~1;
- icu->bezt[i].f2&=~1;
- icu->bezt[i].f3&=~1;
+ BEZ_DESEL(&icu->bezt[i]);
}
}
}
for (icu=ipo->curve.first; icu; icu=icu->next) {
for (i=0; i<icu->totvert; i++){
- if (icu->bezt[i].f2 & 1){
+ if (icu->bezt[i].f2 & SELECT){
tvtot+=3;
- icu->bezt[i].f1 |= 1;
- icu->bezt[i].f3 |= 1;
+ icu->bezt[i].f1 |= SELECT;
+ icu->bezt[i].f3 |= SELECT;
}
}
}
glDrawBuffer(GL_FRONT);
headerprint("(LMB) draw, (MMB) constrain to x/y screen axis, (Enter) cut (with Ctrl to select cut line), (Esc) cancel");
}
+ bglFlush();
persp(PERSP_WIN);
if ((i>1)&&(i!=lasti)) { /*Draw recorded part of curve */
sdrawline((int)curve[i-2].x, (int)curve[i-2].y, (int)curve[i-1].x, (int)curve[i-1].y);
- glFlush();
+ bglFlush();
}
if ((i==lasti)&&(i>0)) { /*Draw rubberband */
glLineWidth(2.0);
sdrawXORline((int)curve[i-1].x, (int)curve[i-1].y,(int)mval[0], (int)mval[1]);
glLineWidth(1.0);
- glFlush();
+ bglFlush();
rubberband=1;
}
lasti=i;
static void copymenu_properties(Object *ob)
{
- bProperty *prop, *propn, *propc;
+ bProperty *prop;
Base *base;
int nr, tot=0;
char *str;
return;
}
- str= MEM_callocN(24+32*tot, "copymenu prop");
+ str= MEM_callocN(50 + 33*tot, "copymenu prop");
- strcpy(str, "Copy Property %t");
+ strcpy(str, "Copy Property %t|Replace All|Merge All|%l");
tot= 0;
prop= ob->prop.first;
while(prop) {
tot++;
- strcat(str, " |");
+ strcat(str, "|");
strcat(str, prop->name);
prop= prop->next;
}
nr= pupmenu(str);
- if(nr>0) {
- tot= 0;
- prop= ob->prop.first;
- while(prop) {
- tot++;
- if(tot==nr) break;
- prop= prop->next;
+
+ if ( nr==1 || nr==2 ) {
+ base= FIRSTBASE;
+ while(base) {
+ if((base != BASACT) && TESTBASELIB(base)) {
+ if (nr==1) { /* replace */
+ copy_properties( &base->object->prop, &ob->prop );
+ } else {
+ for(prop = ob->prop.first; prop; prop= prop->next ) {
+ set_ob_property(base->object, prop);
+ }
+ }
+ }
+ base= base->next;
}
+ } else if(nr>0) {
+ prop = BLI_findlink(&ob->prop, nr-4); /* account for first 3 menu items & menu index starting at 1*/
+
if(prop) {
- propc= prop;
-
- base= FIRSTBASE;
- while(base) {
- if(base != BASACT) {
- if(TESTBASELIB(base)) {
- prop= get_property(base->object, propc->name);
- if(prop) {
- free_property(prop);
- BLI_remlink(&base->object->prop, prop);
- }
- propn= copy_property(propc);
- BLI_addtail(&base->object->prop, propn);
- }
+ for(base= FIRSTBASE; base; base= base->next) {
+ if((base != BASACT) && TESTBASELIB(base)) {
+ set_ob_property(base->object, prop);
}
- base= base->next;
}
}
}
else if(event==30) { /* index object */
base->object->index= ob->index;
}
+ else if(event==31) { /* object color */
+ QUATCOPY(base->object->col, ob->col);
+ }
}
}
base= base->next;
* view3d_edit_object_copyattrmenu() and in toolbox.c
*/
- strcpy(str, "Copy Attributes %t|Location%x1|Rotation%x2|Size%x3|Draw Options%x4|Time Offset%x5|Dupli%x6|%l|Mass%x7|Damping%x8|All Physical Attributes%x11|Properties%x9|Logic Bricks%x10|Protected Transform%x29|%l");
+ strcpy(str, "Copy Attributes %t|Location%x1|Rotation%x2|Size%x3|Draw Options%x4|Time Offset%x5|Dupli%x6|Object Color%x31|%l|Mass%x7|Damping%x8|All Physical Attributes%x11|Properties%x9|Logic Bricks%x10|Protected Transform%x29|%l");
strcat (str, "|Object Constraints%x22");
strcat (str, "|NLA Strips%x26");
}
}
+void select_single_seq(Sequence *seq, int deselect_all)
+{
+ if(deselect_all)
+ deselect_all_seq();
+ set_last_seq(seq);
+
+ if((seq->type==SEQ_IMAGE) || (seq->type==SEQ_MOVIE)) {
+ if(seq->strip)
+ strncpy(last_imagename, seq->strip->dir, FILE_MAXDIR-1);
+ }
+ else if((seq->type==SEQ_HD_SOUND) || (seq->type==SEQ_RAM_SOUND)) {
+ if(seq->strip)
+ strncpy(last_sounddir, seq->strip->dir, FILE_MAXDIR-1);
+ }
+ seq->flag|= SELECT;
+ recurs_sel_seq(seq);
+}
+
void swap_select_seq(void)
{
Sequence *seq;
}
force_draw_plus(SPACE_BUTS, 0);
- if(get_last_seq()) allqueue(REDRAWIPO, 0);
+ if(get_last_seq()) {
+ allqueue(REDRAWIPO, 0);
+ allqueue(REDRAWOOPS, 0);
+ }
+
BIF_undo_push("Select Strips, Sequencer");
std_rmouse_transform(transform_seq_nomarker);
BIF_undo_push("Delete Strip(s), Sequencer");
allqueue(REDRAWSEQ, 0);
+ allqueue(REDRAWOOPS, 0);
}
static Sequence *dupli_seq(Sequence *seq)
BIF_undo_push("Un-Make Meta Strip, Sequencer");
allqueue(REDRAWSEQ, 0);
-
+ allqueue(REDRAWOOPS, 0);
}
void exit_meta(void)
MEM_freeN(ms);
allqueue(REDRAWSEQ, 0);
+ allqueue(REDRAWOOPS, 0);
BIF_undo_push("Exit Meta Strip, Sequence");
}
set_last_seq(NULL);
allqueue(REDRAWSEQ, 0);
+ allqueue(REDRAWOOPS, 0);
BIF_undo_push("Enter Meta Strip, Sequence");
}
return texid;
}
-#define FTOCHAR(val) val<=0.0f?0: (val>=1.0f?255: (char)(255.0f*val))
void glaDrawPixelsTex(float x, float y, int img_w, int img_h, int format, void *rect)
{
float *f_rect;
else {
if(G.main->library.first)
#ifdef WITH_VERSE
- uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Verse Servers %x9|Verse Sessions %x8|Libraries %x7|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, "");
+ uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Verse Servers %x9|Verse Sessions %x8|Libraries %x7|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4|Sequence %x10", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, "");
#else
- uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Libraries %x7|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, "");
+ uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Libraries %x7|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4|Sequence %x10", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, "");
#endif /* WITH_VERSE */
else
#ifdef WITH_VERSE
- uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Verse Servers %x9|Verse Sessions %x8|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, "");
+ uiDefButS(block, MENU, B_REDR, "Outliner Display%t|Verse Servers %x9|Verse Sessions %x8|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4|Sequence %x10", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, "");
#else
- uiDefButS(block, MENU, B_REDR, "Outliner Display%t|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, "");
+ uiDefButS(block, MENU, B_REDR, "Outliner Display%t|All Scenes %x0|Current Scene %x1|Visible Layers %x2|Groups %x6|Same Types %x5|Selected %x3|Active %x4|Sequence %x10", xco, 0, 100, 20, &soops->outlinevis, 0, 0, 0, 0, "");
#endif /* WITH_VERSE */
}
case 7: /* Objects in Same Group */
case 8: /* Object Hooks*/
case 9: /* Object PassIndex*/
+ case 10: /* Object Color*/
+ case 11: /* Game Properties*/
select_object_grouped((short)event);
break;
}
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Objects on Shared Layers|Shift G, 6", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 6, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Objects in Same Group|Shift G, 7", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 7, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object Hooks|Shift G, 8", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 8, "");
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object PassIndex|Shift G, 9", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object PassIndex|Shift G, 9", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 9, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object Color|Shift G, 0", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 10, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Game Properties|Shift G, Alt+1", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 11, "");
uiBlockSetDirection(block, UI_RIGHT);
uiTextBoundsBlock(block, 60);
#include "DNA_texture_types.h"
#include "DNA_text_types.h"
#include "DNA_world_types.h"
+#include "DNA_sequence_types.h"
#include "BLI_blenlib.h"
+#include "IMB_imbuf_types.h"
+
#include "BKE_constraint.h"
#include "BKE_deform.h"
#include "BKE_depsgraph.h"
#include "BIF_screen.h"
#include "BIF_space.h"
#include "BIF_toolbox.h"
+#include "BIF_editseq.h"
#ifdef WITH_VERSE
#include "BIF_verse.h"
while(te) {
tselem= TREESTORE(te);
- if(te->idcode==idcode && tselem->type==0) return tselem->id;
+ if(tselem->type==0 && te->idcode==idcode) return tselem->id;
te= te->parent;
}
return NULL;
te->parent= parent;
te->index= index; // for data arays
- te->name= id->name+2; // default, can be overridden by Library or non-ID data
- te->idcode= GS(id->name);
+ if((type!=TSE_SEQUENCE) && (type != TSE_SEQ_STRIP) && (type != TSE_SEQUENCE_DUP)) {
+ te->name= id->name+2; // default, can be overridden by Library or non-ID data
+ te->idcode= GS(id->name);
+ }
if(type==0) {
break;
}
}
+ else if(type==TSE_SEQUENCE) {
+ Sequence *seq= (Sequence*) idv;
+ Sequence *p;
+
+ /*
+ * The idcode is a little hack, but the outliner
+ * only check te->idcode if te->type is equal to zero,
+ * so this is "safe".
+ */
+ te->idcode= seq->type;
+ te->directdata= seq;
+
+ if(seq->type<7) {
+ /*
+ * This work like the sequence.
+ * If the sequence have a name (not default name)
+ * show it, in other case put the filename.
+ */
+ if(strcmp(seq->name, "SQ"))
+ te->name= seq->name;
+ else {
+ if((seq->strip) && (seq->strip->stripdata))
+ te->name= seq->strip->stripdata->name;
+ else if((seq->strip) && (seq->strip->tstripdata) && (seq->strip->tstripdata->ibuf))
+ te->name= seq->strip->tstripdata->ibuf->name;
+ else
+ te->name= "SQ None";
+ }
+
+ if(seq->type==SEQ_META) {
+ te->name= "Meta Strip";
+ p= seq->seqbase.first;
+ while(p) {
+ outliner_add_element(soops, &te->subtree, (void*)p, te, TSE_SEQUENCE, index);
+ p= p->next;
+ }
+ }
+ else
+ outliner_add_element(soops, &te->subtree, (void*)seq->strip, te, TSE_SEQ_STRIP, index);
+ }
+ else
+ te->name= "Effect";
+ }
+ else if(type==TSE_SEQ_STRIP) {
+ Strip *strip= (Strip *)idv;
+
+ if(strip->dir)
+ te->name= strip->dir;
+ else
+ te->name= "Strip None";
+ te->directdata= strip;
+ }
+ else if(type==TSE_SEQUENCE_DUP) {
+ Sequence *seq= (Sequence*)idv;
+
+ te->idcode= seq->type;
+ te->directdata= seq;
+ te->name= seq->strip->stripdata->name;
+ }
#ifdef WITH_VERSE
else if(type==ID_VS) {
struct VerseSession *session = (VerseSession*)idv;
}
}
+/* Helped function to put duplicate sequence in the same tree. */
+int need_add_seq_dup(Sequence *seq)
+{
+ Sequence *p;
+
+ if((!seq->strip) || (!seq->strip->stripdata) || (!seq->strip->stripdata->name))
+ return(1);
+
+ /*
+ * First check backward, if we found a duplicate
+ * sequence before this, don't need it, just return.
+ */
+ p= seq->prev;
+ while(p) {
+ if((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) {
+ p= p->prev;
+ continue;
+ }
+
+ if(!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name))
+ return(2);
+ p= p->prev;
+ }
+
+ p= seq->next;
+ while(p) {
+ if((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) {
+ p= p->next;
+ continue;
+ }
+
+ if(!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name))
+ return(0);
+ p= p->next;
+ }
+ return(1);
+}
+
+void add_seq_dup(SpaceOops *soops, Sequence *seq, TreeElement *te, short index)
+{
+ TreeElement *ch;
+ Sequence *p;
+
+ p= seq;
+ while(p) {
+ if((!p->strip) || (!p->strip->stripdata) || (!p->strip->stripdata->name)) {
+ p= p->next;
+ continue;
+ }
+
+ if(!strcmp(p->strip->stripdata->name, seq->strip->stripdata->name))
+ ch= outliner_add_element(soops, &te->subtree, (void*)p, te, TSE_SEQUENCE, index);
+ p= p->next;
+ }
+}
+
static void outliner_build_tree(SpaceOops *soops)
{
Base *base;
}
}
#endif
+ else if(soops->outlinevis==SO_SEQUENCE) {
+ Sequence *seq;
+ Editing *ed;
+ int op;
+
+ ed= G.scene->ed;
+ if(!ed)
+ retu