From 392e1da1790d252f0f156379c1d5507959a4e17a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 17 Apr 2010 15:47:00 +0000 Subject: bugfix and cleanup - BGE Shader.setSampler(name, index): index range check was wrong. - Compositor check for an invalid channel was incorrect. - getting the center of selected verts used an uninitalized z axis. - do_init_render_material() used && rather then & when testing for MA_TRANSP. - weight paint activate flipped bone used && rather then & for flag checking. --- source/blender/blenkernel/intern/customdata.c | 2 +- source/blender/blenkernel/intern/material.c | 2 +- source/blender/blenkernel/intern/particle.c | 2 +- source/blender/blenkernel/intern/particle_system.c | 4 ++-- source/blender/blenlib/intern/threads.c | 1 + source/blender/blenlib/intern/uvproject.c | 2 +- source/blender/editors/armature/poseobject.c | 2 +- source/blender/editors/mesh/editmesh_loop.c | 2 +- source/blender/editors/mesh/editmesh_mods.c | 2 +- source/blender/editors/space_nla/nla_edit.c | 2 +- source/blender/makesrna/intern/makesrna.c | 2 +- source/blender/nodes/intern/CMP_util.c | 4 ++-- source/gameengine/Converter/BL_ArmatureConstraint.cpp | 2 +- source/gameengine/Ketsji/BL_Shader.cpp | 2 +- source/gameengine/Ketsji/KX_CameraActuator.cpp | 2 +- source/gameengine/Ketsji/KX_SoundActuator.cpp | 2 +- 16 files changed, 18 insertions(+), 17 deletions(-) diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 71be2ce7b78..a973c33ca54 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -445,7 +445,7 @@ static int mdisp_corners(MDisps *s) return (s->totdisp % (3*3) == 0)? 3: 4; } -static void layerSwap_mdisps(void *data, int *ci) +static void layerSwap_mdisps(void *data, const int *ci) { MDisps *s = data; float (*d)[3] = NULL; diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 3b17ac1db1a..f3096cdf8f2 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -730,7 +730,7 @@ static void do_init_render_material(Material *ma, int r_mode, float *amb) /* since the raytracer doesnt recalc O structs for each ray, we have to preset them all */ if(r_mode & R_RAYTRACE) { - if((ma->mode & (MA_RAYMIRROR|MA_SHADOW_TRA)) || ((ma->mode && MA_TRANSP) && (ma->mode & MA_RAYTRANSP))) { + if((ma->mode & (MA_RAYMIRROR|MA_SHADOW_TRA)) || ((ma->mode & MA_TRANSP) && (ma->mode & MA_RAYTRANSP))) { ma->texco |= NEED_UV|TEXCO_ORCO|TEXCO_REFL|TEXCO_NORM; if(r_mode & R_OSA) ma->texco |= TEXCO_OSA; } diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index d41ede22006..c4888dedf48 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -396,7 +396,7 @@ void free_hair(Object *ob, ParticleSystem *psys, int dynamics) if(dynamics) { BKE_ptcache_free_list(&psys->ptcaches); psys->clmd->point_cache = psys->pointcache = NULL; - psys->clmd->ptcaches.first = psys->clmd->ptcaches.first = NULL; + psys->clmd->ptcaches.first = psys->clmd->ptcaches.last = NULL; modifier_free((ModifierData*)psys->clmd); diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 389b31a20c7..720bf3b2a47 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -2385,7 +2385,7 @@ void particle_fluidsim(ParticleSystem *psys, ParticleData *pa, ParticleSettings static void apply_particle_fluidsim(ParticleSystem *psys, ParticleData *pa, ParticleSettings *part, ParticleSimulationData *sim, float dfra, float cfra){ ParticleTarget *pt; - float dtime = dfra*psys_get_timestep(sim); +// float dtime = dfra*psys_get_timestep(sim); float particle_mass = part->mass; particle_fluidsim(psys, pa, part, sim, dfra, cfra, particle_mass); @@ -3688,7 +3688,7 @@ static void system_step(ParticleSimulationData *sim, float cfra) PARTICLE_P; int oldtotpart; float disp, *vg_vel= 0, *vg_tan= 0, *vg_rot= 0, *vg_size= 0; - int init= 0, emit= 0, only_children_changed= 0; + int init= 0, emit= 0; //, only_children_changed= 0; int framenr, framedelta, startframe = 0, endframe = 100; framenr= (int)sim->scene->r.cfra; diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c index aa87a56a60c..de7842727df 100644 --- a/source/blender/blenlib/intern/threads.c +++ b/source/blender/blenlib/intern/threads.c @@ -29,6 +29,7 @@ */ #include +#include #include "MEM_guardedalloc.h" diff --git a/source/blender/blenlib/intern/uvproject.c b/source/blender/blenlib/intern/uvproject.c index 8cfa083554b..11d93748fe4 100644 --- a/source/blender/blenlib/intern/uvproject.c +++ b/source/blender/blenlib/intern/uvproject.c @@ -136,7 +136,7 @@ UvCameraInfo *project_camera_info(Object *ob, float (*rotmat)[4], float winx, fl uci.do_persp = (camera->type==CAM_PERSP); uci.camangle= lens_to_angle(camera->lens) / 2.0f; - uci.camsize= uci.do_persp ? uci.camsize= tanf(uci.camangle) : camera->ortho_scale; + uci.camsize= uci.do_persp ? tanf(uci.camangle) : camera->ortho_scale; if (invert_m4_m4(uci.caminv, ob->obmat)) { UvCameraInfo *uci_pt; diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 0c6bf04b8b9..a3d2c454d23 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -1459,7 +1459,7 @@ void pose_activate_flipped_bone(Scene *scene) if(ob==NULL) return; - if(ob->mode && OB_MODE_WEIGHT_PAINT) { + if(ob->mode & OB_MODE_WEIGHT_PAINT) { ob= modifiers_isDeformedByArmature(ob); } if(ob && (ob->mode & OB_MODE_POSE)) { diff --git a/source/blender/editors/mesh/editmesh_loop.c b/source/blender/editors/mesh/editmesh_loop.c index 90de0a01eea..643785ca200 100644 --- a/source/blender/editors/mesh/editmesh_loop.c +++ b/source/blender/editors/mesh/editmesh_loop.c @@ -629,7 +629,7 @@ static int knife_cut_exec(bContext *C, wmOperator *op) int len=0; short numcuts= RNA_int_get(op->ptr, "num_cuts"); short mode= RNA_int_get(op->ptr, "type"); - int corner_cut_pattern= RNA_enum_get(op->ptr,"corner_cut_pattern"); +// int corner_cut_pattern= RNA_enum_get(op->ptr,"corner_cut_pattern"); /* edit-object needed for matrix, and ar->regiondata for projections to work */ if (ELEM3(NULL, obedit, ar, ar->regiondata)) diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c index 7a5fd2d13cd..3a5d5380089 100644 --- a/source/blender/editors/mesh/editmesh_mods.c +++ b/source/blender/editors/mesh/editmesh_mods.c @@ -4058,7 +4058,7 @@ static void editmesh_calc_selvert_center(EditMesh *em, float cent_r[3]) EditVert *eve; int nsel= 0; - cent_r[0]= cent_r[1]= cent_r[0]= 0.0; + zero_v3(cent_r); for (eve= em->verts.first; eve; eve= eve->next) { if (eve->f & SELECT) { diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index 3319c36e92b..79aac30a7a4 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -903,7 +903,7 @@ static int nlaedit_bake_exec (bContext *C, wmOperator *op) ListBase anim_data = {NULL, NULL}; bAnimListElem *ale; int filter; - int flag = 0; +// int flag = 0; /* get editor data */ if (ANIM_animdata_get_context(C, &ac) == 0) diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index c568fea38d7..fc019f6afe1 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -1636,7 +1636,7 @@ static const char *rna_property_typename(PropertyType type) } } -static const char *rna_property_subtypename(PropertyType type) +static const char *rna_property_subtypename(PropertySubType type) { switch(type) { case PROP_NONE: return "PROP_NONE"; diff --git a/source/blender/nodes/intern/CMP_util.c b/source/blender/nodes/intern/CMP_util.c index f66b13a1937..f3e00cb37f8 100644 --- a/source/blender/nodes/intern/CMP_util.c +++ b/source/blender/nodes/intern/CMP_util.c @@ -578,9 +578,9 @@ CompBuf *valbuf_from_rgbabuf(CompBuf *cbuf, int channel) valbuf->yof= cbuf->yof; valf= valbuf->rect; - + /* defaults to returning alpha channel */ - if ((channel < CHAN_R) && (channel > CHAN_A)) channel = CHAN_A; + if ((channel < CHAN_R) || (channel > CHAN_A)) channel = CHAN_A; rectf= cbuf->rect + channel; diff --git a/source/gameengine/Converter/BL_ArmatureConstraint.cpp b/source/gameengine/Converter/BL_ArmatureConstraint.cpp index f9455d37622..7117ba61037 100644 --- a/source/gameengine/Converter/BL_ArmatureConstraint.cpp +++ b/source/gameengine/Converter/BL_ArmatureConstraint.cpp @@ -74,7 +74,7 @@ BL_ArmatureConstraint::BL_ArmatureConstraint( bConstraint *constraint, KX_GameObject* target, KX_GameObject* subtarget) - : PyObjectPlus(), m_armature(armature), m_constraint(constraint), m_posechannel(posechannel) + : PyObjectPlus(), m_constraint(constraint), m_posechannel(posechannel), m_armature(armature) { m_target = target; m_blendtarget = (target) ? target->GetBlenderObject() : NULL; diff --git a/source/gameengine/Ketsji/BL_Shader.cpp b/source/gameengine/Ketsji/BL_Shader.cpp index 55be606378d..8edefe7ac2d 100644 --- a/source/gameengine/Ketsji/BL_Shader.cpp +++ b/source/gameengine/Ketsji/BL_Shader.cpp @@ -884,7 +884,7 @@ KX_PYMETHODDEF_DOC( BL_Shader, setSampler, "setSampler(name, index)" ) { int loc = GetUniformLocation(uniform); if(loc != -1) { - if(index >= MAXTEX && index < 0) + if(index >= MAXTEX || index < 0) spit("Invalid texture sample index: " << index); #ifdef SORT_UNIFORMS diff --git a/source/gameengine/Ketsji/KX_CameraActuator.cpp b/source/gameengine/Ketsji/KX_CameraActuator.cpp index f9ec503478c..191ffeb66bd 100644 --- a/source/gameengine/Ketsji/KX_CameraActuator.cpp +++ b/source/gameengine/Ketsji/KX_CameraActuator.cpp @@ -380,7 +380,7 @@ PyTypeObject KX_CameraActuator::Type = { }; PyMethodDef KX_CameraActuator::Methods[] = { - {NULL,NULL,NULL,NULL} //Sentinel + {NULL, NULL} //Sentinel }; PyAttributeDef KX_CameraActuator::Attributes[] = { diff --git a/source/gameengine/Ketsji/KX_SoundActuator.cpp b/source/gameengine/Ketsji/KX_SoundActuator.cpp index 08f235801a0..9aa388648a8 100644 --- a/source/gameengine/Ketsji/KX_SoundActuator.cpp +++ b/source/gameengine/Ketsji/KX_SoundActuator.cpp @@ -299,7 +299,7 @@ PyMethodDef KX_SoundActuator::Methods[] = { KX_PYMETHODTABLE_NOARGS(KX_SoundActuator, startSound), KX_PYMETHODTABLE_NOARGS(KX_SoundActuator, pauseSound), KX_PYMETHODTABLE_NOARGS(KX_SoundActuator, stopSound), - {NULL,NULL,NULL,NULL} //Sentinel + {NULL, NULL} //Sentinel }; PyAttributeDef KX_SoundActuator::Attributes[] = { -- cgit v1.2.3