diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-08-01 03:42:22 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-08-01 03:42:22 +0400 |
commit | 0b3fd395ef3c6d9f3a83712abe2903cb661e94eb (patch) | |
tree | 5b40726d5a0def595cfbf2b397817b257387c12c /source/gameengine/Converter/BL_BlenderDataConversion.cpp | |
parent | fe850bd1637b9d0efd28cfcc648903172d7b9303 (diff) | |
parent | 0949d48d25efdb703e7b411b4403f3cdf0eb5308 (diff) |
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r22075:22099
Diffstat (limited to 'source/gameengine/Converter/BL_BlenderDataConversion.cpp')
-rw-r--r-- | source/gameengine/Converter/BL_BlenderDataConversion.cpp | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 2ff9d38dee4..a1af195801c 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -323,8 +323,7 @@ bool ConvertMaterial( MTFace* tface, const char *tfaceName, MFace* mface, - MCol* mmcol, - int lightlayer, + MCol* mmcol, MTF_localLayer *layers, bool glslmat) { @@ -720,12 +719,12 @@ bool ConvertMaterial( return true; } - -RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, RAS_IRenderTools* rendertools, KX_Scene* scene, KX_BlenderSceneConverter *converter) +/* blenderobj can be NULL, make sure its checked for */ +RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene, KX_BlenderSceneConverter *converter) { RAS_MeshObject *meshobj; bool skinMesh = false; - int lightlayer = blenderobj->lay; + int lightlayer = blenderobj ? blenderobj->lay:(1<<20)-1; // all layers if no object. if ((meshobj = converter->FindGameMesh(mesh/*, ob->lay*/)) != NULL) return meshobj; @@ -748,7 +747,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, RAS_IRenderTools* } // Determine if we need to make a skinned mesh - if (mesh->dvert || mesh->key || ((blenderobj->gameflag & OB_SOFT_BODY) != 0) || BL_ModifierDeformer::HasCompatibleDeformer(blenderobj)) + if (blenderobj && (mesh->dvert || mesh->key || ((blenderobj->gameflag & OB_SOFT_BODY) != 0) || BL_ModifierDeformer::HasCompatibleDeformer(blenderobj))) { meshobj = new BL_SkinMeshObject(mesh); skinMesh = true; @@ -843,9 +842,8 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, RAS_IRenderTools* tan3 = tangent[f*4 + 3]; } - /* get material */ - ma = give_current_material(blenderobj, mface->mat_nr+1); - + ma = give_current_material(blenderobj, mface->mat_nr+1); + { bool visible = true; bool twoside = false; @@ -859,7 +857,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, RAS_IRenderTools* if (!bl_mat) bl_mat = new BL_Material(); ConvertMaterial(bl_mat, ma, tface, tfaceName, mface, mcol, - lightlayer, layers, converter->GetGLSLMaterials()); + layers, converter->GetGLSLMaterials()); visible = ((bl_mat->ras_mode & POLY_VIS)!=0); collider = ((bl_mat->ras_mode & COLLIDER)!=0); @@ -882,7 +880,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, RAS_IRenderTools* if (kx_blmat == NULL) kx_blmat = new KX_BlenderMaterial(); - kx_blmat->Initialize(scene, bl_mat, skinMesh, lightlayer); + kx_blmat->Initialize(scene, bl_mat, skinMesh); polymat = static_cast<RAS_IPolyMaterial*>(kx_blmat); } else { @@ -1066,8 +1064,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, RAS_IRenderTools* -static PHY_MaterialProps *CreateMaterialFromBlenderObject(struct Object* blenderobject, - KX_Scene *kxscene) +static PHY_MaterialProps *CreateMaterialFromBlenderObject(struct Object* blenderobject) { PHY_MaterialProps *materialProps = new PHY_MaterialProps; @@ -1100,8 +1097,7 @@ static PHY_MaterialProps *CreateMaterialFromBlenderObject(struct Object* blender return materialProps; } -static PHY_ShapeProps *CreateShapePropsFromBlenderObject(struct Object* blenderobject, - KX_Scene *kxscene) +static PHY_ShapeProps *CreateShapePropsFromBlenderObject(struct Object* blenderobject) { PHY_ShapeProps *shapeProps = new PHY_ShapeProps; @@ -1396,12 +1392,11 @@ void BL_CreatePhysicsObjectNew(KX_GameObject* gameobj, PHY_ShapeProps* shapeprops = - CreateShapePropsFromBlenderObject(blenderobject, - kxscene); + CreateShapePropsFromBlenderObject(blenderobject); PHY_MaterialProps* smmaterial = - CreateMaterialFromBlenderObject(blenderobject, kxscene); + CreateMaterialFromBlenderObject(blenderobject); KX_ObjectProperties objprop; objprop.m_lockXaxis = (blenderobject->gameflag2 & OB_LOCK_RIGID_BODY_X_AXIS) !=0; @@ -1719,7 +1714,7 @@ static KX_GameObject *gameobject_from_blenderobject( Mesh* mesh = static_cast<Mesh*>(ob->data); float center[3], extents[3]; float radius = my_boundbox_mesh((Mesh*) ob->data, center, extents); - RAS_MeshObject* meshobj = BL_ConvertMesh(mesh,ob,rendertools,kxscene,converter); + RAS_MeshObject* meshobj = BL_ConvertMesh(mesh,ob,kxscene,converter); // needed for python scripting kxscene->GetLogicManager()->RegisterMeshName(meshobj->GetName(),meshobj); @@ -1902,7 +1897,6 @@ void BL_ConvertBlenderObjects(struct Main* maggie, KX_KetsjiEngine* ketsjiEngine, e_PhysicsEngine physics_engine, PyObject* pythondictionary, - SCA_IInputDevice* keydev, RAS_IRenderTools* rendertools, RAS_ICanvas* canvas, KX_BlenderSceneConverter* converter, @@ -2671,7 +2665,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie, struct Object* blenderobj = converter->FindBlenderObject(gameobj); int layerMask = (groupobj.find(blenderobj) == groupobj.end()) ? activeLayerBitInfo : 0; bool isInActiveLayer = (blenderobj->lay & layerMask)!=0; - BL_ConvertSensors(blenderobj,gameobj,logicmgr,kxscene,ketsjiEngine,keydev,layerMask,isInActiveLayer,canvas,converter); + BL_ConvertSensors(blenderobj,gameobj,logicmgr,kxscene,ketsjiEngine,layerMask,isInActiveLayer,canvas,converter); // set the init state to all objects gameobj->SetInitState((blenderobj->init_state)?blenderobj->init_state:blenderobj->state); } @@ -2709,4 +2703,3 @@ void BL_ConvertBlenderObjects(struct Main* maggie, RAS_BucketManager *bucketmanager = kxscene->GetBucketManager(); bucketmanager->OptimizeBuckets(distance); } - |