[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16221] trunk/blender/source/gameengine: BGE Python API - GameLogic.getBlendFileList(path='//') to return a list of blend's in the current directory.
Revision: 16221 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16221 Author: campbellbarton Date: 2008-08-22 08:02:01 +0200 (Fri, 22 Aug 2008) Log Message: --- BGE Python API - GameLogic.getBlendFileList(path='//') to return a list of blend's in the current directory. Needed for creating a level selector that lists all files in the level directory. CMakeFile include path to compile with recent changes. Modified Paths: -- trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp trunk/blender/source/gameengine/Physics/Bullet/CMakeLists.txt trunk/blender/source/gameengine/PyDoc/GameLogic.py Modified: trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp === --- trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp2008-08-22 02:33:19 UTC (rev 16220) +++ trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp2008-08-22 06:02:01 UTC (rev 16221) @@ -31,6 +31,7 @@ #include "GL/glew.h" #include +#include // directory header for py function getBlendFileList #ifdef WIN32 #pragma warning (disable : 4786) @@ -112,9 +113,7 @@ return PyFloat_FromDouble(MT_random()); } -static PyObject* gPySetGravity(PyObject*, - PyObject* args, - PyObject*) +static PyObject* gPySetGravity(PyObject*, PyObject* args) { MT_Vector3 vec = MT_Vector3(0., 0., 0.); if (PyVecArgTo(args, vec)) @@ -138,9 +137,7 @@ other .blend).\n\ The function also converts the directory separator to the local file system format."; -static PyObject* gPyExpandPath(PyObject*, - PyObject* args, - PyObject*) +static PyObject* gPyExpandPath(PyObject*, PyObject* args) { char expanded[FILE_MAXDIR + FILE_MAXFILE]; char* filename; @@ -185,9 +182,7 @@ -static PyObject* gPyStartDSP(PyObject*, - PyObject* args, - PyObject*) +static PyObject* gPyStartDSP(PyObject*, PyObject* args) { SND_IAudioDevice* audiodevice = SND_DeviceManager::Instance(); @@ -205,9 +200,7 @@ -static PyObject* gPyStopDSP(PyObject*, - PyObject* args, - PyObject*) +static PyObject* gPyStopDSP(PyObject*, PyObject* args) { SND_IAudioDevice* audiodevice = SND_DeviceManager::Instance(); @@ -223,9 +216,7 @@ return NULL; } -static PyObject* gPySetLogicTicRate(PyObject*, - PyObject* args, - PyObject*) +static PyObject* gPySetLogicTicRate(PyObject*, PyObject* args) { float ticrate; if (PyArg_ParseTuple(args, "f", &ticrate)) @@ -242,9 +233,7 @@ return PyFloat_FromDouble(KX_KetsjiEngine::GetTicRate()); } -static PyObject* gPySetPhysicsTicRate(PyObject*, - PyObject* args, - PyObject*) +static PyObject* gPySetPhysicsTicRate(PyObject*, PyObject* args) { float ticrate; if (PyArg_ParseTuple(args, "f", &ticrate)) @@ -257,9 +246,7 @@ return NULL; } -static PyObject* gPySetPhysicsDebug(PyObject*, - PyObject* args, - PyObject*) +static PyObject* gPySetPhysicsDebug(PyObject*, PyObject* args) { int debugMode; if (PyArg_ParseTuple(args, "i", &debugMode)) @@ -278,6 +265,44 @@ return PyFloat_FromDouble(PHY_GetActiveEnvironment()->getFixedTimeStep()); } +static PyObject* gPyGetBlendFileList(PyObject*, PyObject* args) +{ + char cpath[sizeof(G.sce)]; + char *searchpath = NULL; + PyObject* list; + +DIR *dp; +struct dirent *dirp; + + if (!PyArg_ParseTuple(args, "|s", &searchpath)) + return NULL; + + list = PyList_New(0); + + if (searchpath) { + BLI_strncpy(cpath, searchpath, FILE_MAXDIR + FILE_MAXFILE); + BLI_convertstringcode(cpath, G.sce); + } else { + /* Get the dir only */ + BLI_split_dirfile_basic(G.sce, cpath, NULL); + } + +if((dp = opendir(cpath)) == NULL) { + /* todo, show the errno, this shouldnt happen anyway if the blendfile is readable */ + fprintf(stderr, "Could not read directoty () failed, code %d (%s)\n", cpath, errno, strerror(errno)); + return list; +} + +while ((dirp = readdir(dp)) != NULL) { + if (BLI_testextensie(dirp->d_name, ".blend")) { +
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16220] branches/apricot/source/blender/ src/drawmesh.c: error in last commit
Revision: 16220 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16220 Author: campbellbarton Date: 2008-08-22 04:33:19 +0200 (Fri, 22 Aug 2008) Log Message: --- error in last commit Modified Paths: -- branches/apricot/source/blender/src/drawmesh.c Modified: branches/apricot/source/blender/src/drawmesh.c === --- branches/apricot/source/blender/src/drawmesh.c 2008-08-22 00:54:22 UTC (rev 16219) +++ branches/apricot/source/blender/src/drawmesh.c 2008-08-22 02:33:19 UTC (rev 16220) @@ -507,7 +507,7 @@ else { badtex = set_draw_settings_cached(0, Gtexdraw.istex, tface, Gtexdraw.islit, Gtexdraw.ob, matnr, TF_TWOSIDE); if (badtex) { - mcol+=4; + if (mcol) mcol+=4; continue; } } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16219] branches/apricot/source/blender/ src/drawmesh.c: missing NULL check when game text meshes had no vertex colors
Revision: 16219 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16219 Author: campbellbarton Date: 2008-08-22 02:54:22 +0200 (Fri, 22 Aug 2008) Log Message: --- missing NULL check when game text meshes had no vertex colors Modified Paths: -- branches/apricot/source/blender/src/drawmesh.c Modified: branches/apricot/source/blender/src/drawmesh.c === --- branches/apricot/source/blender/src/drawmesh.c 2008-08-22 00:35:14 UTC (rev 16218) +++ branches/apricot/source/blender/src/drawmesh.c 2008-08-22 00:54:22 UTC (rev 16219) @@ -484,7 +484,7 @@ ddm = mesh_get_derived_deform(ob, CD_MASK_BAREMESH); - for(a=0, mf=mface; amode; int matnr= mf->mat_nr; int mf_smooth= mf->flag & ME_SMOOTH; @@ -506,8 +506,10 @@ } else { badtex = set_draw_settings_cached(0, Gtexdraw.istex, tface, Gtexdraw.islit, Gtexdraw.ob, matnr, TF_TWOSIDE); - if (badtex) + if (badtex) { + mcol+=4; continue; + } } ddm->getVertCo(ddm, mf->v1, v1); @@ -535,6 +537,9 @@ GPU_render_text(tface, tface->mode, string, characters, (unsigned int*)mcol, v1, v2, v3, (mf->v4? v4: NULL), glattrib); } + if (mcol) { + mcol+=4; + } } ddm->release(ddm); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16218] trunk/blender/source/blender: Merged shrinkwrap modifier from soc-2008-jaguarandi
Revision: 16218 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16218 Author: jaguarandi Date: 2008-08-22 02:35:14 +0200 (Fri, 22 Aug 2008) Log Message: --- Merged shrinkwrap modifier from soc-2008-jaguarandi Modified Paths: -- trunk/blender/source/blender/blenkernel/BKE_deform.h trunk/blender/source/blender/blenkernel/intern/bvhutils.c trunk/blender/source/blender/blenkernel/intern/deform.c trunk/blender/source/blender/blenkernel/intern/modifier.c trunk/blender/source/blender/blenlib/intern/BLI_kdopbvh.c trunk/blender/source/blender/makesdna/DNA_modifier_types.h trunk/blender/source/blender/src/buttons_editing.c Added Paths: --- trunk/blender/source/blender/blenkernel/BKE_shrinkwrap.h trunk/blender/source/blender/blenkernel/intern/shrinkwrap.c Modified: trunk/blender/source/blender/blenkernel/BKE_deform.h === --- trunk/blender/source/blender/blenkernel/BKE_deform.h2008-08-21 23:41:08 UTC (rev 16217) +++ trunk/blender/source/blender/blenkernel/BKE_deform.h2008-08-22 00:35:14 UTC (rev 16218) @@ -46,5 +46,8 @@ int get_named_vertexgroup_num (Object *ob, char *name); void unique_vertexgroup_name (struct bDeformGroup *dg, struct Object *ob); +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); + #endif Copied: trunk/blender/source/blender/blenkernel/BKE_shrinkwrap.h (from rev 16216, branches/soc-2008-jaguarandi/source/blender/blenkernel/BKE_shrinkwrap.h) === --- trunk/blender/source/blender/blenkernel/BKE_shrinkwrap.h (rev 0) +++ trunk/blender/source/blender/blenkernel/BKE_shrinkwrap.h2008-08-22 00:35:14 UTC (rev 16218) @@ -0,0 +1,146 @@ +/** + * BKE_shrinkwrap.h + * + * * BEGIN GPL LICENSE BLOCK * + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * * END GPL LICENSE BLOCK * + */ +#ifndef BKE_SHRINKWRAP_H +#define BKE_SHRINKWRAP_H + +/* mesh util */ +//TODO: move this somewhere else +#include "BKE_customdata.h" +struct DerivedMesh; +struct Object; +struct DerivedMesh *object_get_derived_final(struct Object *ob, CustomDataMask dataMask); + + +/* SpaceTransform stuff */ +/* + * TODO: move this somewhere else + * + * this structs encapsulates all needed data to convert between 2 coordinate spaces + * (where conversion can be represented by a matrix multiplication) + * + * This is used to reduce the number of arguments to pass to functions that need to perform + * this kind of operation and make it easier for the coder, as he/she doenst needs to recode + * the matrix calculation. + * + * A SpaceTransform is initialized using: + * space_transform_setup( &data, ob1, ob2 ) + * + * After that the following calls can be used: + * space_transform_apply (&data, co); //converts a coordinate in ob1 coords space to the corresponding ob2 coords + * space_transform_invert(&data, co); //converts a coordinate in ob2 coords space to the corresponding ob1 coords + * + * //Same Concept as space_transform_apply and space_transform_invert, but no is normalized after conversion + * space_transform_apply_normal (&data, &no); + * space_transform_invert_normal(&data, &no); + * + */ +struct Object; + +typedef struct SpaceTransform +{ + float local2target[4][4]; + float target2local[4][4]; + +} SpaceTransform; + +void space_transform_from_matrixs(SpaceTransform *data, float local[][4], float target[][4]); +#define space_transform_setup(data, local, target) space_transform_from_matrixs(data, (local)->obmat, (target)->obmat) + +void space_transform_apply (const SpaceTransform *data, float *co); +void space_transform_invert(const SpaceTransform *data, float *co); + +void space_transform_apply_normal (const SpaceTransform *data, float *no); +void space_transform_invert_normal(const SpaceTransform *data, float *no); + +/* S
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16217] branches/apricot/source: partial merge because of conflicts
Revision: 16217 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16217 Author: campbellbarton Date: 2008-08-22 01:41:08 +0200 (Fri, 22 Aug 2008) Log Message: --- partial merge because of conflicts svn merge -16186:16194 https://svn.blender.org/svnroot/bf-blender/trunk/blender Modified Paths: -- branches/apricot/source/blender/blenkernel/BKE_blender.h branches/apricot/source/blender/include/BIF_resources.h branches/apricot/source/blender/makesdna/DNA_userdef_types.h branches/apricot/source/blender/src/drawipo.c branches/apricot/source/blender/src/resources.c branches/apricot/source/blender/src/space.c branches/apricot/source/blender/src/usiblender.c branches/apricot/source/gameengine/GamePlayer/ghost/GPG_Application.cpp branches/apricot/source/gameengine/GamePlayer/ghost/GPG_Application.h branches/apricot/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp Modified: branches/apricot/source/blender/blenkernel/BKE_blender.h === --- branches/apricot/source/blender/blenkernel/BKE_blender.h2008-08-21 22:57:25 UTC (rev 16216) +++ branches/apricot/source/blender/blenkernel/BKE_blender.h2008-08-21 23:41:08 UTC (rev 16217) @@ -41,7 +41,7 @@ struct MemFile; #define BLENDER_VERSION247 -#define BLENDER_SUBVERSION 0 +#define BLENDER_SUBVERSION 1 #define BLENDER_MINVERSION 245 #define BLENDER_MINSUBVERSION 15 Modified: branches/apricot/source/blender/include/BIF_resources.h === --- branches/apricot/source/blender/include/BIF_resources.h 2008-08-21 22:57:25 UTC (rev 16216) +++ branches/apricot/source/blender/include/BIF_resources.h 2008-08-21 23:41:08 UTC (rev 16217) @@ -524,6 +524,10 @@ TH_EDGE_SHARP, TH_EDITMESH_ACTIVE, + + TH_HANDLE_VERTEX, + TH_HANDLE_VERTEX_SELECT, + TH_HANDLE_VERTEX_SIZE, }; /* XXX WARNING: previous is saved in file, so do not change order! */ Modified: branches/apricot/source/blender/makesdna/DNA_userdef_types.h === --- branches/apricot/source/blender/makesdna/DNA_userdef_types.h 2008-08-21 22:57:25 UTC (rev 16216) +++ branches/apricot/source/blender/makesdna/DNA_userdef_types.h 2008-08-21 23:41:08 UTC (rev 16217) @@ -101,6 +101,11 @@ char movie[4], image[4], scene[4], audio[4];// for sequence editor char effect[4], plugin[4], transition[4], meta[4]; char editmesh_active[4]; + + char handle_vertex[4]; + char handle_vertex_select[4]; + char handle_vertex_size; + char hpad[7]; } ThemeSpace; Modified: branches/apricot/source/blender/src/drawipo.c === --- branches/apricot/source/blender/src/drawipo.c 2008-08-21 22:57:25 UTC (rev 16216) +++ branches/apricot/source/blender/src/drawipo.c 2008-08-21 23:41:08 UTC (rev 16217) @@ -1212,16 +1212,9 @@ /*}*/ } else { /* normal non bit curves */ if(ei->flag & IPO_EDIT) { - if(ei->icu->ipo==IPO_BEZ) { - /* Draw the editmode hendels for a bezier curve */ - if( (bezt->f1 & SELECT) == sel)/* && G.v2d->cur.xmin < bezt->vec[0][0] < G.v2d->cur.xmax)*/ - bglVertex3fv(bezt->vec[0]); - - if( (bezt->f3 & SELECT) == sel)/* && G.v2d->cur.xmin < bezt->vec[2][0] < G.v2d->cur.xmax)*/ - bglVertex3fv(bezt->vec[2]); - - } - + /* Only the vertex of the line, the +* handler are draw below. +*/ if( (bezt->f2 & SELECT) == sel) /* && G.v2d->cur.xmin < bezt->vec[1][0] < G.v2d->cur.xmax)*/ bglVertex3fv(bezt->vec[1]); @@ -1237,6 +1230,45 @@ bezt++; } bglEnd(); + + if (ei->flag & IPO_EDIT) { + /* Now draw the two vertex of the hand
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16216] branches/soc-2008-jaguarandi: svn merge -r 16174:16215 https://svn.blender.org/svnroot/bf-blender/trunk/ blender
Revision: 16216 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16216 Author: jaguarandi Date: 2008-08-22 00:57:25 +0200 (Fri, 22 Aug 2008) Log Message: --- svn merge -r 16174:16215 https://svn.blender.org/svnroot/bf-blender/trunk/blender Modified Paths: -- branches/soc-2008-jaguarandi/extern/bullet2/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp branches/soc-2008-jaguarandi/projectfiles_vc7/gameengine/physics/PHY_Physics/PHY_Bullet/PHY_Bullet.vcproj branches/soc-2008-jaguarandi/release/scripts/flt_properties.py branches/soc-2008-jaguarandi/source/blender/blenkernel/BKE_blender.h branches/soc-2008-jaguarandi/source/blender/blenkernel/BKE_collision.h branches/soc-2008-jaguarandi/source/blender/blenkernel/BKE_effect.h branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/collision.c branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/effect.c branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/implicit.c branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/ipo.c branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/modifier.c branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/particle.c branches/soc-2008-jaguarandi/source/blender/blenkernel/intern/particle_system.c branches/soc-2008-jaguarandi/source/blender/blenloader/intern/readfile.c branches/soc-2008-jaguarandi/source/blender/blenloader/intern/writefile.c branches/soc-2008-jaguarandi/source/blender/include/BIF_resources.h branches/soc-2008-jaguarandi/source/blender/makesdna/DNA_ipo_types.h branches/soc-2008-jaguarandi/source/blender/makesdna/DNA_modifier_types.h branches/soc-2008-jaguarandi/source/blender/makesdna/DNA_object_force.h branches/soc-2008-jaguarandi/source/blender/makesdna/DNA_particle_types.h branches/soc-2008-jaguarandi/source/blender/makesdna/DNA_userdef_types.h branches/soc-2008-jaguarandi/source/blender/python/api2_2x/Material.c branches/soc-2008-jaguarandi/source/blender/python/api2_2x/Mesh.c branches/soc-2008-jaguarandi/source/blender/python/api2_2x/Object.c branches/soc-2008-jaguarandi/source/blender/python/api2_2x/doc/Material.py branches/soc-2008-jaguarandi/source/blender/python/api2_2x/doc/Object.py branches/soc-2008-jaguarandi/source/blender/src/buttons_object.c branches/soc-2008-jaguarandi/source/blender/src/drawipo.c branches/soc-2008-jaguarandi/source/blender/src/editipo.c branches/soc-2008-jaguarandi/source/blender/src/editipo_lib.c branches/soc-2008-jaguarandi/source/blender/src/resources.c branches/soc-2008-jaguarandi/source/blender/src/space.c branches/soc-2008-jaguarandi/source/blender/src/usiblender.c branches/soc-2008-jaguarandi/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp branches/soc-2008-jaguarandi/source/gameengine/GamePlayer/ghost/GPG_Application.cpp branches/soc-2008-jaguarandi/source/gameengine/GamePlayer/ghost/GPG_Application.h branches/soc-2008-jaguarandi/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp branches/soc-2008-jaguarandi/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp branches/soc-2008-jaguarandi/source/gameengine/Ketsji/KX_PythonInit.cpp branches/soc-2008-jaguarandi/source/gameengine/Ketsji/KX_Scene.cpp branches/soc-2008-jaguarandi/source/gameengine/Ketsji/KX_Scene.h branches/soc-2008-jaguarandi/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp branches/soc-2008-jaguarandi/source/gameengine/Physics/Bullet/CcdPhysicsController.h branches/soc-2008-jaguarandi/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp branches/soc-2008-jaguarandi/source/gameengine/Physics/Bullet/SConscript branches/soc-2008-jaguarandi/source/gameengine/Physics/common/PHY_DynamicTypes.h Added Paths: --- branches/soc-2008-jaguarandi/release/scripts/flt_dofedit.py branches/soc-2008-jaguarandi/release/scripts/flt_lodedit.py Modified: branches/soc-2008-jaguarandi/extern/bullet2/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp === --- branches/soc-2008-jaguarandi/extern/bullet2/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp 2008-08-21 21:14:08 UTC (rev 16215) +++ branches/soc-2008-jaguarandi/extern/bullet2/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp 2008-08-21 22:57:25 UTC (rev 16216) @@ -856,10 +856,26 @@ btScalar radius = coneShape->getRadius();//+coneShape->getMargin(); btScalar height = coneShape->getHeight();//+coneShape->getMargin(); btVector3 start = worldTransform.getOrigin(); - getDebugDrawer()->drawLine(start+worldTransform.getBasis() * btVector3(btScalar(0.),btScalar(0.),btScalar(0.5)*height),start+worldTransform.
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16215] trunk/blender/source/gameengine/ Physics/Bullet/SConscript: Update scons files in source/gameengine/Physics/ Bullet.
Revision: 16215 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16215 Author: bdiego Date: 2008-08-21 23:14:08 +0200 (Thu, 21 Aug 2008) Log Message: --- Update scons files in source/gameengine/Physics/Bullet. Please Nathan double check this, but all compile fine here :) Modified Paths: -- trunk/blender/source/gameengine/Physics/Bullet/SConscript Modified: trunk/blender/source/gameengine/Physics/Bullet/SConscript === --- trunk/blender/source/gameengine/Physics/Bullet/SConscript 2008-08-21 21:12:27 UTC (rev 16214) +++ trunk/blender/source/gameengine/Physics/Bullet/SConscript 2008-08-21 21:14:08 UTC (rev 16215) @@ -3,7 +3,7 @@ sources = 'CcdPhysicsEnvironment.cpp CcdPhysicsController.cpp' -incs = '. ../common' +incs = '. ../common #source/kernel/gen_system #intern/string #intern/moto/include #source/gameengine/Rasterizer' incs += ' ' + env['BF_BULLET_INC'] ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16214] trunk/blender/source/blender: New things for particle effectors:
Revision: 16214 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16214 Author: jhk Date: 2008-08-21 23:12:27 +0200 (Thu, 21 Aug 2008) Log Message: --- New things for particle effectors: - For newtonian particles a "self effect" button in particle extras makes the particles be effected by themselves if a particle effector is defined for this system, currently this is a brute force method so things start getting slow with more than ~100 particles, but this will hopefully change in the future. - Two new effector types: charge and a Lennard-Jones potential based force (inter-molecular forces for example). -Charge is similar to spherical field except it changes behavior (attract/repulse) based on the effected particles charge field (negative/positive) like real particles with a charge. -The Lennard-Jones field is a very short range force with a behavior determined by the sizes of the effector and effected particle. At a distance smaller than the combined sizes the field is very repulsive and after that distance it's attractive. It tries to keep the particles at an equilibrium distance from each other. Particles need to be at a close proximity to each other to be effected by this field at all. - Particle systems can now have two effector fields (two slots in the fields panel). This allows to create particles which for example have both a charge and a Lennard-Jones potential. Modified Paths: -- trunk/blender/source/blender/blenkernel/BKE_effect.h trunk/blender/source/blender/blenkernel/intern/effect.c trunk/blender/source/blender/blenkernel/intern/ipo.c trunk/blender/source/blender/blenkernel/intern/particle.c trunk/blender/source/blender/blenkernel/intern/particle_system.c trunk/blender/source/blender/blenloader/intern/readfile.c trunk/blender/source/blender/blenloader/intern/writefile.c trunk/blender/source/blender/makesdna/DNA_ipo_types.h trunk/blender/source/blender/makesdna/DNA_object_force.h trunk/blender/source/blender/makesdna/DNA_particle_types.h trunk/blender/source/blender/src/buttons_object.c trunk/blender/source/blender/src/editipo.c trunk/blender/source/blender/src/editipo_lib.c Modified: trunk/blender/source/blender/blenkernel/BKE_effect.h === --- trunk/blender/source/blender/blenkernel/BKE_effect.h2008-08-21 21:04:42 UTC (rev 16213) +++ trunk/blender/source/blender/blenkernel/BKE_effect.h2008-08-21 21:12:27 UTC (rev 16214) @@ -66,7 +66,7 @@ void pdDoEffectors(struct ListBase *lb, float *opco, float *force, float *speed, float cur_time, float loc_time, unsigned int flags); /* required for particle_system.c */ -void do_physical_effector(Object *ob, float *opco, short type, float force_val, float distance, float falloff, float size, float damp, float *eff_velocity, float *vec_to_part, float *velocity, float *field, int planar, struct RNG *rng, float noise_factor); +void do_physical_effector(Object *ob, float *opco, short type, float force_val, float distance, float falloff, float size, float damp, float *eff_velocity, float *vec_to_part, float *velocity, float *field, int planar, struct RNG *rng, float noise_factor, float charge, float pa_size); float effector_falloff(struct PartDeflect *pd, float *eff_velocity, float *vec_to_part); Modified: trunk/blender/source/blender/blenkernel/intern/effect.c === --- trunk/blender/source/blender/blenkernel/intern/effect.c 2008-08-21 21:04:42 UTC (rev 16213) +++ trunk/blender/source/blender/blenkernel/intern/effect.c 2008-08-21 21:12:27 UTC (rev 16214) @@ -332,7 +332,10 @@ { float eff_dir[3], temp[3]; float falloff=1.0, fac, r_fac; - + + if(pd->forcefield==PFIELD_LENNARDJ) + return falloff; /* Lennard-Jones field has it's own falloff built in */ + VecCopyf(eff_dir,eff_velocity); Normalize(eff_dir); @@ -369,7 +372,7 @@ return falloff; } -void do_physical_effector(Object *ob, float *opco, short type, float force_val, float distance, float falloff, float size, float damp, float *eff_velocity, float *vec_to_part, float *velocity, float *field, int planar, struct RNG *rng, float noise_factor) +void do_physical_effector(Object *ob, float *opco, short type, float force_val, float distance, float falloff, float size, float damp, float *eff_velocity, float *vec_to_part, float *velocity, float *field, int planar, struct RNG *rng, float noise_factor, float charge, float pa_size) { float mag_vec[3]={0,0,0}; float temp[3], temp2[3]; @@ -442,14 +445,44 @@ VecMulf(mag_vec,damp*1.9f*(float)sqrt(force_val)); VecSubf(field,field,mag_vec); break; - case PFIELD_NUCLE
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16213] trunk/blender/source/gameengine: BGE bug #17411 fixed: the always sensor is called before the the scale of the object is applied.
Revision: 16213 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16213 Author: ben2610 Date: 2008-08-21 23:04:42 +0200 (Thu, 21 Aug 2008) Log Message: --- BGE bug #17411 fixed: the always sensor is called before the the scale of the object is applied. The scale is now applied to the shape before the creation of the rigid body. Modified Paths: -- trunk/blender/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp Modified: trunk/blender/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp === --- trunk/blender/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp 2008-08-21 20:28:33 UTC (rev 16212) +++ trunk/blender/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp 2008-08-21 21:04:42 UTC (rev 16213) @@ -801,11 +801,8 @@ } bm->setMargin(0.06); - if (objprop->m_dyna) - bm->calculateLocalInertia(ci.m_mass,ci.m_localInertiaTensor); - if (objprop->m_isCompoundChild) { //find parent, compound shape and add to it @@ -905,6 +902,8 @@ ci.m_collisionFilterGroup = (isbulletdyna) ? short(CcdConstructionInfo::DefaultFilter) : short(CcdConstructionInfo::StaticFilter); ci.m_collisionFilterMask = (isbulletdyna) ? short(CcdConstructionInfo::AllFilter) : short(CcdConstructionInfo::AllFilter ^ CcdConstructionInfo::StaticFilter); ci.m_bRigid = objprop->m_dyna && objprop->m_angular_rigidbody; + MT_Vector3 scaling = gameobj->NodeGetWorldScaling(); + ci.m_scaling.setValue(scaling[0], scaling[1], scaling[2]); KX_BulletPhysicsController* physicscontroller = new KX_BulletPhysicsController(ci,isbulletdyna); // shapeInfo is reference counted, decrement now as we don't use it anymore if (shapeInfo) Modified: trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp === --- trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp 2008-08-21 20:28:33 UTC (rev 16212) +++ trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp 2008-08-21 21:04:42 UTC (rev 16213) @@ -48,6 +48,10 @@ // copy pointers locally to allow smart release m_MotionState = ci.m_MotionState; m_collisionShape = ci.m_collisionShape; + // apply scaling before creating rigid body + m_collisionShape->setLocalScaling(m_cci.m_scaling); + if (m_cci.m_mass) + m_collisionShape->calculateLocalInertia(m_cci.m_mass, m_cci.m_localInertiaTensor); // shape info is shared, increment ref count m_shapeInfo = ci.m_shapeInfo; if (m_shapeInfo) ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16212] trunk/blender/source/blender/src/ editipo.c: Missing newline at EOF.
Revision: 16212 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16212 Author: khughes Date: 2008-08-21 22:28:33 +0200 (Thu, 21 Aug 2008) Log Message: --- Missing newline at EOF. Modified Paths: -- trunk/blender/source/blender/src/editipo.c Modified: trunk/blender/source/blender/src/editipo.c === --- trunk/blender/source/blender/src/editipo.c 2008-08-21 19:10:32 UTC (rev 16211) +++ trunk/blender/source/blender/src/editipo.c 2008-08-21 20:28:33 UTC (rev 16212) @@ -6011,4 +6011,4 @@ } } BIF_undo_push("Set frame to selected Ipo vertex"); -} \ No newline at end of file +} ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16211] branches/soc-2007-joeedh/source/ blender/render/intern/source: fix for somewhat embarresing threading bug introduced
Revision: 16211 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16211 Author: joeedh Date: 2008-08-21 21:10:32 +0200 (Thu, 21 Aug 2008) Log Message: --- fix for somewhat embarresing threading bug introduced when I added the option to only use the main thread for rendering if threads is set to 1 (it's a #define'd option the code for debugging purposes, as it doesn't work quite as well). Modified Paths: -- branches/soc-2007-joeedh/source/blender/render/intern/source/convertblender.c branches/soc-2007-joeedh/source/blender/render/intern/source/dsm.c branches/soc-2007-joeedh/source/blender/render/intern/source/dsm_soft.c branches/soc-2007-joeedh/source/blender/render/intern/source/pipeline.c branches/soc-2007-joeedh/source/blender/render/intern/source/rayshade.c Modified: branches/soc-2007-joeedh/source/blender/render/intern/source/convertblender.c === --- branches/soc-2007-joeedh/source/blender/render/intern/source/convertblender.c 2008-08-21 19:00:24 UTC (rev 16210) +++ branches/soc-2007-joeedh/source/blender/render/intern/source/convertblender.c 2008-08-21 19:10:32 UTC (rev 16211) @@ -3587,7 +3587,7 @@ /* Annoying, lamp UI does this, but the UI might not have been used? - add here too. * make sure this matches buttons_shading.c's logic */ - if(ELEM4(la->type, LA_AREA, LA_SPOT, LA_SUN, LA_LOCAL) && (la->mode & LA_SHAD_RAY)) + if(ELEM4(la->type, LA_AREA, LA_SPOT, LA_SUN, LA_LOCAL)) if (ELEM3(la->type, LA_SPOT, LA_SUN, LA_LOCAL)) if (la->ray_samp_method == LA_SAMP_CONSTANT) la->ray_samp_method = LA_SAMP_HALTON; Modified: branches/soc-2007-joeedh/source/blender/render/intern/source/dsm.c === --- branches/soc-2007-joeedh/source/blender/render/intern/source/dsm.c 2008-08-21 19:00:24 UTC (rev 16210) +++ branches/soc-2007-joeedh/source/blender/render/intern/source/dsm.c 2008-08-21 19:10:32 UTC (rev 16211) @@ -749,6 +749,7 @@ zco= ((float)apn->z[a])/2147483647.0f; zco = (shb->winmat[3][2])/(shb->winmat[2][2] - shb->winmat[2][3]*zco); zco = (zco - shb->clipsta) / (shb->clipend - shb->clipsta); + row2[totface].depth = 2147483647.0f*zco; //if (zco < -0.001 || zco > 1.001) printf("linear z: %f\n", zco); } else row2[totface].depth = apn->z[a]; Modified: branches/soc-2007-joeedh/source/blender/render/intern/source/dsm_soft.c === --- branches/soc-2007-joeedh/source/blender/render/intern/source/dsm_soft.c 2008-08-21 19:00:24 UTC (rev 16210) +++ branches/soc-2007-joeedh/source/blender/render/intern/source/dsm_soft.c 2008-08-21 19:10:32 UTC (rev 16211) @@ -79,7 +79,125 @@ extern Render R; static TCS_TilePool *deepbuffer_pool = NULL; +#if 0 +/*backprojection based method*/ +float DSM_getBPSoftShadow(Render *re, ShadBuf *shb, ShadeInput *shi, LampRen *lar, +float *rco, float *dxco, float *dyco, float inp, int channel) +{ + DSMBuffer *buf = shb->dsmbuffer; + DSMTile *tile; + DSMFunction *func; + DSMSampleLayer *samp, *startsamp=NULL; + float fac, co[4], co2[4], d, siz; + float xs, ys, a, b, res, worldz, startz; + int zs, bias, i; + float corners[4]; + BASSERT(shb->dsmbuffer); + + if(inp <= 0.0f) return 0.0f; + + /* rotate renderco en osaco */ + siz= 0.5f*(float)shb->size; + + VECCOPY(co, rco); + VECCOPY(co4, rco; + + co4[3] = 1.0f; + co[3]= 1.0f; + MTC_Mat4MulVec4fl(shb->persmat, co); /* rational hom co */ + MTC_Mat4MulVec4fl(shb->viewmat, co4); /* used for getting world-space depth */ + + worldz = co4[2]; + + xs= siz*(1.0f+co[0]/co[3]); + ys= siz*(1.0f+co[1]/co[3]); + + /* Clip for z: clipsta and clipend clip values of the shadow buffer. We + * can test for -1.0/1.0 because of the properties of the + * coordinate transformations. */ + + if (G.rt == 20) d = -0.0f; + else d = -1.0f; + + if (G.rt == 30) { + if (co[2] - shb->clipsta < -0.1f) return 1.0; + else if (co[2] > shb->clipend) co[2] = shb->clipend - 0.001; + + fac= (double)(co[2] - shb->clipsta) / (double)(shb->clipend - shb->clipsta); + } else { + + /* Clip for z: clipsta and clipend clip values of the shadow buffer. We +
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16210] trunk/blender: fix warning in previous revision, update MSVC project files, scons files in source/gameengine/Physics/ Bullet must be updated b
Revision: 16210 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16210 Author: ben2610 Date: 2008-08-21 21:00:24 +0200 (Thu, 21 Aug 2008) Log Message: --- fix warning in previous revision, update MSVC project files, scons files in source/gameengine/Physics/Bullet must be updated by adding these directories in the include list: intern/string/include, source/gameengine/Rasterizer, source/kernel/gen_system. I leave it up to more expert than me. Modified Paths: -- trunk/blender/projectfiles_vc7/gameengine/physics/PHY_Physics/PHY_Bullet/PHY_Bullet.vcproj trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp Modified: trunk/blender/projectfiles_vc7/gameengine/physics/PHY_Physics/PHY_Bullet/PHY_Bullet.vcproj === --- trunk/blender/projectfiles_vc7/gameengine/physics/PHY_Physics/PHY_Bullet/PHY_Bullet.vcproj 2008-08-21 18:12:36 UTC (rev 16209) +++ trunk/blender/projectfiles_vc7/gameengine/physics/PHY_Physics/PHY_Bullet/PHY_Bullet.vcproj 2008-08-21 19:00:24 UTC (rev 16210) @@ -19,7 +19,7 @@ http://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16209] branches/harmonic-skeleton/source/ blender/src/reeb.c: Vertice outside of faces would create zero degree nodes and mess up later.
Revision: 16209 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16209 Author: theeth Date: 2008-08-21 20:12:36 +0200 (Thu, 21 Aug 2008) Log Message: --- Vertice outside of faces would create zero degree nodes and mess up later. Do a single pass to remove those after reeb graph creation (but before filtering). Modified Paths: -- branches/harmonic-skeleton/source/blender/src/reeb.c Modified: branches/harmonic-skeleton/source/blender/src/reeb.c === --- branches/harmonic-skeleton/source/blender/src/reeb.c2008-08-21 17:28:58 UTC (rev 16208) +++ branches/harmonic-skeleton/source/blender/src/reeb.c2008-08-21 18:12:36 UTC (rev 16209) @@ -1296,7 +1296,6 @@ merging = 2; } - if (merging) { BLI_ReflagSubgraph((BGraph*)rg, end_node->flag, subgraph); @@ -1978,22 +1977,22 @@ /* MAIN ALGORITHM **/ -ReebArc * findConnectedArc(ReebGraph *rg, ReebArc *arc, ReebNode *v) +/* edges alone will create zero degree nodes, use this function to remove them */ +void removeZeroNodes(ReebGraph *rg) { - ReebArc *nextArc = arc->next; + ReebNode *node, *next_node; - for(nextArc = rg->arcs.first; nextArc; nextArc = nextArc->next) + for (node = rg->nodes.first; node; node = next_node) { - if (arc != nextArc && (nextArc->head == v || nextArc->tail == v)) + next_node = node->next; + + if (node->degree == 0) { - break; + BLI_removeNode((BGraph*)rg, (BNode*)node); } } - - return nextArc; } - void removeNormalNodes(ReebGraph *rg) { ReebArc *arc, *nextArc; @@ -2539,9 +2538,10 @@ printf("\n"); - BLI_listbase_from_dlist(dlist, &rg->nodes); + removeZeroNodes(rg); + removeNormalNodes(rg); return rg; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16208] branches/harmonic-skeleton/source/ blender: Finish yesterday's bugfixing.
Revision: 16208 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16208 Author: theeth Date: 2008-08-21 19:28:58 +0200 (Thu, 21 Aug 2008) Log Message: --- Finish yesterday's bugfixing. Making shape function work on cyclic graphs requires tracking the current graph level, which wasn't done correctly when this was implemented. Done properly now so going up and down on graph works as it did before. Modified Paths: -- branches/harmonic-skeleton/source/blender/blenlib/intern/graph.c branches/harmonic-skeleton/source/blender/src/autoarmature.c Modified: branches/harmonic-skeleton/source/blender/blenlib/intern/graph.c === --- branches/harmonic-skeleton/source/blender/blenlib/intern/graph.c 2008-08-21 16:13:26 UTC (rev 16207) +++ branches/harmonic-skeleton/source/blender/blenlib/intern/graph.c 2008-08-21 17:28:58 UTC (rev 16208) @@ -465,6 +465,8 @@ int BLI_subtreeShape(BGraph *graph, BNode *node, BArc *rootArc, int include_root) { + BNode *test_node; + BLI_flagNodes(graph, 0); return subtreeShape(node, rootArc, include_root); } Modified: branches/harmonic-skeleton/source/blender/src/autoarmature.c === --- branches/harmonic-skeleton/source/blender/src/autoarmature.c 2008-08-21 16:13:26 UTC (rev 16207) +++ branches/harmonic-skeleton/source/blender/src/autoarmature.c 2008-08-21 17:28:58 UTC (rev 16208) @@ -1341,8 +1341,6 @@ cost_cache = MEM_callocN(sizeof(float) * nb_edges, "Cost cache"); vec_cache = MEM_callocN(sizeof(float*) * (nb_edges + 1), "Vec cache"); -// /* symmetry axis */ -// if (earc->symmetry_level == 1 && iarc->symmetry_level == 1) if (testFlipArc(iarc, inode_start)) { node_start = earc->tail; @@ -1693,8 +1691,6 @@ float *previous_vec = NULL; -// /* symmetry axis */ -// if (earc->symmetry_level == 1 && iarc->symmetry_level == 1) if (testFlipArc(iarc, inode_start)) { node_start = (ReebNode*)earc->tail; @@ -1798,13 +1794,10 @@ RigEdge *edge = iarc->edges.first; EditBone *bone = edge->bone; -// /* symmetry axis */ -// if (earc->symmetry_level == 1 && iarc->symmetry_level == 1) if (testFlipArc(iarc, inode_start)) { repositionBone(rigg, bone, earc->tail->p, earc->head->p); } - /* or not */ else { repositionBone(rigg, bone, earc->head->p, earc->tail->p); @@ -1868,7 +1861,7 @@ next_earc = next_earc->link_up; reebg = reebg->link_up; enode = next_earc->head; - eshape = BLI_subtreeShape((BGraph*)rigg->link_mesh, (BNode*)enode, (BArc*)next_earc, 1) % SHAPE_LEVELS; + eshape = BLI_subtreeShape((BGraph*)reebg, (BNode*)enode, (BArc*)next_earc, 1) % SHAPE_LEVELS; } next_earc->flag = 1; // mark as taken @@ -1915,16 +1908,20 @@ next_iarc->link_mesh = NULL; + printf("---\n"); + printf("MATCHING LIMB\n"); + RIG_printArcBones(next_iarc); + for(i = 0; i < enode->degree; i++) { next_earc = (ReebArc*)enode->arcs[i]; if (next_earc->flag == 0) { - printf("candidate (flag %i == %i) (group %i == %i) (level %i == %i)\n", - next_earc->symmetry_flag, symmetry_flag, - next_earc->symmetry_group, symmetry_group, - next_earc->symmetry_level, symmetry_level); + printf("candidate (flag %i ?= %i) (group %i ?= %i) (level %i ?= %i)\n", + symmetry_flag, next_earc->symmetry_flag, + symmetry_group, next_earc->symmetry_flag, + symmetry_level, next_earc->symmetry_level); } if (next_earc->flag == 0 && /* not already taken */ @@ -1932,9 +1929,7 @@ next_earc->symmetry_group == symmetry_group && next_earc->symmetry_level == symmetry_level) { - printf("---\n"); printf("CORRESPONDING ARC FOUND\n"); - RIG_printArcBones(next_iarc); printf("flag %i -- symmetry level %i -- symmetry flag %i\n", next_earc->flag, next_earc->symmetry_level, next_earc->symmetry_flag); matchMultiResolutionArc(rigg, start_node, next_iarc, next_earc); @@ -1945,19 +1940,8 @@
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16207] trunk/blender/source/blender/ python/api2_2x/Mesh.c: Python API
Revision: 16207 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16207 Author: khughes Date: 2008-08-21 18:13:26 +0200 (Thu, 21 Aug 2008) Log Message: --- Python API -- Fix typo in Mesh module exception messages (submitted by Teppo Kansala ). Modified Paths: -- trunk/blender/source/blender/python/api2_2x/Mesh.c Modified: trunk/blender/source/blender/python/api2_2x/Mesh.c === --- trunk/blender/source/blender/python/api2_2x/Mesh.c 2008-08-21 16:10:30 UTC (rev 16206) +++ trunk/blender/source/blender/python/api2_2x/Mesh.c 2008-08-21 16:13:26 UTC (rev 16207) @@ -5381,11 +5381,11 @@ if( PySequence_Size( args ) != 2 || !PyArg_ParseTuple( args, "iO", &edge_also, &args ) ) return EXPP_ReturnPyObjError( PyExc_TypeError, - "expected and int and a sequence of ints or MFaces" ); + "expected an int and a sequence of ints or MFaces" ); if( !PyList_Check( args ) && !PyTuple_Check( args ) ) return EXPP_ReturnPyObjError( PyExc_TypeError, - "expected and int and a sequence of ints or MFaces" ); + "expected an int and a sequence of ints or MFaces" ); /* see how many args we need to parse */ len = PySequence_Size( args ); ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16206] trunk/blender/source/blender/ python/api2_2x: Python API
Revision: 16206 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16206 Author: khughes Date: 2008-08-21 18:10:30 +0200 (Thu, 21 Aug 2008) Log Message: --- Python API -- Access to empty shapes by object.emptyShape attribute, contributed by Domino Marama (thanks!) Modified Paths: -- trunk/blender/source/blender/python/api2_2x/Object.c trunk/blender/source/blender/python/api2_2x/doc/Object.py Modified: trunk/blender/source/blender/python/api2_2x/Object.c === --- trunk/blender/source/blender/python/api2_2x/Object.c2008-08-21 15:44:29 UTC (rev 16205) +++ trunk/blender/source/blender/python/api2_2x/Object.c2008-08-21 16:10:30 UTC (rev 16206) @@ -204,6 +204,7 @@ EXPP_OBJ_ATTR_SB_INSPRING, EXPP_OBJ_ATTR_SB_INFRICT, + EXPP_OBJ_ATTR_EMPTY_DRAWTYPE }; #define EXPP_OBJECT_DRAWSIZEMIN 0.01f @@ -2431,6 +2432,12 @@ OB_BOUNDBOX, OB_TEXTURE, 'b' ); } +static int Object_setEmptyShape( BPy_Object * self, PyObject * value ) +{ + return EXPP_setIValueRange( value, &self->object->empty_drawtype, + OB_ARROWS, OB_EMPTY_CONE, 'b' ); +} + static int Object_setEuler( BPy_Object * self, PyObject * args ) { float rot1, rot2, rot3; @@ -3758,6 +3765,9 @@ case EXPP_OBJ_ATTR_DRAWTYPE: param = object->dt; break; + case EXPP_OBJ_ATTR_EMPTY_DRAWTYPE: + param = object->empty_drawtype; + break; case EXPP_OBJ_ATTR_PARENT_TYPE: param = object->partype; break; @@ -4938,6 +4948,10 @@ (getter)getIntAttr, (setter)Object_setDrawType, "The object's drawing type", (void *)EXPP_OBJ_ATTR_DRAWTYPE}, + {"emptyShape", +(getter)getIntAttr, (setter)Object_setEmptyShape, +"The empty's drawing shape", +(void *)EXPP_OBJ_ATTR_EMPTY_DRAWTYPE}, {"parentType", (getter)getIntAttr, (setter)NULL, "The object's parent type", @@ -5538,6 +5552,24 @@ return M; } +static PyObject *M_Object_EmptyShapesDict( void ) +{ + PyObject *M = PyConstant_New( ); + + if( M ) { + BPy_constant *d = ( BPy_constant * ) M; + PyConstant_Insert( d, "ARROWS", PyInt_FromLong( OB_ARROWS ) ); + PyConstant_Insert( d, "AXES", PyInt_FromLong( OB_PLAINAXES ) ); + PyConstant_Insert( d, "CIRCLE", PyInt_FromLong( OB_CIRCLE ) ); + PyConstant_Insert( d, "ARROW", PyInt_FromLong( OB_SINGLE_ARROW ) ); + PyConstant_Insert( d, "CUBE", PyInt_FromLong( OB_CUBE ) ); + PyConstant_Insert( d, "SPHERE", PyInt_FromLong( OB_EMPTY_SPHERE ) ); + PyConstant_Insert( d, "CONE", PyInt_FromLong( OB_EMPTY_CONE ) ); + } + return M; +} + + /*/ /* Function:initObject */ /*/ @@ -5552,6 +5584,7 @@ PyObject *RBFlagsDict = M_Object_RBFlagsDict( ); PyObject *RBShapesDict = M_Object_RBShapeBoundDict( ); PyObject *IpoKeyTypesDict = M_Object_IpoKeyTypesDict( ); + PyObject *EmptyShapesDict = M_Object_EmptyShapesDict( ); PyType_Ready( &Object_Type ) ; @@ -5596,7 +5629,9 @@ if( RBShapesDict ) PyModule_AddObject( module, "RBShapes", RBShapesDict ); if( IpoKeyTypesDict ) - PyModule_AddObject( module, "IpoKeyTypes", IpoKeyTypesDict ); + PyModule_AddObject( module, "IpoKeyTypes", IpoKeyTypesDict ); + if( EmptyShapesDict ) + PyModule_AddObject( module, "EmptyShapes", EmptyShapesDict ); /*Add SUBMODULES to the module*/ dict = PyModule_GetDict( module ); /*borrowed*/ Modified: trunk/blender/source/blender/python/api2_2x/doc/Object.py === --- trunk/blender/source/blender/python/api2_2x/doc/Object.py 2008-08-21 15:44:29 UTC (rev 16205) +++ trunk/blender/source/blender/python/api2_2x/doc/Object.py 2008-08-21 16:10:30 UTC (rev 16206) @@ -117,6 +117,10 @@ attribute. Only one type can be selected at a time. Values are BOX, SPHERE, CYLINDER, CONE, and POLYHEDERON [EMAIL PROTECTED] EmptyShapes: readonly dictionary [EMAIL PROTECTED] EmptyShapes: Constant dict used for with L{Object.emptyShape} attribute. + Only one type can be selected at a time. Values are + ARROW, ARROWS, AXES, CIRCLE, CONE, CUBE AND SPHERE """ def New (type, name='type'): @@ -347,7 +351,7 @@ ob.layers = [] # object won't be visible ob.layers = [1, 4] # object visible only
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16205] branches/apricot/source: Apricot Branch: bugfix: glsl materials didn't get correct lights
Revision: 16205 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16205 Author: blendix Date: 2008-08-21 17:44:29 +0200 (Thu, 21 Aug 2008) Log Message: --- Apricot Branch: bugfix: glsl materials didn't get correct lights when switching between blend files. Also took advantage of this to remove some duplicate code related to accessing blender scenes. Modified Paths: -- branches/apricot/source/blender/gpu/intern/gpu_material.c branches/apricot/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp branches/apricot/source/gameengine/Converter/BL_BlenderDataConversion.cpp branches/apricot/source/gameengine/Converter/KX_BlenderSceneConverter.cpp branches/apricot/source/gameengine/Converter/KX_BlenderSceneConverter.h branches/apricot/source/gameengine/GamePlayer/ActiveX/BlenderPlayerCtl.cpp branches/apricot/source/gameengine/GamePlayer/ghost/GPG_Application.cpp branches/apricot/source/gameengine/GamePlayer/ghost/GPG_Application.h branches/apricot/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp branches/apricot/source/gameengine/GamePlayer/netscape/src/ketsji/KXH_ketsji_hooks.cpp branches/apricot/source/gameengine/Ketsji/BL_BlenderShader.cpp branches/apricot/source/gameengine/Ketsji/KX_ISceneConverter.h branches/apricot/source/gameengine/Ketsji/KX_KetsjiEngine.cpp branches/apricot/source/gameengine/Ketsji/KX_Scene.cpp branches/apricot/source/gameengine/Ketsji/KX_Scene.h Modified: branches/apricot/source/blender/gpu/intern/gpu_material.c === --- branches/apricot/source/blender/gpu/intern/gpu_material.c 2008-08-21 15:19:54 UTC (rev 16204) +++ branches/apricot/source/blender/gpu/intern/gpu_material.c 2008-08-21 15:44:29 UTC (rev 16205) @@ -749,7 +749,7 @@ if (ob->transflag & OB_DUPLI) { DupliObject *dob; - ListBase *lb = object_duplilist(G.scene, ob); + ListBase *lb = object_duplilist(shi->gpumat->scene, ob); for(dob=lb->first; dob; dob=dob->next) { Object *ob = dob->ob; Modified: branches/apricot/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp === --- branches/apricot/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp 2008-08-21 15:19:54 UTC (rev 16204) +++ branches/apricot/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp 2008-08-21 15:44:29 UTC (rev 16205) @@ -309,7 +309,8 @@ mousedevice, networkdevice, audiodevice, - startscenename); + startscenename, + blscene); // some python things PyObject* dictionaryobject = initGamePythonScripting("Ketsji", psl_Lowest); @@ -577,7 +578,9 @@ mousedevice, networkdevice, audiodevice, - startscenename); + startscenename, + blscene); + // some python things PyObject* dictionaryobject = initGamePythonScripting("Ketsji", psl_Lowest); ketsjiengine->SetPythonDictionary(dictionaryobject); Modified: branches/apricot/source/gameengine/Converter/BL_BlenderDataConversion.cpp === --- branches/apricot/source/gameengine/Converter/BL_BlenderDataConversion.cpp 2008-08-21 15:19:54 UTC (rev 16204) +++ branches/apricot/source/gameengine/Converter/BL_BlenderDataConversion.cpp 2008-08-21 15:44:29 UTC (rev 16205) @@ -1613,20 +1613,6 @@ SG_Node* m_gamechildnode; }; - /** -* Find the specified scene by name, or the first -* scene if nothing matches (shouldn't happen). -*/ -static struct Scene *GetSceneForName(struct Main *maggie, const STR_String& scenename) { - Scene *sce; - - for (sce= (Scene*) maggie->scene.first; sce; sce= (Scene*) sce->id.next) - if (scenename == (sce->id.name+2)) - return sce; - - return (Scene*) maggie->scene.first; -} - #include "DNA_constraint_types.h" #include "BIF_editconstraint.h" @@ -1725,7 +1711,7 @@ ) { - Scene *blenderscene = GetSceneForName(maggie, scenename); + Scene *blenderscene = converter->GetBlenderSceneForName(scenename); // for SETLOOPER Scene *sce; Base *base; Modified: branches/apricot/source/gameengine/Conver
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16204] trunk/blender: BGE bug #17491 fixed: BGE, Dupli instance with different scale, massive slowdown.
Revision: 16204 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16204 Author: ben2610 Date: 2008-08-21 17:19:54 +0200 (Thu, 21 Aug 2008) Log Message: --- BGE bug #17491 fixed: BGE, Dupli instance with different scale, massive slowdown. The root cause of this bug is the fact that Bullet shapes are shared between duplicated game objects. As the physics object scale is stored in the shape, all duplicas must have the same scale otherwise the physics representation is incorrect. This fix introduces a mechanism to duplicate shapes at runtime so that Bullet shapes are not shared anymore. The drawback is an increased memory consuption. A reference count mechanism will be introduced in a later revision to keep Bullet shape shared between duplicas that have the same scale. Modified Paths: -- trunk/blender/projectfiles_vc7/gameengine/physics/PHY_Physics/PHY_Bullet/PHY_Bullet.vcproj trunk/blender/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp trunk/blender/source/gameengine/Ketsji/KX_Scene.cpp trunk/blender/source/gameengine/Ketsji/KX_Scene.h trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsController.h trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp trunk/blender/source/gameengine/Physics/common/PHY_DynamicTypes.h Modified: trunk/blender/projectfiles_vc7/gameengine/physics/PHY_Physics/PHY_Bullet/PHY_Bullet.vcproj === --- trunk/blender/projectfiles_vc7/gameengine/physics/PHY_Physics/PHY_Bullet/PHY_Bullet.vcproj 2008-08-21 14:07:24 UTC (rev 16203) +++ trunk/blender/projectfiles_vc7/gameengine/physics/PHY_Physics/PHY_Bullet/PHY_Bullet.vcproj 2008-08-21 15:19:54 UTC (rev 16204) @@ -151,7 +151,7 @@ NumPolygons(); - if (!numpolys) - { - return NULL; - } - - // Count the number of collision polygons and check they all come from the same - // vertex array - int numvalidpolys = 0; - int vtxarray = -1; - RAS_IPolyMaterial *poly_material = NULL; - bool reinstance = true; - - for (int p=0; pGetPolygon(p); - - // only add polygons that have the collisionflag set - if (poly->IsCollider()) - { - // check polygon is from the same vertex array - if (poly->GetVertexIndexBase().m_vtxarray != vtxarray) - { - if (vtxarray < 0) - vtxarray = poly->GetVertexIndexBase().m_vtxarray; - else - { - reinstance = false; - vtxarray = -1; - } - } - - // check poly is from the same material - if (poly->GetMaterial()->GetPolyMaterial() != poly_material) - { - if (poly_material) - { - reinstance = false; - poly_material = NULL; - } - else - poly_material = poly->GetMaterial()->GetPolyMaterial(); - } - - // count the number of collision polys - numvalidpolys++; - - // We have one collision poly, and we can't reinstance, so we - // might as well break here. - if (!reinstance) - break; - } - } - - // No collision polygons - if (numvalidpolys < 1) - return NULL; - - - if (polytope) - { - convexHullShape = new btConvexHullShape(&points[0].getX(),numPoints); - collisionMeshShape = convexHullShape; - } else - { - collisionMeshData = new btTriangleMesh(); -// concaveShape = new btTriangleMeshShape(collisionMeshData); - //collisionMeshShape = concaveShape; - - } - - - numvalidpolys = 0; - - for (int p2=0; p2GetPolygon(p2); - - // only add polygons that have the collisionflag set - if (poly->IsCollider()) - { - //Bullet can raycast any shape, so - if (polytope) - { - for (int i=0;iVertexCount();i++) - { - const float* vtx = meshobj->GetVertex(poly->GetVertexIndexBase().m_vtxarray, -
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16203] trunk/blender/extern/bullet2/src/ BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp: BGE Bullet fix: physics debug representation of cone sh
Revision: 16203 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16203 Author: ben2610 Date: 2008-08-21 16:07:24 +0200 (Thu, 21 Aug 2008) Log Message: --- BGE Bullet fix: physics debug representation of cone shape does not take Up axis into account. Use Bullet 2.69 code to fix that bug. Modified Paths: -- trunk/blender/extern/bullet2/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp Modified: trunk/blender/extern/bullet2/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp === --- trunk/blender/extern/bullet2/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp 2008-08-21 13:40:40 UTC (rev 16202) +++ trunk/blender/extern/bullet2/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp 2008-08-21 14:07:24 UTC (rev 16203) @@ -856,10 +856,26 @@ btScalar radius = coneShape->getRadius();//+coneShape->getMargin(); btScalar height = coneShape->getHeight();//+coneShape->getMargin(); btVector3 start = worldTransform.getOrigin(); - getDebugDrawer()->drawLine(start+worldTransform.getBasis() * btVector3(btScalar(0.),btScalar(0.),btScalar(0.5)*height),start+worldTransform.getBasis() * btVector3(radius,btScalar(0.),btScalar(-0.5)*height),color); - getDebugDrawer()->drawLine(start+worldTransform.getBasis() * btVector3(btScalar(0.),btScalar(0.),btScalar(0.5)*height),start+worldTransform.getBasis() * btVector3(-radius,btScalar(0.),btScalar(-0.5)*height),color); - getDebugDrawer()->drawLine(start+worldTransform.getBasis() * btVector3(btScalar(0.),btScalar(0.),btScalar(0.5)*height),start+worldTransform.getBasis() * btVector3(btScalar(0.),radius,btScalar(-0.5)*height),color); - getDebugDrawer()->drawLine(start+worldTransform.getBasis() * btVector3(btScalar(0.),btScalar(0.),btScalar(0.5)*height),start+worldTransform.getBasis() * btVector3(btScalar(0.),-radius,btScalar(-0.5)*height),color); + // insert here Bullet 2.69 that fixes representation of cone + int upAxis= coneShape->getConeUpIndex(); + + btVector3 offsetHeight(0,0,0); + offsetHeight[upAxis] = height * btScalar(0.5); + btVector3 offsetRadius(0,0,0); + offsetRadius[(upAxis+1)%3] = radius; + btVector3 offset2Radius(0,0,0); + offset2Radius[(upAxis+2)%3] = radius; + + getDebugDrawer()->drawLine(start+worldTransform.getBasis() * (offsetHeight),start+worldTransform.getBasis() * (-offsetHeight+offsetRadius),color); + getDebugDrawer()->drawLine(start+worldTransform.getBasis() * (offsetHeight),start+worldTransform.getBasis() * (-offsetHeight-offsetRadius),color); + getDebugDrawer()->drawLine(start+worldTransform.getBasis() * (offsetHeight),start+worldTransform.getBasis() * (-offsetHeight+offset2Radius),color); + getDebugDrawer()->drawLine(start+worldTransform.getBasis() * (offsetHeight),start+worldTransform.getBasis() * (-offsetHeight-offset2Radius),color); + + // buggy code that does not take into account the direction of the cone + //getDebugDrawer()->drawLine(start+worldTransform.getBasis() * btVector3(btScalar(0.),btScalar(0.),btScalar(0.5)*height),start+worldTransform.getBasis() * btVector3(radius,btScalar(0.),btScalar(-0.5)*height),color); + //getDebugDrawer()->drawLine(start+worldTransform.getBasis() * btVector3(btScalar(0.),btScalar(0.),btScalar(0.5)*height),start+worldTransform.getBasis() * btVector3(-radius,btScalar(0.),btScalar(-0.5)*height),color); + //getDebugDrawer()->drawLine(start+worldTransform.getBasis() * btVector3(btScalar(0.),btScalar(0.),btScalar(0.5)*height),start+worldTransform.getBasis() * btVector3(btScalar(0.),radius,btScalar(-0.5)*height),color); + //getDebugDrawer()->drawLine(start+worldTransform.getBasis() * btVector3(btScalar(0.),btScalar(0.),btScalar(0.5)*height),start+worldTransform.getBasis() * btVector3(btScalar(0.),-radius,btScalar(-0.5)*height),color); break; } ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16202] branches/apricot/source/gameengine :
Revision: 16202 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16202 Author: blendix Date: 2008-08-21 15:40:40 +0200 (Thu, 21 Aug 2008) Log Message: --- Apricot Branch: fix for bug #17435, only first 3 texture slots were being used for finding second uv coordinate layer. Modified Paths: -- branches/apricot/source/gameengine/Ketsji/BL_Material.h branches/apricot/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h branches/apricot/source/gameengine/Rasterizer/RAS_TexVert.h Modified: branches/apricot/source/gameengine/Ketsji/BL_Material.h === --- branches/apricot/source/gameengine/Ketsji/BL_Material.h 2008-08-21 07:59:18 UTC (rev 16201) +++ branches/apricot/source/gameengine/Ketsji/BL_Material.h 2008-08-21 13:40:40 UTC (rev 16202) @@ -18,9 +18,9 @@ this will default to users available units to build with more available, just increment this value although the more you add the slower the search time will be. - we will go for three, which should be enough + we will go for eight, which should be enough */ -#define MAXTEX 3 //match in RAS_TexVert & RAS_OpenGLRasterizer +#define MAXTEX 8 //match in RAS_TexVert & RAS_OpenGLRasterizer // different mapping modes class BL_Mapping Modified: branches/apricot/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h === --- branches/apricot/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h 2008-08-21 07:59:18 UTC (rev 16201) +++ branches/apricot/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h 2008-08-21 13:40:40 UTC (rev 16202) @@ -41,7 +41,7 @@ #include "RAS_MaterialBucket.h" #include "RAS_ICanvas.h" -#define RAS_MAX_TEXCO 3 // match in BL_Material +#define RAS_MAX_TEXCO 8 // match in BL_Material #define RAS_MAX_ATTRIB 16 // match in BL_BlenderShader struct OglDebugLine Modified: branches/apricot/source/gameengine/Rasterizer/RAS_TexVert.h === --- branches/apricot/source/gameengine/Rasterizer/RAS_TexVert.h 2008-08-21 07:59:18 UTC (rev 16201) +++ branches/apricot/source/gameengine/Rasterizer/RAS_TexVert.h 2008-08-21 13:40:40 UTC (rev 16202) @@ -57,7 +57,7 @@ enum { FLAT = 1, SECOND_UV = 2, - MAX_UNIT = 3 + MAX_UNIT = 8 }; short getFlag() const; ___ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs
[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16201] branches/soc-2007-joeedh/source/ blender: Commit of an experimental tile-based disk-backed image
Revision: 16201 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16201 Author: joeedh Date: 2008-08-21 09:59:18 +0200 (Thu, 21 Aug 2008) Log Message: --- Commit of an experimental tile-based disk-backed image library I felt like writing. It does nothing at the moment. Also, added some UI for soft shadows (which of course don't work yet, still need to code a good PCF implementation, as it seems not only is the more physically-correct method my nonworking code is using a lot slower, but it's also not worth it if your rendering fur). Modified Paths: -- branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_bucketbuffer.c branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_cache.c branches/soc-2007-joeedh/source/blender/blenkernel/intern/tcs_image.c branches/soc-2007-joeedh/source/blender/makesdna/DNA_lamp_types.h branches/soc-2007-joeedh/source/blender/render/intern/include/render_types.h branches/soc-2007-joeedh/source/blender/render/intern/source/convertblender.c branches/soc-2007-joeedh/source/blender/render/intern/source/dsm_func.c branches/soc-2007-joeedh/source/blender/render/intern/source/dsm_soft.c branches/soc-2007-joeedh/source/blender/src/buttons_shading.c Added Paths: --- branches/soc-2007-joeedh/source/blender/blenkernel/BKE_imagebuffer.h Added: branches/soc-2007-joeedh/source/blender/blenkernel/BKE_imagebuffer.h === --- branches/soc-2007-joeedh/source/blender/blenkernel/BKE_imagebuffer.h (rev 0) +++ branches/soc-2007-joeedh/source/blender/blenkernel/BKE_imagebuffer.h 2008-08-21 07:59:18 UTC (rev 16201) @@ -0,0 +1,119 @@ +/** + * blenlib/BKE_imagebuffer.h + * + * $Id: BKE_imagebuffer.h 15647 2008-07-20 04:39:35Z joeedh $ + * + * * BEGIN GPL LICENSE BLOCK * + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * * END GPL LICENSE BLOCK * + */ +#ifndef BKE_IMAGEBUFFER_H +#define BKE_IMAGEBUFFER_H + +#define USEIMAGEBUFFER 0 + +#if USEIMAGEBUFFER + +#include "BKE_tile.h" + +typedef struct TCS_ImageTile { + TCS_Tile tile; + union { + char *c; + float *f; + } data; + int sizex, sizey; + int x, y, type, totchannels; +} TCS_ImageTile; + +typedef struct TCS_Image { + TCS_TileBuffer buffer; + int sizex, sizey; + int tilex, tiley; + + short flags, type; + int totchannels; + + TCS_ImageTile *tilerect; +} TCS_Image; + +/*image types*/ +#define IMAGE_FLOAT0 +#define IMAGE_BYTE 1 + +#define TCSIMAGE_MAX_TILESIZE 64 +#define TCSIMAGE_MAX_TOTCHANNELS 4 +#define TCSIMAGE_MAXMEM75*1024*1024 + +/*note: initcolor is allowed to be NuLL*/ +TCS_Image *TCSImage_newImage(int sizex, int sizey, int type, int totchannels, +void *initcolor); + +void TCSImage_getPixelf(TCS_Image *img, int x, int y, float *dst_pixel); +void TCSImage_getPixelub(TCS_Image *img, int x, int y, char *dst_pixel); + +void TCSImage_setPixelf(TCS_Image *img, int x, int y, float *src_pixel); +void TCSImage_setPixelub(TCS_Image *img, int x, int y, char *src_pixel); + +/*note, this can't (by it's nature) lock the tile automatically the way the previous + two functions can (there's no point) */ +void *TCSImage_getPixel(TCS_Image *img, int x, int y); + +/*ok, as much as possible try to use the pixel processor functions, which + loops over every pixel in an image and calls a function on these, + since they'll automatically do float<->byte conversions for you. + + also, the processor functions themselves always work in floats*/ + +/*x and y are pixel positions in normalized 0.0 ... 1.0 space. + note that fac is always provided. + + in is the input pixel, out is the output. note that out is *not* + zeroed, so it may have garbage in it. totchannels is the number of + channels this pixel has.*/ +typedef void (*PixelProc)(float *in, float *out, float *fac,