merging 17300:17342
authorMartin Poirier <theeth@yahoo.com>
Thu, 6 Nov 2008 01:30:24 +0000 (01:30 +0000)
committerMartin Poirier <theeth@yahoo.com>
Thu, 6 Nov 2008 01:30:24 +0000 (01:30 +0000)
57 files changed:
SConstruct
config/darwin-config.py
config/linux2-config.py
config/linuxcross-config.py
config/openbsd3-config.py
config/sunos5-config.py
config/win32-mingw-config.py
config/win32-vc-config.py
extern/libopenjpeg/SConscript
extern/libredcode/SConscript
extern/libredcode/format.c
release/scripts/export_m3g.py
release/scripts/image_auto_layout.py
release/scripts/import_lightwave_motion.py
release/scripts/scripttemplate_gamelogic.py
source/blender/blenkernel/BKE_lattice.h
source/blender/blenkernel/BKE_shrinkwrap.h
source/blender/blenkernel/BKE_writeffmpeg.h
source/blender/blenkernel/intern/blender.c
source/blender/blenkernel/intern/deform.c
source/blender/blenkernel/intern/exotic.c
source/blender/blenkernel/intern/lattice.c
source/blender/blenkernel/intern/modifier.c
source/blender/blenkernel/intern/shrinkwrap.c
source/blender/blenkernel/intern/simple_deform.c
source/blender/blenkernel/intern/texture.c
source/blender/blenkernel/intern/writeffmpeg.c
source/blender/imbuf/intern/IMB_anim.h
source/blender/imbuf/intern/amiga.c
source/blender/imbuf/intern/anim.c
source/blender/imbuf/intern/readimage.c
source/blender/imbuf/intern/util.c
source/blender/src/buttons_shading.c
source/blender/src/editmesh_mods.c
source/blender/src/reeb.c
source/gameengine/Ketsji/KX_BlenderMaterial.h
source/gameengine/VideoTexture/Exception.cpp
source/gameengine/VideoTexture/FilterBase.h
source/gameengine/VideoTexture/FilterBlueScreen.cpp
source/gameengine/VideoTexture/FilterBlueScreen.h
source/gameengine/VideoTexture/FilterColor.cpp
source/gameengine/VideoTexture/FilterColor.h
source/gameengine/VideoTexture/FilterNormal.cpp
source/gameengine/VideoTexture/FilterNormal.h
source/gameengine/VideoTexture/FilterSource.cpp
source/gameengine/VideoTexture/FilterSource.h
source/gameengine/VideoTexture/ImageBuff.cpp
source/gameengine/VideoTexture/ImageMix.cpp
source/gameengine/VideoTexture/ImageRender.cpp
source/gameengine/VideoTexture/ImageViewport.cpp
source/gameengine/VideoTexture/PyTypeList.cpp
source/gameengine/VideoTexture/Texture.cpp
source/gameengine/VideoTexture/Texture.h
source/gameengine/VideoTexture/VideoFFmpeg.cpp
source/gameengine/VideoTexture/VideoFFmpeg.h
source/gameengine/VideoTexture/blendVideoTex.cpp
tools/Blender.py

index 91603ce772464a53a38eec23d3d67d20e0e99bb7..968266bd6d1ce21e745d9f6f90ed23c2bdb0fa1b 100644 (file)
@@ -227,7 +227,7 @@ if env['OURPLATFORM'] == 'linux2' :
             context.Result(result)
             return result
 
-        env2 = env.Copy( LIBPATH = env['BF_OPENAL'] ) 
+        env2 = env.Clone( LIBPATH = env['BF_OPENAL'] ) 
         sconf_temp = mkdtemp()
         conf = Configure( env2, {'CheckFreeAlut' : CheckFreeAlut}, sconf_temp, '/dev/null' )
         if conf.CheckFreeAlut( env2 ):
index 547d655b531ad93e52c2d6cb3e6fb000cc8814e1..7c118b7886134413e9f771e5eb1b3c02ab943238 100644 (file)
@@ -260,11 +260,11 @@ CC_WARN = ['-Wall', '-Wno-long-double']
 ##LOPTS = --dynamic
 ##DYNLDFLAGS = -shared $(LDFLAGS)
 
-BF_PROFILE_FLAGS = ' -pg -g '
+BF_PROFILE_CCFLAGS = ['-pg', '-g ']
 BF_PROFILE = False
 
 BF_DEBUG = False
-BF_DEBUG_FLAGS = '-g'
+BF_DEBUG_CCFLAGS = ['-g']
 
 BF_BUILDDIR='../build/darwin'
 BF_INSTALLDIR='../install/darwin'
index ca07bf10ab8836339b862cc1b6e00dda83e04c9c..19b62dd2395ca63c018e077256e6366f9b53a7a4 100644 (file)
@@ -197,11 +197,11 @@ LLIBS = 'util c m dl pthread stdc++'
 ##LOPTS = --dynamic
 ##DYNLDFLAGS = -shared $(LDFLAGS)
 
-BF_PROFILE_FLAGS = ['-pg','-g']
 BF_PROFILE = False
+BF_PROFILE_CCFLAGS = ['-pg','-g']
 
 BF_DEBUG = False
-BF_DEBUG_FLAGS = '-g'
+BF_DEBUG_CCFLAGS = ['-g']
 
 BF_BUILDDIR = '../build/linux2'
 BF_INSTALLDIR='../install/linux2'
index c10e9d76cb525cb9e752f00535d233da2d08cf90..4c5f4859a6c6fe8c106acef2940f8abe08f67a26 100644 (file)
@@ -144,7 +144,7 @@ CC_WARN = [ '-Wall' ]
 LLIBS = [ '-ldxguid', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz'] #'-lutil', '-lc', '-lm', '-ldl', '-lpthread' ]
 
 BF_DEBUG = False
-BF_DEBUG_FLAGS= ''
+BF_DEBUG_CCFLAGS= []
 
 BF_BUILDDIR = '../build/linuxcross'
 BF_INSTALLDIR='../install/linuxcross'
index 0a4f75e3bccc4fc4d777cc7309e3a3fc9739866d..cd46d11867edd7ab7d57f239eb29ede4ec84b9ec 100644 (file)
@@ -155,11 +155,11 @@ LLIBS = 'm stdc++ pthread util'
 ##LOPTS = --dynamic
 ##DYNLDFLAGS = -shared $(LDFLAGS)
 
-BF_PROFILE_FLAGS = ' -pg -g '
+BF_PROFILE_CCFLAGS = ['-pg', '-g']
 BF_PROFILE = False
 
 BF_DEBUG = False
-BF_DEBUG_FLAGS = '-g'
+BF_DEBUG_CCFLAGS = ['-g']
 
 BF_BUILDDIR='../build/openbsd3'
 BF_INSTALLDIR='../install/openbsd3'
index 2343ce69060ceaaf5228d5b3679f8d3446952d43..4e7e99bc88495bdf48079147faf36c8726ce94fc 100644 (file)
@@ -169,15 +169,15 @@ LLIBS = 'c m dl pthread stdc++'
 ##LOPTS = --dynamic
 ##DYNLDFLAGS = -shared $(LDFLAGS)
 
-BF_PROFILE_FLAGS = ['-pg','-g']
+BF_PROFILE_CCFLAGS = ['-pg','-g']
 BF_PROFILE = False
 
 BF_DEBUG = False
-BF_DEBUG_FLAGS = ''
+BF_DEBUG_CCFLAGS = []
 
 BF_BUILDDIR = '../build/sunos5'
 BF_INSTALLDIR='../install/sunos5'
 BF_DOCDIR='../install/doc'
 
 
-PLATFORM_LINKFLAGS = ['']
+PLATFORM_LINKFLAGS = []
index bdeca1ddc9182ab9e43d0b23f00c8d817d65b5df..15bfce80f8926906e0928a000b5fcbf48adbe85f 100644 (file)
@@ -160,9 +160,9 @@ CC_WARN = [ '-Wall' ]
 LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++']
 
 BF_DEBUG = False
-BF_DEBUG_FLAGS= '-g'
+BF_DEBUG_CCFLAGS= ['-g']
 
-BF_PROFILE_FLAGS = ['-pg','-g']
+BF_PROFILE_CCFLAGS = ['-pg','-g']
 BF_PROFILE = False
 
 BF_BUILDDIR = '..\\build\\win32-mingw'
index a5aa76c2868a9b8016c5cb22b6e5f4ec3d689314..9a41f7ee55745910930efd29663bca94e4f9f6f6 100644 (file)
@@ -150,6 +150,11 @@ BF_QUICKTIME_INC = '${BF_QUICKTIME}/CIncludes'
 BF_QUICKTIME_LIB = 'qtmlClient'
 BF_QUICKTIME_LIBPATH = '${BF_QUICKTIME}/Libraries'
 
+WITH_BF_OPENJPEG = True 
+
+WITH_BF_REDCODE = False  
+BF_REDCODE_INC = '#extern'
+
 WITH_BF_STATICOPENGL = False
 BF_OPENGL_INC = '${BF_OPENGL}/include'
 BF_OPENGL_LIBINC = '${BF_OPENGL}/lib'
index f0a93f6e2d9cdeae878c404500ad5d58c737da2b..837701eeae0c3416ce316447ffddc23232f88f0b 100644 (file)
@@ -7,14 +7,18 @@ Import('env')
 sources = env.Glob('*.c')
 incs = '.'
 
-flags = "-Wall -O3 -ffast-math -std=c99"
+if env['OURPLATFORM'] == 'win32-vc':
+       flags = []
+else:
+       flags = ['-Wall', '-O3', '-ffast-math', '-std=c99']
 
-oj_env = env.Copy();
-oj_env.Replace(CCFLAGS = '')
-oj_env.Replace(BF_DEBUG_FLAGS = '')
+oj_env = env.Clone()
+if not env['OURPLATFORM'] == 'win32-vc':
+       oj_env.Replace(CCFLAGS = '')
+       oj_env.Replace(BF_DEBUG_FLAGS = '')
 
 oj_env.BlenderLib ( libname='extern_openjpeg', 
                     sources=sources, includes=Split(incs),
                     defines=[],
                     libtype=['core','intern','player'],
-                    priority=[10, 10, 300], compileflags = Split(flags))
+                    priority=[10, 10, 300], compileflags = flags)
index 4e83ba5cbb4f28bdcf437d7a7a71d59ade76486e..9fd25ad63c7478ba2cd5ac5d9f8fcc0503bdd830 100644 (file)
@@ -9,18 +9,6 @@ Import('env')
 sources = env.Glob('*.c')
 incs = '. ../libopenjpeg'
 
-root = "extern/libredcode"
-
-if not os.path.isdir(root + "/include"):
-    os.mkdir(root + "/include");
-if not os.path.isdir(root + "/include/redcode"):
-    os.mkdir(root + "/include/redcode");
-
-for h in env.Glob('*.h'):
-    shutil.copyfile(root + "/" + h,
-                    root + "/include/redcode/" + h)
-
-
 env.BlenderLib ( libname='extern_redcode', 
                  sources=sources, includes=Split(incs),
                  defines=[],
index 35410e9e26916c09f928d501ccb4ef9e05c0a180..4677c49b8a561b978a53704365b1988f3fb916e0 100644 (file)
@@ -1,4 +1,9 @@
+#ifdef _WIN32
+#include <Winsock2.h>
+#else
 #include <netinet/in.h>
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index 86ac03cc407a97134c3a32d41122f097cd7d5bdd..c74e7acbcd37fff72e9e7b6abf6b4b88ddb89e65 100644 (file)
@@ -11,7 +11,7 @@ Tooltip: 'Export to M3G'
 #
 # Source: http://www.nelson-games.de/bl2m3g/source
 #
-# $Id: m3g_export.py,v 0.1 2005/04/19 12:25 gerhardv Exp gerhardv $
+# $Id$
 #
 # Author: Gerhard Völkl
 #
index 19ee396c3b1d2671cbe1fa78ff0008a2c36c54cc..c6f97a25434f9ae00da9091f528ca3e3003b433d 100644 (file)
@@ -265,8 +265,8 @@ def consolidate_mesh_images(mesh_list, scn, PREF_IMAGE_PATH, PREF_IMAGE_SIZE, PR
        render_context.setRenderWinSize(100)
        render_context.setImageType(Render.PNG)
        render_context.enableExtensions(True) 
-       render_context.enableSky() # No alpha needed.
-       render_context.enableRGBColor()
+       render_context.enablePremultiply() # No alpha needed.
+       render_context.enableRGBAColor()
        render_context.threads = 2
        
        #Render.EnableDispView() # Broken??
@@ -275,8 +275,9 @@ def consolidate_mesh_images(mesh_list, scn, PREF_IMAGE_PATH, PREF_IMAGE_SIZE, PR
        render_mat= B.Material.New()
        render_mat.mode |= B.Material.Modes.SHADELESS
        render_mat.mode |= B.Material.Modes.TEXFACE
-       
-       
+       render_mat.mode |= B.Material.Modes.ZTRANSP
+       render_mat.setAlpha(0.0)
+               
        render_me= B.Mesh.New()
        render_me.verts.extend([Vector(0,0,0)]) # Stupid, dummy vert, preverts errors. when assigning UV's/
        render_ob= B.Object.New('Mesh')
index c242a9f6bd3ee9507de7848c48ee0d06e056fcc2..20c87dfd5c633761db1b14fa5e8234d077f6bf16 100644 (file)
@@ -22,7 +22,7 @@ Be sure to set the framerate correctly
 
 """
 
-# $Id: export_lightwave_motion.py 9924 2007-01-27 02:15:14Z campbellbarton $
+# $Id$
 # --------------------------------------------------------------------------
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
index 1709525115500c5ee716f70a19b679376d3d937d..7184d7e424fcf3e2344660c2b2e1661d1b7fb5ba 100644 (file)
@@ -83,7 +83,8 @@ def main():
                        own.life += ob.life
                        ob.life = 0
        print own.life
-       """\r
+       """
+
 main()
 '''
 
index 5620674e791eee6838b09a65fa7b13342b7ee370..dc7c9dcd5e596fbe80531e6f3e71b7fd5969ce41 100644 (file)
@@ -35,6 +35,7 @@ struct Lattice;
 struct Object;
 struct DerivedMesh;
 struct BPoint;
+struct MDeformVert;
 
 extern struct Lattice *editLatt;
 
@@ -67,5 +68,7 @@ float (*lattice_getVertexCos(struct Object *ob, int *numVerts_r))[3];
 void lattice_applyVertexCos(struct Object *ob, float (*vertexCos)[3]);
 void lattice_calc_modifiers(struct Object *ob);
 
+struct MDeformVert* lattice_get_deform_verts(struct Object *lattice);
+
 #endif
 
index e8276238ff220213cbdacb262ad9afb99adb847f..eed22ff9d8e3dda2609fcc6ac4485bf780807f19 100644 (file)
@@ -96,6 +96,7 @@ void space_transform_invert_normal(const SpaceTransform *data, float *no);
 struct Object;
 struct DerivedMesh;
 struct ShrinkwrapModifierData;
+struct MDeformVert;
 struct BVHTree;
 
 
@@ -109,6 +110,9 @@ typedef struct ShrinkwrapCalcData
        float (*vertexCos)[3];                  //vertexs being shrinkwraped
        int numVerts;
 
+       struct MDeformVert* dvert;                      //Pointer to mdeform array
+       int vgroup;                                             //Vertex group num
+
        struct DerivedMesh *target;             //mesh we are shrinking to      
        SpaceTransform local2target;    //transform to move bettwem local and target space
 
index 50053446294096e786c519bfc058bbad2fc10d03..02f7ba6f8602861b3805d404f075c773efe5eccd 100644 (file)
@@ -59,8 +59,6 @@ extern void start_ffmpeg(struct RenderData *rd, int rectx, int recty);
 extern void end_ffmpeg(void);
 extern void append_ffmpeg(int frame, int *pixels, int rectx, int recty);
 
-void silence_log_ffmpeg(int quiet);
-
 #ifdef __cplusplus
 }
 #endif
index 1fe6447752e72f37dd51c11d09663925e3b7cb19..5dcccc56d06223841d8d47c115eb68a917f38355 100644 (file)
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifndef WIN32 
-    #include <unistd.h> // for read close
-    #include <sys/param.h> // for MAXPATHLEN
+#ifndef _WIN32 
+       #include <unistd.h> // for read close
+       #include <sys/param.h> // for MAXPATHLEN
 #else
-    #include <io.h> // for open close read
+       #include <io.h> // for open close read
+       #define open _open
+       #define read _read
+       #define close _close
+       #define write _write
 #endif
 
 #include <stdlib.h>
index 3143c5e4df2328e80647f9e73c9d13171756c28c..477368652735e598ae62104b3b1300e97c67cf43 100644 (file)
@@ -239,12 +239,9 @@ float deformvert_get_weight(const struct MDeformVert *dvert, int group_num)
 
 float vertexgroup_get_vertex_weight(const struct MDeformVert *dvert, int index, int group_num)
 {
-       if(group_num == -1)
+       if(group_num == -1 || dvert == NULL)
                return 1.0;
 
-       if(dvert == 0)
-               return 0.0;
-
        return deformvert_get_weight(dvert+index, group_num);
 }
 
index 9fb8d17d730da2b794da9d9270e723ad38dc24cf..ee3fd59fe9fd5c6cf6cd042c55b9d9a017a3e085 100644 (file)
 #include <fcntl.h>
 #include <string.h>
 
-#ifndef WIN32 
+#ifndef _WIN32 
 #include <unistd.h>
 #else
 #include <io.h>
+#define open _open
+#define read _read
+#define close _close
+#define write _write
 #endif
 
 #include "MEM_guardedalloc.h"
index 54915058bab7b21778a8c29ff0a3db9d86e04ab2..6614c657647b3bb0df33a7e7c2252d074ac25219 100644 (file)
@@ -928,3 +928,15 @@ void lattice_calc_modifiers(Object *ob)
                BLI_addtail(&ob->disp, dl);
        }
 }
+
+struct MDeformVert* lattice_get_deform_verts(struct Object *oblatt)
+{
+       if(oblatt->type == OB_LATTICE)
+       {
+               Lattice *lt = (oblatt==G.obedit)?editLatt:(Lattice*)oblatt->data;
+               return lt->dvert;
+       }
+
+       return NULL;    
+}
+
index 13dc2e834f234de04fa532aec14fec4932adb325..6bdd395a2ac1f22d1c737b6d7bb20f8fdcb00f5d 100644 (file)
@@ -7804,9 +7804,10 @@ static void shrinkwrapModifier_deformVerts(ModifierData *md, Object *ob, Derived
        {
                if(derivedData) dm = CDDM_copy(derivedData);
                else if(ob->type==OB_MESH) dm = CDDM_from_mesh(ob->data, ob);
+               else if(ob->type==OB_LATTICE) dm = NULL;
                else return;
 
-               if(dataMask & CD_MVERT)
+               if(dm != NULL && (dataMask & CD_MVERT))
                {
                        CDDM_apply_vert_coords(dm, vertexCos);
                        CDDM_calc_normals(dm);
@@ -7828,9 +7829,10 @@ static void shrinkwrapModifier_deformVertsEM(ModifierData *md, Object *ob, EditM
        {
                if(derivedData) dm = CDDM_copy(derivedData);
                else if(ob->type==OB_MESH) dm = CDDM_from_editmesh(editData, ob->data);
+               else if(ob->type==OB_LATTICE) dm = NULL;
                else return;
 
-               if(dataMask & CD_MVERT)
+               if(dm != NULL && (dataMask & CD_MVERT))
                {
                        CDDM_apply_vert_coords(dm, vertexCos);
                        CDDM_calc_normals(dm);
@@ -7916,9 +7918,10 @@ static void simpledeformModifier_deformVerts(ModifierData *md, Object *ob, Deriv
        {
                if(derivedData) dm = CDDM_copy(derivedData);
                else if(ob->type==OB_MESH) dm = CDDM_from_mesh(ob->data, ob);
+               else if(ob->type==OB_LATTICE) dm = NULL;
                else return;
 
-               if(dataMask & CD_MVERT)
+               if(dm != NULL && (dataMask & CD_MVERT))
                {
                        CDDM_apply_vert_coords(dm, vertexCos);
                        CDDM_calc_normals(dm);
@@ -7942,9 +7945,10 @@ static void simpledeformModifier_deformVertsEM(ModifierData *md, Object *ob, Edi
        {
                if(derivedData) dm = CDDM_copy(derivedData);
                else if(ob->type==OB_MESH) dm = CDDM_from_editmesh(editData, ob->data);
+               else if(ob->type==OB_LATTICE) dm = NULL;
                else return;
 
-               if(dataMask & CD_MVERT)
+               if(dm != NULL && (dataMask & CD_MVERT))
                {
                        CDDM_apply_vert_coords(dm, vertexCos);
                        CDDM_calc_normals(dm);
index 28bf7aee88439578c05e1400f213920ec020b4e4..ab98fb1f0078c79a915351189aca2d0bdddec291 100644 (file)
@@ -41,6 +41,7 @@
 
 #include "BKE_shrinkwrap.h"
 #include "BKE_DerivedMesh.h"
+#include "BKE_lattice.h"
 #include "BKE_utildefines.h"
 #include "BKE_deform.h"
 #include "BKE_cdderivedmesh.h"
@@ -161,6 +162,18 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM
        calc.numVerts = numVerts;
        calc.vertexCos = vertexCos;
 
+       //DeformVertex
+       calc.vgroup = get_named_vertexgroup_num(calc.ob, calc.smd->vgroup_name);
+       if(calc.original)
+       {
+               calc.dvert = calc.original->getVertDataArray(calc.original, CD_MDEFORMVERT);
+       }
+       else if(calc.ob->type == OB_LATTICE)
+       {
+               calc.dvert = lattice_get_deform_verts(calc.ob);
+       }
+
+
        if(smd->target)
        {
                //TODO currently we need a copy in case object_get_derived_final returns an emDM that does not defines getVertArray or getFace array
@@ -207,8 +220,6 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd, Object *ob, DerivedM
 void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
 {
        int i;
-       const int vgroup                 = get_named_vertexgroup_num(calc->ob, calc->smd->vgroup_name);
-       MDeformVert *const dvert = calc->original ? calc->original->getVertDataArray(calc->original, CD_MDEFORMVERT) : NULL;
 
        BVHTreeFromMesh treeData = NULL_BVHTreeFromMesh;
        BVHTreeNearest  nearest  = NULL_BVHTreeNearest;
@@ -230,7 +241,7 @@ void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
        {
                float *co = calc->vertexCos[i];
                float tmp_co[3];
-               float weight = vertexgroup_get_vertex_weight(dvert, i, vgroup);
+               float weight = vertexgroup_get_vertex_weight(calc->dvert, i, calc->vgroup);
                if(weight == 0.0f) continue;
 
                VECCOPY(tmp_co, co);
@@ -342,11 +353,6 @@ void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc)
        MVert *vert  = NULL; //Needed in case of vertex normal
        DerivedMesh* ss_mesh = NULL;
 
-       //Vertex group data
-       const int vgroup                   = get_named_vertexgroup_num(calc->ob, calc->smd->vgroup_name);
-       const MDeformVert *dvert = calc->original ? calc->original->getVertDataArray(calc->original, CD_MDEFORMVERT) : NULL;
-
-
        //Raycast and tree stuff
        BVHTreeRayHit hit;
        BVHTreeFromMesh treeData = NULL_BVHTreeFromMesh;        //target
@@ -441,7 +447,7 @@ do
                float *co = calc->vertexCos[i];
                float tmp_co[3], tmp_no[3];
                float lim = 10000.0f; //TODO: we should use FLT_MAX here, but sweepsphere code isnt prepared for that
-               float weight = vertexgroup_get_vertex_weight(dvert, i, vgroup);
+               float weight = vertexgroup_get_vertex_weight(calc->dvert, i, calc->vgroup);
 
                if(weight == 0.0f) continue;
 
@@ -520,9 +526,6 @@ void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
 {
        int i;
 
-       const int vgroup = get_named_vertexgroup_num(calc->ob, calc->smd->vgroup_name);
-       const MDeformVert *const dvert = calc->original ? calc->original->getVertDataArray(calc->original, CD_MDEFORMVERT) : NULL;
-
        BVHTreeFromMesh treeData = NULL_BVHTreeFromMesh;
        BVHTreeNearest  nearest  = NULL_BVHTreeNearest;
 
@@ -547,7 +550,7 @@ void shrinkwrap_calc_nearest_surface_point(ShrinkwrapCalcData *calc)
        {
                float *co = calc->vertexCos[i];
                float tmp_co[3];
-               float weight = vertexgroup_get_vertex_weight(dvert, i, vgroup);
+               float weight = vertexgroup_get_vertex_weight(calc->dvert, i, calc->vgroup);
                if(weight == 0.0f) continue;
 
                //Convert the vertex to tree coordinates
index 0eb710fa48ec31ddc59a1c55f81bbc0d9a5d7286..2978a6f7f01972e01dfb4aae0985f22174835e1b 100644 (file)
@@ -32,6 +32,7 @@
 
 #include "BKE_simple_deform.h"
 #include "BKE_DerivedMesh.h"
+#include "BKE_lattice.h"
 #include "BKE_deform.h"
 #include "BKE_utildefines.h"
 #include "BLI_arithb.h"
@@ -204,7 +205,14 @@ void SimpleDeformModifier_do(SimpleDeformModifierData *smd, struct Object *ob, s
 
 
        if(dm)
-               dvert   = dm->getVertDataArray(dm, CD_MDEFORMVERT);
+       {
+               dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT);
+       }
+       else if(ob->type == OB_LATTICE)
+       {
+               dvert = lattice_get_deform_verts(ob);
+       }
+
 
 
        switch(smd->mode)
index bb726887d32770a0a43b510324e8c3136b75be27..ab9e6f9af415c33d5569a459b9369a6eb16c4986 100644 (file)
@@ -348,6 +348,15 @@ int do_colorband(ColorBand *coba, float in, float out[4])
                                else
                                        fac= 0.0f;
                                
+                               if (coba->ipotype==4) {
+                                       /* constant */
+                                       out[0]= cbd2->r;
+                                       out[1]= cbd2->g;
+                                       out[2]= cbd2->b;
+                                       out[3]= cbd2->a;
+                                       return 1;
+                               }
+                               
                                if(coba->ipotype>=2) {
                                        /* ipo from right to left: 3 2 1 0 */
                                        
index 642b4fd1b19eb0ca457ac067c511241e05f0585d..cef6f802729cf5e13f53337b68a22fb72232b43a 100644 (file)
@@ -34,7 +34,6 @@
 #include <ffmpeg/rational.h>
 #include <ffmpeg/swscale.h>
 #include <ffmpeg/opt.h>
-#include <ffmpeg/log.h>
 
 #if LIBAVFORMAT_VERSION_INT < (49 << 16)
 #define FFMPEG_OLD_FRAME_RATE 1
@@ -105,18 +104,6 @@ static RenderData *ffmpeg_renderdata = 0;
 
 #define FFMPEG_AUTOSPLIT_SIZE 2000000000
 
-void silence_log_ffmpeg(int quiet)
-{
-       if (quiet)
-       {
-               av_log_set_level(AV_LOG_QUIET);
-       }
-       else
-       {
-               av_log_set_level(AV_LOG_INFO);
-       }
-}
-
 /* Delete a picture buffer */
 
 static void delete_picture(AVFrame* f)
index 7dc1f966b71b950edb40ac60c6abb97066c6b9c3..745248d321861500b0ec69856e573a494bc44da8 100644 (file)
 #endif
 
 #ifdef WITH_REDCODE
-#include <redcode/format.h>
+#ifdef _WIN32 /* on windows we use the one in extern instead */
+#include "libredcode/format.h"
+#else
+#include "libredcode/format.h"
+#endif
 #endif
 
 #include "IMB_imbuf_types.h"
index 3d52a287a31d9bb24c5704f962a40d0e4d555660..534e4945aa34fd3dbd5e54d0c33a056c5a33562d 100644 (file)
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifdef WIN32
+#ifdef _WIN32
 #include <io.h>
+#define open _open
+#define read _read
+#define close _close
+#define write _write
 #endif
 #include "imbuf.h"
 #include "imbuf_patch.h"
index c0e84b73e47bb64c5bef4e24c5a047420dde12da..80bf401bec01e56d7cba827c6e8c7b0cde23a3e8 100644 (file)
 #endif
 
 #ifdef WITH_REDCODE
-#include <redcode/format.h>
-#include <redcode/codec.h>
+#ifdef _WIN32 /* on windows we use the ones in extern instead */
+#include "libredcode/format.h"
+#include "libredcode/codec.h"
+#else
+#include "libredcode/format.h"
+#include "libredcode/codec.h"
+#endif
 #endif
 
 /****/
index 566df53a25e6033ca261bc1a9bfdc7ed25206e0a..05e7921665bc2707fbda9fe2f59602a0bb52c976 100644 (file)
  * $Id$
  */
 
-#ifdef WIN32
+#ifdef _WIN32
 #include <io.h>
 #include <stddef.h>
 #include <sys/types.h>
 #include "mmap_win.h"
+#define open _open
+#define read _read
+#define close _close
 #endif
 
 #include "BLI_blenlib.h"
index 05d594019a5a5796da44b7d3661b2a6caf9d305c..c86f9b017bf295392ca35b0c4b9300e79f8b2dc2 100644 (file)
  * $Id$
  */
 
+#ifdef _WIN32
+#include <io.h>
+#define open _open
+#define read _read
+#define close _close
+#endif
+
 #include "BLI_blenlib.h"
 
 #include "DNA_userdef_types.h"
 #include "BKE_global.h"
-#include "BKE_writeffmpeg.h" /* for silence_log_ffmpeg */
 
 #include "imbuf.h"
 #include "imbuf_patch.h"
@@ -66,6 +72,7 @@
 #include <ffmpeg/avcodec.h>
 #include <ffmpeg/avformat.h>
 //#include <ffmpeg/avdevice.h>
+#include <ffmpeg/log.h>
 
 #if LIBAVFORMAT_VERSION_INT < (49 << 16)
 #define FFMPEG_OLD_FRAME_RATE 1
@@ -231,6 +238,19 @@ static int isqtime (char *name) {
 #endif
 
 #ifdef WITH_FFMPEG
+
+void silence_log_ffmpeg(int quiet)
+{
+       if (quiet)
+       {
+               av_log_set_level(AV_LOG_QUIET);
+       }
+       else
+       {
+               av_log_set_level(AV_LOG_INFO);
+       }
+}
+
 extern void do_init_ffmpeg();
 void do_init_ffmpeg()
 {
@@ -262,7 +282,8 @@ static AVCodecContext* get_codec_from_stream(AVStream* stream)
 
 static int isffmpeg (char *filename) {
        AVFormatContext *pFormatCtx;
-       int            i, videoStream;
+       unsigned int i;
+       int videoStream;
        AVCodec *pCodec;
        AVCodecContext *pCodecCtx;
 
index 5687651a6c5da4ce6a66e47e8f1f02d57d4b6e22..f1250c975fb894a2b9819434a8d21078f3f43885 100644 (file)
@@ -1468,10 +1468,9 @@ static void draw_colorband_buts(uiBlock *block, ColorBand *coba, int xoffs, int
        uiDefButS(block, NUM, redraw,           "Cur:",         117+xoffs,95+yoffs,81,20, &coba->cur, 0.0, (float)(coba->tot-1), 0, 0, "Displays the active color from the colorband");
        bt= uiDefBut(block, BUT, redraw,                "Del",          199+xoffs,95+yoffs,37,20, 0, 0, 0, 0, 0, "Deletes the active position");
        uiButSetFunc(bt, colorband_del_cb, coba, NULL);
-       uiDefButS(block, ROW, redraw,            "E",           236+xoffs,95+yoffs,16,20, &coba->ipotype, 5.0, 1.0, 0, 0, "Sets interpolation type 'Ease' (quadratic) ");
-       uiDefButS(block, ROW, redraw,           "C",            252+xoffs,95+yoffs,16,20, &coba->ipotype, 5.0, 3.0, 0, 0, "Sets interpolation type Cardinal");
-       uiDefButS(block, ROW, redraw,           "L",            268+xoffs,95+yoffs,16,20, &coba->ipotype, 5.0, 0.0, 0, 0, "Sets interpolation type Linear");
-       uiDefButS(block, ROW, redraw,           "S",            284+xoffs,95+yoffs,16,20, &coba->ipotype, 5.0, 2.0, 0, 0, "Sets interpolation type B-Spline");
+       
+       uiDefButS(block, MENU, redraw,          "Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4",
+               236+xoffs, 95+yoffs, 64, 20,            &coba->ipotype, 0.0, 0.0, 0, 0, "Sets interpolation type");
 
        uiDefBut(block, BUT_COLORBAND, redraw, "",      xoffs,65+yoffs,300,30, coba, 0, 0, 0, 0, "");
        
@@ -1506,11 +1505,10 @@ void draw_colorband_buts_small(uiBlock *block, ColorBand *coba, rctf *butr, int
        uiButSetFunc(bt, colorband_add_cb, coba, NULL);
        bt= uiDefBut(block, BUT, event, "Del",          xs+8.0f*unit,butr->ymin+20.0f,2.0f*unit,20,     NULL, 0, 0, 0, 0, "Deletes the active position");
        uiButSetFunc(bt, colorband_del_cb, coba, NULL);
-       uiDefButS(block, ROW, event,            "E",            xs+10.0f*unit,butr->ymin+20.0f,unit,20,         &coba->ipotype, 5.0, 1.0, 0, 0, "Sets interpolation type 'Ease' (quadratic) ");
-       uiDefButS(block, ROW, event,            "C",            xs+11.0f*unit,butr->ymin+20.0f,unit,20,         &coba->ipotype, 5.0, 3.0, 0, 0, "Sets interpolation type Cardinal");
-       uiDefButS(block, ROW, event,            "L",            xs+12.0f*unit,butr->ymin+20.0f,unit,20,         &coba->ipotype, 5.0, 0.0, 0, 0, "Sets interpolation type Linear");
-       uiDefButS(block, ROW, event,            "S",            xs+13.0f*unit,butr->ymin+20.0f,unit,20,         &coba->ipotype, 5.0, 2.0, 0, 0, "Sets interpolation type B-Spline");
-       
+
+       uiDefButS(block, MENU, event,           "Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4",
+               xs+10.0f*unit, butr->ymin+20.0f, unit*4, 20,            &coba->ipotype, 0.0, 0.0, 0, 0, "Sets interpolation type");
+
        uiDefBut(block, BUT_COLORBAND, event, "",               xs,butr->ymin,butr->xmax-butr->xmin,20.0f, coba, 0, 0, 0, 0, "");
        uiBlockEndAlign(block);
        
index 81d0ffeeb3bc4424214e3bb413b81e88828a3d8d..3dbbe7d73363a68daff6f19819a03eb30da7b10b 100644 (file)
@@ -1864,7 +1864,7 @@ void faceloop_select(EditEdge *startedge, int select)
                looking= 0;
                
                for(efa= em->faces.first; efa; efa= efa->next) {
-                       if(efa->e4 && efa->f1==0) {     /* not done quad */
+                       if(efa->h==0 && efa->e4 && efa->f1==0) {        /* not done quad */
                                if(efa->e1->f1<=2 && efa->e2->f1<=2 && efa->e3->f1<=2 && efa->e4->f1<=2) { /* valence ok */
 
                                        /* if edge tagged, select opposing edge and mark face ok */
index 3678106e9efb70a3ecaba1208dbc7753a5a6d050..b37087064cb22516d5d015fa626c09a35a77ec5e 100644 (file)
@@ -69,6 +69,7 @@
 
 #include "reeb.h"
 
+
 ReebGraph *GLOBAL_RG = NULL;
 ReebGraph *FILTERED_RG = NULL;
 
index b858fa3754cc92866d0738b814d110b6de0680c7..6e5db1b56c1b8947bf41f2562c814924da6e3342 100644 (file)
@@ -70,6 +70,9 @@ public:
        BL_Texture * getTex (unsigned int idx) { 
                return (idx < MAXTEX) ? mTextures + idx : NULL; 
        }
+       Image * getImage (unsigned int idx) { 
+               return (idx < MAXTEX && mMaterial) ? mMaterial->img[idx] : NULL; 
+       }
 
        // for ipos
        void UpdateIPO(
index 3ac8b8e321db78e638bde5b68921dc605ac849d4..3f939de6bc292bbf112321dfab05f9374843cb02 100644 (file)
@@ -168,15 +168,15 @@ void Exception::setXptDesc (void)
                }
                // add result code
                // length of result code
-               const size_t rsltSize = 10;
+               const size_t rsltSize = 11;
                // delimit description
                const char delimRslt[] = ": ";
                // set text of description
                char rsltTxt[rsltSize];
                std::ostrstream os(rsltTxt, rsltSize);
-               os << std::hex << m_hRslt << delimRslt;
+               os << std::hex << m_hRslt << delimRslt << '\0';
                // copy result to description
-               m_desc.insert(0, rsltTxt, rsltSize);
+               m_desc.insert(0, rsltTxt);
                // copy exception description to last exception string
                m_lastError = m_desc;
        }
index c530e385ada621502dd7ddbd101998e17c2e9ab4..b6080f018d5108bea234d9dcee36c58aea353d55 100644 (file)
@@ -29,6 +29,12 @@ http://www.gnu.org/copyleft/lesser.txt.
 
 #include "PyTypeList.h"
 
+#define VT_C(v,idx)    ((unsigned char*)&v)[idx]
+#define VT_R(v)        ((unsigned char*)&v)[0]
+#define VT_G(v)        ((unsigned char*)&v)[1]
+#define VT_B(v)        ((unsigned char*)&v)[2]
+#define VT_A(v)        ((unsigned char*)&v)[3]
+#define VT_RGBA(v,r,g,b,a)     VT_R(v)=(unsigned char)r, VT_G(v)=(unsigned char)g, VT_B(v)=(unsigned char)b, VT_A(v)=(unsigned char)a
 
 // forward declaration
 class FilterBase;
index 50c3a87ffc41947298bd1d520f00b87bb1e89f34..43d7566102a550792825a5f6e330f0e247c4631b 100644 (file)
@@ -125,10 +125,10 @@ static int setLimits (PyFilter * self, PyObject * value, void * closure)
 // attributes structure
 static PyGetSetDef filterBSGetSets[] =
 { 
-       {"color", (getter)getColor, (setter)setColor, "blue screen color", NULL},
-       {"limits", (getter)getLimits, (setter)setLimits, "blue screen color limits", NULL},
+       {(char*)"color", (getter)getColor, (setter)setColor, (char*)"blue screen color", NULL},
+       {(char*)"limits", (getter)getLimits, (setter)setLimits, (char*)"blue screen color limits", NULL},
        // attributes from FilterBase class
-       {"previous", (getter)Filter_getPrevious, (setter)Filter_setPrevious, "previous pixel filter", NULL},
+       {(char*)"previous", (getter)Filter_getPrevious, (setter)Filter_setPrevious, (char*)"previous pixel filter", NULL},
        {NULL}
 };
 
index 20660804f78e3ee29a25582816914c1222518d11..820e4a44501e73c86c6c3213ce6e7dd1810f35e6 100644 (file)
@@ -63,25 +63,24 @@ protected:
                short * size, unsigned int pixSize, unsigned int val)
        {
                // calculate differences
-               int difRed = int((val >> 16) & 0xFF) - int(m_color[0]);
-               int difGreen = int((val >> 8) & 0xFF) - int(m_color[1]);
-               int difBlue = int(val & 0xFF) - int(m_color[2]);
+               int difRed = int(VT_R(val)) - int(m_color[0]);
+               int difGreen = int(VT_G(val)) - int(m_color[1]);
+               int difBlue = int(VT_B(val)) - int(m_color[2]);
                // calc distance from "blue screen" color
                unsigned int dist = (unsigned int)(difRed * difRed + difGreen * difGreen
                        + difBlue * difBlue);
                // condition for fully transparent color
                if (m_squareLimits[0] >= dist) 
                        // return color with zero alpha
-                       //return 0xFF000000;
-                       return val & 0x00FFFFFF;
+                       VT_A(val) = 0;
                // condition for fully opaque color
                else if (m_squareLimits[1] <= dist)
                        // return normal colour
-                       return val | 0xFF000000;
+                       VT_A(val) = 0xFF;
                // otherwise calc alpha
                else
-                       return (val & 0x00FFFFFF) | ((((dist - m_squareLimits[0]) << 8)
-                       / m_limitDist) << 24);
+                       VT_A(val) = (((dist - m_squareLimits[0]) << 8) / m_limitDist);
+               return val;
        }
 
        /// virtual filtering function for byte source
index a1ddf581aef162577de7df08a4cb1939b9f2152c..22ee729b200f7bb3fc8767146cea3ff1e5f476e3 100644 (file)
@@ -34,7 +34,7 @@ http://www.gnu.org/copyleft/lesser.txt.
 // attributes structure
 static PyGetSetDef filterGrayGetSets[] =
 { // attributes from FilterBase class
-       {"previous", (getter)Filter_getPrevious, (setter)Filter_setPrevious, "previous pixel filter", NULL},
+       {(char*)"previous", (getter)Filter_getPrevious, (setter)Filter_setPrevious, (char*)"previous pixel filter", NULL},
        {NULL}
 };
 
@@ -164,9 +164,9 @@ static int setMatrix (PyFilter * self, PyObject * value, void * closure)
 // attributes structure
 static PyGetSetDef filterColorGetSets[] =
 { 
-       {"matrix", (getter)getMatrix, (setter)setMatrix, "matrix [4][5] for color calculation", NULL},
+       {(char*)"matrix", (getter)getMatrix, (setter)setMatrix, (char*)"matrix [4][5] for color calculation", NULL},
        // attributes from FilterBase class
-       {"previous", (getter)Filter_getPrevious, (setter)Filter_setPrevious, "previous pixel filter", NULL},
+       {(char*)"previous", (getter)Filter_getPrevious, (setter)Filter_setPrevious, (char*)"previous pixel filter", NULL},
        {NULL}
 };
 
@@ -223,7 +223,7 @@ FilterLevel::FilterLevel (void)
        for (int r = 0; r < 4; ++r)
        {
                levels[r][0] = 0;
-               levels[r][1] = 0xFF << (r << 3);
+               levels[r][1] = 0xFF;
                levels[r][2] = 0xFF;
        }
 }
@@ -235,7 +235,7 @@ void FilterLevel::setLevels (ColorLevel & lev)
        for (int r = 0; r < 4; ++r)
        {
                for (int c = 0; c < 2; ++c)
-                       levels[r][c] = lev[r][c] << (r << 3);
+                       levels[r][c] = lev[r][c];
                levels[r][2] = lev[r][0] < lev[r][1] ? lev[r][1] - lev[r][0] : 1;
        }
 }
@@ -252,9 +252,9 @@ inline FilterLevel * getFilterLevel (PyFilter * self)
 static PyObject * getLevels (PyFilter * self, void * closure)
 {
        ColorLevel & lev = getFilterLevel(self)->getLevels();
-       return Py_BuildValue("((kk)(kk)(kk)(kk))",
-               lev[0][0], lev[0][1], lev[1][0] >> 8, lev[1][1] >> 8,
-               lev[2][0] >> 16, lev[2][1] >> 16, lev[3][0] >> 24, lev[3][1] >> 24);
+       return Py_BuildValue("((HH)(HH)(HH)(HH))",
+               lev[0][0], lev[0][1], lev[1][0], lev[1][1],
+               lev[2][0], lev[2][1], lev[3][0], lev[3][1]);
 }
 
 // set color levels
@@ -279,7 +279,7 @@ static int setLevels (PyFilter * self, PyObject * value, void * closure)
                        valid = PyInt_Check(PySequence_Fast_GET_ITEM(row, c));
                        // if it is valid, save it in matrix
                        if (valid)
-                               lev[r][c] = (unsigned long)(PyInt_AsLong(PySequence_Fast_GET_ITEM(row, c)));
+                               lev[r][c] = (unsigned short)(PyInt_AsLong(PySequence_Fast_GET_ITEM(row, c)));
                }
        }
        // if parameter is not valid, report error
@@ -298,9 +298,9 @@ static int setLevels (PyFilter * self, PyObject * value, void * closure)
 // attributes structure
 static PyGetSetDef filterLevelGetSets[] =
 { 
-       {"levels", (getter)getLevels, (setter)setLevels, "levels matrix [4] (min, max)", NULL},
+       {(char*)"levels", (getter)getLevels, (setter)setLevels, (char*)"levels matrix [4] (min, max)", NULL},
        // attributes from FilterBase class
-       {"previous", (getter)Filter_getPrevious, (setter)Filter_setPrevious, "previous pixel filter", NULL},
+       {(char*)"previous", (getter)Filter_getPrevious, (setter)Filter_setPrevious, (char*)"previous pixel filter", NULL},
        {NULL}
 };
 
index ae2e98fa942ff5ef520971eaecb376343cdfedc2..b7e52c4521c3c6f954a4fb17dd810cb7304d53d5 100644 (file)
@@ -43,10 +43,13 @@ protected:
                short * size, unsigned int pixSize, unsigned int val)
        {
                // calculate gray value
-               unsigned int gray = (28 * ((val >> 16) & 0xFF) + 151 * ((val >> 8) & 0xFF)
-                       + 77 * (val & 0xFF)) & 0xFF00;
+               unsigned int gray = (28 * (VT_B(val)) + 151 * (VT_G(val))
+                       + 77 * (VT_R(val))) >> 8;
                // return gray scale value
-               return (val & 0xFF000000) | gray << 8 | gray | gray >> 8;
+               VT_R(val) = gray;
+               VT_G(val) = gray;
+               VT_B(val) = gray;
+               return val;
        }
 
        /// virtual filtering function for byte source
@@ -82,11 +85,11 @@ protected:
        ColorMatrix m_matrix;
 
        /// calculate one color component
-       unsigned int calcColor (unsigned int val, short idx)
+       unsigned char calcColor (unsigned int val, short idx)
        {
-               return (((m_matrix[idx][0]  * (val & 0xFF) + m_matrix[idx][1] * ((val >> 8) & 0xFF)
-                       + m_matrix[idx][2] * ((val >> 16) & 0xFF) + m_matrix[idx][3] * ((val >> 24) & 0xFF)
-                       + m_matrix[idx][4]) >> 8) & 0xFF) << (idx << 3);
+               return (((m_matrix[idx][0]  * (VT_R(val)) + m_matrix[idx][1] * (VT_G(val))
+                       + m_matrix[idx][2] * (VT_B(val)) + m_matrix[idx][3] * (VT_A(val))
+                       + m_matrix[idx][4]) >> 8) & 0xFF);
        }
 
        /// filter pixel template, source int buffer
@@ -94,8 +97,9 @@ protected:
                short * size, unsigned int pixSize, unsigned int val)
        {
                // return calculated color
-               return calcColor(val, 0) | calcColor(val, 1) | calcColor(val, 2)
-                       | calcColor(val, 3);
+               int color;
+               VT_RGBA(color, calcColor(val, 0), calcColor(val, 1), calcColor(val, 2), calcColor(val, 3));
+               return color;
        }
 
        /// virtual filtering function for byte source
@@ -110,7 +114,7 @@ protected:
 
 
 /// type for color levels
-typedef unsigned long ColorLevel[4][3];
+typedef unsigned short ColorLevel[4][3];
 
 /// pixel filter for color calculation
 class FilterLevel : public FilterBase
@@ -133,11 +137,10 @@ protected:
        /// calculate one color component
        unsigned int calcColor (unsigned int val, short idx)
        {
-               unsigned int col = val & (0xFF << (idx << 3));
+               unsigned int col = VT_C(val,idx);;
                if (col <= levels[idx][0]) col = 0;
-               else if (col >= levels[idx][1]) col = 0xFF << (idx << 3);
-               else if (idx < 3) col = (((col - levels[idx][0]) << 8) / levels[idx][2]) & (0xFF << (idx << 3));
-               else col = (((col - levels[idx][0]) / levels[idx][2]) << 8) & (0xFF << (idx << 3));
+               else if (col >= levels[idx][1]) col = 0xFF;
+               else col = (((col - levels[idx][0]) << 8) / levels[idx][2]) & 0xFF;
                return col; 
        }
 
@@ -146,8 +149,9 @@ protected:
                short * size, unsigned int pixSize, unsigned int val)
        {
                // return calculated color
-               return calcColor(val, 0) | calcColor(val, 1) | calcColor(val, 2)
-                       | calcColor(val, 3);
+               int color;
+               VT_RGBA(color, calcColor(val, 0), calcColor(val, 1), calcColor(val, 2), calcColor(val, 3));
+               return color;
        }
 
        /// virtual filtering function for byte source
index 514214bec8b61aa5fac6fc79ef77f3d3abdd4f44..03a79c1c8ce95eaf7d3f2d866ae72632af06ea8d 100644 (file)
@@ -32,7 +32,7 @@ http://www.gnu.org/copyleft/lesser.txt.
 // implementation FilterNormal
 
 // constructor
-FilterNormal::FilterNormal (void) : m_colShift(0)
+FilterNormal::FilterNormal (void) : m_colIdx(0)
 {
        // set default depth
        setDepth(4);
@@ -44,7 +44,7 @@ void FilterNormal::setColor (unsigned short colIdx)
        // check validity of index
        if (colIdx < 3)
                // set color shift
-               m_colShift = colIdx << 3;
+               m_colIdx = colIdx;
 }
 
 // set depth
@@ -109,10 +109,10 @@ static int setDepth (PyFilter * self, PyObject * value, void * closure)
 // attributes structure
 static PyGetSetDef filterNormalGetSets[] =
 { 
-       {"colorIdx", (getter)getColor, (setter)setColor, "index of color used to calculate normal (0 - red, 1 - green, 2 - blue)", NULL},
-       {"depth", (getter)getDepth, (setter)setDepth, "depth of relief", NULL},
+       {(char*)"colorIdx", (getter)getColor, (setter)setColor, (char*)"index of color used to calculate normal (0 - red, 1 - green, 2 - blue)", NULL},
+       {(char*)"depth", (getter)getDepth, (setter)setDepth, (char*)"depth of relief", NULL},
        // attributes from FilterBase class
-       {"previous", (getter)Filter_getPrevious, (setter)Filter_setPrevious, "previous pixel filter", NULL},
+       {(char*)"previous", (getter)Filter_getPrevious, (setter)Filter_setPrevious, (char*)"previous pixel filter", NULL},
        {NULL}
 };
 
index ec51ca39db9710fd2273807cf2be438ded1c67fe..840043be9a133c02eb99b045f814049a3776aa83 100644 (file)
@@ -43,7 +43,7 @@ public:
        virtual ~FilterNormal (void) {}
 
        /// get index of color used to calculate normals
-       unsigned short getColor (void) { return m_colShift >> 3; }
+       unsigned short getColor (void) { return m_colIdx; }
        /// set index of color used to calculate normals
        void setColor (unsigned short colIdx);
 
@@ -58,20 +58,28 @@ protected:
        /// scale to calculate normals
        float m_depthScale;
 
-       /// shift to used color component
-       unsigned short m_colShift;
+       /// color index, 0=red, 1=green, 2=blue, 3=alpha
+       unsigned short m_colIdx;
 
        /// filter pixel, source int buffer
        template <class SRC> unsigned int tFilter (SRC * src, short x, short y,
                short * size, unsigned int pixSize, unsigned int val = 0)
        {
                // get value of required color
-               int actPix = int((val >> m_colShift) & 0xFF);
+               int actPix = int(VT_C(val,m_colIdx));
+               int upPix = actPix;
+               int leftPix = actPix;
                // get upper and left pixel from actual pixel
-               int upPix = y > 0 ? int((convertPrevious(src - pixSize * size[0], x, y - 1,
-                       size, pixSize) >> m_colShift) & 0xFF) : actPix;
-               int leftPix = x > 0 ? int((convertPrevious(src - pixSize, x - 1, y, size, pixSize)
-                       >> m_colShift) & 0xFF) : actPix;
+               if (y > 0)
+               {
+                       val = convertPrevious(src - pixSize * size[0], x, y - 1, size, pixSize);
+                       upPix = VT_C(val,m_colIdx);
+               }
+               if (x > 0)
+               {
+                       val = convertPrevious(src - pixSize, x - 1, y, size, pixSize);
+                       leftPix = VT_C(val,m_colIdx);
+               }
                // height differences (from blue color)
                float dx = (actPix - leftPix) * m_depthScale;
                float dy = (actPix - upPix) * m_depthScale;
@@ -81,7 +89,8 @@ protected:
                dy = dy * dz + normScaleKoef;
                dz += normScaleKoef;
                // return normal vector converted to color
-               return 0xFF000000 | int(dz) << 16 | int(dy) << 8 | int(dx);
+               VT_RGBA(val, dx, dy, dz, 0xFF);
+               return val;
        }
 
        /// filter pixel, source byte buffer
index 8d8749dbc8f3efb4dfe50c20d92e811c38e7c9f6..f3676e93a6d6665ec6aa849c176e7cd6a5d4bfbd 100644 (file)
@@ -77,6 +77,52 @@ PyTypeObject FilterRGB24Type =
        Filter_allocNew,           /* tp_new */
 };
 
+// FilterRGBA32
+
+// define python type
+PyTypeObject FilterRGBA32Type =
+{ 
+       PyObject_HEAD_INIT(NULL)
+       0,                         /*ob_size*/
+       "VideoTexture.FilterRGBA32",   /*tp_name*/
+       sizeof(PyFilter),          /*tp_basicsize*/
+       0,                         /*tp_itemsize*/
+       (destructor)Filter_dealloc,/*tp_dealloc*/
+       0,                         /*tp_print*/
+       0,                         /*tp_getattr*/
+       0,                         /*tp_setattr*/
+       0,                         /*tp_compare*/
+       0,                         /*tp_repr*/
+       0,                         /*tp_as_number*/
+       0,                         /*tp_as_sequence*/
+       0,                         /*tp_as_mapping*/
+       0,                         /*tp_hash */
+       0,                         /*tp_call*/
+       0,                         /*tp_str*/
+       0,                         /*tp_getattro*/
+       0,                         /*tp_setattro*/
+       0,                         /*tp_as_buffer*/
+       Py_TPFLAGS_DEFAULT,        /*tp_flags*/
+       "Source filter RGBA32 objects",       /* tp_doc */
+       0,                             /* tp_traverse */
+       0,                             /* tp_clear */
+       0,                             /* tp_richcompare */
+       0,                             /* tp_weaklistoffset */
+       0,                             /* tp_iter */
+       0,                             /* tp_iternext */
+       NULL,                /* tp_methods */
+       0,                   /* tp_members */
+       NULL,             /* tp_getset */
+       0,                         /* tp_base */
+       0,                         /* tp_dict */
+       0,                         /* tp_descr_get */
+       0,                         /* tp_descr_set */
+       0,                         /* tp_dictoffset */
+       (initproc)Filter_init<FilterRGBA32>,     /* tp_init */
+       0,                         /* tp_alloc */
+       Filter_allocNew,           /* tp_new */
+};
+
 // FilterBGR24
 
 // define python type
index c3d4e0079f9bae6e7a6a8138aac69bab025d6200..7e90747d2522f5ae6fdeb93b29291eeb5ab86704 100644 (file)
@@ -44,7 +44,34 @@ protected:
        /// filter pixel, source byte buffer
        virtual unsigned int filter (unsigned char * src, short x, short y,
                short * size, unsigned int pixSize, unsigned int val)
-       { return 0xFF000000 | src[0] << 16 | src[1] << 8 | src[2]; }
+       { VT_RGBA(val,src[0],src[1],src[2],0xFF); return val; }
+};
+
+/// class for RGBA32 conversion
+class FilterRGBA32 : public FilterBase
+{
+public:
+       /// constructor
+       FilterRGBA32 (void) {}
+       /// destructor
+       virtual ~FilterRGBA32 (void) {}
+
+       /// get source pixel size
+       virtual unsigned int getPixelSize (void) { return 4; }
+
+protected:
+       /// filter pixel, source byte buffer
+       virtual unsigned int filter (unsigned char * src, short x, short y,
+               short * size, unsigned int pixSize, unsigned int val)
+       { 
+               if ((intptr_t(src)&0x3) == 0) 
+                       return *(unsigned int*)src;
+               else 
+               {
+                       VT_RGBA(val,src[0],src[1],src[2],src[3]); 
+                       return val; 
+               }
+       }
 };
 
 /// class for BGR24 conversion
@@ -63,7 +90,7 @@ protected:
        /// filter pixel, source byte buffer
        virtual unsigned int filter (unsigned char * src, short x, short y,
                short * size, unsigned int pixSize, unsigned int val)
-       { return 0xFF000000 | src[2] << 16 | src[1] << 8 | src[0]; }
+       { VT_RGBA(val,src[2],src[1],src[0],0xFF); return val; }
 };
 
 /// class for YV12 conversion
@@ -215,15 +242,15 @@ protected:
                int red = (298 * c + 409 * e + 128) >> 8;
                if (red >= 0x100) red = 0xFF;
                else if (red < 0) red = 0;
-               int green = 298 * c - 100 * d - 208 * e;
-               if (green > 0x10000) green = 0xFF00;
+               int green = (298 * c - 100 * d - 208 * e) >> 8;
+               if (green >= 0x100) green = 0xFF;
                else if (green < 0) green = 0;
-               int blue = (298 * c + 516 * d + 128) << 8;
-               if (blue > 0x1000000) blue = 0xFF0000;
+               int blue = (298 * c + 516 * d + 128) >> 8;
+               if (blue >= 0x100) blue = 0xFF;
                else if (blue < 0) blue = 0;
                // return result
-               return 0xFF000000 | blue & 0xFF0000 | green & 0xFF00
-                       | red & 0xFF;
+               VT_RGBA(val, red, green, blue, 0xFF);
+               return val;
        }
 };
 
index a0c6e1f6f744561886cc9c77cf0439bf24fa0d9e..19ad17ac64326cd09dad2eb6e2707d0752266160 100644 (file)
@@ -32,7 +32,7 @@ http://www.gnu.org/copyleft/lesser.txt.
 
 
 // default filter
-FilterBGR24 defFilter;
+FilterRGB24 defFilter;
 
 
 // load image from buffer
@@ -111,11 +111,11 @@ static PyMethodDef imageBuffMethods[] =
 // attributes structure
 static PyGetSetDef imageBuffGetSets[] =
 {      // attributes from ImageBase class
-       {"image", (getter)Image_getImage, NULL, "image data", NULL},
-       {"size", (getter)Image_getSize, NULL, "image size", NULL},
-       {"scale", (getter)Image_getScale, (setter)Image_setScale, "fast scale of image (near neighbour)", NULL},
-       {"flip", (getter)Image_getFlip, (setter)Image_setFlip, "flip image vertically", NULL},
-       {"filter", (getter)Image_getFilter, (setter)Image_setFilter, "pixel filter", NULL},
+       {(char*)"image", (getter)Image_getImage, NULL, (char*)"image data", NULL},
+       {(char*)"size", (getter)Image_getSize, NULL, (char*)"image size", NULL},
+       {(char*)"scale", (getter)Image_getScale, (setter)Image_setScale, (char*)"fast scale of image (near neighbour)", NULL},
+       {(char*)"flip", (getter)Image_getFlip, (setter)Image_setFlip, (char*)"flip image vertically", NULL},
+       {(char*)"filter", (getter)Image_getFilter, (setter)Image_setFilter, (char*)"pixel filter", NULL},
        {NULL}
 };
 
index 8532249f7d86e93aed4d5896a40969d8c81841f7..b07b362818cf968511a9062c280bdb4af18331af 100644 (file)
@@ -150,11 +150,11 @@ static PyMethodDef imageMixMethods[] =
 // attributes structure
 static PyGetSetDef imageMixGetSets[] =
 { // attributes from ImageBase class
-       {"image", (getter)Image_getImage, NULL, "image data", NULL},
-       {"size", (getter)Image_getSize, NULL, "image size", NULL},
-       {"scale", (getter)Image_getScale, (setter)Image_setScale, "fast scale of image (near neighbour)", NULL},
-       {"flip", (getter)Image_getFlip, (setter)Image_setFlip, "flip image vertically", NULL},
-       {"filter", (getter)Image_getFilter, (setter)Image_setFilter, "pixel filter", NULL},
+       {(char*)"image", (getter)Image_getImage, NULL, (char*)"image data", NULL},
+       {(char*)"size", (getter)Image_getSize, NULL, (char*)"image size", NULL},
+       {(char*)"scale", (getter)Image_getScale, (setter)Image_setScale, (char*)"fast scale of image (near neighbour)", NULL},
+       {(char*)"flip", (getter)Image_getFlip, (setter)Image_setFlip, (char*)"flip image vertically", NULL},
+       {(char*)"filter", (getter)Image_getFilter, (setter)Image_setFilter, (char*)"pixel filter", NULL},
        {NULL}
 };
 
index fb284261d705da8bdff27d66eb2b134e7a5a7704..2f2d9debd48451ba51506a04ff42ddcf965d9ee5 100644 (file)
@@ -207,13 +207,13 @@ static PyMethodDef imageRenderMethods[] =
 // attributes structure
 static PyGetSetDef imageRenderGetSets[] =
 { 
-       {"background", (getter)getBackground, (setter)setBackground, "background color", NULL},
+       {(char*)"background", (getter)getBackground, (setter)setBackground, (char*)"background color", NULL},
        // attributes from ImageBase class
-       {"image", (getter)Image_getImage, NULL, "image data", NULL},
-       {"size", (getter)Image_getSize, NULL, "image size", NULL},
-       {"scale", (getter)Image_getScale, (setter)Image_setScale, "fast scale of image (near neighbour)",       NULL},
-       {"flip", (getter)Image_getFlip, (setter)Image_setFlip, "flip image vertically", NULL},
-       {"filter", (getter)Image_getFilter, (setter)Image_setFilter, "pixel filter", NULL},
+       {(char*)"image", (getter)Image_getImage, NULL, (char*)"image data", NULL},
+       {(char*)"size", (getter)Image_getSize, NULL, (char*)"image size", NULL},
+       {(char*)"scale", (getter)Image_getScale, (setter)Image_setScale, (char*)"fast scale of image (near neighbour)", NULL},
+       {(char*)"flip", (getter)Image_getFlip, (setter)Image_setFlip, (char*)"flip image vertically", NULL},
+       {(char*)"filter", (getter)Image_getFilter, (setter)Image_setFilter, (char*)"pixel filter", NULL},
        {NULL}
 };
 
index 4ed1cd9e80132011ee9ca9559c700fd3d5dcd73f..deb66ffb6ba4500d783dae579b38f02ed8d89756 100644 (file)
@@ -135,7 +135,7 @@ void ImageViewport::calcImage (unsigned int texId)
                glReadPixels(m_upLeft[0], m_upLeft[1], (GLsizei)m_capSize[0], (GLsizei)m_capSize[1], GL_RGB,
                        GL_UNSIGNED_BYTE, m_viewportImage);
                // filter loaded data
-               FilterBGR24 filt;
+               FilterRGB24 filt;
                filterImage(filt, m_viewportImage, m_capSize);
        }
 }
@@ -239,15 +239,15 @@ static PyMethodDef imageViewportMethods[] =
 // attributes structure
 static PyGetSetDef imageViewportGetSets[] =
 { 
-       {"whole", (getter)ImageViewport_getWhole, (setter)ImageViewport_setWhole, "use whole viewport to capture", NULL},
-       {"position", (getter)ImageViewport_getPosition, (setter)ImageViewport_setPosition, "upper left corner of captured area", NULL},
-       {"capsize", (getter)ImageViewport_getCaptureSize, (setter)ImageViewport_setCaptureSize, "size of viewport area being captured", NULL},
+       {(char*)"whole", (getter)ImageViewport_getWhole, (setter)ImageViewport_setWhole, (char*)"use whole viewport to capture", NULL},
+       {(char*)"position", (getter)ImageViewport_getPosition, (setter)ImageViewport_setPosition, (char*)"upper left corner of captured area", NULL},
+       {(char*)"capsize", (getter)ImageViewport_getCaptureSize, (setter)ImageViewport_setCaptureSize, (char*)"size of viewport area being captured", NULL},
        // attributes from ImageBase class
-       {"image", (getter)Image_getImage, NULL, "image data", NULL},
-       {"size", (getter)Image_getSize, NULL, "image size", NULL},
-       {"scale", (getter)Image_getScale, (setter)Image_setScale, "fast scale of image (near neighbour)", NULL},
-       {"flip", (getter)Image_getFlip, (setter)Image_setFlip, "flip image vertically", NULL},
-       {"filter", (getter)Image_getFilter, (setter)Image_setFilter, "pixel filter", NULL},
+       {(char*)"image", (getter)Image_getImage, NULL, (char*)"image data", NULL},
+       {(char*)"size", (getter)Image_getSize, NULL, (char*)"image size", NULL},
+       {(char*)"scale", (getter)Image_getScale, (setter)Image_setScale, (char*)"fast scale of image (near neighbour)", NULL},
+       {(char*)"flip", (getter)Image_getFlip, (setter)Image_setFlip, (char*)"flip image vertically", NULL},
+       {(char*)"filter", (getter)Image_getFilter, (setter)Image_setFilter, (char*)"pixel filter", NULL},
        {NULL}
 };
 
index 0451d74c8add9f9835d884fe048c81998408421e..6d2676dce09b139c8e6aeb1d741fc57e21ce3a96 100644 (file)
@@ -78,6 +78,6 @@ void PyTypeList::reg (PyObject * module)
                        // increase ref count
                        Py_INCREF((*it)->getType());
                        // add type to module
-                       PyModule_AddObject(module, (*it)->getName(), (PyObject*)(*it)->getType());
+                       PyModule_AddObject(module, (char*)(*it)->getName(), (PyObject*)(*it)->getType());
                }
 }
index ceda39aeff44917c33f31055aa1f594f5824dc99..88a26e3c0884eb21b93f478e92d8750254d80b35 100644 (file)
@@ -54,9 +54,6 @@ http://www.gnu.org/copyleft/lesser.txt.
 { exp.report(); }
 
 
-// are Blender materials used
-bool blendMats = false;
-
 // Blender GameObject type
 BlendType<KX_GameObject> gameObjectType ("KX_GameObject");
 
@@ -198,15 +195,22 @@ int Texture_init (Texture *self, PyObject *args, PyObject *kwds)
                        if (mat != NULL)
                        {
                                // is it blender material or polygon material
-                               blendMats = (mat->GetFlag() & RAS_BLENDERMAT) != 0;
-                               if (blendMats)
+                               if (mat->GetFlag() & RAS_BLENDERGLSL) 
+                               {
+                                       self->m_imgTexture = static_cast<KX_BlenderMaterial*>(mat)->getImage(texID);
+                                       self->m_useMatTexture = false;
+                               } else if (mat->GetFlag() & RAS_BLENDERMAT)
+                               {
                                        // get blender material texture
                                        self->m_matTexture = static_cast<KX_BlenderMaterial*>(mat)->getTex(texID);
+                                       self->m_useMatTexture = true;
+                               }
                                else
                                {
                                        // get texture pointer from polygon material
                                        MTFace * tface = static_cast<KX_PolygonMaterial*>(mat)->GetMTFace();
                                        self->m_imgTexture = (Image*)tface->tpage;
+                                       self->m_useMatTexture = false;
                                }
                        }
                        // check if texture is available, if not, initialization failed
@@ -246,7 +250,7 @@ PyObject * Texture_close(Texture * self)
        {
                self->m_orgSaved = false;
                // restore original texture code
-               if (blendMats)
+               if (self->m_useMatTexture)
                        self->m_matTexture->swapTexture(self->m_orgTex);
                else
                        self->m_imgTexture->bindcode = self->m_orgTex;
@@ -292,7 +296,7 @@ PyObject * Texture_refresh (Texture * self, PyObject * args)
                                {
                                        self->m_orgSaved = true;
                                        // save original image code
-                                       if (blendMats)
+                                       if (self->m_useMatTexture)
                                                self->m_orgTex = self->m_matTexture->swapTexture(self->m_actTex);
                                        else
                                        {
@@ -412,8 +416,8 @@ static PyMethodDef textureMethods[] =
 // class Texture attributes
 static PyGetSetDef textureGetSets[] =
 { 
-       {"source", (getter)Texture_getSource, (setter)Texture_setSource, "source of texture", NULL},
-       {"mipmap", (getter)Texture_getMipmap, (setter)Texture_setMipmap, "mipmap texture", NULL},
+       {(char*)"source", (getter)Texture_getSource, (setter)Texture_setSource, (char*)"source of texture", NULL},
+       {(char*)"mipmap", (getter)Texture_getMipmap, (setter)Texture_setMipmap, (char*)"mipmap texture", NULL},
        {NULL}
 };
 
index 569e34da121523b167c2c970cd9db9fc81ae8f99..3c371e51537c31bc8299f21a7a950ada996fdfa8 100644 (file)
@@ -39,9 +39,11 @@ struct Texture
 {
        PyObject_HEAD
 
+       // texture is using blender material
+       bool m_useMatTexture;
+
        // video texture bind code
        unsigned int m_actTex;
-
        // original texture bind code
        unsigned int m_orgTex;
        // original texture saved
@@ -70,9 +72,6 @@ struct Texture
 // Texture type description
 extern PyTypeObject TextureType;
 
-// usage of Blender materials
-extern bool blendMats;
-
 // load texture
 void loadTexture (unsigned int texId, unsigned int * texture, short * size,
                                  bool mipmap = false);
index 272d2695c4b38e3e099f47c2b882e91d70149433..dfbd61daee8d03c7284e135315e6da5cb1c4b01c 100644 (file)
@@ -20,6 +20,11 @@ http://www.gnu.org/copyleft/lesser.txt.
 -----------------------------------------------------------------------------
 */
 
+// INT64_C fix for some linux machines (C99ism)
+#define __STDC_CONSTANT_MACROS
+#include <stdint.h>
+
+
 #include "MEM_guardedalloc.h"
 #include "PIL_time.h"
 
@@ -46,10 +51,10 @@ extern "C" void do_init_ffmpeg();
 // constructor
 VideoFFmpeg::VideoFFmpeg (HRESULT * hRslt) : VideoBase(), 
 m_codec(NULL), m_formatCtx(NULL), m_codecCtx(NULL), 
-m_frame(NULL), m_frameDeinterlaced(NULL), m_frameBGR(NULL), m_imgConvertCtx(NULL),
+m_frame(NULL), m_frameDeinterlaced(NULL), m_frameRGB(NULL), m_imgConvertCtx(NULL),
 m_deinterlace(false), m_preseek(0),    m_videoStream(-1), m_baseFrameRate(25.0),
 m_lastFrame(-1),  m_curPosition(-1), m_startTime(0), 
-m_captWidth(0), m_captHeight(0), m_captRate(0.f)
+m_captWidth(0), m_captHeight(0), m_captRate(0.f), m_isImage(false)
 {
        // set video format
        m_format = RGB24;
@@ -72,49 +77,48 @@ bool VideoFFmpeg::release()
        if (m_codecCtx)
        {
                avcodec_close(m_codecCtx);
+               m_codecCtx = NULL;
        }
        if (m_formatCtx)
        {
                av_close_input_file(m_formatCtx);
+               m_formatCtx = NULL;
        }
        if (m_frame)
        {
                av_free(m_frame);
+               m_frame = NULL;
        }
        if (m_frameDeinterlaced)
        {
                MEM_freeN(m_frameDeinterlaced->data[0]);
                av_free(m_frameDeinterlaced);
+               m_frameDeinterlaced = NULL;
        }
-       if (m_frameBGR)
+       if (m_frameRGB)
        {
-               MEM_freeN(m_frameBGR->data[0]);
-               av_free(m_frameBGR);
+               MEM_freeN(m_frameRGB->data[0]);
+               av_free(m_frameRGB);
+               m_frameRGB = NULL;
        }
        if (m_imgConvertCtx)
        {
                sws_freeContext(m_imgConvertCtx);
+               m_imgConvertCtx = NULL;
        }
-
        m_codec = NULL;
-       m_codecCtx = NULL;
-       m_formatCtx = NULL;
-       m_frame = NULL;
-       m_frame = NULL;
-       m_frameBGR = NULL;
-       m_imgConvertCtx = NULL;
-
-       // object will be deleted after that
+       m_status = SourceStopped;
        return true;
 }
 
 
 // set initial parameters
-void VideoFFmpeg::initParams (short width, short height, float rate)
+void VideoFFmpeg::initParams (short width, short height, float rate, bool image)
 {
        m_captWidth = width;
        m_captHeight = height;
        m_captRate = rate;
+       m_isImage = image;
 }
 
 int VideoFFmpeg::openStream(const char *filename, AVInputFormat *inputFormat, AVFormatParameters *formatParams)
@@ -184,7 +188,7 @@ int VideoFFmpeg::openStream(const char *filename, AVInputFormat *inputFormat, AV
        m_videoStream = videoStream;
        m_frame = avcodec_alloc_frame();
        m_frameDeinterlaced = avcodec_alloc_frame();
-       m_frameBGR = avcodec_alloc_frame();
+       m_frameRGB = avcodec_alloc_frame();
 
 
        // allocate buffer if deinterlacing is required
@@ -196,12 +200,12 @@ int VideoFFmpeg::openStream(const char *filename, AVInputFormat *inputFormat, AV
                m_codecCtx->pix_fmt, m_codecCtx->width, m_codecCtx->height);
 
        // allocate buffer to store final decoded frame
-       avpicture_fill((AVPicture*)m_frameBGR
+       avpicture_fill((AVPicture*)m_frameRGB
                (uint8_t*)MEM_callocN(avpicture_get_size(
-               PIX_FMT_BGR24,
+               PIX_FMT_RGB24,
                m_codecCtx->width, m_codecCtx->height),
-               "ffmpeg bgr"),
-               PIX_FMT_BGR24, m_codecCtx->width, m_codecCtx->height);
+               "ffmpeg rgb"),
+               PIX_FMT_RGB24, m_codecCtx->width, m_codecCtx->height);
        // allocate sws context
        m_imgConvertCtx = sws_getContext(
                m_codecCtx->width,
@@ -209,7 +213,7 @@ int VideoFFmpeg::openStream(const char *filename, AVInputFormat *inputFormat, AV
                m_codecCtx->pix_fmt,
                m_codecCtx->width,
                m_codecCtx->height,
-               PIX_FMT_BGR24,
+               PIX_FMT_RGB24,
                SWS_FAST_BILINEAR,
                NULL, NULL, NULL);
 
@@ -219,8 +223,8 @@ int VideoFFmpeg::openStream(const char *filename, AVInputFormat *inputFormat, AV
                av_free(m_frame);
                MEM_freeN(m_frameDeinterlaced->data[0]);
                av_free(m_frameDeinterlaced);
-               MEM_freeN(m_frameBGR->data[0]);
-               av_free(m_frameBGR);
+               MEM_freeN(m_frameRGB->data[0]);
+               av_free(m_frameRGB);
                return -1;
        }
        return 0;
@@ -250,7 +254,7 @@ void VideoFFmpeg::openFile (char * filename)
 
        if (
 #ifdef FFMPEG_PB_IS_POINTER
-        m_formatCtx->pb->is_streamed
+        m_formatCtx->pb && m_formatCtx->pb->is_streamed
 #else
         m_formatCtx->pb.is_streamed
 #endif
@@ -261,6 +265,18 @@ void VideoFFmpeg::openFile (char * filename)
                // for streaming it is important to do non blocking read
                m_formatCtx->flags |= AVFMT_FLAG_NONBLOCK;
        }
+
+       if (m_isImage) 
+       {
+               // the file is to be treated as an image, i.e. load the first frame only
+               m_isFile = false;
+               // in case of reload, the filename is taken from m_imageName, no need to change it
+               if (m_imageName.Ptr() != filename)
+                       m_imageName = filename;
+               m_preseek = 0;
+               play();
+       }
+
 }
 
 
@@ -343,7 +359,6 @@ void VideoFFmpeg::openCam (char * file, short camIdx)
        VideoBase::openCam(file, camIdx);
 }
 
-
 // play video
 bool VideoFFmpeg::play (void)
 {
@@ -445,6 +460,13 @@ void VideoFFmpeg::loadFrame (void)
                                init(short(m_codecCtx->width), short(m_codecCtx->height));
                                // process image
                                process((BYTE*)(frame->data[0]));
+                               // in case it is an image, automatically stop reading it
+                               if (m_isImage)
+                               {
+                                       m_status = SourceStopped;
+                                       // close the file as we don't need it anymore
+                                       release();
+                               }
                        }
                }
        }
@@ -560,14 +582,14 @@ bool VideoFFmpeg::grabFrame(long position)
                                                input = m_frameDeinterlaced;
                                        }
                                }
-                               // convert to BGR24
+                               // convert to RGB24
                                sws_scale(m_imgConvertCtx,
                                        input->data,
                                        input->linesize,
                                        0,
                                        m_codecCtx->height,
-                                       m_frameBGR->data,
-                                       m_frameBGR->linesize);
+                                       m_frameRGB->data,
+                                       m_frameRGB->linesize);
                                av_free_packet(&packet);
                                frameLoaded = true;
                                break;
@@ -687,18 +709,18 @@ static PyMethodDef videoMethods[] =
 // attributes structure
 static PyGetSetDef videoGetSets[] =
 { // methods from VideoBase class
-       {"status", (getter)Video_getStatus, NULL, "video status", NULL},
-       {"range", (getter)Video_getRange, (setter)Video_setRange, "replay range", NULL},
-       {"repeat", (getter)Video_getRepeat, (setter)Video_setRepeat, "repeat count, -1 for infinite repeat", NULL},
-       {"framerate", (getter)Video_getFrameRate, (setter)Video_setFrameRate, "frame rate", NULL},
+       {(char*)"status", (getter)Video_getStatus, NULL, (char*)"video status", NULL},
+       {(char*)"range", (getter)Video_getRange, (setter)Video_setRange, (char*)"replay range", NULL},
+       {(char*)"repeat", (getter)Video_getRepeat, (setter)Video_setRepeat, (char*)"repeat count, -1 for infinite repeat", NULL},
+       {(char*)"framerate", (getter)Video_getFrameRate, (setter)Video_setFrameRate, (char*)"frame rate", NULL},
        // attributes from ImageBase class
-       {"image", (getter)Image_getImage, NULL, "image data", NULL},
-       {"size", (getter)Image_getSize, NULL, "image size", NULL},
-       {"scale", (getter)Image_getScale, (setter)Image_setScale, "fast scale of image (near neighbour)", NULL},
-       {"flip", (getter)Image_getFlip, (setter)Image_setFlip, "flip image vertically", NULL},
-       {"filter", (getter)Image_getFilter, (setter)Image_setFilter, "pixel filter", NULL},
-       {"preseek", (getter)VideoFFmpeg_getPreseek, (setter)VideoFFmpeg_setPreseek, "nb of frames of preseek", NULL},
-       {"deinterlace", (getter)VideoFFmpeg_getDeinterlace, (setter)VideoFFmpeg_setDeinterlace, "deinterlace image", NULL},
+       {(char*)"image", (getter)Image_getImage, NULL, (char*)"image data", NULL},
+       {(char*)"size", (getter)Image_getSize, NULL, (char*)"image size", NULL},
+       {(char*)"scale", (getter)Image_getScale, (setter)Image_setScale, (char*)"fast scale of image (near neighbour)", NULL},
+       {(char*)"flip", (getter)Image_getFlip, (setter)Image_setFlip, (char*)"flip image vertically", NULL},
+       {(char*)"filter", (getter)Image_getFilter, (setter)Image_setFilter, (char*)"pixel filter", NULL},
+       {(char*)"preseek", (getter)VideoFFmpeg_getPreseek, (setter)VideoFFmpeg_setPreseek, (char*)"nb of frames of preseek", NULL},
+       {(char*)"deinterlace", (getter)VideoFFmpeg_getDeinterlace, (setter)VideoFFmpeg_setDeinterlace, (char*)"deinterlace image", NULL},
        {NULL}
 };
 
@@ -746,7 +768,123 @@ PyTypeObject VideoFFmpegType =
        Image_allocNew,           /* tp_new */
 };
 
+// object initialization
+static int ImageFFmpeg_init (PyObject * pySelf, PyObject * args, PyObject * kwds)
+{
+       PyImage * self = reinterpret_cast<PyImage*>(pySelf);
+       // parameters - video source
+       // file name or format type for capture (only for Linux: video4linux or dv1394)
+       char * file = NULL;
+
+       // get parameters
+       if (!PyArg_ParseTuple(args, "s", &file))
+               return -1; 
+
+       try
+       {
+               // create video object
+               Video_init<VideoFFmpeg>(self);
+
+               getVideoFFmpeg(self)->initParams(0, 0, 1.0, true);
+
+               // open video source
+               Video_open(getVideo(self), file, -1);
+       }
+       catch (Exception & exp)
+       {
+               exp.report();
+               return -1;
+       }
+       // initialization succeded
+       return 0;
+}
+
+PyObject * Image_reload (PyImage * self, PyObject *args)
+{
+       char * newname = NULL;
+
+       if (self->m_image != NULL && PyArg_ParseTuple(args, "|s", &newname))
+       {
+               VideoFFmpeg* video = getFFmpeg(self);
+               // check type of object
+               if (!newname)
+                       newname = video->getImageName();
+               if (!newname) {
+                       // if not set, retport error
+                       PyErr_SetString(PyExc_RuntimeError, "No image file name given");
+                       return NULL;
+               }
+               // make sure the previous file is cleared
+               video->release();
+               // open the new file
+               video->openFile(newname);
+       }
+       Py_RETURN_NONE;
+}
+
+// methods structure
+static PyMethodDef imageMethods[] =
+{ // methods from VideoBase class
+       {"refresh", (PyCFunction)Video_refresh, METH_NOARGS, "Refresh image, i.e. load it"},
+       {"reload", (PyCFunction)Image_reload, METH_VARARGS, "Reload image, i.e. reopen it"},
+       {NULL}
+};
+// attributes structure
+static PyGetSetDef imageGetSets[] =
+{ // methods from VideoBase class
+       {(char*)"status", (getter)Video_getStatus, NULL, (char*)"video status", NULL},
+       // attributes from ImageBase class
+       {(char*)"image", (getter)Image_getImage, NULL, (char*)"image data", NULL},
+       {(char*)"size", (getter)Image_getSize, NULL, (char*)"image size", NULL},
+       {(char*)"scale", (getter)Image_getScale, (setter)Image_setScale, (char*)"fast scale of image (near neighbour)", NULL},
+       {(char*)"flip", (getter)Image_getFlip, (setter)Image_setFlip, (char*)"flip image vertically", NULL},
+       {(char*)"filter", (getter)Image_getFilter, (setter)Image_setFilter, (char*)"pixel filter", NULL},
+       {NULL}
+};
 
+// python type declaration
+PyTypeObject ImageFFmpegType =
+{ 
+       PyObject_HEAD_INIT(NULL)
+       0,                         /*ob_size*/
+       "VideoTexture.ImageFFmpeg",   /*tp_name*/
+       sizeof(PyImage),          /*tp_basicsize*/
+       0,                         /*tp_itemsize*/
+       (destructor)Image_dealloc, /*tp_dealloc*/
+       0,                         /*tp_print*/
+       0,                         /*tp_getattr*/
+       0,                         /*tp_setattr*/
+       0,                         /*tp_compare*/
+       0,                         /*tp_repr*/
+       0,                         /*tp_as_number*/
+       0,                         /*tp_as_sequence*/
+       0,                         /*tp_as_mapping*/
+       0,                         /*tp_hash */
+       0,                         /*tp_call*/
+       0,                         /*tp_str*/
+       0,                         /*tp_getattro*/
+       0,                         /*tp_setattro*/
+       0,                         /*tp_as_buffer*/
+       Py_TPFLAGS_DEFAULT,        /*tp_flags*/
+       "FFmpeg image source",       /* tp_doc */
+       0,                             /* tp_traverse */
+       0,                             /* tp_clear */
+       0,                             /* tp_richcompare */
+       0,                             /* tp_weaklistoffset */
+       0,                             /* tp_iter */
+       0,                             /* tp_iternext */
+       imageMethods,    /* tp_methods */
+       0,                   /* tp_members */
+       imageGetSets,          /* tp_getset */
+       0,                         /* tp_base */
+       0,                         /* tp_dict */
+       0,                         /* tp_descr_get */
+       0,                         /* tp_descr_set */
+       0,                         /* tp_dictoffset */
+       (initproc)ImageFFmpeg_init,     /* tp_init */
+       0,                         /* tp_alloc */
+       Image_allocNew,           /* tp_new */
+};
 
 #endif //WITH_FFMPEG
 
index 4720bef1841b64db5de7910a169f5520ab2eca20..db2cb293d8b966b3df1b3cdd271c94ffd101f3df 100644 (file)
@@ -65,8 +65,8 @@ public:
        virtual ~VideoFFmpeg ();
 
        /// set initial parameters
-       void initParams (short width, short height, float rate);
-       /// open video file
+       void initParams (short width, short height, float rate, bool image=false);
+       /// open video/image file
        virtual void openFile (char * file);
        /// open video capture device
        virtual void openCam (char * driver, short camIdx);
@@ -88,6 +88,7 @@ public:
        void setPreseek(int preseek) { if (preseek >= 0) m_preseek = preseek; }
        bool getDeinterlace(void) { return m_deinterlace; }
        void setDeinterlace(bool deinterlace) { m_deinterlace = deinterlace; }
+       char *getImageName(void) { return (m_isImage) ? m_imageName.Ptr() : NULL; }
 
 protected:
 
@@ -100,7 +101,7 @@ protected:
        // deinterlaced frame if codec requires it
        AVFrame *m_frameDeinterlaced;
        // decoded RGB24 frame if codec requires it
-       AVFrame *m_frameBGR;
+       AVFrame *m_frameRGB;
        // conversion from raw to RGB is done with sws_scale
        struct SwsContext *m_imgConvertCtx;
        // should the codec be deinterlaced?
@@ -131,6 +132,12 @@ protected:
        /// frame rate of capture in frames per seconds
        float m_captRate;
 
+       /// is file an image?
+       bool m_isImage;
+
+       /// keep last image name
+       STR_String m_imageName;
+
        /// image calculation
        virtual void calcImage (unsigned int texId);
 
@@ -150,7 +157,7 @@ protected:
        bool grabFrame(long frame);
 
        /// return the frame in RGB24 format, the image data is found in AVFrame.data[0]
-       AVFrame* getFrame(void) { return m_frameBGR; }
+       AVFrame* getFrame(void) { return m_frameRGB; }
 };
 
 inline VideoFFmpeg * getFFmpeg (PyImage * self) 
index 629b589c0e6b07836afec290908b36da33d22b60..b38882f8164ac632ed6afe40a8d61a90708b16e7 100644 (file)
@@ -119,6 +119,7 @@ static PyMethodDef moduleMethods[] =
 
 #if WITH_FFMPEG
 extern PyTypeObject VideoFFmpegType;
+extern PyTypeObject ImageFFmpegType;
 #endif
 extern PyTypeObject FilterBlueScreenType;
 extern PyTypeObject FilterGrayType;
@@ -126,6 +127,7 @@ extern PyTypeObject FilterColorType;
 extern PyTypeObject FilterLevelType;
 extern PyTypeObject FilterNormalType;
 extern PyTypeObject FilterRGB24Type;
+extern PyTypeObject FilterRGBA32Type;
 extern PyTypeObject FilterBGR24Type;
 extern PyTypeObject ImageBuffType;
 extern PyTypeObject ImageMixType;
@@ -138,6 +140,7 @@ static void registerAllTypes(void)
 {
 #if WITH_FFMPEG
        pyImageTypes.add(&VideoFFmpegType, "VideoFFmpeg");
+       pyImageTypes.add(&ImageFFmpegType, "ImageFFmpeg");
 #endif
        pyImageTypes.add(&ImageBuffType, "ImageBuff");
        pyImageTypes.add(&ImageMixType, "ImageMix");
@@ -150,6 +153,7 @@ static void registerAllTypes(void)
        pyFilterTypes.add(&FilterLevelType, "FilterLevel");
        pyFilterTypes.add(&FilterNormalType, "FilterNormal");
        pyFilterTypes.add(&FilterRGB24Type, "FilterRGB24");
+       pyFilterTypes.add(&FilterRGBA32Type, "FilterRGBA32");
        pyFilterTypes.add(&FilterBGR24Type, "FilterBGR24");
 }
 
@@ -180,7 +184,7 @@ PyObject* initVideoTexture(void)
        pyFilterTypes.reg(m);
 
        Py_INCREF(&TextureType);
-       PyModule_AddObject(m, "Texture", (PyObject*)&TextureType);
+       PyModule_AddObject(m, (char*)"Texture", (PyObject*)&TextureType);
 
        // init last error description
        Exception::m_lastError[0] = '\0';
index af2a20eb95a4a2bdc7fec24b335d50f688f9bd2e..857d5c4d78056b68540ea7a09698a7f2883551b3 100644 (file)
@@ -416,14 +416,10 @@ class BlenderEnvironment(SConsEnvironment):
                     lenv.Append(CPPDEFINES=['GAMEBLENDER=1'])
             if lenv['WITH_BF_BULLET']:
                     lenv.Append(CPPDEFINES=['WITH_BULLET=1'])
-            # debug or not
-            # CXXFLAGS defaults to CCFLAGS, therefore
-            #  we Replace() rather than Append() to CXXFLAGS the first time
-            #lenv.Replace(CXXFLAGS = lenv['CCFLAGS'])
             if lenv['BF_DEBUG'] or (libname in quickdebug):
-                    lenv.Append(CFLAGS = Split(lenv['BF_DEBUG_CFLAGS']))
-                    lenv.Append(CCFLAGS = Split(lenv['BF_DEBUG_CCFLAGS']))
-                    lenv.Append(CXXFLAGS = Split(lenv['BF_DEBUG_CXXFLAGS']))
+                    lenv.Append(CFLAGS = lenv['BF_DEBUG_CFLAGS'])
+                    lenv.Append(CCFLAGS = lenv['BF_DEBUG_CCFLAGS'])
+                    lenv.Append(CXXFLAGS = lenv['BF_DEBUG_CXXFLAGS'])
             else:
                     lenv.Append(CFLAGS = lenv['REL_CFLAGS'])
                     lenv.Append(CCFLAGS = lenv['REL_CCFLAGS'])