Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2013-01-27 03:52:55 +0400
committerDalai Felinto <dfelinto@gmail.com>2013-01-27 03:52:55 +0400
commit4d8104917d8a6fd3897a0ab78af112b53e043945 (patch)
tree667d32d92d14c62eb09d007d11551fa098a8ba3e /source/gameengine/Converter
parentc84383301c5a2582e95259a7e4468a23a3566401 (diff)
BGE bugfix: Material initial object color working in the game
The object color option in the materials always worked, however the initial color of the object was never passed to the game. We are now passing it only, only when the object's mesh has a material that has ((shade_flags & OB_COLOR)). There reason to not always set the object color is probably due to performance (the m_bUseObjectColor flag in KX_GameObject). This patch still respect that. Bug report from Mike Pan, as part of our book nitty-gritties review work. Bugfix during Vancouver Global Game Jam :)
Diffstat (limited to 'source/gameengine/Converter')
-rw-r--r--source/gameengine/Converter/BL_BlenderDataConversion.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index 409a3bfec8f..ae902e23d65 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -1973,6 +1973,22 @@ static KX_GameObject *gameobject_from_blenderobject(
((ob->gameflag2 & OB_NEVER_DO_ACTIVITY_CULLING)!=0);
gameobj->SetIgnoreActivityCulling(ignoreActivityCulling);
gameobj->SetOccluder((ob->gameflag & OB_OCCLUDER) != 0, false);
+
+ // we only want obcolor used if there is a material in the mesh
+ // that requires it
+ Material *mat= NULL;
+ bool bUseObjectColor=false;
+
+ for (int i=0;i<mesh->totcol;i++) {
+ mat=mesh->mat[i];
+ if (!mat) break;
+ if ((mat->shade_flag &= MA_OBCOLOR)) {
+ bUseObjectColor = true;
+ break;
+ }
+ }
+ if (bUseObjectColor)
+ gameobj->SetObjectColor(ob->col);
// two options exists for deform: shape keys and armature
// only support relative shape key