diff options
Diffstat (limited to 'source/gameengine/Converter')
15 files changed, 210 insertions, 210 deletions
diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp b/source/gameengine/Converter/BL_ActionActuator.cpp index 5d87e7fd969..61379209151 100644 --- a/source/gameengine/Converter/BL_ActionActuator.cpp +++ b/source/gameengine/Converter/BL_ActionActuator.cpp @@ -365,14 +365,14 @@ PyObject* BL_ActionActuator::PyGetChannel(PyObject* value) bPoseChannel *pchan; - if(m_userpose==NULL && m_pose==NULL) { + if (m_userpose==NULL && m_pose==NULL) { BL_ArmatureObject *obj = (BL_ArmatureObject*)GetParent(); obj->GetPose(&m_pose); /* Get the underlying pose from the armature */ } // get_pose_channel accounts for NULL pose, run on both in case one exists but // the channel doesnt - if( !(pchan=get_pose_channel(m_userpose, string)) && + if ( !(pchan=get_pose_channel(m_userpose, string)) && !(pchan=get_pose_channel(m_pose, string)) ) { PyErr_SetString(PyExc_ValueError, "channel doesnt exist"); @@ -428,11 +428,11 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel, return NULL; } - if(PyTuple_Size(args)==2) { + if (PyTuple_Size(args)==2) { if (!PyArg_ParseTuple(args,"sO:setChannel", &string, &pymat)) // matrix return NULL; } - else if(PyTuple_Size(args)==4) { + else if (PyTuple_Size(args)==4) { if (!PyArg_ParseTuple(args,"sOOO:setChannel", &string, &pyloc, &pysize, &pyquat)) // loc/size/quat return NULL; } @@ -441,11 +441,11 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel, return NULL; } - if(pymat) { + if (pymat) { float matrix[4][4]; MT_Matrix4x4 mat; - if(!PyMatTo(pymat, mat)) + if (!PyMatTo(pymat, mat)) return NULL; mat.getValue((float*)matrix); @@ -453,14 +453,14 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel, BL_ArmatureObject *obj = (BL_ArmatureObject*)GetParent(); if (!m_userpose) { - if(!m_pose) + if (!m_pose) obj->GetPose(&m_pose); /* Get the underlying pose from the armature */ game_copy_pose(&m_userpose, m_pose, 0); } // pchan= verify_pose_channel(m_userpose, string); // adds the channel if its not there. pchan= get_pose_channel(m_userpose, string); // adds the channel if its not there. - if(pchan) { + if (pchan) { copy_v3_v3(pchan->loc, matrix[3]); mat4_to_size(pchan->size, matrix); mat4_to_quat(pchan->quat, matrix); @@ -476,7 +476,7 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel, // same as above if (!m_userpose) { - if(!m_pose) + if (!m_pose) obj->GetPose(&m_pose); /* Get the underlying pose from the armature */ game_copy_pose(&m_userpose, m_pose, 0); } @@ -484,14 +484,14 @@ KX_PYMETHODDEF_DOC(BL_ActionActuator, setChannel, pchan= get_pose_channel(m_userpose, string); // adds the channel if its not there. // for some reason loc.setValue(pchan->loc) fails - if(pchan) { + if (pchan) { pchan->loc[0]= loc[0]; pchan->loc[1]= loc[1]; pchan->loc[2]= loc[2]; pchan->size[0]= size[0]; pchan->size[1]= size[1]; pchan->size[2]= size[2]; pchan->quat[0]= quat[3]; pchan->quat[1]= quat[0]; pchan->quat[2]= quat[1]; pchan->quat[3]= quat[2]; /* notice xyzw -> wxyz is intentional */ } } - if(pchan==NULL) { + if (pchan==NULL) { PyErr_SetString(PyExc_ValueError, "Channel could not be found, use the 'channelNames' attribute to get a list of valid channels"); return NULL; } @@ -595,9 +595,9 @@ PyObject* BL_ActionActuator::pyattr_get_channel_names(void *self_v, const KX_PYA bPose *pose= ((BL_ArmatureObject*)self->GetParent())->GetOrigPose(); - if(pose) { + if (pose) { bPoseChannel *pchan; - for(pchan= (bPoseChannel *)pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) { + for (pchan= (bPoseChannel *)pose->chanbase.first; pchan; pchan= (bPoseChannel *)pchan->next) { item= PyUnicode_FromString(pchan->name); PyList_Append(ret, item); Py_DECREF(item); diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp b/source/gameengine/Converter/BL_ArmatureObject.cpp index dd2e29e4288..f4c437c04ec 100644 --- a/source/gameengine/Converter/BL_ArmatureObject.cpp +++ b/source/gameengine/Converter/BL_ArmatureObject.cpp @@ -121,7 +121,7 @@ void game_copy_pose(bPose **dst, bPose *src, int copy_constraint) // fails to link, props are not used in the BGE yet. #if 0 - if(pchan->prop) + if (pchan->prop) pchan->prop= IDP_CopyProperty(pchan->prop); #endif pchan->prop= NULL; @@ -186,7 +186,7 @@ void game_blend_poses(bPose *dst, bPose *src, float srcweight/*, short mode*/) if (schan->rotmode) dchan->eul[i] = (dchan->eul[i]*dstweight) + (schan->eul[i]*srcweight); } - for(dcon= (bConstraint*)dchan->constraints.first, scon= (bConstraint*)schan->constraints.first; dcon && scon; dcon= (bConstraint*)dcon->next, scon= (bConstraint*)scon->next) { + for (dcon= (bConstraint*)dchan->constraints.first, scon= (bConstraint*)schan->constraints.first; dcon && scon; dcon= (bConstraint*)dcon->next, scon= (bConstraint*)scon->next) { /* no 'add' option for constraint blending */ dcon->enforce= dcon->enforce*(1.0f-srcweight) + scon->enforce*srcweight; } @@ -469,7 +469,7 @@ void BL_ArmatureObject::ApplyPose() // in the GE, we use ctime to store the timestep m_pose->ctime = (float)m_timestep; //m_scene->r.cfra++; - if(m_lastapplyframe != m_lastframe) { + if (m_lastapplyframe != m_lastframe) { // update the constraint if any, first put them all off so that only the active ones will be updated SG_DList::iterator<BL_ArmatureConstraint> cit(m_controlledConstraints); for (cit.begin(); !cit.end(); ++cit) { @@ -591,7 +591,7 @@ bool BL_ArmatureObject::GetBoneMatrix(Bone* bone, MT_Matrix4x4& matrix) ApplyPose(); pchan = get_pose_channel(m_objArma->pose, bone->name); - if(pchan) + if (pchan) matrix.setValue(&pchan->pose_mat[0][0]); RestorePose(); diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 33cbbe3ee86..1805214c6a2 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -414,7 +414,7 @@ static void SetDefaultLightMode(Scene* scene) Scene *sce_iter; Base *base; - for(SETLOOPER(scene, sce_iter, base)) + for (SETLOOPER(scene, sce_iter, base)) { if (base->object->type == OB_LAMP) { @@ -440,7 +440,7 @@ static void GetRGB(short type, { case 0: // vertex colors { - if(mmcol) { + if (mmcol) { c0 = KX_Mcol2uint_new(mmcol[0]); c1 = KX_Mcol2uint_new(mmcol[1]); c2 = KX_Mcol2uint_new(mmcol[2]); @@ -511,7 +511,7 @@ bool ConvertMaterial( bool validface = (tface!=0); short type = 0; - if( validmat ) + if ( validmat ) type = 1; // material color material->IdMode = DEFAULT_BLENDER; @@ -519,10 +519,10 @@ bool ConvertMaterial( material->materialindex = mface->mat_nr; // -------------------------------- - if(validmat) { + if (validmat) { // use vertex colors by explicitly setting - if(mat->mode &MA_VERTEXCOLP || glslmat) + if (mat->mode &MA_VERTEXCOLP || glslmat) type = 0; // use lighting? @@ -539,21 +539,21 @@ bool ConvertMaterial( * it is set in the buttons * In GLSL is not working yet :/ 3.2011 */ bool facetex = false; - if(validface && mat->mode &MA_FACETEXTURE) + if (validface && mat->mode &MA_FACETEXTURE) facetex = true; numchan = numchan>MAXTEX?MAXTEX:numchan; if (facetex && numchan == 0) numchan = 1; // foreach MTex - for(int i=0; i<numchan; i++) { + for (int i=0; i<numchan; i++) { // use face tex - if(i==0 && facetex ) { + if (i==0 && facetex ) { facetex = false; Image*tmp = (Image*)(tface->tpage); - if(tmp) { + if (tmp) { material->img[i] = tmp; material->texname[i] = material->img[i]->id.name; material->flag[i] |= MIPMAP; @@ -562,12 +562,12 @@ bool ConvertMaterial( material->flag[i] |= ( mat->game.alpha_blend & GEMAT_ALPHA )?USEALPHA:0; material->flag[i] |= ( mat->game.alpha_blend & GEMAT_ADD )?CALCALPHA:0; - if(material->img[i]->flag & IMA_REFLECT) + if (material->img[i]->flag & IMA_REFLECT) material->mapping[i].mapping |= USEREFL; else { mttmp = getImageFromMaterial( mat, i ); - if(mttmp && mttmp->texco &TEXCO_UV) + if (mttmp && mttmp->texco &TEXCO_UV) { STR_String uvName = mttmp->uvname; @@ -589,24 +589,24 @@ bool ConvertMaterial( } mttmp = getImageFromMaterial( mat, i ); - if( mttmp ) { - if( mttmp->tex ) { - if( mttmp->tex->type == TEX_IMAGE ) { + if ( mttmp ) { + if ( mttmp->tex ) { + if ( mttmp->tex->type == TEX_IMAGE ) { material->mtexname[i] = mttmp->tex->id.name; material->img[i] = mttmp->tex->ima; - if( material->img[i] ) { + if ( material->img[i] ) { material->texname[i] = material->img[i]->id.name; material->flag[i] |= ( mttmp->tex->imaflag &TEX_MIPMAP )?MIPMAP:0; // ----------------------- - if( mttmp->tex->imaflag &TEX_USEALPHA ) { + if ( mttmp->tex->imaflag &TEX_USEALPHA ) { material->flag[i] |= USEALPHA; } // ----------------------- - else if( mttmp->tex->imaflag &TEX_CALCALPHA ) { + else if ( mttmp->tex->imaflag &TEX_CALCALPHA ) { material->flag[i] |= CALCALPHA; } - else if(mttmp->tex->flag &TEX_NEGALPHA) { + else if (mttmp->tex->flag &TEX_NEGALPHA) { material->flag[i] |= USENEGALPHA; } @@ -614,12 +614,12 @@ bool ConvertMaterial( material->flag[i] |= ( mttmp->mapto & MAP_ALPHA )?TEXALPHA:0; material->flag[i] |= ( mttmp->texflag& MTEX_NEGATIVE )?TEXNEG:0; - if(!glslmat && (material->flag[i] & TEXALPHA)) + if (!glslmat && (material->flag[i] & TEXALPHA)) texalpha = 1; } } - else if(mttmp->tex->type == TEX_ENVMAP) { - if( mttmp->tex->env->stype == ENV_LOAD ) { + else if (mttmp->tex->type == TEX_ENVMAP) { + if ( mttmp->tex->env->stype == ENV_LOAD ) { material->mtexname[i] = mttmp->tex->id.name; EnvMap *env = mttmp->tex->env; @@ -643,16 +643,16 @@ bool ConvertMaterial( // mapping methods material->mapping[i].mapping |= ( mttmp->texco & TEXCO_REFL )?USEREFL:0; - if(mttmp->texco & TEXCO_OBJECT) { + if (mttmp->texco & TEXCO_OBJECT) { material->mapping[i].mapping |= USEOBJ; - if(mttmp->object) + if (mttmp->object) material->mapping[i].objconame = mttmp->object->id.name; } - else if(mttmp->texco &TEXCO_REFL) + else if (mttmp->texco &TEXCO_REFL) material->mapping[i].mapping |= USEREFL; - else if(mttmp->texco &(TEXCO_ORCO|TEXCO_GLOB)) + else if (mttmp->texco &(TEXCO_ORCO|TEXCO_GLOB)) material->mapping[i].mapping |= USEORCO; - else if(mttmp->texco &TEXCO_UV) + else if (mttmp->texco &TEXCO_UV) { STR_String uvName = mttmp->uvname; @@ -662,9 +662,9 @@ bool ConvertMaterial( material->mapping[i].uvCoName = ""; material->mapping[i].mapping |= USEUV; } - else if(mttmp->texco &TEXCO_NORM) + else if (mttmp->texco &TEXCO_NORM) material->mapping[i].mapping |= USENORM; - else if(mttmp->texco &TEXCO_TANGENT) + else if (mttmp->texco &TEXCO_TANGENT) material->mapping[i].mapping |= USETANG; else material->mapping[i].mapping |= DISABLE; @@ -740,15 +740,15 @@ bool ConvertMaterial( int valid = 0; // check for tface tex to fallback on - if( validface ){ + if ( validface ){ material->img[0] = (Image*)(tface->tpage); // ------------------------ - if(material->img[0]) { + if (material->img[0]) { material->texname[0] = material->img[0]->id.name; material->mapping[0].mapping |= ( (material->img[0]->flag & IMA_REFLECT)!=0 )?USEREFL:0; /* see if depth of the image is 32bits */ - if(BKE_image_has_alpha(material->img[0])) { + if (BKE_image_has_alpha(material->img[0])) { material->flag[0] |= USEALPHA; material->alphablend = GEMAT_ALPHA; } @@ -786,7 +786,7 @@ bool ConvertMaterial( /* No material, what to do? let's see what is in the UV and set the material accordingly * light and visible is always on */ - if( validface ) { + if ( validface ) { material->tile = tface->tile; uv[0].setValue(tface->uv[0]); @@ -811,17 +811,17 @@ bool ConvertMaterial( } // with ztransp enabled, enforce alpha blending mode - if(validmat && (mat->mode & MA_TRANSP) && (mat->mode & MA_ZTRANSP) && (material->alphablend == GEMAT_SOLID)) + if (validmat && (mat->mode & MA_TRANSP) && (mat->mode & MA_ZTRANSP) && (material->alphablend == GEMAT_SOLID)) material->alphablend = GEMAT_ALPHA; // always zsort alpha + add - if((ELEM3(material->alphablend, GEMAT_ALPHA, GEMAT_ALPHA_SORT, GEMAT_ADD) || texalpha) && (material->alphablend != GEMAT_CLIP )) { + if ((ELEM3(material->alphablend, GEMAT_ALPHA, GEMAT_ALPHA_SORT, GEMAT_ADD) || texalpha) && (material->alphablend != GEMAT_CLIP )) { material->ras_mode |= ALPHA; material->ras_mode |= (mat && (mat->game.alpha_blend & GEMAT_ALPHA_SORT))? ZSORT: 0; } // get uv sets - if(validmat) + if (validmat) { bool isFirstSet = true; @@ -860,7 +860,7 @@ bool ConvertMaterial( isFirstSet = false; uvName = layer.name; } - else if(strcmp(layer.name, uvName) != 0) + else if (strcmp(layer.name, uvName) != 0) { uv2[0] = uvSet[0]; uv2[1] = uvSet[1]; uv2[2] = uvSet[2]; uv2[3] = uvSet[3]; @@ -889,7 +889,7 @@ bool ConvertMaterial( material->SetConversionUV(uvName, uv); material->SetConversionUV2(uv2Name, uv2); - if(validmat) + if (validmat) material->matname =(mat->id.name); material->tface = tface; @@ -919,7 +919,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, int totface = dm->getNumTessFaces(dm); const char *tfaceName = ""; - if(tface) { + if (tface) { DM_add_tangent_layer(dm); tangent = (float(*)[4])dm->getTessFaceDataArray(dm, CD_TANGENT); } @@ -942,7 +942,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, layers[validLayers].face = (MTFace*)(dm->faceData.layers[i].data); layers[validLayers].name = dm->faceData.layers[i].name; - if(tface == layers[validLayers].face) + if (tface == layers[validLayers].face) tfaceName = layers[validLayers].name; validLayers++; } @@ -976,7 +976,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, pt2.setValue(mvert[mface->v3].co); if (mface->v4) pt3.setValue(mvert[mface->v4].co); - if(mface->flag & ME_SMOOTH) { + if (mface->flag & ME_SMOOTH) { float n0[3], n1[3], n2[3], n3[3]; normal_short_to_float_v3(n0, mvert[mface->v1].no); @@ -986,7 +986,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, no1 = n1; no2 = n2; - if(mface->v4) { + if (mface->v4) { normal_short_to_float_v3(n3, mvert[mface->v4].no); no3 = n3; } @@ -994,7 +994,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, else { float fno[3]; - if(mface->v4) + if (mface->v4) normal_quad_v3( fno,mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co, mvert[mface->v4].co); else normal_tri_v3( fno,mvert[mface->v1].co, mvert[mface->v2].co, mvert[mface->v3].co); @@ -1002,7 +1002,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, no0 = no1 = no2 = no3 = MT_Vector3(fno); } - if(tangent) { + if (tangent) { tan0 = tangent[f*4 + 0]; tan1 = tangent[f*4 + 1]; tan2 = tangent[f*4 + 2]; @@ -1010,13 +1010,13 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, if (mface->v4) tan3 = tangent[f*4 + 3]; } - if(blenderobj) + if (blenderobj) ma = give_current_material(blenderobj, mface->mat_nr+1); else ma = mesh->mat ? mesh->mat[mface->mat_nr]:NULL; /* ckeck for texface since texface _only_ is used as a fallback */ - if(ma == NULL && tface == NULL) { + if (ma == NULL && tface == NULL) { ma= &defmaterial; } @@ -1024,7 +1024,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, bool visible = true; bool twoside = false; - if(converter->GetMaterials()) { + if (converter->GetMaterials()) { /* do Blender Multitexture and Blender GLSL materials */ unsigned int rgb[4]; MT_Point2 uv[4]; @@ -1102,7 +1102,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, } /* set UV properties */ - if(tface) { + if (tface) { uv0.setValue(tface->uv[0]); uv1.setValue(tface->uv[1]); uv2.setValue(tface->uv[2]); @@ -1204,7 +1204,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, if (bucketCreated) { // this is needed to free up memory afterwards converter->RegisterPolyMaterial(polymat); - if(converter->GetMaterials()) { + if (converter->GetMaterials()) { converter->RegisterBlenderMaterial(bl_mat); // the poly material has been stored in the bucket, next time we must create a new one bl_mat = NULL; @@ -1254,7 +1254,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, meshobj->EndConversion(); // pre calculate texture generation - for(list<RAS_MeshMaterial>::iterator mit = meshobj->GetFirstMaterial(); + for (list<RAS_MeshMaterial>::iterator mit = meshobj->GetFirstMaterial(); mit != meshobj->GetLastMaterial(); ++ mit) { mit->m_bucket->GetPolyMaterial()->OnConstruction(lightlayer); } @@ -1361,7 +1361,7 @@ static float my_boundbox_mesh(Mesh *me, float *loc, float *size) float radius=0.0f, vert_radius, *co; int a; - if(me->bb==0) me->bb= (struct BoundBox *)MEM_callocN(sizeof(BoundBox), "boundbox"); + if (me->bb==0) me->bb= (struct BoundBox *)MEM_callocN(sizeof(BoundBox), "boundbox"); bb= me->bb; INIT_MINMAX(min, max); @@ -1370,7 +1370,7 @@ static float my_boundbox_mesh(Mesh *me, float *loc, float *size) if (!size) size= msize; mvert= me->mvert; - for(a=0; a<me->totvert; a++, mvert++) { + for (a=0; a<me->totvert; a++, mvert++) { co= mvert->co; /* bounds */ @@ -1382,7 +1382,7 @@ static float my_boundbox_mesh(Mesh *me, float *loc, float *size) radius= vert_radius; } - if(me->totvert) { + if (me->totvert) { loc[0]= (min[0]+max[0])/2.0f; loc[1]= (min[1]+max[1])/2.0f; loc[2]= (min[2]+max[2])/2.0f; @@ -1419,18 +1419,18 @@ static void my_tex_space_mesh(Mesh *me) my_boundbox_mesh(me, loc, size); - if(me->texflag & ME_AUTOSPACE) { - if(me->key) { + if (me->texflag & ME_AUTOSPACE) { + if (me->key) { kb= me->key->refkey; if (kb) { INIT_MINMAX(min, max); fp= (float *)kb->data; - for(a=0; a<kb->totelem; a++, fp+=3) { + for (a=0; a<kb->totelem; a++, fp+=3) { DO_MINMAX(fp, min, max); } - if(kb->totelem) { + if (kb->totelem) { loc[0]= (min[0]+max[0])/2.0f; loc[1]= (min[1]+max[1])/2.0f; loc[2]= (min[2]+max[2])/2.0f; size[0]= (max[0]-min[0])/2.0f; size[1]= (max[1]-min[1])/2.0f; size[2]= (max[2]-min[2])/2.0f; } @@ -1446,17 +1446,17 @@ static void my_tex_space_mesh(Mesh *me) copy_v3_v3(me->size, size); me->rot[0]= me->rot[1]= me->rot[2]= 0.0f; - if(me->size[0]==0.0) me->size[0]= 1.0f; - else if(me->size[0]>0.0 && me->size[0]< 0.00001f) me->size[0]= 0.00001f; - else if(me->size[0]<0.0 && me->size[0]> -0.00001f) me->size[0]= -0.00001f; + if (me->size[0]==0.0) me->size[0]= 1.0f; + else if (me->size[0]>0.0 && me->size[0]< 0.00001f) me->size[0]= 0.00001f; + else if (me->size[0]<0.0 && me->size[0]> -0.00001f) me->size[0]= -0.00001f; - if(me->size[1]==0.0) me->size[1]= 1.0f; - else if(me->size[1]>0.0 && me->size[1]< 0.00001f) me->size[1]= 0.00001f; - else if(me->size[1]<0.0 && me->size[1]> -0.00001f) me->size[1]= -0.00001f; + if (me->size[1]==0.0) me->size[1]= 1.0f; + else if (me->size[1]>0.0 && me->size[1]< 0.00001f) me->size[1]= 0.00001f; + else if (me->size[1]<0.0 && me->size[1]> -0.00001f) me->size[1]= -0.00001f; - if(me->size[2]==0.0) me->size[2]= 1.0f; - else if(me->size[2]>0.0 && me->size[2]< 0.00001f) me->size[2]= 0.00001f; - else if(me->size[2]<0.0 && me->size[2]> -0.00001f) me->size[2]= -0.00001f; + if (me->size[2]==0.0) me->size[2]= 1.0f; + else if (me->size[2]>0.0 && me->size[2]< 0.00001f) me->size[2]= 0.00001f; + else if (me->size[2]<0.0 && me->size[2]> -0.00001f) me->size[2]= -0.00001f; } } @@ -1484,7 +1484,7 @@ static void my_get_local_bounds(Object *ob, DerivedMesh *dm, float *center, floa } else { bb= ( (Mesh *)ob->data )->bb; - if(bb==0) + if (bb==0) { my_tex_space_mesh((struct Mesh *)ob->data); bb= ( (Mesh *)ob->data )->bb; @@ -1505,7 +1505,7 @@ static void my_get_local_bounds(Object *ob, DerivedMesh *dm, float *center, floa break; } - if(bb==NULL) + if (bb==NULL) { center[0]= center[1]= center[2]= 0.0; size[0] = size[1]=size[2]=1.0; @@ -1876,7 +1876,7 @@ static KX_LightObject *gamelight_from_blamp(Object *ob, Lamp *la, unsigned int l bool glslmat = converter->GetGLSLMaterials(); // in GLSL NEGATIVE LAMP is handled inside the lamp update function - if(glslmat==0) { + if (glslmat==0) { if (la->mode & LA_NEG) { lightobj.m_red = -lightobj.m_red; @@ -2049,7 +2049,7 @@ static KX_GameObject *gameobject_from_blenderobject( gameobj = new KX_FontObject(kxscene,KX_Scene::m_callbacks, rendertools, ob); /* add to the list only the visible fonts */ - if((ob->lay & kxscene->GetBlenderScene()->lay) != 0) + if ((ob->lay & kxscene->GetBlenderScene()->lay) != 0) kxscene->AddFont(static_cast<KX_FontObject*>(gameobj)); break; } @@ -2060,7 +2060,7 @@ static KX_GameObject *gameobject_from_blenderobject( gameobj->SetLayer(ob->lay); gameobj->SetBlenderObject(ob); /* set the visibility state based on the objects render option in the outliner */ - if(ob->restrictflag & OB_RESTRICT_RENDER) gameobj->SetVisible(0, 0); + if (ob->restrictflag & OB_RESTRICT_RENDER) gameobj->SetVisible(0, 0); } return gameobj; } @@ -2079,8 +2079,8 @@ bPoseChannel *get_active_posechannel2 (Object *ob) bPoseChannel *pchan; /* find active */ - for(pchan= (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan= pchan->next) { - if(pchan->bone && (pchan->bone == arm->act_bone) && (pchan->bone->layer & arm->layer)) + for (pchan= (bPoseChannel *)ob->pose->chanbase.first; pchan; pchan= pchan->next) { + if (pchan->bone && (pchan->bone == arm->act_bone) && (pchan->bone->layer & arm->layer)) return pchan; } @@ -2470,7 +2470,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie, { Group* group = *git; GroupObject* go; - for(go=(GroupObject*)group->gobject.first; go; go=(GroupObject*)go->next) + for (go=(GroupObject*)group->gobject.first; go; go=(GroupObject*)go->next) { Object* blenderobject = go->ob; if (converter->FindGameObject(blenderobject) == NULL) @@ -2521,13 +2521,13 @@ void BL_ConvertBlenderObjects(struct Main* maggie, if (blenderscene->camera && blenderscene->camera->type == OB_CAMERA) { KX_Camera *gamecamera= (KX_Camera*) converter->FindGameObject(blenderscene->camera); - if(gamecamera) + if (gamecamera) kxscene->SetActiveCamera(gamecamera); } // Set up armatures set<Object*>::iterator oit; - for(oit=allblobj.begin(); oit!=allblobj.end(); oit++) + for (oit=allblobj.begin(); oit!=allblobj.end(); oit++) { Object* blenderobj = *oit; if (blenderobj->type==OB_MESH) { @@ -2610,7 +2610,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie, // parent this to a bone Bone *parent_bone = get_named_bone( (bArmature *)(blenderchild->parent)->data, blenderchild->parsubstr); - if(parent_bone) { + if (parent_bone) { KX_BoneParentRelation *bone_parent_relation = KX_BoneParentRelation::New(parent_bone); pcit->m_gamechildnode->SetParentRelation(bone_parent_relation); } @@ -2739,7 +2739,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie, bConstraint *curcon; conlist = get_active_constraints2(blenderobject); - if((gameobj->GetLayer()&activeLayerBitInfo)==0) + if ((gameobj->GetLayer()&activeLayerBitInfo)==0) continue; if (conlist) { @@ -2795,14 +2795,14 @@ void BL_ConvertBlenderObjects(struct Main* maggie, dofbit<<=1; } } - else if(dat->type == PHY_CONE_TWIST_CONSTRAINT) + else if (dat->type == PHY_CONE_TWIST_CONSTRAINT) { int dof; int dofbit = 1<<3; // bitflag use_angular_limit_x for (dof=3;dof<6;dof++) { - if(dat->flag & dofbit) + if (dat->flag & dofbit) { kxscene->GetPhysicsEnvironment()->setConstraintParam(constraintId,dof,dat->minLimit[dof],dat->maxLimit[dof]); } diff --git a/source/gameengine/Converter/BL_DeformableGameObject.cpp b/source/gameengine/Converter/BL_DeformableGameObject.cpp index 9d514e99661..f6d9b4a5065 100644 --- a/source/gameengine/Converter/BL_DeformableGameObject.cpp +++ b/source/gameengine/Converter/BL_DeformableGameObject.cpp @@ -108,7 +108,7 @@ void BL_DeformableGameObject::SetDeformer(class RAS_Deformer* deformer) m_pDeformer = deformer; SG_QList::iterator<RAS_MeshSlot> mit(m_meshSlots); - for(mit.begin(); !mit.end(); ++mit) + for (mit.begin(); !mit.end(); ++mit) { (*mit)->SetDeformer(deformer); } diff --git a/source/gameengine/Converter/BL_MeshDeformer.cpp b/source/gameengine/Converter/BL_MeshDeformer.cpp index 4e5852a21c1..f2c30193613 100644 --- a/source/gameengine/Converter/BL_MeshDeformer.cpp +++ b/source/gameengine/Converter/BL_MeshDeformer.cpp @@ -53,21 +53,21 @@ bool BL_MeshDeformer::Apply(RAS_IPolyMaterial*) size_t i; // only apply once per frame if the mesh is actually modified - if(m_pMeshObject->MeshModified() && + if (m_pMeshObject->MeshModified() && m_lastDeformUpdate != m_gameobj->GetLastFrame()) { // For each material - for(list<RAS_MeshMaterial>::iterator mit= m_pMeshObject->GetFirstMaterial(); + for (list<RAS_MeshMaterial>::iterator mit= m_pMeshObject->GetFirstMaterial(); mit != m_pMeshObject->GetLastMaterial(); ++ mit) { - if(!mit->m_slots[(void*)m_gameobj]) + if (!mit->m_slots[(void*)m_gameobj]) continue; RAS_MeshSlot *slot = *mit->m_slots[(void*)m_gameobj]; RAS_MeshSlot::iterator it; // for each array - for(slot->begin(it); !slot->end(it); slot->next(it)) { + for (slot->begin(it); !slot->end(it); slot->next(it)) { // For each vertex - for(i=it.startvertex; i<it.endvertex; i++) { + for (i=it.startvertex; i<it.endvertex; i++) { RAS_TexVert& v = it.vertex[i]; v.SetXYZ(m_bmesh->mvert[v.getOrigIndex()].co); } @@ -126,17 +126,17 @@ void BL_MeshDeformer::RecalcNormals() memset(m_transnors, 0, sizeof(float)*3*m_bmesh->totvert); /* add face normals to vertices. */ - for(mit = m_pMeshObject->GetFirstMaterial(); + for (mit = m_pMeshObject->GetFirstMaterial(); mit != m_pMeshObject->GetLastMaterial(); ++ mit) { - if(!mit->m_slots[(void*)m_gameobj]) + if (!mit->m_slots[(void*)m_gameobj]) continue; RAS_MeshSlot *slot = *mit->m_slots[(void*)m_gameobj]; - for(slot->begin(it); !slot->end(it); slot->next(it)) { + for (slot->begin(it); !slot->end(it); slot->next(it)) { int nvert = (int)it.array->m_type; - for(i=0; i<it.totindex; i+=nvert) { + for (i=0; i<it.totindex; i+=nvert) { RAS_TexVert& v1 = it.vertex[it.index[i]]; RAS_TexVert& v2 = it.vertex[it.index[i+1]]; RAS_TexVert& v3 = it.vertex[it.index[i+2]]; @@ -150,7 +150,7 @@ void BL_MeshDeformer::RecalcNormals() /* compute face normal */ float fnor[3], n1[3], n2[3]; - if(nvert == 4) { + if (nvert == 4) { v4 = &it.vertex[it.index[i+3]]; co4 = m_transverts[v4->getOrigIndex()]; @@ -186,17 +186,17 @@ void BL_MeshDeformer::RecalcNormals() vn2[0] += fnor[0]; vn2[1] += fnor[1]; vn2[2] += fnor[2]; vn3[0] += fnor[0]; vn3[1] += fnor[1]; vn3[2] += fnor[2]; - if(v4) { + if (v4) { float *vn4 = m_transnors[v4->getOrigIndex()]; vn4[0] += fnor[0]; vn4[1] += fnor[1]; vn4[2] += fnor[2]; } /* in case of flat - just assign, the vertices are split */ - if(v1.getFlag() & RAS_TexVert::FLAT) { + if (v1.getFlag() & RAS_TexVert::FLAT) { v1.SetNormal(fnor); v2.SetNormal(fnor); v3.SetNormal(fnor); - if(v4) + if (v4) v4->SetNormal(fnor); } } @@ -204,18 +204,18 @@ void BL_MeshDeformer::RecalcNormals() } /* assign smooth vertex normals */ - for(mit = m_pMeshObject->GetFirstMaterial(); + for (mit = m_pMeshObject->GetFirstMaterial(); mit != m_pMeshObject->GetLastMaterial(); ++ mit) { - if(!mit->m_slots[(void*)m_gameobj]) + if (!mit->m_slots[(void*)m_gameobj]) continue; RAS_MeshSlot *slot = *mit->m_slots[(void*)m_gameobj]; - for(slot->begin(it); !slot->end(it); slot->next(it)) { - for(i=it.startvertex; i<it.endvertex; i++) { + for (slot->begin(it); !slot->end(it); slot->next(it)) { + for (i=it.startvertex; i<it.endvertex; i++) { RAS_TexVert& v = it.vertex[i]; - if(!(v.getFlag() & RAS_TexVert::FLAT)) + if (!(v.getFlag() & RAS_TexVert::FLAT)) v.SetNormal(m_transnors[v.getOrigIndex()]); //.safe_normalized() } } diff --git a/source/gameengine/Converter/BL_ModifierDeformer.cpp b/source/gameengine/Converter/BL_ModifierDeformer.cpp index 500968462c3..c1c94c25108 100644 --- a/source/gameengine/Converter/BL_ModifierDeformer.cpp +++ b/source/gameengine/Converter/BL_ModifierDeformer.cpp @@ -132,7 +132,7 @@ bool BL_ModifierDeformer::HasArmatureDeformer(Object *ob) return false; ModifierData* md = (ModifierData*)ob->modifiers.first; - if(md->type == eModifierType_Armature ) + if (md->type == eModifierType_Armature ) return true; return false; @@ -218,7 +218,7 @@ bool BL_ModifierDeformer::Apply(RAS_IPolyMaterial *mat) for (int imat=0; imat<nmat; imat++) { RAS_MeshMaterial *mmat = m_pMeshObject->GetMeshMaterial(imat); RAS_MeshSlot **slot = mmat->m_slots[(void*)m_gameobj]; - if(!slot || !*slot) + if (!slot || !*slot) continue; (*slot)->m_pDerivedMesh = m_dm; } diff --git a/source/gameengine/Converter/BL_SkinDeformer.cpp b/source/gameengine/Converter/BL_SkinDeformer.cpp index f320df12078..85010ce1bbf 100644 --- a/source/gameengine/Converter/BL_SkinDeformer.cpp +++ b/source/gameengine/Converter/BL_SkinDeformer.cpp @@ -111,9 +111,9 @@ BL_SkinDeformer::BL_SkinDeformer( BL_SkinDeformer::~BL_SkinDeformer() { - if(m_releaseobject && m_armobj) + if (m_releaseobject && m_armobj) m_armobj->Release(); - if(m_dfnrToPC) + if (m_dfnrToPC) delete [] m_dfnrToPC; } @@ -149,16 +149,16 @@ bool BL_SkinDeformer::Apply(RAS_IPolyMaterial *mat) nmat = m_pMeshObject->NumMaterials(); for (imat=0; imat<nmat; imat++) { mmat = m_pMeshObject->GetMeshMaterial(imat); - if(!mmat->m_slots[(void*)m_gameobj]) + if (!mmat->m_slots[(void*)m_gameobj]) continue; slot = *mmat->m_slots[(void*)m_gameobj]; // for each array - for(slot->begin(it); !slot->end(it); slot->next(it)) { + for (slot->begin(it); !slot->end(it); slot->next(it)) { // for each vertex // copy the untransformed data from the original mvert - for(i=it.startvertex; i<it.endvertex; i++) { + for (i=it.startvertex; i<it.endvertex; i++) { RAS_TexVert& v = it.vertex[i]; v.SetXYZ(m_transverts[v.getOrigIndex()]); if (m_copyNormals) @@ -307,7 +307,7 @@ bool BL_SkinDeformer::UpdateInternal(bool shape_applied) /* See if the armature has been updated for this frame */ if (PoseUpdated()){ - if(!shape_applied) { + if (!shape_applied) { /* store verts locally */ VerifyStorage(); diff --git a/source/gameengine/Converter/BlenderWorldInfo.cpp b/source/gameengine/Converter/BlenderWorldInfo.cpp index 2225c7895d8..fc3b75c49ad 100644 --- a/source/gameengine/Converter/BlenderWorldInfo.cpp +++ b/source/gameengine/Converter/BlenderWorldInfo.cpp @@ -90,7 +90,7 @@ BlenderWorldInfo::BlenderWorldInfo(struct Scene *blenderscene, struct World* ble copy_v3_v3(m_backgroundcolor, &blenderworld->horr); copy_v3_v3(m_ambientcolor, &blenderworld->ambr); - if(blenderscene->r.color_mgt_flag & R_COLOR_MANAGEMENT) { + if (blenderscene->r.color_mgt_flag & R_COLOR_MANAGEMENT) { linearrgb_to_srgb_v3_v3(m_mistcolor, m_mistcolor); linearrgb_to_srgb_v3_v3(m_backgroundcolor, m_backgroundcolor); linearrgb_to_srgb_v3_v3(m_ambientcolor, m_ambientcolor); diff --git a/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp b/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp index 37960e5c2f7..f020aab4d50 100644 --- a/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp +++ b/source/gameengine/Converter/KX_BlenderScalarInterpolator.cpp @@ -49,11 +49,11 @@ float BL_ScalarInterpolator::GetValue(float currentTime) const BL_InterpolatorList::BL_InterpolatorList(bAction *action) { - if(action==NULL) + if (action==NULL) return; - for(FCurve *fcu= (FCurve *)action->curves.first; fcu; fcu= (FCurve *)fcu->next) { - if(fcu->rna_path) { + for (FCurve *fcu= (FCurve *)action->curves.first; fcu; fcu= (FCurve *)fcu->next) { + if (fcu->rna_path) { BL_ScalarInterpolator *new_ipo = new BL_ScalarInterpolator(fcu); //assert(new_ipo); push_back(new_ipo); @@ -71,10 +71,10 @@ BL_InterpolatorList::~BL_InterpolatorList() KX_IScalarInterpolator *BL_InterpolatorList::GetScalarInterpolator(const char *rna_path, int array_index) { - for(BL_InterpolatorList::iterator i = begin(); (i != end()) ; i++ ) + for (BL_InterpolatorList::iterator i = begin(); (i != end()) ; i++ ) { FCurve *fcu= (static_cast<BL_ScalarInterpolator *>(*i))->GetFCurve(); - if(array_index==fcu->array_index && strcmp(rna_path, fcu->rna_path)==0) + if (array_index==fcu->array_index && strcmp(rna_path, fcu->rna_path)==0) return *i; } return NULL; diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp index ee60d2c5bc5..d82a911b4ab 100644 --- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp +++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp @@ -214,13 +214,13 @@ Scene *KX_BlenderSceneConverter::GetBlenderSceneForName(const STR_String& name) * Find the specified scene by name, or the first * scene if nothing matches (shouldn't happen). */ - if((sce= (Scene *)BLI_findstring(&m_maggie->scene, name.ReadPtr(), offsetof(ID, name) + 2))) + if ((sce= (Scene *)BLI_findstring(&m_maggie->scene, name.ReadPtr(), offsetof(ID, name) + 2))) return sce; for (vector<Main*>::iterator it=m_DynamicMaggie.begin(); !(it==m_DynamicMaggie.end()); it++) { Main *main= *it; - if((sce= (Scene *)BLI_findstring(&main->scene, name.ReadPtr(), offsetof(ID, name) + 2))) + if ((sce= (Scene *)BLI_findstring(&main->scene, name.ReadPtr(), offsetof(ID, name) + 2))) return sce; } @@ -537,7 +537,7 @@ void KX_BlenderSceneConverter::RegisterGameMesh( RAS_MeshObject *gamemesh, struct Mesh *for_blendermesh) { - if(for_blendermesh) { /* dynamically loaded meshes we don't want to keep lookups for */ + if (for_blendermesh) { /* dynamically loaded meshes we don't want to keep lookups for */ m_map_mesh_to_gamemesh.insert(CHashedPtr(for_blendermesh),gamemesh); } m_meshobjects.push_back(pair<KX_Scene*,RAS_MeshObject*>(m_currentScene,gamemesh)); @@ -665,13 +665,13 @@ void KX_BlenderSceneConverter::ResetPhysicsObjectsAnimationIpo(bool clearIpo) IpoCurve *icu1; int numCurves = 0; - for( icu1 = (IpoCurve*)ipo->curve.first; icu1; ) { + for ( icu1 = (IpoCurve*)ipo->curve.first; icu1; ) { IpoCurve* tmpicu = icu1; /*int i; BezTriple *bezt; - for( bezt = tmpicu->bezt, i = 0; i < tmpicu->totvert; i++, bezt++){ + for ( bezt = tmpicu->bezt, i = 0; i < tmpicu->totvert; i++, bezt++){ printf("(%f,%f,%f),(%f,%f,%f),(%f,%f,%f)\n",bezt->vec[0][0],bezt->vec[0][1],bezt->vec[0][2],bezt->vec[1][0],bezt->vec[1][1],bezt->vec[1][2],bezt->vec[2][0],bezt->vec[2][1],bezt->vec[2][2]); }*/ @@ -679,7 +679,7 @@ void KX_BlenderSceneConverter::ResetPhysicsObjectsAnimationIpo(bool clearIpo) numCurves++; BLI_remlink( &( blenderObject->ipo->curve ), tmpicu ); - if( tmpicu->bezt ) + if ( tmpicu->bezt ) MEM_freeN( tmpicu->bezt ); MEM_freeN( tmpicu ); localDel_ipoCurve( tmpicu ); @@ -769,7 +769,7 @@ void KX_BlenderSceneConverter::WritePhysicsObjectToAnimationIpo(int frameNumber) { //KX_IPhysicsController* physCtrl = gameObj->GetPhysicsController(); - if(blenderObject->adt==NULL) + if (blenderObject->adt==NULL) BKE_id_add_animdata(&blenderObject->id); if (blenderObject->adt) @@ -807,37 +807,37 @@ void KX_BlenderSceneConverter::WritePhysicsObjectToAnimationIpo(int frameNumber) IpoCurve *icu_lx = findIpoCurve((IpoCurve *)ipo->curve.first,"LocX"); if (!icu_lx) { icu_lx = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_X, 1); - if(icu_lx) icu_lx->ipo = IPO_LIN; + if (icu_lx) icu_lx->ipo = IPO_LIN; } IpoCurve *icu_ly = findIpoCurve((IpoCurve *)ipo->curve.first,"LocY"); if (!icu_ly) { icu_ly = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_Y, 1); - if(icu_ly) icu_ly->ipo = IPO_LIN; + if (icu_ly) icu_ly->ipo = IPO_LIN; } IpoCurve *icu_lz = findIpoCurve((IpoCurve *)ipo->curve.first,"LocZ"); if (!icu_lz) { icu_lz = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_LOC_Z, 1); - if(icu_lz) icu_lz->ipo = IPO_LIN; + if (icu_lz) icu_lz->ipo = IPO_LIN; } IpoCurve *icu_rx = findIpoCurve((IpoCurve *)ipo->curve.first,"RotX"); if (!icu_rx) { icu_rx = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_X, 1); - if(icu_rx) icu_rx->ipo = IPO_LIN; + if (icu_rx) icu_rx->ipo = IPO_LIN; } IpoCurve *icu_ry = findIpoCurve((IpoCurve *)ipo->curve.first,"RotY"); if (!icu_ry) { icu_ry = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_Y, 1); - if(icu_ry) icu_ry->ipo = IPO_LIN; + if (icu_ry) icu_ry->ipo = IPO_LIN; } IpoCurve *icu_rz = findIpoCurve((IpoCurve *)ipo->curve.first,"RotZ"); if (!icu_rz) { icu_rz = verify_ipocurve(&blenderObject->id, ipo->blocktype, NULL, NULL, NULL, OB_ROT_Z, 1); - if(icu_rz) icu_rz->ipo = IPO_LIN; + if (icu_rz) icu_rz->ipo = IPO_LIN; } - if(icu_rx) eulerAnglesOld[0]= eval_icu( icu_rx, frameNumber - 1 ) / ((180 / 3.14159265f) / 10); - if(icu_ry) eulerAnglesOld[1]= eval_icu( icu_ry, frameNumber - 1 ) / ((180 / 3.14159265f) / 10); - if(icu_rz) eulerAnglesOld[2]= eval_icu( icu_rz, frameNumber - 1 ) / ((180 / 3.14159265f) / 10); + if (icu_rx) eulerAnglesOld[0]= eval_icu( icu_rx, frameNumber - 1 ) / ((180 / 3.14159265f) / 10); + if (icu_ry) eulerAnglesOld[1]= eval_icu( icu_ry, frameNumber - 1 ) / ((180 / 3.14159265f) / 10); + if (icu_rz) eulerAnglesOld[2]= eval_icu( icu_rz, frameNumber - 1 ) / ((180 / 3.14159265f) / 10); // orn.getValue((float *)tmat); // uses the wrong ordering, cant use this for (int r=0;r<3;r++) @@ -848,7 +848,7 @@ void KX_BlenderSceneConverter::WritePhysicsObjectToAnimationIpo(int frameNumber) mat3_to_compatible_eul( eulerAngles, eulerAnglesOld,tmat); //eval_icu - for(int x = 0; x < 3; x++) + for (int x = 0; x < 3; x++) eulerAngles[x] *= (float) ((180 / 3.14159265f) / 10.0); //fill the curves with data @@ -925,7 +925,7 @@ vector<Main*> &KX_BlenderSceneConverter::GetMainDynamic() Main* KX_BlenderSceneConverter::GetMainDynamicPath(const char *path) { for (vector<Main*>::iterator it=m_DynamicMaggie.begin(); !(it==m_DynamicMaggie.end()); it++) - if(BLI_path_cmp((*it)->name, path) == 0) + if (BLI_path_cmp((*it)->name, path) == 0) return *it; return NULL; @@ -958,21 +958,21 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha static char err_local[255]; /* only scene and mesh supported right now */ - if(idcode!=ID_SCE && idcode!=ID_ME &&idcode!=ID_AC) { + if (idcode!=ID_SCE && idcode!=ID_ME &&idcode!=ID_AC) { snprintf(err_local, sizeof(err_local), "invalid ID type given \"%s\"\n", group); *err_str= err_local; BLO_blendhandle_close(bpy_openlib); return false; } - if(GetMainDynamicPath(path)) { + if (GetMainDynamicPath(path)) { snprintf(err_local, sizeof(err_local), "blend file already open \"%s\"\n", path); *err_str= err_local; BLO_blendhandle_close(bpy_openlib); return false; } - if(bpy_openlib==NULL) { + if (bpy_openlib==NULL) { snprintf(err_local, sizeof(err_local), "could not open blendfile \"%s\"\n", path); *err_str= err_local; return false; @@ -1027,31 +1027,31 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha strncpy(main_newlib->name, path, sizeof(main_newlib->name)); - if(idcode==ID_ME) { + if (idcode==ID_ME) { /* Convert all new meshes into BGE meshes */ ID* mesh; - for(mesh= (ID *)main_newlib->mesh.first; mesh; mesh= (ID *)mesh->next ) { + for (mesh= (ID *)main_newlib->mesh.first; mesh; mesh= (ID *)mesh->next ) { if (options & LIB_LOAD_VERBOSE) printf("MeshName: %s\n", mesh->name+2); RAS_MeshObject *meshobj = BL_ConvertMesh((Mesh *)mesh, NULL, scene_merge, this); scene_merge->GetLogicManager()->RegisterMeshName(meshobj->GetName(),meshobj); } } - else if(idcode==ID_AC) { + else if (idcode==ID_AC) { /* Convert all actions */ ID *action; - for(action= (ID *)main_newlib->action.first; action; action= (ID *)action->next) { + for (action= (ID *)main_newlib->action.first; action; action= (ID *)action->next) { if (options & LIB_LOAD_VERBOSE) printf("ActionName: %s\n", action->name+2); scene_merge->GetLogicManager()->RegisterActionName(action->name+2, action); } } - else if(idcode==ID_SCE) { + else if (idcode==ID_SCE) { /* Merge all new linked in scene into the existing one */ ID *scene; - for(scene= (ID *)main_newlib->scene.first; scene; scene= (ID *)scene->next ) { + for (scene= (ID *)main_newlib->scene.first; scene; scene= (ID *)scene->next ) { if (options & LIB_LOAD_VERBOSE) printf("SceneName: %s\n", scene->name+2); @@ -1067,7 +1067,7 @@ bool KX_BlenderSceneConverter::LinkBlendFile(BlendHandle *bpy_openlib, const cha if (options & LIB_LOAD_LOAD_ACTIONS) { ID *action; - for(action= (ID *)main_newlib->action.first; action; action= (ID *)action->next) { + for (action= (ID *)main_newlib->action.first; action; action= (ID *)action->next) { if (options & LIB_LOAD_VERBOSE) printf("ActionName: %s\n", action->name+2); scene_merge->GetLogicManager()->RegisterActionName(action->name+2, action); @@ -1085,13 +1085,13 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) int maggie_index= -1; int i=0; - if(maggie==NULL) + if (maggie==NULL) return false; /* tag all false except the one we remove */ for (vector<Main*>::iterator it=m_DynamicMaggie.begin(); !(it==m_DynamicMaggie.end()); it++) { Main *main= *it; - if(main != maggie) { + if (main != maggie) { tag_main(main, 0); } else { @@ -1101,7 +1101,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) } /* should never happen but just to be safe */ - if(maggie_index == -1) + if (maggie_index == -1) return false; m_DynamicMaggie.erase(m_DynamicMaggie.begin() + maggie_index); @@ -1116,7 +1116,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) for (int scene_idx=0;scene_idx<numScenes;scene_idx++) { KX_Scene* scene = scenes->at(scene_idx); - if(IS_TAGGED(scene->GetBlenderScene())) { + if (IS_TAGGED(scene->GetBlenderScene())) { RemoveScene(scene); // XXX - not tested yet scene_idx--; numScenes--; @@ -1127,10 +1127,10 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) { CTR_Map<STR_HashedString,void*> &mapStringToMeshes = scene->GetLogicManager()->GetMeshMap(); - for(int i=0; i<mapStringToMeshes.size(); i++) + for (int i=0; i<mapStringToMeshes.size(); i++) { RAS_MeshObject *meshobj= (RAS_MeshObject *) *mapStringToMeshes.at(i); - if(meshobj && IS_TAGGED(meshobj->GetMesh())) + if (meshobj && IS_TAGGED(meshobj->GetMesh())) { STR_HashedString mn = meshobj->GetName(); mapStringToMeshes.remove(mn); @@ -1144,11 +1144,11 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) { CTR_Map<STR_HashedString,void*> &mapStringToActions = scene->GetLogicManager()->GetActionMap(); - for(int i=0; i<mapStringToActions.size(); i++) + for (int i=0; i<mapStringToActions.size(); i++) { ID *action= (ID*) *mapStringToActions.at(i); - if(IS_TAGGED(action)) + if (IS_TAGGED(action)) { STR_HashedString an = action->name+2; mapStringToActions.remove(an); @@ -1160,7 +1160,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) //scene->FreeTagged(); /* removed tagged objects and meshes*/ CListValue *obj_lists[] = {scene->GetObjectList(), scene->GetInactiveList(), NULL}; - for(int ob_ls_idx=0; obj_lists[ob_ls_idx]; ob_ls_idx++) + for (int ob_ls_idx=0; obj_lists[ob_ls_idx]; ob_ls_idx++) { CListValue *obs= obj_lists[ob_ls_idx]; RAS_MeshObject* mesh; @@ -1168,7 +1168,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) for (int ob_idx = 0; ob_idx < obs->GetCount(); ob_idx++) { KX_GameObject* gameobj = (KX_GameObject*)obs->GetValue(ob_idx); - if(IS_TAGGED(gameobj->GetBlenderObject())) { + if (IS_TAGGED(gameobj->GetBlenderObject())) { int size_before = obs->GetCount(); @@ -1176,7 +1176,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) * frees m_map_gameobject_to_blender from UnregisterGameObject */ scene->RemoveObject(gameobj); - if(size_before != obs->GetCount()) + if (size_before != obs->GetCount()) ob_idx--; else { printf("ERROR COULD NOT REMOVE \"%s\"\n", gameobj->GetName().ReadPtr()); @@ -1187,7 +1187,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) int mesh_index= gameobj->GetMeshCount(); while(mesh_index--) { mesh= gameobj->GetMesh(mesh_index); - if(IS_TAGGED(mesh->GetMesh())) { + if (IS_TAGGED(mesh->GetMesh())) { gameobj->RemoveMeshes(); /* XXX - slack, should only remove meshes that are library items but mostly objects only have 1 mesh */ break; } @@ -1199,7 +1199,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) if (gameobj->GetActuators()[act_idx]->IsType(SCA_IActuator::KX_ACT_ACTION)) { BL_ActionActuator *act = (BL_ActionActuator*)gameobj->GetActuators()[act_idx]; - if(IS_TAGGED(act->GetAction())) + if (IS_TAGGED(act->GetAction())) act->SetAction(NULL); } } @@ -1237,7 +1237,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) for (int scene_idx=0;scene_idx<numScenes;scene_idx++) { KX_Scene* scene = scenes->at(scene_idx); - if(scene->GetWorldInfo()) + if (scene->GetWorldInfo()) worldset.insert( scene->GetWorldInfo() ); } @@ -1270,7 +1270,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) Material *bmat= NULL; /* Why do we need to check for RAS_BLENDERMAT if both are cast to a (PyObject*)? - Campbell */ - if(mat->GetFlag() & RAS_BLENDERMAT) { + if (mat->GetFlag() & RAS_BLENDERMAT) { KX_BlenderMaterial *bl_mat = static_cast<KX_BlenderMaterial*>(mat); bmat= bl_mat->GetBlenderMaterial(); @@ -1295,7 +1295,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) Material *bmat= NULL; /* Why do we need to check for RAS_BLENDERMAT if both are cast to a (PyObject*)? - Campbell */ - if(mat->GetFlag() & RAS_BLENDERMAT) { + if (mat->GetFlag() & RAS_BLENDERMAT) { KX_BlenderMaterial *bl_mat = static_cast<KX_BlenderMaterial*>(mat); bmat= bl_mat->GetBlenderMaterial(); @@ -1304,7 +1304,7 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main *maggie) bmat= kx_mat->GetBlenderMaterial(); } - if(bmat) { + if (bmat) { //printf("FOUND MAT '%s' !!! ", ((ID*)bmat)->name+2); } else { @@ -1419,13 +1419,13 @@ RAS_MeshObject *KX_BlenderSceneConverter::ConvertMeshSpecial(KX_Scene* kx_scene, /* Find a mesh in the current main */ ID *me= static_cast<ID *>(BLI_findstring(&m_maggie->mesh, name, offsetof(ID, name) + 2)); - if(me==NULL) { + if (me==NULL) { printf("Could not be found \"%s\"\n", name); return NULL; } /* Watch this!, if its used in the original scene can cause big troubles */ - if(me->us > 0) { + if (me->us > 0) { printf("Mesh has a user \"%s\"\n", name); me = (ID*)copy_mesh((Mesh*)me); me->us--; @@ -1439,16 +1439,16 @@ RAS_MeshObject *KX_BlenderSceneConverter::ConvertMeshSpecial(KX_Scene* kx_scene, Mesh *mesh= (Mesh *)me; /* ensure all materials are tagged */ - for(int i=0; i<mesh->totcol; i++) - if(mesh->mat[i]) + for (int i=0; i<mesh->totcol; i++) + if (mesh->mat[i]) mesh->mat[i]->id.flag &= ~LIB_DOIT; - for(int i=0; i<mesh->totcol; i++) + for (int i=0; i<mesh->totcol; i++) { Material *mat_old= mesh->mat[i]; /* if its tagged its a replaced material */ - if(mat_old && (mat_old->id.flag & LIB_DOIT)==0) + if (mat_old && (mat_old->id.flag & LIB_DOIT)==0) { Material *mat_old= mesh->mat[i]; Material *mat_new= copy_material( mat_old ); @@ -1462,9 +1462,9 @@ RAS_MeshObject *KX_BlenderSceneConverter::ConvertMeshSpecial(KX_Scene* kx_scene, mesh->mat[i]= mat_new; /* the same material may be used twice */ - for(int j=i+1; j<mesh->totcol; j++) + for (int j=i+1; j<mesh->totcol; j++) { - if(mesh->mat[j]==mat_old) + if (mesh->mat[j]==mat_old) { mesh->mat[j]= mat_new; mat_new->id.us++; diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp index 04342717555..af7875e0b4f 100644 --- a/source/gameengine/Converter/KX_ConvertActuators.cpp +++ b/source/gameengine/Converter/KX_ConvertActuators.cpp @@ -396,7 +396,7 @@ void BL_ConvertActuators(const char* maggiename, settings.reference_distance = soundact->sound3D.reference_distance; settings.rolloff_factor = soundact->sound3D.rolloff_factor; - if(!sound) + if (!sound) { std::cout << "WARNING: Sound actuator \"" << bact->name << "\" from object \"" << blenderobject->id.name+2 << @@ -407,12 +407,12 @@ void BL_ConvertActuators(const char* maggiename, snd_sound = *reinterpret_cast<AUD_Reference<AUD_IFactory>*>(sound->playback_handle); // if sound shall be 3D but isn't mono, we have to make it mono! - if(is3d) + if (is3d) { try { AUD_Reference<AUD_IReader> reader = snd_sound->createReader(); - if(reader->getSpecs().channels != AUD_CHANNELS_MONO) + if (reader->getSpecs().channels != AUD_CHANNELS_MONO) { AUD_DeviceSpecs specs; specs.channels = AUD_CHANNELS_MONO; diff --git a/source/gameengine/Converter/KX_ConvertControllers.cpp b/source/gameengine/Converter/KX_ConvertControllers.cpp index 503876b13c7..81778928c2e 100644 --- a/source/gameengine/Converter/KX_ConvertControllers.cpp +++ b/source/gameengine/Converter/KX_ConvertControllers.cpp @@ -161,7 +161,7 @@ void BL_ConvertControllers( pyctrl->SetNamespace(converter->GetPyNamespace()); - if(pycont->mode==SCA_PythonController::SCA_PYEXEC_SCRIPT) { + if (pycont->mode==SCA_PythonController::SCA_PYEXEC_SCRIPT) { if (pycont->text) { char *buf; @@ -181,7 +181,7 @@ void BL_ConvertControllers( pyctrl->SetScriptText(STR_String(pycont->module)); pyctrl->SetScriptName(pycont->module); /* will be something like module.func so using it as the name is OK */ - if(pycont->flag & CONT_PY_DEBUG) { + if (pycont->flag & CONT_PY_DEBUG) { printf("\nDebuging \"%s\", module for object %s\n\texpect worse performance.\n", pycont->module, blenderobject->id.name+2); pyctrl->SetDebug(true); } @@ -223,7 +223,7 @@ void BL_ConvertControllers( SCA_PythonController *pyctrl= static_cast<SCA_PythonController*>(gamecontroller); /* not strictly needed but gives syntax errors early on and * gives more predictable performance for larger scripts */ - if(pyctrl->m_mode==SCA_PythonController::SCA_PYEXEC_SCRIPT) + if (pyctrl->m_mode==SCA_PythonController::SCA_PYEXEC_SCRIPT) pyctrl->Compile(); else { /* We cant do this because importing runs the script which could end up accessing diff --git a/source/gameengine/Converter/KX_ConvertProperties.cpp b/source/gameengine/Converter/KX_ConvertProperties.cpp index 791f99b53c0..81a5f13b8f0 100644 --- a/source/gameengine/Converter/KX_ConvertProperties.cpp +++ b/source/gameengine/Converter/KX_ConvertProperties.cpp @@ -142,14 +142,14 @@ void BL_ConvertProperties(Object* object,KX_GameObject* gameobj,SCA_TimeEventMan #ifdef WITH_PYTHON /* Warn if we double up on attributes, this isn't quite right since it wont find inherited attributes however there arnt many */ - for(PyAttributeDef *attrdef = KX_GameObject::Attributes; attrdef->m_name; attrdef++) { - if(strcmp(prop->name, attrdef->m_name)==0) { + for (PyAttributeDef *attrdef = KX_GameObject::Attributes; attrdef->m_name; attrdef++) { + if (strcmp(prop->name, attrdef->m_name)==0) { printf("Warning! user defined property name \"%s\" is also a python attribute for object \"%s\"\n\tUse ob[\"%s\"] syntax to avoid conflict\n", prop->name, object->id.name+2, prop->name); break; } } - for(PyMethodDef *methdef = KX_GameObject::Methods; methdef->ml_name; methdef++) { - if(strcmp(prop->name, methdef->ml_name)==0) { + for (PyMethodDef *methdef = KX_GameObject::Methods; methdef->ml_name; methdef++) { + if (strcmp(prop->name, methdef->ml_name)==0) { printf("Warning! user defined property name \"%s\" is also a python method for object \"%s\"\n\tUse ob[\"%s\"] syntax to avoid conflict\n", prop->name, object->id.name+2, prop->name); break; } @@ -176,9 +176,9 @@ void BL_ConvertProperties(Object* object,KX_GameObject* gameobj,SCA_TimeEventMan void BL_ConvertTextProperty(Object* object, KX_FontObject* fontobj,SCA_TimeEventManager* timemgr,SCA_IScene* scene, bool isInActiveLayer) { CValue* tprop = fontobj->GetProperty("Text"); - if(!tprop) return; + if (!tprop) return; bProperty* prop = get_ob_property(object, "Text"); - if(!prop) return; + if (!prop) return; Curve *curve = static_cast<Curve *>(object->data); STR_String str = curve->str; diff --git a/source/gameengine/Converter/KX_IpoConvert.cpp b/source/gameengine/Converter/KX_IpoConvert.cpp index d0002f3b3e7..309959b4324 100644 --- a/source/gameengine/Converter/KX_IpoConvert.cpp +++ b/source/gameengine/Converter/KX_IpoConvert.cpp @@ -120,42 +120,42 @@ SG_Controller *BL_CreateIPO(struct bAction *action, KX_GameObject* gameobj, KX_B KX_IInterpolator *interpolator; KX_IScalarInterpolator *interp; - for(int i=0; i<3; i++) { + for (int i=0; i<3; i++) { if ((interp = adtList->GetScalarInterpolator("location", i))) { interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetPosition()[i]), interp); ipocontr->AddInterpolator(interpolator); ipocontr->SetIPOChannelActive(OB_LOC_X+i, true); } } - for(int i=0; i<3; i++) { + for (int i=0; i<3; i++) { if ((interp = adtList->GetScalarInterpolator("delta_location", i))) { interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetDeltaPosition()[i]), interp); ipocontr->AddInterpolator(interpolator); ipocontr->SetIPOChannelActive(OB_DLOC_X+i, true); } } - for(int i=0; i<3; i++) { + for (int i=0; i<3; i++) { if ((interp = adtList->GetScalarInterpolator(rotmode, i))) { interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetEulerAngles()[i]), interp); ipocontr->AddInterpolator(interpolator); ipocontr->SetIPOChannelActive(OB_ROT_X+i, true); } } - for(int i=0; i<3; i++) { + for (int i=0; i<3; i++) { if ((interp = adtList->GetScalarInterpolator(drotmode, i))) { interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetDeltaEulerAngles()[i]), interp); ipocontr->AddInterpolator(interpolator); ipocontr->SetIPOChannelActive(OB_DROT_X+i, true); } } - for(int i=0; i<3; i++) { + for (int i=0; i<3; i++) { if ((interp = adtList->GetScalarInterpolator("scale", i))) { interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetScaling()[i]), interp); ipocontr->AddInterpolator(interpolator); ipocontr->SetIPOChannelActive(OB_SIZE_X+i, true); } } - for(int i=0; i<3; i++) { + for (int i=0; i<3; i++) { if ((interp = adtList->GetScalarInterpolator("delta_scale", i))) { interpolator= new KX_ScalarInterpolator(&(ipocontr->GetIPOTransform().GetDeltaScaling()[i]), interp); ipocontr->AddInterpolator(interpolator); @@ -166,7 +166,7 @@ SG_Controller *BL_CreateIPO(struct bAction *action, KX_GameObject* gameobj, KX_B { KX_ObColorIpoSGController* ipocontr_obcol=NULL; - for(int i=0; i<4; i++) { + for (int i=0; i<4; i++) { if ((interp = adtList->GetScalarInterpolator("color", i))) { if (!ipocontr_obcol) { ipocontr_obcol = new KX_ObColorIpoSGController(); @@ -223,7 +223,7 @@ SG_Controller *BL_CreateLampIPO(struct bAction *action, KX_GameObject* lightobj ipocontr->SetModifyDist(true); } - for(int i=0; i<3; i++) { + for (int i=0; i<3; i++) { if ((interp = adtList->GetScalarInterpolator("color", i))) { interpolator= new KX_ScalarInterpolator(&ipocontr->m_col_rgb[i], interp); ipocontr->AddInterpolator(interpolator); @@ -323,7 +323,7 @@ void BL_ConvertWorldIpos(struct World* blenderworld,KX_BlenderSceneConverter *co KX_IInterpolator *interpolator; KX_IScalarInterpolator *interp; - for(int i=0; i<3; i++) { + for (int i=0; i<3; i++) { if ((interp = adtList->GetScalarInterpolator("horizon_color", i))) { interpolator= new KX_ScalarInterpolator(&ipocontr->m_mist_rgb[i], interp); ipocontr->AddInterpolator(interpolator); @@ -379,7 +379,7 @@ static void ConvertMaterialIpos( KX_IScalarInterpolator *sinterp; // -- - for(int i=0; i<3; i++) { + for (int i=0; i<3; i++) { if ((sinterp = adtList->GetScalarInterpolator("diffuse_color", i))) { if (!ipocontr) { ipocontr = new KX_MaterialIpoController(matname_hash); @@ -401,7 +401,7 @@ static void ConvertMaterialIpos( ipocontr->AddInterpolator(interpolator); } - for(int i=0; i<3; i++) { + for (int i=0; i<3; i++) { if ((sinterp = adtList->GetScalarInterpolator("specular_color", i))) { if (!ipocontr) { ipocontr = new KX_MaterialIpoController(matname_hash); @@ -467,7 +467,7 @@ void BL_ConvertMaterialIpos( // if there is only one material attached to the mesh then set material_index in BL_ConvertMaterialIpos to NULL // --> this makes the UpdateMaterialData function in KX_GameObject.cpp use the old hack of using SetObjectColor // because this yields a better performance as not all the vertex colors need to be edited - if(mat) ConvertMaterialIpos(mat, 0, gameobj, converter); + if (mat) ConvertMaterialIpos(mat, 0, gameobj, converter); } else { @@ -475,7 +475,7 @@ void BL_ConvertMaterialIpos( { Material *mat = give_current_material(blenderobject, material_index); STR_HashedString matname; - if(mat) { + if (mat) { matname= mat->id.name; // who is using this name? can we remove the MA here? ConvertMaterialIpos(mat, matname.hash(), gameobj, converter); } diff --git a/source/gameengine/Converter/KX_SoftBodyDeformer.cpp b/source/gameengine/Converter/KX_SoftBodyDeformer.cpp index 6fe662ac7ed..e3c12c2b966 100644 --- a/source/gameengine/Converter/KX_SoftBodyDeformer.cpp +++ b/source/gameengine/Converter/KX_SoftBodyDeformer.cpp @@ -88,18 +88,18 @@ bool KX_SoftBodyDeformer::Apply(class RAS_IPolyMaterial *polymat) // share the same mesh (=the same cache). As the rendering is done per polymaterial // cycling through the objects, the entire mesh cache cannot be updated in one shot. mmat = m_pMeshObject->GetMeshMaterial(polymat); - if(!mmat->m_slots[(void*)m_gameobj]) + if (!mmat->m_slots[(void*)m_gameobj]) return true; slot = *mmat->m_slots[(void*)m_gameobj]; // for each array - for(slot->begin(it); !slot->end(it); slot->next(it)) + for (slot->begin(it); !slot->end(it); slot->next(it)) { btSoftBody::tNodeArray& nodes(softBody->m_nodes); int index = 0; - for(i=it.startvertex; i<it.endvertex; i++,index++) { + for (i=it.startvertex; i<it.endvertex; i++,index++) { RAS_TexVert& v = it.vertex[i]; btAssert(v.getSoftBodyIndex() >= 0); |