--- blender/source/blender/python/api2_2x/sceneSequence.c 2008-06-29 12:40:00.000000000 +0200 +++ blender/source/blender/python/api2_2x/sceneSequence.c 2008-07-07 02:58:48.000000000 +0200 @@ -81,6 +81,7 @@ static PyObject *Sequence_copy( BPy_Sequence * self ); static PyObject *Sequence_new( BPy_Sequence * self, PyObject * args ); static PyObject *Sequence_remove( BPy_Sequence * self, PyObject * args ); +static PyObject *Sequence_rebuildProxy( BPy_Sequence * self ); static PyObject *SceneSeq_new( BPy_SceneSeq * self, PyObject * args ); static PyObject *SceneSeq_remove( BPy_SceneSeq * self, PyObject * args ); @@ -96,6 +97,8 @@ "() - Return a copy of the sequence containing the same objects."}, {"copy", ( PyCFunction ) Sequence_copy, METH_NOARGS, "() - Return a copy of the sequence containing the same objects."}, + {"rebuildProxy", ( PyCFunction ) Sequence_rebuildProxy, METH_VARARGS, + "() - Rebuild the active strip's Proxy."}, {NULL, NULL, 0, NULL} }; @@ -309,6 +312,7 @@ Py_RETURN_NONE; } + /*****************************************************************************/ /* PythonTypeObject callback function prototypes */ /*****************************************************************************/ @@ -383,8 +387,6 @@ } - - static PyObject *Sequence_getName( BPy_Sequence * self ) { return PyString_FromString( self->seq->name+2 ); @@ -403,11 +405,13 @@ return 0; } + static PyObject *Sequence_getProxyDir( BPy_Sequence * self ) { return PyString_FromString( self->seq->strip->proxy ? self->seq->strip->proxy->dir : "" ); } + static int Sequence_setProxyDir( BPy_Sequence * self, PyObject * value ) { char *name = NULL; @@ -430,6 +434,14 @@ } +static PyObject *Sequence_rebuildProxy( BPy_Sequence * self ) +{ + if (self->seq->strip->proxy) + seq_proxy_rebuild(self->seq); + Py_RETURN_NONE; +} + + static PyObject *Sequence_getSound( BPy_Sequence * self ) { if (self->seq->type == SEQ_RAM_SOUND && self->seq->sound) @@ -622,6 +634,56 @@ return 0; } +static PyObject *M_Sequence_BlendModesDict( void ) +{ + PyObject *M = PyConstant_New( ); + + if( M ) { + BPy_constant *d = ( BPy_constant * ) M; + PyConstant_Insert( d, "CROSS", PyInt_FromLong( SEQ_CROSS ) ); + PyConstant_Insert( d, "ADD", PyInt_FromLong( SEQ_ADD ) ); + PyConstant_Insert( d, "SUBTRACT", PyInt_FromLong( SEQ_SUB ) ); + PyConstant_Insert( d, "ALPHAOVER", PyInt_FromLong( SEQ_ALPHAOVER ) ); + PyConstant_Insert( d, "ALPHAUNDER", PyInt_FromLong( SEQ_ALPHAUNDER ) ); + PyConstant_Insert( d, "GAMMACROSS", PyInt_FromLong( SEQ_GAMCROSS ) ); + PyConstant_Insert( d, "MULTIPLY", PyInt_FromLong( SEQ_MUL ) ); + PyConstant_Insert( d, "OVERDROP", PyInt_FromLong( SEQ_OVERDROP ) ); + PyConstant_Insert( d, "PLUGIN", PyInt_FromLong( SEQ_PLUGIN ) ); + PyConstant_Insert( d, "WIPE", PyInt_FromLong( SEQ_WIPE ) ); + PyConstant_Insert( d, "GLOW", PyInt_FromLong( SEQ_GLOW ) ); + PyConstant_Insert( d, "TRANSFORM", PyInt_FromLong( SEQ_TRANSFORM ) ); + PyConstant_Insert( d, "COLOR", PyInt_FromLong( SEQ_COLOR ) ); + PyConstant_Insert( d, "SPEED", PyInt_FromLong( SEQ_SPEED ) ); + } + return M; +} + +static PyObject *Sequence_getBlendMode( BPy_Sequence * self ) +{ + if (self->seq->blend_mode == 0) + return PyString_FromString( "Replace" ); + else + return PyString_FromString( give_seqname_by_type( self->seq->blend_mode ) ); +} + +static int Sequence_setBlendMode( BPy_Sequence * self, PyObject * value ) +{ + struct Sequence *seq= self->seq; + int number; + + if( !PyInt_Check( value ) ) + return EXPP_ReturnIntError( PyExc_TypeError, "expected an int value" ); + + number = PyInt_AS_LONG( value ); + + if ( seq_can_blend(seq) ) { + seq->blend_mode=number; + return 0; + } + + return 0; +} + /* * get floating point attributes */ @@ -836,7 +898,11 @@ (getter)Sequence_getImages, (setter)Sequence_setImages, "Sequence scene", NULL}, - + {"blendMode", + (getter)Sequence_getBlendMode, (setter)Sequence_setBlendMode, + "Sequence Blend Mode", + NULL}, + {"type", (getter)getIntAttr, (setter)NULL, "", @@ -1131,6 +1197,7 @@ /*****************************************************************************/ PyObject *Sequence_Init( void ) { + PyObject *BlendModesDict = M_Sequence_BlendModesDict( ); PyObject *submodule; if( PyType_Ready( &Sequence_Type ) < 0 ) return NULL; @@ -1142,6 +1209,9 @@ "The Blender Sequence module\n\n\ This module provides access to **Sequence Data** in Blender.\n" ); + if( BlendModesDict ) + PyModule_AddObject( submodule, "BlendModes", BlendModesDict ); + /*Add SUBMODULES to the module*/ /*PyDict_SetItemString(dict, "Constraint", Constraint_Init()); //creates a *new* module*/ return submodule; --- blender/source/blender/src/sequence.c 2008-06-29 12:40:18.000000000 +0200 +++ blender/source/blender/src/sequence.c 2008-07-07 02:38:09.000000000 +0200 @@ -564,7 +564,6 @@ *(ed->seqbasep)= seqbase; } - void clear_scene_in_allseqs(Scene *sce) { Scene *sce1; @@ -2380,6 +2379,16 @@ return i; } +/* check used when we need to change seq->blend_mode but not to effect or audio strips */ +int seq_can_blend(Sequence *seq) +{ + if (seq->type == SEQ_IMAGE || seq->type == SEQ_META || + seq->type == SEQ_SCENE || seq->type == SEQ_MOVIE) + return 1; + else + return 0; +} + /* threading api */ static ListBase running_threads; --- blender/source/blender/include/BSE_sequence.h 2008-06-29 12:40:04.000000000 +0200 +++ blender/source/blender/include/BSE_sequence.h 2008-07-07 02:39:08.000000000 +0200 @@ -92,6 +92,8 @@ struct RenderResult; void do_render_seq(struct RenderResult *rr, int cfra); +int seq_can_blend(struct Sequence *seq); + #define SEQ_HAS_PATH(seq) (seq->type==SEQ_MOVIE || seq->type==SEQ_HD_SOUND || seq->type==SEQ_RAM_SOUND || seq->type==SEQ_IMAGE) #endif --- blender/source/blender/makesdna/DNA_sequence_types.h 2008-06-29 12:40:03.000000000 +0200 +++ blender/source/blender/makesdna/DNA_sequence_types.h 2008-07-07 03:13:01.000000000 +0200 @@ -231,36 +231,36 @@ } SpeedControlVars; /* SpeedControlVars->flags */ -#define SEQ_SPEED_INTEGRATE 1 -#define SEQ_SPEED_BLEND 2 -#define SEQ_SPEED_COMPRESS_IPO_Y 4 +#define SEQ_SPEED_INTEGRATE 1 +#define SEQ_SPEED_BLEND 2 +#define SEQ_SPEED_COMPRESS_IPO_Y 4 /* ***************** SEQUENCE ****************** */ /* seq->flag */ -#define SEQ_LEFTSEL 2 -#define SEQ_RIGHTSEL 4 -#define SEQ_OVERLAP 8 -#define SEQ_FILTERY 16 -#define SEQ_MUTE 32 -#define SEQ_MAKE_PREMUL 64 -#define SEQ_REVERSE_FRAMES 128 -#define SEQ_IPO_FRAME_LOCKED 256 -#define SEQ_EFFECT_NOT_LOADED 512 -#define SEQ_FLAG_DELETE 1024 -#define SEQ_FLIPX 2048 -#define SEQ_FLIPY 4096 -#define SEQ_MAKE_FLOAT 8192 -#define SEQ_LOCK 16384 -#define SEQ_USE_PROXY 32768 -#define SEQ_USE_TRANSFORM 65536 -#define SEQ_USE_CROP 131072 -#define SEQ_USE_COLOR_BALANCE 262144 -#define SEQ_USE_PROXY_CUSTOM_DIR 524288 - -#define SEQ_COLOR_BALANCE_INVERSE_GAIN 1 -#define SEQ_COLOR_BALANCE_INVERSE_GAMMA 2 -#define SEQ_COLOR_BALANCE_INVERSE_LIFT 4 +#define SEQ_LEFTSEL 2 +#define SEQ_RIGHTSEL 4 +#define SEQ_OVERLAP 8 +#define SEQ_FILTERY 16 +#define SEQ_MUTE 32 +#define SEQ_MAKE_PREMUL 64 +#define SEQ_REVERSE_FRAMES 128 +#define SEQ_IPO_FRAME_LOCKED 256 +#define SEQ_EFFECT_NOT_LOADED 512 +#define SEQ_FLAG_DELETE 1024 +#define SEQ_FLIPX 2048 +#define SEQ_FLIPY 4096 +#define SEQ_MAKE_FLOAT 8192 +#define SEQ_LOCK 16384 +#define SEQ_USE_PROXY 32768 +#define SEQ_USE_TRANSFORM 65536 +#define SEQ_USE_CROP 131072 +#define SEQ_USE_COLOR_BALANCE 262144 +#define SEQ_USE_PROXY_CUSTOM_DIR 524288 + +#define SEQ_COLOR_BALANCE_INVERSE_GAIN 1 +#define SEQ_COLOR_BALANCE_INVERSE_GAMMA 2 +#define SEQ_COLOR_BALANCE_INVERSE_LIFT 4 /* seq->type WATCH IT: SEQ_EFFECT BIT is used to determine if this is an effect strip!!! */ #define SEQ_IMAGE 0 @@ -275,11 +275,11 @@ #define SEQ_CROSS 8 #define SEQ_ADD 9 #define SEQ_SUB 10 -#define SEQ_ALPHAOVER 11 -#define SEQ_ALPHAUNDER 12 -#define SEQ_GAMCROSS 13 +#define SEQ_ALPHAOVER 11 +#define SEQ_ALPHAUNDER 12 +#define SEQ_GAMCROSS 13 #define SEQ_MUL 14 -#define SEQ_OVERDROP 15 +#define SEQ_OVERDROP 15 #define SEQ_PLUGIN 24 #define SEQ_WIPE 25 #define SEQ_GLOW 26 @@ -288,12 +288,12 @@ #define SEQ_SPEED 29 #define SEQ_EFFECT_MAX 29 -#define STRIPELEM_FAILED 0 -#define STRIPELEM_OK 1 +#define STRIPELEM_FAILED 0 +#define STRIPELEM_OK 1 #define STRIPELEM_PREVIEW_DONE 1 -#define SEQ_BLEND_REPLACE 0 +#define SEQ_BLEND_REPLACE 0 /* all other BLEND_MODEs are simple SEQ_EFFECT ids and therefore identical to the table above. (Only those effects that handle _exactly_ two inputs, otherwise, you can't really blend, right :) !) --- blender/source/blender/src/buttons_scene.c 2008-06-29 12:40:18.000000000 +0200 +++ blender/source/blender/src/buttons_scene.c 2008-07-07 03:50:59.000000000 +0200 @@ -499,7 +499,7 @@ so that would collide also. */ - if (!(last_seq->type & SEQ_EFFECT)) { + if ( seq_can_blend(last_seq) ) { int i; for (i = SEQ_EFFECT; i <= SEQ_EFFECT_MAX; i++) {