somehow scripts line endings change is messing things up, these changes wont be included
error is:
svn: File 'release/scripts/scripttemplate_metaball_create.py' has inconsistent newlines
svn: Inconsistent line ending style
svn: Error reading spooled REPORT request response
This commit is contained in:
Campbell Barton 2008-11-05 15:11:40 +00:00
commit aa1ba2f3fb
70 changed files with 483 additions and 286 deletions

@ -88,14 +88,16 @@ INCLUDE(CMake/macros.cmake)
#Platform specifics
IF(UNIX)
INCLUDE(${CMAKE_ROOT}/Modules/FindOpenAL.cmake)
IF(OPENAL_FOUND)
SET(WITH_OPENAL ON)
SET(OPENAL_LIB ${OPENAL_LIBRARY})
SET(OPENAL_INC ${OPENAL_INCLUDE_DIR})
ELSE(OPENAL_FOUND)
SET(WITH_OPENAL OFF)
ENDIF(OPENAL_FOUND)
IF(WITH_OPENAL)
INCLUDE(${CMAKE_ROOT}/Modules/FindOpenAL.cmake)
IF(OPENAL_FOUND)
SET(WITH_OPENAL ON)
SET(OPENAL_LIB ${OPENAL_LIBRARY})
SET(OPENAL_INC ${OPENAL_INCLUDE_DIR})
ELSE(OPENAL_FOUND)
SET(WITH_OPENAL OFF)
ENDIF(OPENAL_FOUND)
ENDIF(WITH_OPENAL)
FIND_LIBRARY(ALUT_LIBRARY
NAMES alut

@ -260,11 +260,11 @@ CC_WARN = ['-Wall', '-Wno-long-double']
##LOPTS = --dynamic
##DYNLDFLAGS = -shared $(LDFLAGS)
BF_PROFILE_FLAGS = ' -pg -g '
BF_PROFILE_FLAGS = ['-pg', '-g ']
BF_PROFILE = False
BF_DEBUG = False
BF_DEBUG_FLAGS = '-g'
BF_DEBUG_FLAGS = ['-g']
BF_BUILDDIR='../build/darwin'
BF_INSTALLDIR='../install/darwin'

@ -201,7 +201,7 @@ BF_PROFILE_FLAGS = ['-pg','-g']
BF_PROFILE = False
BF_DEBUG = False
BF_DEBUG_FLAGS = '-g'
BF_DEBUG_FLAGS = ['-g']
BF_BUILDDIR = '../build/linux2'
BF_INSTALLDIR='../install/linux2'

@ -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_FLAGS= []
BF_BUILDDIR = '../build/linuxcross'
BF_INSTALLDIR='../install/linuxcross'

@ -155,11 +155,11 @@ LLIBS = 'm stdc++ pthread util'
##LOPTS = --dynamic
##DYNLDFLAGS = -shared $(LDFLAGS)
BF_PROFILE_FLAGS = ' -pg -g '
BF_PROFILE_FLAGS = ['-pg', '-g']
BF_PROFILE = False
BF_DEBUG = False
BF_DEBUG_FLAGS = '-g'
BF_DEBUG_FLAGS = ['-g']
BF_BUILDDIR='../build/openbsd3'
BF_INSTALLDIR='../install/openbsd3'

@ -173,11 +173,11 @@ BF_PROFILE_FLAGS = ['-pg','-g']
BF_PROFILE = False
BF_DEBUG = False
BF_DEBUG_FLAGS = ''
BF_DEBUG_FLAGS = []
BF_BUILDDIR = '../build/sunos5'
BF_INSTALLDIR='../install/sunos5'
BF_DOCDIR='../install/doc'
PLATFORM_LINKFLAGS = ['']
PLATFORM_LINKFLAGS = []

@ -160,7 +160,7 @@ CC_WARN = [ '-Wall' ]
LLIBS = ['-lshell32', '-lshfolder', '-lgdi32', '-lmsvcrt', '-lwinmm', '-lmingw32', '-lm', '-lws2_32', '-lz', '-lstdc++']
BF_DEBUG = False
BF_DEBUG_FLAGS= '-g'
BF_DEBUG_FLAGS= ['-g']
BF_PROFILE_FLAGS = ['-pg','-g']
BF_PROFILE = False

@ -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'

@ -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)

@ -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=[],

@ -1,4 +1,9 @@
#ifdef _WIN32
#include <Winsock2.h>
#else
#include <netinet/in.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

@ -142,6 +142,7 @@ ifneq ($(NAN_NO_KETSJI),true)
COMLIB += $(OCGDIR)/gameengine/OpenGLrasterizer/$(DEBUG_DIR)libOpenGLrasterizer.a
COMLIB += $(OCGDIR)/gameengine/expression/$(DEBUG_DIR)libexpression.a
COMLIB += $(OCGDIR)/gameengine/scenegraph/$(DEBUG_DIR)libscenegraph.a
COMLIB += $(OCGDIR)/gameengine/videotex/$(DEBUG_DIR)libvideotex.a
# COMLIB += $(OCGDIR)/sumo/$(DEBUG_DIR)libfuzzics.a
# COMLIB += $(OCGDIR)/sumo/$(DEBUG_DIR)libsolid.a
COMLIB += $(NAN_MOTO)/lib/libmoto.a

@ -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

@ -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

@ -30,11 +30,15 @@
* ***** 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>

@ -1100,9 +1100,12 @@ float *make_orco_curve(Object *ob)
fp[1]= 2.0f*v/(dl->nr-1) - 1.0f;
fp[2]= 0.0;
} else {
float *vert;
int realv= v % dl->nr;
VECCOPY(fp, &dl->verts[(dl->nr*u + realv)*3]);
int realu= u % dl->parts;
vert= dl->verts + 3*(dl->nr*realu + realv);
VECCOPY(fp, vert);
fp[0]= (fp[0]-cu->loc[0])/cu->size[0];
fp[1]= (fp[1]-cu->loc[1])/cu->size[1];

@ -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);
}

@ -76,10 +76,14 @@
#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"

@ -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;
}

@ -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);

@ -1163,7 +1163,10 @@ static void copy_object_pose(Object *obn, Object *ob)
ListBase targets = {NULL, NULL};
bConstraintTarget *ct;
if(con->ipo) {
/* note that we can't change lib linked ipo blocks. for making
* proxies this still works correct however because the object
* is changed to object->proxy_from when evaluating the driver. */
if(con->ipo && !con->ipo->id.lib) {
IpoCurve *icu;
for(icu= con->ipo->curve.first; icu; icu= icu->next) {
if(icu->driver && icu->driver->ob==ob)

@ -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

@ -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)

@ -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 */

@ -364,6 +364,9 @@ BlendFileData *BLO_read_from_memfile(const char *filename, MemFile *memfile, Ble
if (fd) {
strcpy(fd->filename, filename);
/* clear ob->proxy_from pointers in G.main */
blo_clear_proxy_pointers_from_lib(fd);
/* separate libraries from G.main */
blo_split_main(&mainlist, G.main);
/* add the library pointers in oldmap lookup */

@ -1130,6 +1130,19 @@ static void change_idid_adr(ListBase *mainlist, FileData *basefd, void *old, voi
}
}
/* lib linked proxy objects point to our local data, we need
* to clear that pointer before reading the undo memfile since
* the object might be removed, it is set again in reading
* if the local object still exists */
void blo_clear_proxy_pointers_from_lib(FileData *fd)
{
Object *ob= G.main->object.first;
for(;ob; ob= ob->id.next)
if(ob->id.lib)
ob->proxy_from= NULL;
}
/* assumed; G.main still exists */
void blo_make_image_pointer_map(FileData *fd)
{

@ -112,6 +112,7 @@ FileData *blo_openblenderfile( char *name, BlendReadError *error_r);
FileData *blo_openblendermemory( void *buffer, int buffersize, BlendReadError *error_r);
FileData *blo_openblendermemfile(struct MemFile *memfile, BlendReadError *error_r);
void blo_clear_proxy_pointers_from_lib(FileData *fd);
void blo_make_image_pointer_map(FileData *fd);
void blo_end_image_pointer_map(FileData *fd);
void blo_add_library_pointer_map(ListBase *mainlist, FileData *fd);

@ -82,7 +82,11 @@
#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"

@ -29,8 +29,12 @@
* ***** 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"

@ -97,8 +97,13 @@
#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
/****/

@ -29,11 +29,14 @@
* $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"

@ -29,6 +29,13 @@
* $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"
@ -65,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
@ -230,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()
{
@ -238,6 +259,11 @@ void do_init_ffmpeg()
ffmpeg_init = 1;
av_register_all();
//avdevice_register_all();
if ((G.f & G_DEBUG) == 0)
{
silence_log_ffmpeg(1);
}
}
}
@ -256,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;

@ -244,7 +244,8 @@ static PyObject *BonesDict_GetItem(BPy_BonesDict *self, PyObject* key)
}
if(value == NULL){ /* item not found in dict. throw exception */
char* key_str = PyString_AsString( key );
if (key_str) {
if (key_str==NULL) {
return EXPP_ReturnPyObjError(PyExc_KeyError, "bone key must be a string" );
} else {
char buffer[128];

@ -3549,7 +3549,7 @@ void logic_buts(void)
if(ob->controllers.first) uiSetCurFont(block, UI_HELV);
uiDefButBitS(block, TOG, OB_ADDCONT, B_ADD_CONT, "Add",(short)(xco+width-40), yco, 50, 19, &ob->scaflag, 0, 0, 0, 0, "Add a new Controller");
uiBlockEndAlign(block);
yco-=17;
yco-=20;
/* mark all actuators linked to these controllers */
/* note that some of these actuators could be from objects that are not in the display list.

@ -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);

@ -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 */

@ -2153,7 +2153,7 @@ static int ui_act_as_text_but(uiBut *but)
value = 0.0f; /* Zero out value on error */
if(str[0])
retval = 0; /* invalidate return value if eval failed, except when string was null */
retval = B_NOP; /* invalidate return value if eval failed, except when string was null */
}
#else
value=atof(str);

@ -69,8 +69,6 @@
#include "reeb.h"
/* REPLACE WITH NEW ONE IN UTILDEFINES ONCE PATCH IS APPLIED */
#define FTOCHAR(val) (val<=0.0f)? 0 : ((val>(1.0f-0.5f/255.0f))? 255 : (char)((255.0f*val)+0.5f))
ReebGraph *GLOBAL_RG = NULL;
ReebGraph *FILTERED_RG = NULL;

@ -143,6 +143,7 @@ IF(WIN32)
COMMAND xcopy /E /Y \"${WIN_SOURCE_DIR}\\release\\scripts\\*.*\" \"${TARGETDIR}\\.blender\\scripts\"
COMMAND xcopy /E /Y \"${WIN_SOURCE_DIR}\\release\\plugins\\*.*\" \"${TARGETDIR}\\plugins\"
COMMAND copy /Y \"${WIN_SOURCE_DIR}\\release\\text\\*.*\" \"${TARGETDIR}\"
COMMAND copy /Y \"${WIN_SOURCE_DIR}\\release\\windows\\extra\\python25.zip\" \"${TARGETDIR}\\\"
)
FILE(TO_NATIVE_PATH "${LIBDIR}" WIN_LIBDIR)
@ -265,7 +266,8 @@ IF(UNIX)
blender_python
bf_quicktime
extern_binreloc
extern_glew
extern_glew
bf_videotex
)
FOREACH(SORTLIB ${BLENDER_SORTED_LIBS})

@ -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(

@ -35,7 +35,7 @@ DIR = $(OCGDIR)/gameengine
DIRS = BlenderRoutines
DIRS += Converter
DIRS += Expressions GameLogic Ketsji Rasterizer SceneGraph
DIRS += Network Physics
DIRS += Network Physics VideoTexture
ifeq ($(WITH_BF_BLENDERGAMEENGINE),true)
DIRS += GamePlayer

@ -24,7 +24,7 @@ http://www.gnu.org/copyleft/lesser.txt.
#include <strstream>
#include <fstream>
#include <Python.h>
#include <PyObjectPlus.h>
#include "Exception.h"
@ -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;
}

@ -22,7 +22,7 @@ http://www.gnu.org/copyleft/lesser.txt.
#include "FilterBase.h"
#include <Python.h>
#include <PyObjectPlus.h>
#include <structmember.h>

@ -25,10 +25,16 @@ http://www.gnu.org/copyleft/lesser.txt.
#include "Common.h"
#include <Python.h>
#include <PyObjectPlus.h>
#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;

@ -21,7 +21,7 @@ http://www.gnu.org/copyleft/lesser.txt.
*/
#include <Python.h>
#include <PyObjectPlus.h>
#include <structmember.h>
#include "FilterBlueScreen.h"
@ -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}
};

@ -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

@ -21,7 +21,7 @@ http://www.gnu.org/copyleft/lesser.txt.
*/
#include <Python.h>
#include <PyObjectPlus.h>
#include <structmember.h>
#include "FilterColor.h"
@ -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}
};

@ -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

@ -21,7 +21,7 @@ http://www.gnu.org/copyleft/lesser.txt.
*/
#include <Python.h>
#include <PyObjectPlus.h>
#include <structmember.h>
#include "FilterNormal.h"
@ -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}
};

@ -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

@ -22,7 +22,7 @@ http://www.gnu.org/copyleft/lesser.txt.
// implementation
#include <Python.h>
#include <PyObjectPlus.h>
#include <structmember.h>
#include "FilterSource.h"
@ -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

@ -44,9 +44,35 @@ 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
class FilterBGR24 : public FilterBase
@ -64,10 +90,9 @@ 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
class FilterYV12 : public FilterBase
{
@ -217,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;
}
};

@ -25,7 +25,7 @@ http://www.gnu.org/copyleft/lesser.txt.
#include <vector>
#include <string.h>
#include <Python.h>
#include <PyObjectPlus.h>
#include <structmember.h>
#include "FilterBase.h"

@ -26,7 +26,7 @@ http://www.gnu.org/copyleft/lesser.txt.
#include "Common.h"
#include <vector>
#include <Python.h>
#include <PyObjectPlus.h>
#include "PyTypeList.h"

@ -22,7 +22,7 @@ http://www.gnu.org/copyleft/lesser.txt.
// implementation
#include <Python.h>
#include <PyObjectPlus.h>
#include <structmember.h>
#include "ImageBuff.h"
@ -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}
};

@ -22,7 +22,7 @@ http://www.gnu.org/copyleft/lesser.txt.
// implementation
#include <Python.h>
#include <PyObjectPlus.h>
#include <structmember.h>
#include "ImageMix.h"
@ -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}
};

@ -22,7 +22,7 @@ http://www.gnu.org/copyleft/lesser.txt.
// implementation
#include <Python.h>
#include <PyObjectPlus.h>
#include <structmember.h>
#include <KX_BlenderCanvas.h>
@ -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}
};

@ -22,16 +22,15 @@ http://www.gnu.org/copyleft/lesser.txt.
// implementation
#include <Python.h>
#include <PyObjectPlus.h>
#include <structmember.h>
#include "ImageViewport.h"
#include <BIF_gl.h>
#include "Texture.h"
#include "ImageBase.h"
#include "FilterSource.h"
#include "ImageViewport.h"
// constructor
@ -81,7 +80,7 @@ void ImageViewport::setCaptureSize (short * size)
if (size[idx] < 1)
m_capSize[idx] = 1;
else if (size[idx] > getViewportSize()[idx])
m_capSize[idx] = getViewportSize()[idx];
m_capSize[idx] = short(getViewportSize()[idx]);
else
m_capSize[idx] = size[idx];
}
@ -91,7 +90,7 @@ void ImageViewport::setCaptureSize (short * size)
}
// set position of capture rectangle
void ImageViewport::setPosition (int * pos)
void ImageViewport::setPosition (GLint * pos)
{
// if new position is not provided, use existing position
if (pos == NULL) pos = m_position;
@ -125,7 +124,7 @@ void ImageViewport::calcImage (unsigned int texId)
{
// just copy current viewport to texture
glBindTexture(GL_TEXTURE_2D, texId);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_upLeft[0], m_upLeft[1], m_capSize[0], m_capSize[1]);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, m_upLeft[0], m_upLeft[1], (GLsizei)m_capSize[0], (GLsizei)m_capSize[1]);
// image is not available
m_avail = false;
}
@ -133,10 +132,10 @@ void ImageViewport::calcImage (unsigned int texId)
else if (!m_avail)
{
// get frame buffer data
glReadPixels(m_upLeft[0], m_upLeft[1], m_capSize[0], m_capSize[1], GL_RGB,
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);
}
}
@ -193,9 +192,9 @@ static int ImageViewport_setPosition (PyImage * self, PyObject * value, void * c
return -1;
}
// set position
int pos [] = {
int(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 0))),
int(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 1)))
GLint pos [] = {
GLint(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 0))),
GLint(PyInt_AsLong(PySequence_Fast_GET_ITEM(value, 1)))
};
getImageViewport(self)->setPosition(pos);
// success
@ -240,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}
};

@ -49,13 +49,13 @@ public:
void setCaptureSize (short * size = NULL);
/// get position in viewport
int * getPosition (void) { return m_position; }
GLint * getPosition (void) { return m_position; }
/// set position in viewport
void setPosition (int * pos = NULL);
void setPosition (GLint * pos = NULL);
protected:
/// frame buffer rectangle
int m_viewport[4];
GLint m_viewport[4];
/// size of captured area
short m_capSize[2];
@ -63,9 +63,9 @@ protected:
bool m_whole;
/// position of capture rectangle in viewport
int m_position[2];
GLint m_position[2];
/// upper left point for capturing
int m_upLeft[2];
GLint m_upLeft[2];
/// buffer to copy viewport
BYTE * m_viewportImage;
@ -76,7 +76,7 @@ protected:
virtual void calcImage (unsigned int texId);
/// get viewport size
int * getViewportSize (void) { return m_viewport + 2; }
GLint * getViewportSize (void) { return m_viewport + 2; }
};

@ -26,7 +26,7 @@ http://www.gnu.org/copyleft/lesser.txt.
#include <memory>
#include <vector>
#include <Python.h>
#include <PyObjectPlus.h>
/// check, if type is in list
@ -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());
}
}

@ -28,7 +28,7 @@ http://www.gnu.org/copyleft/lesser.txt.
#include <memory>
#include <vector>
#include <Python.h>
#include <PyObjectPlus.h>
// forward declaration
class PyTypeListItem;

@ -21,7 +21,6 @@ if env['OURPLATFORM'] == 'win32-vc':
cflags.append('/GR')
cflags.append('/Ox')
incs += ' ' + env['BF_PYTHON'] + '/lib/python' + env['BF_PYTHON_VERSION'] + "/site-packages/numpy/core/include"
incs += ' ' + env['BF_PYTHON_INC']
#incs += ' ' + env['BF_OPENGL_INC']

@ -22,7 +22,7 @@ http://www.gnu.org/copyleft/lesser.txt.
// implementation
#include <Python.h>
#include <PyObjectPlus.h>
#include <structmember.h>
#include <KX_GameObject.h>
@ -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}
};

@ -23,7 +23,7 @@ http://www.gnu.org/copyleft/lesser.txt.
#if !defined TEXTURE_H
#define TEXTURE_H
#include <Python.h>
#include <PyObjectPlus.h>
#include <structmember.h>
#include <DNA_image_types.h>
@ -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);

@ -24,7 +24,7 @@ http://www.gnu.org/copyleft/lesser.txt.
#define VIDEOBASE_H
#include <Python.h>
#include <PyObjectPlus.h>
#include "ImageBase.h"

@ -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,7 +51,7 @@ 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)
@ -86,10 +91,10 @@ bool VideoFFmpeg::release()
MEM_freeN(m_frameDeinterlaced->data[0]);
av_free(m_frameDeinterlaced);
}
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);
}
if (m_imgConvertCtx)
{
@ -101,7 +106,7 @@ bool VideoFFmpeg::release()
m_formatCtx = NULL;
m_frame = NULL;
m_frame = NULL;
m_frameBGR = NULL;
m_frameRGB = NULL;
m_imgConvertCtx = NULL;
// object will be deleted after that
@ -184,7 +189,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 +201,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 +214,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 +224,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;
@ -560,14 +565,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 +692,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}
};

@ -100,7 +100,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?
@ -150,7 +150,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)

@ -20,16 +20,12 @@ http://www.gnu.org/copyleft/lesser.txt.
-----------------------------------------------------------------------------
*/
#define PY_ARRAY_UNIQUE_SYMBOL numpyPtr
#include <Python.h>
#include <PyObjectPlus.h>
#include <RAS_GLExtensionManager.h>
#include <RAS_IPolygonMaterial.h>
#include <numpy/arrayobject.h>
//Old API
//#include "TexPlayer.h"
//#include "TexImage.h"
@ -85,15 +81,6 @@ static PyObject * setLogFile (PyObject *self, PyObject *args)
}
// function to initialize numpy structures
static bool initNumpy (void)
{
// init module and report failure
import_array1(false);
// report success
return true;
}
// image to numpy array
static PyObject * imageToArray (PyObject * self, PyObject *args)
{
@ -107,15 +94,14 @@ static PyObject * imageToArray (PyObject * self, PyObject *args)
}
// get image structure
PyImage * img = reinterpret_cast<PyImage*>(pyImg);
// check initialization of numpy interface, and initialize it if needed
if (numpyPtr == NULL && !initNumpy()) Py_RETURN_NONE;
// create array object
npy_intp dim[1];
dim[0] = img->m_image->getBuffSize() / sizeof(unsigned int);
unsigned int * imgBuff = img->m_image->getImage();
// if image is available, convert it to array
if (imgBuff != NULL)
return PyArray_SimpleNewFromData(1, dim, NPY_UBYTE, imgBuff);
// Nasty problem here: the image buffer is an array of integers
// in the processor endian format. The user must take care of that in the script.
// Need to find an elegant solution to this problem
return Py_BuildValue("s#", imgBuff, img->m_image->getBuffSize());
// otherwise return None
Py_RETURN_NONE;
}
@ -140,6 +126,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;
@ -164,6 +151,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");
}
@ -189,15 +177,12 @@ PyObject* initVideoTexture(void)
if (m == NULL)
return NULL;
// prepare numpy array
numpyPtr = NULL;
// initialize classes
pyImageTypes.reg(m);
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';

@ -89,8 +89,8 @@ ifeq ($(OS),darwin)
CFLAGS += -pipe -fPIC -ffast-math -march=pentium-m -funsigned-char -fno-strict-aliasing
CCFLAGS += -pipe -fPIC -funsigned-char -fno-strict-aliasing
endif
REL_CFLAGS += -O2
REL_CCFLAGS += -O2
# REL_CFLAGS += -O2
# REL_CCFLAGS += -O2
CPPFLAGS += -D_THREAD_SAFE
NAN_DEPEND = true
OPENGL_HEADERS = /System/Library/Frameworks/OpenGL.framework

@ -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'])