[Bf-blender-cvs] [3a4c307] master: Use COMPAT_ENGINES instead of RenderEngine.use_game_engine for panel poll methods

2016-07-27 Thread Mitchell Stokes
Commit: 3a4c307652e7e58aace0384d7306b28b7626a1d9
Author: Mitchell Stokes
Date:   Mon Jul 4 22:05:32 2016 -0700
Branches: master
https://developer.blender.org/rB3a4c307652e7e58aace0384d7306b28b7626a1d9

Use COMPAT_ENGINES instead of RenderEngine.use_game_engine for panel poll 
methods

This mostly affects physics panels. Any engines relying on
RenderEngine.use_game_engine flag to show/hide panels will need to be
updated. The COMPAT_ENGINES technique is how we usually deal with this.
One issue with use_game_engine is that I cannot find a way to set it; it
appears only the BGE can set it. This means (without this commit)
external RenderEngines cannot get rid of the default physics panels.

The RE_GAME flag (the C flag behind use_game_engine) is pretty hacky
and we should look into removing its usage where possible.

===

M   release/scripts/startup/bl_ui/properties_game.py
M   release/scripts/startup/bl_ui/properties_physics_cloth.py
M   release/scripts/startup/bl_ui/properties_physics_common.py
M   release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py
M   release/scripts/startup/bl_ui/properties_physics_field.py
M   release/scripts/startup/bl_ui/properties_physics_fluid.py
M   release/scripts/startup/bl_ui/properties_physics_rigidbody.py
M   release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py
M   release/scripts/startup/bl_ui/properties_physics_smoke.py
M   release/scripts/startup/bl_ui/properties_physics_softbody.py
M   release/scripts/startup/bl_ui/properties_world.py

===

diff --git a/release/scripts/startup/bl_ui/properties_game.py 
b/release/scripts/startup/bl_ui/properties_game.py
index 300be70..386ad25 100644
--- a/release/scripts/startup/bl_ui/properties_game.py
+++ b/release/scripts/startup/bl_ui/properties_game.py
@@ -568,7 +568,7 @@ class WORLD_PT_game_context_world(WorldButtonsPanel, Panel):
 @classmethod
 def poll(cls, context):
 rd = context.scene.render
-return (context.scene) and (rd.use_game_engine)
+return (context.scene) and (rd.engine in cls.COMPAT_ENGINES)
 
 def draw(self, context):
 layout = self.layout
diff --git a/release/scripts/startup/bl_ui/properties_physics_cloth.py 
b/release/scripts/startup/bl_ui/properties_physics_cloth.py
index a5cbffb..2f1798e 100644
--- a/release/scripts/startup/bl_ui/properties_physics_cloth.py
+++ b/release/scripts/startup/bl_ui/properties_physics_cloth.py
@@ -46,11 +46,12 @@ class PhysicButtonsPanel:
 def poll(cls, context):
 ob = context.object
 rd = context.scene.render
-return (ob and ob.type == 'MESH') and (not rd.use_game_engine) and 
(context.cloth)
+return (ob and ob.type == 'MESH') and (rd.engine in 
cls.COMPAT_ENGINES) and (context.cloth)
 
 
 class PHYSICS_PT_cloth(PhysicButtonsPanel, Panel):
 bl_label = "Cloth"
+COMPAT_ENGINES = {'BLENDER_RENDER'}
 
 def draw(self, context):
 layout = self.layout
@@ -113,6 +114,7 @@ class PHYSICS_PT_cloth(PhysicButtonsPanel, Panel):
 class PHYSICS_PT_cloth_cache(PhysicButtonsPanel, Panel):
 bl_label = "Cloth Cache"
 bl_options = {'DEFAULT_CLOSED'}
+COMPAT_ENGINES = {'BLENDER_RENDER'}
 
 def draw(self, context):
 md = context.cloth
@@ -122,6 +124,7 @@ class PHYSICS_PT_cloth_cache(PhysicButtonsPanel, Panel):
 class PHYSICS_PT_cloth_collision(PhysicButtonsPanel, Panel):
 bl_label = "Cloth Collision"
 bl_options = {'DEFAULT_CLOSED'}
+COMPAT_ENGINES = {'BLENDER_RENDER'}
 
 def draw_header(self, context):
 cloth = context.cloth.collision_settings
@@ -161,6 +164,7 @@ class PHYSICS_PT_cloth_collision(PhysicButtonsPanel, Panel):
 class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel, Panel):
 bl_label = "Cloth Stiffness Scaling"
 bl_options = {'DEFAULT_CLOSED'}
+COMPAT_ENGINES = {'BLENDER_RENDER'}
 
 def draw_header(self, context):
 cloth = context.cloth.settings
@@ -193,6 +197,7 @@ class PHYSICS_PT_cloth_stiffness(PhysicButtonsPanel, Panel):
 class PHYSICS_PT_cloth_sewing(PhysicButtonsPanel, Panel):
 bl_label = "Cloth Sewing Springs"
 bl_options = {'DEFAULT_CLOSED'}
+COMPAT_ENGINES = {'BLENDER_RENDER'}
 
 def draw_header(self, context):
 cloth = context.cloth.settings
@@ -226,6 +231,7 @@ class PHYSICS_PT_cloth_sewing(PhysicButtonsPanel, Panel):
 class PHYSICS_PT_cloth_field_weights(PhysicButtonsPanel, Panel):
 bl_label = "Cloth Field Weights"
 bl_options = {'DEFAULT_CLOSED'}
+COMPAT_ENGINES = {'BLENDER_RENDER'}
 
 def draw(self, context):
 cloth = context.cloth.settings
diff --git a/release/scripts/startup/bl_ui/properties_physics_common.py 
b/release/scripts/startup/bl_ui/properties_physics_common.py
index 82eecf0..277b59d 100644
--- a/rele

[Bf-blender-cvs] [11e4558] master: BGE: Fix animations when using VBOs

2016-03-10 Thread Mitchell Stokes
Commit: 11e4558313f73dc6837851c13959964548c4e61a
Author: Mitchell Stokes
Date:   Wed Mar 9 20:44:14 2016 -0800
Branches: master
https://developer.blender.org/rB11e4558313f73dc6837851c13959964548c4e61a

BGE: Fix animations when using VBOs

===

M   source/gameengine/Converter/BL_SkinDeformer.cpp

===

diff --git a/source/gameengine/Converter/BL_SkinDeformer.cpp 
b/source/gameengine/Converter/BL_SkinDeformer.cpp
index 950c1dc..68da99f 100644
--- a/source/gameengine/Converter/BL_SkinDeformer.cpp
+++ b/source/gameengine/Converter/BL_SkinDeformer.cpp
@@ -153,7 +153,10 @@ void BL_SkinDeformer::Relink(CTR_Map*map)
 bool BL_SkinDeformer::Apply(RAS_IPolyMaterial *mat)
 {
// We do everything in UpdateInternal() now so we can thread it.
-   return false;
+   // All that is left is telling the rasterizer if we've changed the mesh
+   bool retval = !m_poseApplied;
+   m_poseApplied = true;
+   return retval;
 }
 
 RAS_Deformer *BL_SkinDeformer::GetReplica()
@@ -359,6 +362,8 @@ bool BL_SkinDeformer::UpdateInternal(bool shape_applied)
 
UpdateTransverts();
 
+   m_poseApplied = false;
+
/* indicate that the m_transverts and normals are up to date */
return true;
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [4af287f] master: BGE: Fix memory leak in VBO code

2016-03-10 Thread Mitchell Stokes
Commit: 4af287fc9c3ad5f58bfd226287254173fe288cde
Author: Mitchell Stokes
Date:   Thu Mar 10 19:05:24 2016 -0800
Branches: master
https://developer.blender.org/rB4af287fc9c3ad5f58bfd226287254173fe288cde

BGE: Fix memory leak in VBO code

===

M   source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.cpp
M   source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.h

===

diff --git 
a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.cpp 
b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.cpp
index 08d27cb..cad5b5a 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.cpp
@@ -193,6 +193,11 @@ bool RAS_StorageVBO::Init()
 
 void RAS_StorageVBO::Exit()
 {
+   VBOMap::iterator it = m_vbo_lookup.begin();
+   while (it != m_vbo_lookup.end()) {
+   delete it->second;
+   ++it;
+   }
m_vbo_lookup.clear();
 }
 
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.h 
b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.h
index f78faa9..9cb3449 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.h
@@ -62,6 +62,8 @@ private:
void*   uv_offset;
 };
 
+typedef std::map<RAS_DisplayArray*, VBO*> VBOMap;
+
 class RAS_StorageVBO : public RAS_IStorage
 {
 
@@ -86,7 +88,7 @@ protected:
RAS_IRasterizer::TexCoGen*  m_attrib;
int*m_attrib_layer;
 
-   std::map<RAS_DisplayArray*, class VBO*> m_vbo_lookup;
+   VBOMap  m_vbo_lookup;
 
 #ifdef WITH_CXX_GUARDEDALLOC
 public:

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [9d03307] master: BGE: Remove RAS_IRasterizer::IndexPrimitivesMulti()

2015-12-07 Thread Mitchell Stokes
Commit: 9d0330708dc6ce57a2258e4dd01d09f1dcb3
Author: Mitchell Stokes
Date:   Sun Dec 6 14:35:14 2015 -0800
Branches: master
https://developer.blender.org/rB9d0330708dc6ce57a2258e4dd01d09f1dcb3

BGE: Remove RAS_IRasterizer::IndexPrimitivesMulti()

The work that was being done in IndexPrimitiveMulti() is now done by
IndexPrimitive() and we always assume multitexture support.

===

M   source/gameengine/Rasterizer/RAS_IRasterizer.h
M   source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
M   source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_IStorage.h
M   source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
M   source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h
M   
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
M   source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
M   source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.cpp
M   source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.h
M   source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.cpp
M   source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVA.h
M   source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.cpp
M   source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageVBO.h

===

diff --git a/source/gameengine/Rasterizer/RAS_IRasterizer.h 
b/source/gameengine/Rasterizer/RAS_IRasterizer.h
index 7fbaf07..618bcbf 100644
--- a/source/gameengine/Rasterizer/RAS_IRasterizer.h
+++ b/source/gameengine/Rasterizer/RAS_IRasterizer.h
@@ -267,7 +267,6 @@ public:
 * IndexPrimitives: Renders primitives from mesh slot.
 */
virtual void IndexPrimitives(class RAS_MeshSlot ) = 0;
-   virtual void IndexPrimitivesMulti(class RAS_MeshSlot ) = 0;
 
/**
 * IndexPrimitives_3DText will render text into the polygons.
diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp 
b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
index 2078fc9..13d49c5 100644
--- a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
+++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
@@ -649,15 +649,13 @@ void RAS_MaterialBucket::RenderMeshSlot(const 
MT_Transform& cameratrans, RAS_IRa
else
ms.m_bDisplayList = true;
 
-   // for text drawing using faces
-   if (m_material->GetDrawingMode() & 
RAS_IRasterizer::RAS_RENDER_3DPOLYGON_TEXT)
+   if (m_material->GetDrawingMode() & 
RAS_IRasterizer::RAS_RENDER_3DPOLYGON_TEXT) {
+   // for text drawing using faces
rasty->IndexPrimitives_3DText(ms, m_material);
-   // for multitexturing
-   else if ((m_material->GetFlag() & (RAS_MULTITEX|RAS_BLENDERGLSL)))
-   rasty->IndexPrimitivesMulti(ms);
-   // use normal IndexPrimitives
-   else
+   }
+   else {
rasty->IndexPrimitives(ms);
+   }
 
rasty->PopMatrix();
 }
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_IStorage.h 
b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_IStorage.h
index bfa6e1a..ae0cdcd 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_IStorage.h
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_IStorage.h
@@ -44,7 +44,6 @@ public:
virtual voidExit()=0;
 
virtual voidIndexPrimitives(RAS_MeshSlot& ms)=0;
-   virtual voidIndexPrimitivesMulti(RAS_MeshSlot& ms)=0;
 
virtual voidSetDrawingMode(int drawingmode)=0;
 
diff --git 
a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp 
b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
index 34184f7..275e4b4 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
@@ -243,30 +243,6 @@ void RAS_ListRasterizer::IndexPrimitives(RAS_MeshSlot& ms)
if (ms.m_bDisplayList) {
localSlot = FindOrAdd(ms);
localSlot->DrawList();
-   if (localSlot->End()) {
-   // save slot here too, needed for replicas and object 
using same mesh
-   // => they have the same vertexarray but different mesh 
slot
-   ms.m_DisplayList = localSlot;
-   return;
-   }
-   }
-   
-   RAS_OpenGLRasterizer::IndexPrimitives(ms);
-
-   if (ms.m_bDisplayList) {
-   localSlot->EndList();
-   ms.m_DisplayList = localSlot;
-   }
-}
-
-
-void RAS_ListRasterizer::IndexPrimitivesMulti(RAS_MeshSlot& ms)
-{
-   RAS_ListSlot* localSlot =0;
-
-   if (ms.m_bDisplayList) {
-

[Bf-blender-cvs] [fe2f3a1] master: OpenGL/BGE: Remove RAS_StorageIM (glBegin/glEnd rendering of mesh data)

2015-12-07 Thread Mitchell Stokes
Commit: fe2f3a131d96e4b0d1c85e1379b30c73f6378ffd
Author: Mitchell Stokes
Date:   Sun Dec 6 15:24:55 2015 -0800
Branches: master
https://developer.blender.org/rBfe2f3a131d96e4b0d1c85e1379b30c73f6378ffd

OpenGL/BGE: Remove RAS_StorageIM (glBegin/glEnd rendering of mesh data)

The only use we had for RAS_StorageIM was to render derived meshes using
Blender's mesh drawing. This is now handled as a special case in
RAS_OpenGLRasterizer instead of in RAS_StorageIM.

We are now left with RAS_StorageVA and RAS_StorageVBO. At the moment
vertex arrays are still the default since our vertex array with display
lists implementation is still much faster than our VBO code in a lot of
cases. As we improve our VBO code, we can drop vertex arrays since
Blender's minimum OpenGL version is being bumped up to 2.1, which
supports VBOs.

===

M   source/blender/makesrna/intern/rna_scene.c
M   source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
M   source/gameengine/GamePlayer/ghost/GPG_Application.cpp
M   source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt
M   source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.cpp
M   source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_ListRasterizer.h
M   
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
M   source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
D   source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.cpp
D   source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_StorageIM.h

===

diff --git a/source/blender/makesrna/intern/rna_scene.c 
b/source/blender/makesrna/intern/rna_scene.c
index 3011288..4f9fe8b 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -3774,12 +3774,9 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
 
static EnumPropertyItem storage_items[] = {
{RAS_STORE_AUTO, "AUTO", 0, "Auto Select", "Choose the best 
supported mode"},
-   {RAS_STORE_IMMEDIATE, "IMMEDIATE", 0, "Immediate Mode", 
"Slowest performance, requires OpenGL (any version)"},
-   {RAS_STORE_VA, "VERTEX_ARRAY", 0, "Vertex Arrays", "Better 
performance, requires at least OpenGL 1.1"},
-#if 0  /* XXX VBOS are currently disabled since they cannot beat vertex array 
with display lists in performance. */
+   {RAS_STORE_VA, "VERTEX_ARRAY", 0, "Vertex Arrays", "Usually the 
best choice (good performance with display lists)"},
{RAS_STORE_VBO, "VERTEX_BUFFER_OBJECT", 0, "Vertex Buffer 
Objects",
-   "Best performance, requires at least OpenGL 
1.4"}, 
-#endif
+   "Typically slower than vertex arrays with 
display lists, requires at least OpenGL 1.4"},
{0, NULL, 0, NULL, NULL}};
 
srna = RNA_def_struct(brna, "SceneGameData", NULL);
diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp 
b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
index 976590c..0d04ab6 100644
--- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
+++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
@@ -302,12 +302,20 @@ extern "C" void StartKetsjiShell(struct bContext *C, 
struct ARegion *ar, rcti *c
canvas->SetSwapInterval((startscene->gm.vsync == 
VSYNC_ON) ? 1 : 0);
 
RAS_IRasterizer* rasterizer = NULL;
+   RAS_STORAGE_TYPE raster_storage = RAS_AUTO_STORAGE;
+
+   if (startscene->gm.raster_storage == RAS_STORE_VBO) {
+   raster_storage = RAS_VBO;
+   }
+   else if (startscene->gm.raster_storage == RAS_STORE_VA) {
+   raster_storage = RAS_VA;
+   }
//Don't use displaylists with VBOs
//If auto starts using VBOs, make sure to check for that here
-   if (displaylists && startscene->gm.raster_storage != 
RAS_STORE_VBO)
-   rasterizer = new RAS_ListRasterizer(canvas, true, 
startscene->gm.raster_storage);
+   if (displaylists && raster_storage != RAS_VBO)
+   rasterizer = new RAS_ListRasterizer(canvas, true, 
raster_storage);
else
-   rasterizer = new RAS_OpenGLRasterizer(canvas, 
startscene->gm.raster_storage);
+   rasterizer = new RAS_OpenGLRasterizer(canvas, 
raster_storage);
 
RAS_IRasterizer::MipmapOption mipmapval = 
rasterizer->GetMipmapping();
 
diff --git a/source/gameengine/GamePl

[Bf-blender-cvs] [964107f] master: BGE code cleanup: Removing RAS_GLExtensionManager.

2015-12-07 Thread Mitchell Stokes
Commit: 964107fbce77fac3badf2de027e6096cc8efe7ca
Author: Mitchell Stokes
Date:   Sun Mar 30 18:35:02 2014 -0700
Branches: master
https://developer.blender.org/rB964107fbce77fac3badf2de027e6096cc8efe7ca

BGE code cleanup: Removing RAS_GLExtensionManager.

This class did nothing but print out extensions if they were found.
Instead, the code from bge.logic.PrintGLInfo() is now printed as the
Rasterizer is initialized. This gives better information, and it removes
some GL code from KX_PythonInit.cpp (the PrintGLInfo method now calls
the Rasterizer to print the information).

Differential Revision: https://developer.blender.org/D438

===

M   source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
M   source/gameengine/GamePlayer/ghost/GPG_Application.cpp
M   source/gameengine/Ketsji/BL_Shader.cpp
M   source/gameengine/Ketsji/BL_Texture.cpp
M   source/gameengine/Ketsji/KX_BlenderMaterial.cpp
M   source/gameengine/Ketsji/KX_PythonInit.cpp
M   source/gameengine/Rasterizer/RAS_IRasterizer.h
M   source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt
D   
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.cpp
D   
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_GLExtensionManager.h
M   
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
M   source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
M   source/gameengine/VideoTexture/blendVideoTex.cpp

===

diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp 
b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
index 0d04ab6..c5fc55a 100644
--- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
+++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
@@ -54,7 +54,6 @@
 #include "KX_PyConstraintBinding.h"
 #include "KX_PythonMain.h"
 
-#include "RAS_GLExtensionManager.h"
 #include "RAS_OpenGLRasterizer.h"
 #include "RAS_ListRasterizer.h"
 
@@ -250,8 +249,6 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct 
ARegion *ar, rcti *c

PyObject *pyGlobalDict = PyDict_New(); /* python utility storage, spans 
blend file loading */
 #endif
-   
-   bgl::InitExtensions(true);
 
// Globals to be carried on over blender files
GlobalSettings gs;
diff --git a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp 
b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
index 2940e6d..f0a7bd4 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
@@ -78,7 +78,6 @@ extern "C"
 #include "RAS_MeshObject.h"
 #include "RAS_OpenGLRasterizer.h"
 #include "RAS_ListRasterizer.h"
-#include "RAS_GLExtensionManager.h"
 #include "KX_PythonInit.h"
 #include "KX_PyConstraintBinding.h"
 #include "BL_Material.h" // MAXTEX
@@ -563,7 +562,6 @@ bool GPG_Application::initEngine(GHOST_IWindow* window, 
const int stereoMode)
if (!m_engineInitialized)
{
GPU_init();
-   bgl::InitExtensions(true);
 
// get and set the preferences
SYS_SystemHandle syshandle = SYS_GetSystem();
diff --git a/source/gameengine/Ketsji/BL_Shader.cpp 
b/source/gameengine/Ketsji/BL_Shader.cpp
index 4b229f5..6613780 100644
--- a/source/gameengine/Ketsji/BL_Shader.cpp
+++ b/source/gameengine/Ketsji/BL_Shader.cpp
@@ -34,7 +34,6 @@
 #include "KX_PyMath.h"
 #include "MEM_guardedalloc.h"
 
-#include "RAS_GLExtensionManager.h"
 #include "RAS_MeshObject.h"
 #include "RAS_IRasterizer.h"
 
diff --git a/source/gameengine/Ketsji/BL_Texture.cpp 
b/source/gameengine/Ketsji/BL_Texture.cpp
index 8f717c0..17bd8c3 100644
--- a/source/gameengine/Ketsji/BL_Texture.cpp
+++ b/source/gameengine/Ketsji/BL_Texture.cpp
@@ -38,7 +38,6 @@
 #include "BKE_image.h"
 #include "BLI_blenlib.h"
 
-#include "RAS_OpenGLRasterizer/RAS_GLExtensionManager.h"
 #include "RAS_ICanvas.h"
 #include "RAS_Rect.h"
 
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp 
b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
index d85d33d..a10bdf4 100644
--- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
+++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
@@ -39,7 +39,6 @@
 #include "RAS_BucketManager.h"
 #include "RAS_MeshObject.h"
 #include "RAS_IRasterizer.h"
-#include "RAS_OpenGLRasterizer/RAS_GLExtensionManager.h"
 
 #include "GPU_draw.h"
 
diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp 
b/source/gameengine/Ketsji/KX_PythonInit.cpp
index 26c6fca..d35f09d 100644
--- a/sou

[Bf-blender-cvs] [5d59a51] blender-v2.76-release: Fix T45886: cont.deactivate(ActionActuatorInPropertyMode) does not work

2015-10-09 Thread Mitchell Stokes
Commit: 5d59a51acab16e27c42e197c25c0d68a063c152c
Author: Mitchell Stokes
Date:   Sun Aug 23 19:56:51 2015 -0700
Branches: blender-v2.76-release
https://developer.blender.org/rB5d59a51acab16e27c42e197c25c0d68a063c152c

Fix T45886: cont.deactivate(ActionActuatorInPropertyMode) does not work

Make sure the Action Actuator actually deactivates when given a negative
event while using the property play mode.

===

M   source/gameengine/Converter/BL_ActionActuator.cpp

===

diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp 
b/source/gameengine/Converter/BL_ActionActuator.cpp
index d4cfeb2..372be85 100644
--- a/source/gameengine/Converter/BL_ActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ActionActuator.cpp
@@ -307,6 +307,7 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
}
 
switch (m_playtype) {
+   case ACT_ACTION_FROM_PROP:
case ACT_ACTION_LOOP_STOP:
obj->StopAction(m_layer); // Stop the action 
after getting the frame

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [0d36233] master: Fix for T41536: 2.71 getActionFrame no longer returns frames accurately

2015-10-06 Thread Mitchell Stokes
Commit: 0d36233dd81c92d98b2e665d04a8034e7b27aba0
Author: Mitchell Stokes
Date:   Tue Oct 6 22:16:22 2015 -0700
Branches: master
https://developer.blender.org/rB0d36233dd81c92d98b2e665d04a8034e7b27aba0

Fix for T41536: 2.71 getActionFrame no longer returns frames accurately

We now keep actions around when they are finished playing so scripts can
still get access to information such as the current frame. Playing a new
action in the same layer still overwrites the previous action as before this
commit. Using an explicit KX_GameObject.stopAction() will free the memory. The
action is also freed when the KX_GameObject is freed as before.

===

M   source/gameengine/Ketsji/BL_Action.cpp
M   source/gameengine/Ketsji/BL_Action.h
M   source/gameengine/Ketsji/BL_ActionManager.cpp
M   source/gameengine/Ketsji/BL_ActionManager.h

===

diff --git a/source/gameengine/Ketsji/BL_Action.cpp 
b/source/gameengine/Ketsji/BL_Action.cpp
index 12a1cae..507476d 100644
--- a/source/gameengine/Ketsji/BL_Action.cpp
+++ b/source/gameengine/Ketsji/BL_Action.cpp
@@ -268,11 +268,6 @@ bool BL_Action::Play(const char* name,
return true;
 }
 
-void BL_Action::Stop()
-{
-   m_done = true;
-}
-
 bool BL_Action::IsDone()
 {
return m_done;
diff --git a/source/gameengine/Ketsji/BL_Action.h 
b/source/gameengine/Ketsji/BL_Action.h
index 379dd52..7a40441 100644
--- a/source/gameengine/Ketsji/BL_Action.h
+++ b/source/gameengine/Ketsji/BL_Action.h
@@ -94,10 +94,6 @@ public:
float playback_speed,
short blend_mode);
/**
-* Stop playing the action
-*/
-   void Stop();
-   /**
 * Whether or not the action is still playing
 */
bool IsDone();
diff --git a/source/gameengine/Ketsji/BL_ActionManager.cpp 
b/source/gameengine/Ketsji/BL_ActionManager.cpp
index 9e46905..4249db5 100644
--- a/source/gameengine/Ketsji/BL_ActionManager.cpp
+++ b/source/gameengine/Ketsji/BL_ActionManager.cpp
@@ -53,14 +53,6 @@ BL_Action *BL_ActionManager::GetAction(short layer)
return (it != m_layers.end()) ? it->second : 0;
 }
 
-BL_Action* BL_ActionManager::AddAction(short layer)
-{
-   BL_Action *action = new BL_Action(m_obj);
-   m_layers[layer] = action;
-
-   return action;
-}
-
 float BL_ActionManager::GetActionFrame(short layer)
 {
BL_Action *action = GetAction(layer);
@@ -116,8 +108,10 @@ bool BL_ActionManager::PlayAction(const char* name,
 {
// Only this method will create layer if non-existent
BL_Action *action = GetAction(layer);
-   if (!action)
-   action = AddAction(layer);
+   if (!action) {
+   action = new BL_Action(m_obj);
+   m_layers[layer] = action;
+   }
 
// Disable layer blending on the first layer
if (layer == 0) layer_weight = -1.f;
@@ -129,7 +123,10 @@ void BL_ActionManager::StopAction(short layer)
 {
BL_Action *action = GetAction(layer);
 
-   if (action) action->Stop();
+   if (action) {
+   m_layers.erase(layer);
+   delete action;
+   }
 }
 
 void BL_ActionManager::RemoveTaggedActions()
@@ -158,15 +155,10 @@ void BL_ActionManager::Update(float curtime)
m_prevUpdate = curtime;
 
BL_ActionMap::iterator it;
-   for (it = m_layers.begin(); it != m_layers.end(); )
+   for (it = m_layers.begin(); it != m_layers.end(); ++it)
{
-   if (it->second->IsDone()) {
-   delete it->second;
-   m_layers.erase(it++);
-   }
-   else {
+   if (!it->second->IsDone()) {
it->second->Update(curtime);
-   ++it;
}
}
 }
diff --git a/source/gameengine/Ketsji/BL_ActionManager.h 
b/source/gameengine/Ketsji/BL_ActionManager.h
index 97d6d88..1292938 100644
--- a/source/gameengine/Ketsji/BL_ActionManager.h
+++ b/source/gameengine/Ketsji/BL_ActionManager.h
@@ -59,11 +59,6 @@ private:
 */
BL_Action* GetAction(short layer);
 
-   /**
-* Add new action with given layer
-*/
-   BL_Action* AddAction(short layer);
-
 public:
BL_ActionManager(class KX_GameObject* obj);
~BL_ActionManager();

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [077b4ab] master: Fix T45886: cont.deactivate(ActionActuatorInPropertyMode) does not work

2015-10-06 Thread Mitchell Stokes
Commit: 077b4ab846c37ad2456ec6f8f3501d55f42c4ccc
Author: Mitchell Stokes
Date:   Sun Aug 23 19:56:51 2015 -0700
Branches: master
https://developer.blender.org/rB077b4ab846c37ad2456ec6f8f3501d55f42c4ccc

Fix T45886: cont.deactivate(ActionActuatorInPropertyMode) does not work

Make sure the Action Actuator actually deactivates when given a negative
event while using the property play mode.

===

M   source/gameengine/Converter/BL_ActionActuator.cpp

===

diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp 
b/source/gameengine/Converter/BL_ActionActuator.cpp
index d4cfeb2..372be85 100644
--- a/source/gameengine/Converter/BL_ActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ActionActuator.cpp
@@ -307,6 +307,7 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
}
 
switch (m_playtype) {
+   case ACT_ACTION_FROM_PROP:
case ACT_ACTION_LOOP_STOP:
obj->StopAction(m_layer); // Stop the action 
after getting the frame

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [5aade17] master: Revert BGE : KX_VertexProxy support for more than 2 UV channel.

2015-06-06 Thread Mitchell Stokes
Commit: 5aade17bdf0f9d230c2e0bb7a97ead21a48895af
Author: Mitchell Stokes
Date:   Sat Jun 6 13:11:22 2015 -0700
Branches: master
https://developer.blender.org/rB5aade17bdf0f9d230c2e0bb7a97ead21a48895af

Revert BGE : KX_VertexProxy support for more than 2 UV channel.

This reverts commit fb0dd596e9a58f095730359a11759c40ea46be44.

This commit reintroduced a deprecated API that we'd rather not see in a
release. A better solution is being worked on.

===

M   doc/python_api/rst/bge_types/bge.types.KX_VertexProxy.rst
M   source/gameengine/Ketsji/KX_VertexProxy.cpp
M   source/gameengine/Ketsji/KX_VertexProxy.h

===

diff --git a/doc/python_api/rst/bge_types/bge.types.KX_VertexProxy.rst 
b/doc/python_api/rst/bge_types/bge.types.KX_VertexProxy.rst
index d1bd675..73d6927 100644
--- a/doc/python_api/rst/bge_types/bge.types.KX_VertexProxy.rst
+++ b/doc/python_api/rst/bge_types/bge.types.KX_VertexProxy.rst
@@ -25,12 +25,6 @@ base class --- :class:`SCA_IObject`
 
   :type: Vector((u, v))
 
-   .. attribute:: uvs
-
-  A list of all the texture coordinates of the vertex.
-
-  :type: list of Vector((u, v))
-
.. attribute:: normal
 
   The normal of the vertex.
@@ -126,24 +120,18 @@ base class --- :class:`SCA_IObject`
 
   :arg pos: the new position for this vertex in local coordinates.
 
-   .. method:: getUV(index=0)
+   .. method:: getUV()
 
   Gets the UV (texture) coordinates of this vertex.
 
-  :arg index: the UV (texture) channel (optional).
-  :type index: integer
-
   :return: this vertexes UV (texture) coordinates.
   :rtype: Vector((u, v))
 
-   .. method:: setUV(uv, index=0)
+   .. method:: setUV(uv)
 
   Sets the UV (texture) coordinates of this vertex.
 
-  :arg uv: the UV (texture) coordinate of this vertex.
-  :type uv: Vector((u, v))
-  :arg index: the UV (texture) channel (optional).
-  :type index: integer
+  :type:  Vector((u, v))
 
.. method:: getUV2()
 
@@ -152,16 +140,14 @@ base class --- :class:`SCA_IObject`
   :return: this vertexes UV (texture) coordinates.
   :rtype: Vector((u, v))
 
-  .. deprecated:: use :meth:`getUV`
-
-   .. method:: setUV2(uv)
+   .. method:: setUV2(uv, unit)
 
   Sets the 2nd UV (texture) coordinates of this vertex.
 
-  :arg uv: the 2nd (texture) UV coordinate of this vertex.
-  :type uv: Vector((u, v))
+  :type:  Vector((u, v))
 
-  .. deprecated:: use :meth:`setUV`
+  :arg unit: optional argument, FLAT==1, SECOND_UV==2, defaults to 
SECOND_UV
+  :arg unit:  integer
 
.. method:: getRGBA()
 
diff --git a/source/gameengine/Ketsji/KX_VertexProxy.cpp 
b/source/gameengine/Ketsji/KX_VertexProxy.cpp
index 1634165..cd1c9ee 100644
--- a/source/gameengine/Ketsji/KX_VertexProxy.cpp
+++ b/source/gameengine/Ketsji/KX_VertexProxy.cpp
@@ -63,11 +63,11 @@ PyTypeObject KX_VertexProxy::Type = {
 PyMethodDef KX_VertexProxy::Methods[] = {
{getXYZ, (PyCFunction)KX_VertexProxy::sPyGetXYZ,METH_NOARGS},
{setXYZ, (PyCFunction)KX_VertexProxy::sPySetXYZ,METH_O},
-   {getUV, (PyCFunction)KX_VertexProxy::sPyGetUV, METH_VARARGS},
-   {setUV, (PyCFunction)KX_VertexProxy::sPySetUV, METH_VARARGS},
+   {getUV, (PyCFunction)KX_VertexProxy::sPyGetUV1, METH_NOARGS},
+   {setUV, (PyCFunction)KX_VertexProxy::sPySetUV1, METH_O},
 
{getUV2, (PyCFunction)KX_VertexProxy::sPyGetUV2,METH_NOARGS},
-   {setUV2, (PyCFunction)KX_VertexProxy::sPySetUV2, METH_O},
+   {setUV2, (PyCFunction)KX_VertexProxy::sPySetUV2,METH_VARARGS},
 
{getRGBA, (PyCFunction)KX_VertexProxy::sPyGetRGBA,METH_NOARGS},
{setRGBA, (PyCFunction)KX_VertexProxy::sPySetRGBA,METH_O},
@@ -423,6 +423,7 @@ int KX_VertexProxy::pyattr_set_uvs(void *self_v, const 
struct KX_PYATTRIBUTE_DEF
if (PyVecTo(PySequence_GetItem(value, i), vec))
{
self-m_vertex-SetUV(i, vec);
+   self-m_mesh-SetMeshModified(true);
}
else
{
@@ -558,45 +559,25 @@ PyObject *KX_VertexProxy::PySetRGBA(PyObject *value)
return NULL;
 }
 
-PyObject *KX_VertexProxy::PyGetUV(PyObject *args)
-{
-   int index = 0;
-   if (!PyArg_ParseTuple(args, |i:getUV, index))
-   return NULL;
 
-   if (index  0 || index  (RAS_TexVert::MAX_UNIT - 1)) {
-   PyErr_Format(PyExc_TypeError, vert.getUV(index): 
KX_VertexProxy, expected an int between 0 and %i, (RAS_TexVert::MAX_UNIT - 1));
-   return NULL;
-   }
-
-   return PyObjectFrom(MT_Vector2(m_vertex-getUV(index)));
+PyObject *KX_VertexProxy::PyGetUV1()
+{
+   return PyObjectFrom(MT_Vector2(m_vertex-getUV(0)));
 }
 
-PyObject *KX_VertexProxy::PySetUV(PyObject *args)
+PyObject *KX_VertexProxy::PySetUV1

[Bf-blender-cvs] [8478c71] master: BGE: Adding material IPO support to GLSL materials

2015-05-12 Thread Mitchell Stokes
Commit: 8478c71a7b8f75dcf4855747347ba53639e6aac3
Author: Mitchell Stokes
Date:   Mon May 11 23:05:04 2015 -0700
Branches: master
https://developer.blender.org/rB8478c71a7b8f75dcf4855747347ba53639e6aac3

BGE: Adding material IPO support to GLSL materials

Most of this patch was created by Daniel Stokes, I'm mostly just cleaning
it up and testing it. Still todo: hardness. I need to figure out how to
handle the integer - float conversion on a dynamic uniform.

Reviewers: psy-fi, brecht

Reviewed By: psy-fi

Subscribers: psy-fi

Differential Revision: https://developer.blender.org/D511

===

M   source/blender/gpu/GPU_material.h
M   source/blender/gpu/intern/gpu_codegen.c
M   source/blender/gpu/intern/gpu_material.c
M   source/gameengine/Ketsji/KX_BlenderMaterial.cpp
M   source/gameengine/Ketsji/KX_BlenderMaterial.h
M   source/gameengine/Ketsji/KX_IpoConvert.cpp
M   source/gameengine/Ketsji/KX_MaterialIpoController.cpp

===

diff --git a/source/blender/gpu/GPU_material.h 
b/source/blender/gpu/GPU_material.h
index 7bb044a..1fb2518 100644
--- a/source/blender/gpu/GPU_material.h
+++ b/source/blender/gpu/GPU_material.h
@@ -154,6 +154,14 @@ typedef enum GPUDynamicType {
GPU_DYNAMIC_MIST_COLOR = 26,
GPU_DYNAMIC_HORIZON_COLOR = 27,
GPU_DYNAMIC_AMBIENT_COLOR = 28,
+   GPU_DYNAMIC_MAT_DIFFRGB = 29,
+   GPU_DYNAMIC_MAT_REF = 30,
+   GPU_DYNAMIC_MAT_SPECRGB = 31,
+   GPU_DYNAMIC_MAT_SPEC = 32,
+   GPU_DYNAMIC_MAT_HARD = 33,
+   GPU_DYNAMIC_MAT_EMIT = 34,
+   GPU_DYNAMIC_MAT_AMB = 35,
+   GPU_DYNAMIC_MAT_ALPHA = 36,
 } GPUDynamicType;
 
 GPUNodeLink *GPU_attribute(CustomDataType type, const char *name);
diff --git a/source/blender/gpu/intern/gpu_codegen.c 
b/source/blender/gpu/intern/gpu_codegen.c
index e9bc400..e92b589 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -852,10 +852,19 @@ void GPU_pass_update_uniforms(GPUPass *pass)
return;
 
/* pass dynamic inputs to opengl, others were removed */
-   for (input = inputs-first; input; input = input-next)
-   if (!(input-ima || input-tex || input-prv))
-   GPU_shader_uniform_vector(shader, input-shaderloc, 
input-type, 1,
-   input-dynamicvec);
+   for (input = inputs-first; input; input = input-next) {
+   if (!(input-ima || input-tex || input-prv)) {
+   if (input-dynamictype == GPU_DYNAMIC_MAT_HARD) {
+   // The hardness is actually a short pointer, so 
we convert it here
+   float val = (float)(*(short*)input-dynamicvec);
+   GPU_shader_uniform_vector(shader, 
input-shaderloc, 1, 1, val);
+   }
+   else {
+   GPU_shader_uniform_vector(shader, 
input-shaderloc, input-type, 1,
+   input-dynamicvec);
+   }
+   }
+   }
 }
 
 void GPU_pass_unbind(GPUPass *pass)
diff --git a/source/blender/gpu/intern/gpu_material.c 
b/source/blender/gpu/intern/gpu_material.c
index 12672b5..774dee9 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -1449,7 +1449,6 @@ static void do_material_tex(GPUShadeInput *shi)
 
 void GPU_shadeinput_set(GPUMaterial *mat, Material *ma, GPUShadeInput *shi)
 {
-   float hard = ma-har;
float one = 1.0f;
 
memset(shi, 0, sizeof(*shi));
@@ -1457,20 +1456,20 @@ void GPU_shadeinput_set(GPUMaterial *mat, Material *ma, 
GPUShadeInput *shi)
shi-gpumat = mat;
shi-mat = ma;
 
-   GPU_link(mat, set_rgb, GPU_uniform(ma-r), shi-rgb);
-   GPU_link(mat, set_rgb, GPU_uniform(ma-specr), shi-specrgb);
+   GPU_link(mat, set_rgb, GPU_dynamic_uniform(ma-r, 
GPU_DYNAMIC_MAT_DIFFRGB, NULL), shi-rgb);
+   GPU_link(mat, set_rgb, GPU_dynamic_uniform(ma-specr, 
GPU_DYNAMIC_MAT_SPECRGB, NULL), shi-specrgb);
GPU_link(mat, shade_norm, GPU_builtin(GPU_VIEW_NORMAL), shi-vn);
 
if (mat-alpha)
-   GPU_link(mat, set_value, GPU_uniform(ma-alpha), 
shi-alpha);
+   GPU_link(mat, set_value, GPU_dynamic_uniform(ma-alpha, 
GPU_DYNAMIC_MAT_ALPHA, NULL), shi-alpha);
else
GPU_link(mat, set_value, GPU_uniform(one), shi-alpha);
 
-   GPU_link(mat, set_value, GPU_uniform(ma-ref), shi-refl);
-   GPU_link(mat, set_value, GPU_uniform(ma-spec), shi-spec);
-   GPU_link(mat, set_value, GPU_uniform(ma-emit), shi-emit);
-   GPU_link(mat, set_value, GPU_uniform(hard), shi-har);
-   GPU_link(mat, set_value, GPU_uniform(ma-amb), shi-amb);
+   GPU_link(mat, set_value, GPU_dynamic_uniform(ma-ref, 
GPU_DYNAMIC_MAT_REF, NULL

[Bf-blender-cvs] [a1a182c] blender-v2.73-release: Fix T40257: Frustum culling not working properly

2015-01-20 Thread Mitchell Stokes
Commit: a1a182c2684a7f050f6a85820e183c31ff117e82
Author: Mitchell Stokes
Date:   Wed Jan 7 20:41:07 2015 -0800
Branches: blender-v2.73-release
https://developer.blender.org/rBa1a182c2684a7f050f6a85820e183c31ff117e82

Fix T40257: Frustum culling not working properly

Instead of getting fancy this time, we'll just use Mahalin's simpler
fix. This may have slight performance impacts, but it is a lot simpler
than the previous fix and shouldn't cause as many bugs.

===

M   source/gameengine/Ketsji/KX_Scene.cpp

===

diff --git a/source/gameengine/Ketsji/KX_Scene.cpp 
b/source/gameengine/Ketsji/KX_Scene.cpp
index 6b49e44..040949d 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -1502,6 +1502,15 @@ void KX_Scene::CalculateVisibleMeshes(RAS_IRasterizer* 
rasty,KX_Camera* cam, int
bool dbvt_culling = false;
if (m_dbvt_culling) 
{
+   /* Reset KX_GameObject m_bCulled to true before doing culling
+* since DBVT culling will only set it to false.
+* This is similar to what RAS_BucketManager does for 
RAS_MeshSlot culling.
+*/
+   for (int i = 0; i  m_objectlist-GetCount(); i++) {
+   KX_GameObject *gameobj = 
static_castKX_GameObject*(m_objectlist-GetValue(i));
+   gameobj-SetCulled(true);
+   }
+
// test culling through Bullet
MT_Vector4 planes[6];
// get the clip planes

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [e5fbe74] blender-v2.73-release: Revert Fix T40257: Frustum culling not working properly

2015-01-20 Thread Mitchell Stokes
Commit: e5fbe7466ecf733d7d3f394eded8901e07c55acd
Author: Mitchell Stokes
Date:   Wed Jan 7 20:31:08 2015 -0800
Branches: blender-v2.73-release
https://developer.blender.org/rBe5fbe7466ecf733d7d3f394eded8901e07c55acd

Revert Fix T40257: Frustum culling not working properly

This reverts commit 315609ec0c1e28eb12bde3e8bbd2a5b03672b1a9.

This fix still causes more issues than it solves.

===

M   source/gameengine/Ketsji/KX_Dome.cpp
M   source/gameengine/Ketsji/KX_GameObject.cpp
M   source/gameengine/Ketsji/KX_GameObject.h
M   source/gameengine/Ketsji/KX_KetsjiEngine.cpp
M   source/gameengine/Ketsji/KX_KetsjiEngine.h
M   source/gameengine/Ketsji/KX_Scene.cpp
M   source/gameengine/Ketsji/KX_Scene.h
M   source/gameengine/VideoTexture/ImageRender.cpp

===

diff --git a/source/gameengine/Ketsji/KX_Dome.cpp 
b/source/gameengine/Ketsji/KX_Dome.cpp
index a77269c..f58fee8 100644
--- a/source/gameengine/Ketsji/KX_Dome.cpp
+++ b/source/gameengine/Ketsji/KX_Dome.cpp
@@ -2044,7 +2044,6 @@ void KX_Dome::RenderDomeFrame(KX_Scene* scene, KX_Camera* 
cam, int i)
cam-NodeUpdateGS(0.f);
 
scene-CalculateVisibleMeshes(m_rasterizer,cam);
-   scene-UpdateAnimations(m_engine-GetFrameTime());
scene-RenderBuckets(camtrans, m_rasterizer);
 }
 
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp 
b/source/gameengine/Ketsji/KX_GameObject.cpp
index b164980..4ac889b 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -930,27 +930,6 @@ KX_GameObject::SetVisible(
}
 }
 
-bool KX_GameObject::GetCulled()
-{
-   // If we're set to not cull, double-check with
-   // the mesh slots first. This is kind of nasty, but
-   // it allows us to get proper culling information.
-   if (!m_bCulled)
-   {
-   SG_QList::iteratorRAS_MeshSlot mit(m_meshSlots);
-   for (mit.begin(); !mit.end(); ++mit)
-   {
-   if ((*mit)-m_bCulled)
-   {
-   m_bCulled = true;
-   break;
-   }
-   }
-   }
-
-   return m_bCulled;
-}
-
 static void setOccluder_recursive(SG_Node* node, bool v)
 {
NodeList children = node-GetSGChildren();
diff --git a/source/gameengine/Ketsji/KX_GameObject.h 
b/source/gameengine/Ketsji/KX_GameObject.h
index d4fa485..cc84ab0 100644
--- a/source/gameengine/Ketsji/KX_GameObject.h
+++ b/source/gameengine/Ketsji/KX_GameObject.h
@@ -852,10 +852,10 @@ public:
/**
 * Was this object culled?
 */
-   bool
+   inline bool
GetCulled(
void
-   );
+   ) { return m_bCulled; }
 
/**
 * Set culled flag of this object
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp 
b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
index f76580c..f1d0e42 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
@@ -140,6 +140,7 @@ KX_KetsjiEngine::KX_KetsjiEngine(KX_ISystem* system)
m_frameTime(0.f),
m_clockTime(0.f),
m_previousClockTime(0.f),
+   m_previousAnimTime(0.f),
 
 
m_exitcode(KX_EXIT_REQUEST_NO_REQUEST),
@@ -686,6 +687,16 @@ bool KX_KetsjiEngine::NextFrame()
SG_SetActiveStage(SG_STAGE_ACTUATOR_UPDATE);
scene-UpdateParents(m_frameTime);
 
+   // update levels of detail
+   scene-UpdateObjectLods();
+
+   if (!GetRestrictAnimationFPS())
+   {
+   m_logger-StartLog(tc_animations, 
m_kxsystem-GetTimeInSeconds(), true);
+   
SG_SetActiveStage(SG_STAGE_ANIMATION_UPDATE);
+   scene-UpdateAnimations(m_frameTime);
+   }
+
m_logger-StartLog(tc_physics, 
m_kxsystem-GetTimeInSeconds(), true);
SG_SetActiveStage(SG_STAGE_PHYSICS2);
scene-GetPhysicsEnvironment()-BeginFrame();
@@ -787,6 +798,27 @@ bool KX_KetsjiEngine::NextFrame()
m_logger-StartLog(tc_services, 
m_kxsystem-GetTimeInSeconds(), true);
}
}
+
+   
+   // Handle the animations independently of the logic time step
+   if (GetRestrictAnimationFPS())
+   {
+   double clocktime = m_kxsystem-GetTimeInSeconds();
+   m_logger-StartLog(tc_animations, clocktime, true);
+   SG_SetActiveStage(SG_STAGE_ANIMATION_UPDATE);
+
+   double anim_timestep = 
1.0/KX_GetActiveScene()-GetAnimationFPS

[Bf-blender-cvs] [1999b5a] master: Fix ping-pong actions when using the Action Actuator.

2014-12-11 Thread Mitchell Stokes
Commit: 1999b5a8147129ac7b82a5e57420ab8e5d7734a2
Author: Mitchell Stokes
Date:   Wed Dec 10 21:20:19 2014 -0800
Branches: master
https://developer.blender.org/rB1999b5a8147129ac7b82a5e57420ab8e5d7734a2

Fix ping-pong actions when using the Action Actuator.

===

M   source/gameengine/Converter/BL_ActionActuator.cpp

===

diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp 
b/source/gameengine/Converter/BL_ActionActuator.cpp
index f1a7287..c756d86 100644
--- a/source/gameengine/Converter/BL_ActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ActionActuator.cpp
@@ -256,12 +256,14 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
if ((m_flag  ACT_FLAG_PLAY_END)  (m_flag  ACT_FLAG_ACTIVE)  
obj-IsActionDone(m_layer))
{
m_flag = ~ACT_FLAG_ACTIVE;
-   m_flag = ~ACT_FLAG_ATTEMPT_PLAY;
 
-   if (m_playtype == ACT_ACTION_PINGPONG)
+   if (m_playtype == ACT_ACTION_PINGPONG) {
m_flag ^= ACT_FLAG_REVERSE;
-   else
+   }
+   else {
+   m_flag = ~ACT_FLAG_ATTEMPT_PLAY;
return false;
+   }
}

// If a different action is playing, we've been overruled and are no 
longer active

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [5996ad2] master: Fixes for T41168

2014-12-02 Thread Mitchell Stokes
Commit: 5996ad2fd48536c9e38f7ca4329d3dd19364ee39
Author: Mitchell Stokes
Date:   Tue Dec 2 19:06:19 2014 -0800
Branches: master
https://developer.blender.org/rB5996ad2fd48536c9e38f7ca4329d3dd19364ee39

Fixes for T41168

after the completion of the action in Flipper, layer is removed and the 
actuator mistakenly receive zero when trying to get the current frame

Patch Author: avrprj

Reviewers: moguri

Projects: #game_logic

Differential Revision: https://developer.blender.org/D906

===

M   source/gameengine/Converter/BL_ActionActuator.cpp

===

diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp 
b/source/gameengine/Converter/BL_ActionActuator.cpp
index 3dd013d..f1a7287 100644
--- a/source/gameengine/Converter/BL_ActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ActionActuator.cpp
@@ -320,8 +320,9 @@ bool BL_ActionActuator::Update(double curtime, bool frame)

case ACT_ACTION_FLIPPER:
// Convert into a play action and play back to 
the beginning
+   float temp = end;
end = start;
-   start = obj-GetActionFrame(m_layer);
+   start = curr_action ? 
obj-GetActionFrame(m_layer) : temp;
obj-PlayAction(m_action-id.name+2, start, 
end, m_layer, m_priority, 0, BL_Action::ACT_MODE_PLAY, m_layer_weight, 
m_ipo_flags, 1.f, blendmode);
 
m_flag |= ACT_FLAG_PLAY_END;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [ed4075c] master: Fix T41259: Objects parented to non-armature objects cannot play shape actions in the BGE

2014-09-23 Thread Mitchell Stokes
Commit: ed4075cb3410f7e51ea766ab771eee690e3da71c
Author: Mitchell Stokes
Date:   Tue Sep 23 07:52:34 2014 -0700
Branches: master
https://developer.blender.org/rBed4075cb3410f7e51ea766ab771eee690e3da71c

Fix T41259: Objects parented to non-armature objects cannot play shape actions 
in the BGE

===

M   source/gameengine/Ketsji/KX_Scene.cpp

===

diff --git a/source/gameengine/Ketsji/KX_Scene.cpp 
b/source/gameengine/Ketsji/KX_Scene.cpp
index 625bbee..d0eab9d 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -1577,7 +1577,7 @@ void KX_Scene::AddAnimatedObject(CValue* gameobj)
 
 static void update_anim_thread_func(TaskPool *pool, void *taskdata, int 
UNUSED(threadid))
 {
-   KX_GameObject *gameobj, *child;
+   KX_GameObject *gameobj, *child, *parent;
CListValue *children;
bool needs_update;
double curtime = *(double*)BLI_task_pool_userdata(pool);
@@ -1621,8 +1621,11 @@ static void update_anim_thread_func(TaskPool *pool, void 
*taskdata, int UNUSED(t
if (needs_update) {
gameobj-UpdateActionManager(curtime);
children = gameobj-GetChildren();
+   parent = gameobj-GetParent();
 
-   if (!gameobj-GetParent()  gameobj-GetDeformer())
+   // Only do deformers here if they are not parented to an 
armature, otherwise the armature will
+   // handle updating its children
+   if (gameobj-GetDeformer()  (!parent || (parent  
parent-GetGameObjectType() != SCA_IObject::OBJ_ARMATURE)))
gameobj-GetDeformer()-Update();
 
for (int j=0; jchildren-GetCount(); ++j) {

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [7307973] master: BGE: Add property/material detection and X-Ray for mouse over any sensor

2014-07-18 Thread Mitchell Stokes
Commit: 73079730638f1f21c04b075839d87377315e8f86
Author: Mitchell Stokes
Date:   Thu Jul 17 23:00:30 2014 -0700
https://developer.blender.org/rB73079730638f1f21c04b075839d87377315e8f86

BGE: Add property/material detection and X-Ray for mouse over any sensor

This patch adds a Property/Material detection and a X-Ray mode to the mouse 
over any sensor like on the ray sensor.

Proposal:
http://blenderartists.org/forum/showthread.php?261847-BGE-proposal-Mouse-Over-Any-sensor-with-Property-and-X-Rayhighlight=proposal

Reviewers: moguri

Reviewed By: moguri

Differential Revision: https://developer.blender.org/D653

===

M   doc/python_api/rst/bge_types/bge.types.KX_MouseFocusSensor.rst
M   source/blender/editors/space_logic/logic_window.c
M   source/blender/makesdna/DNA_sensor_types.h
M   source/blender/makesrna/intern/rna_sensor.c
M   source/gameengine/Converter/KX_ConvertSensors.cpp
M   source/gameengine/Ketsji/KX_MouseFocusSensor.cpp
M   source/gameengine/Ketsji/KX_MouseFocusSensor.h

===

diff --git a/doc/python_api/rst/bge_types/bge.types.KX_MouseFocusSensor.rst 
b/doc/python_api/rst/bge_types/bge.types.KX_MouseFocusSensor.rst
index dda73ea..0600a4b 100644
--- a/doc/python_api/rst/bge_types/bge.types.KX_MouseFocusSensor.rst
+++ b/doc/python_api/rst/bge_types/bge.types.KX_MouseFocusSensor.rst
@@ -64,3 +64,20 @@ base class --- :class:`SCA_MouseSensor`
 
   :type: boolean
 
+   .. attribute:: useXRay
+
+  If enabled it allows the sensor to see through game objects that don't 
have the selected property or material.
+
+ :type: boolean
+
+   .. attribute:: propName
+
+  The property or material the sensor is looking for.
+
+ :type: string
+
+   .. attribute:: useMaterial
+
+  Determines if the sensor is looking for a property or material. KX_True 
= Find material; KX_False = Find property.
+
+ :type: boolean
diff --git a/source/blender/editors/space_logic/logic_window.c 
b/source/blender/editors/space_logic/logic_window.c
index 3254727..1a0aab7 100644
--- a/source/blender/editors/space_logic/logic_window.c
+++ b/source/blender/editors/space_logic/logic_window.c
@@ -1144,15 +1144,35 @@ static void draw_sensor_message(uiLayout *layout, 
PointerRNA *ptr)
uiItemR(layout, ptr, subject, 0, NULL, ICON_NONE);
 }
 
-static void draw_sensor_mouse(uiLayout *layout, PointerRNA *ptr)
+static void draw_sensor_mouse(uiLayout *layout, PointerRNA *ptr, bContext *C)
 {
-   uiLayout *split;
+   uiLayout *split, *split2;
+
+   Object *ob = (Object *)ptr-id.data;
+   PointerRNA main_ptr;
 
split = uiLayoutSplit(layout, 0.8f, false);
uiItemR(split, ptr, mouse_event, 0, NULL, ICON_NONE);
 
if (RNA_enum_get(ptr, mouse_event) == BL_SENS_MOUSE_MOUSEOVER_ANY)
+   {
uiItemR(split, ptr, use_pulse, UI_ITEM_R_TOGGLE, NULL, 
ICON_NONE);
+
+   split = uiLayoutSplit(layout, 0.3f, false);
+   uiItemR(split, ptr, use_material, 0, , ICON_NONE);
+
+   split2 = uiLayoutSplit(split, 0.7f, false);
+   if (RNA_enum_get(ptr, use_material) == SENS_RAY_PROPERTY)
+   {
+   uiItemR(split2, ptr, property, 0, , ICON_NONE);
+   }
+   else
+   {
+   RNA_main_pointer_create(CTX_data_main(C), main_ptr);
+   uiItemPointerR(split2, ptr, material, main_ptr, 
materials, , ICON_MATERIAL_DATA);
+   }
+   uiItemR(split2, ptr, use_x_ray, UI_ITEM_R_TOGGLE, NULL, 
ICON_NONE);
+   }
 }
 
 static void draw_sensor_near(uiLayout *layout, PointerRNA *ptr)
@@ -1273,7 +1293,7 @@ static void draw_brick_sensor(uiLayout *layout, 
PointerRNA *ptr, bContext *C)
draw_sensor_message(box, ptr);
break;
case SENS_MOUSE:
-   draw_sensor_mouse(box, ptr);
+   draw_sensor_mouse(box, ptr, C);
break;
case SENS_NEAR:
draw_sensor_near(box, ptr);
diff --git a/source/blender/makesdna/DNA_sensor_types.h 
b/source/blender/makesdna/DNA_sensor_types.h
index cd1977c..8d59a13 100644
--- a/source/blender/makesdna/DNA_sensor_types.h
+++ b/source/blender/makesdna/DNA_sensor_types.h
@@ -57,7 +57,9 @@ typedef struct bMouseSensor {
short type;
short flag;
short pad1;
-   short pad2;
+   short mode; /* flag to choose material or property 
*/
+   char propname[64];
+   char matname[64];
 } bMouseSensor;
 
 /* DEPRECATED */
diff --git a/source/blender/makesrna/intern/rna_sensor.c 
b/source/blender/makesrna/intern/rna_sensor.c
index aeef04f..3944b59 100644
--- a/source/blender/makesrna/intern/rna_sensor.c
+++ b/source/blender/makesrna/intern/rna_sensor.c

[Bf-blender-cvs] [dfe1b9b] master: Fix T40146: BGE Compound parent crash

2014-07-15 Thread Mitchell Stokes
Commit: dfe1b9b7a727d5d4cf998a89153aad9f3f6fde55
Author: Mitchell Stokes
Date:   Tue Jul 15 17:52:01 2014 -0700
https://developer.blender.org/rBdfe1b9b7a727d5d4cf998a89153aad9f3f6fde55

Fix T40146: BGE Compound parent crash

===

M   source/gameengine/Ketsji/KX_KetsjiEngine.h
M   source/gameengine/Physics/Bullet/CMakeLists.txt
M   source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
M   source/gameengine/Physics/Bullet/SConscript

===

diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.h 
b/source/gameengine/Ketsji/KX_KetsjiEngine.h
index 45d594e..2bc5bad 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.h
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.h
@@ -223,6 +223,7 @@ public:
PyObject*   GetPyProfileDict();
 #endif
voidSetSceneConverter(KX_ISceneConverter* 
sceneconverter);
+   KX_ISceneConverter* GetSceneConverter() { return m_sceneconverter; }
voidSetAnimRecordMode(bool animation_record, int 
startFrame);
 
RAS_IRasterizer*GetRasterizer() { return m_rasterizer; }
diff --git a/source/gameengine/Physics/Bullet/CMakeLists.txt 
b/source/gameengine/Physics/Bullet/CMakeLists.txt
index 87d8510..fbaa7bb 100644
--- a/source/gameengine/Physics/Bullet/CMakeLists.txt
+++ b/source/gameengine/Physics/Bullet/CMakeLists.txt
@@ -29,6 +29,7 @@ remove_strict_flags()
 set(INC
.
../common
+   ../../Converter
../../Expressions
../../GameLogic
../../Ketsji
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp 
b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
index f34311d..3e0b99e 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
@@ -42,6 +42,7 @@ subject to the following restrictions:
 #include PHY_Pro.h
 #include KX_GameObject.h
 #include KX_PythonInit.h // for KX_RasterizerDrawDebugLine
+#include KX_BlenderSceneConverter.h
 #include RAS_MeshObject.h
 #include RAS_Polygon.h
 #include RAS_TexVert.h
@@ -3044,9 +3045,17 @@ void CcdPhysicsEnvironment::ConvertObject(KX_GameObject 
*gameobj, RAS_MeshObject
CcdConstructionInfo ci;
class CcdShapeConstructionInfo *shapeInfo = new 
CcdShapeConstructionInfo();
 
-   KX_GameObject *parent = gameobj-GetParent();
-   if (parent)
+   // get Root Parent of blenderobject
+   Object *blenderparent = blenderobject-parent;
+   while (blenderparent  blenderparent-parent) {
+   blenderparent = blenderparent-parent;
+   }
+
+   KX_GameObject *parent = NULL;
+   if (blenderparent)
{
+   KX_BlenderSceneConverter *converter = 
(KX_BlenderSceneConverter*)KX_GetActiveEngine()-GetSceneConverter();
+   parent = converter-FindGameObject(blenderparent);
isbulletdyna = false;
isbulletsoftbody = false;
shapeprops-m_mass = 0.f;
diff --git a/source/gameengine/Physics/Bullet/SConscript 
b/source/gameengine/Physics/Bullet/SConscript
index 2700997..2a8249b 100644
--- a/source/gameengine/Physics/Bullet/SConscript
+++ b/source/gameengine/Physics/Bullet/SConscript
@@ -39,6 +39,7 @@ incs = [
 '#source/blender/blenkernel',
 '#source/blender/blenlib',
 '#source/blender/makesdna',
+'#source/gameengine/Converter',
 '#source/gameengine/Expressions',
 '#source/gameengine/GameLogic',
 '#source/gameengine/Ketsji',

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [dbc79e7] master: Fix T41074: Several Mouse Look actuators not working well together when reset button are set in one or several of them

2014-07-14 Thread Mitchell Stokes
Commit: dbc79e7aba4881cd3e61ad60433ef834965b6799
Author: Mitchell Stokes
Date:   Mon Jul 14 18:36:27 2014 -0700
https://developer.blender.org/rBdbc79e7aba4881cd3e61ad60433ef834965b6799

Fix T41074: Several Mouse Look actuators not working well together when reset 
button are set in one or several of them

Fix provided by lordloki (Jorge Bernal)

===

M   source/gameengine/Ketsji/KX_MouseActuator.cpp

===

diff --git a/source/gameengine/Ketsji/KX_MouseActuator.cpp 
b/source/gameengine/Ketsji/KX_MouseActuator.cpp
index 3d74bd7..aae5d18 100644
--- a/source/gameengine/Ketsji/KX_MouseActuator.cpp
+++ b/source/gameengine/Ketsji/KX_MouseActuator.cpp
@@ -208,6 +208,9 @@ bool KX_MouseActuator::Update()
parent-ApplyRotation(rotation, 
m_local_x);
}
}
+   else {
+   setposition[0] = 0.5;
+   }
 
//Calculating Y axis.
if (m_use_axis_y) {
@@ -266,6 +269,9 @@ bool KX_MouseActuator::Update()
parent-ApplyRotation(rotation, 
m_local_y);
}
}
+   else {
+   setposition[1] = 0.5;
+   }
 
setMousePosition(setposition[0], 
setposition[1]);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [59bbe1a] soc-2013-paint: Revert Fix T40257: Frustum culling not working properly

2014-07-12 Thread Mitchell Stokes
Commit: 59bbe1aa61fcb590b1b046a10eea675cc1947615
Author: Mitchell Stokes
Date:   Wed Jul 9 22:34:45 2014 -0700
https://developer.blender.org/rB59bbe1aa61fcb590b1b046a10eea675cc1947615

Revert Fix T40257: Frustum culling not working properly

This reverts commit 978dba4616852e0b94374f2ae56934049d9b3669. The change
still doesn't provide accurate culling information, and actually breaks
animation culling.

===

M   source/gameengine/Ketsji/KX_GameObject.cpp
M   source/gameengine/Ketsji/KX_GameObject.h

===

diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp 
b/source/gameengine/Ketsji/KX_GameObject.cpp
index f61d08e..de528ae 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -928,27 +928,6 @@ KX_GameObject::SetVisible(
}
 }
 
-bool KX_GameObject::GetCulled()
-{
-   // If we're set to not cull, double-check with
-   // the mesh slots first. This is kind of nasty, but
-   // it allows us to get proper culling information.
-   if (!m_bCulled)
-   {
-   SG_QList::iteratorRAS_MeshSlot mit(m_meshSlots);
-   for (mit.begin(); !mit.end(); ++mit)
-   {
-   if ((*mit)-m_bCulled)
-   {
-   m_bCulled = true;
-   break;
-   }
-   }
-   }
-
-   return m_bCulled;
-}
-
 static void setOccluder_recursive(SG_Node* node, bool v)
 {
NodeList children = node-GetSGChildren();
diff --git a/source/gameengine/Ketsji/KX_GameObject.h 
b/source/gameengine/Ketsji/KX_GameObject.h
index f7f40ac..7450be4 100644
--- a/source/gameengine/Ketsji/KX_GameObject.h
+++ b/source/gameengine/Ketsji/KX_GameObject.h
@@ -852,10 +852,10 @@ public:
/**
 * Was this object culled?
 */
-   bool
+   inline bool
GetCulled(
void
-   );
+   ) { return m_bCulled; }
 
/**
 * Set culled flag of this object

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [67fdb2c] soc-2013-paint: Fix T40909: BGE softbodies broken.

2014-07-12 Thread Mitchell Stokes
Commit: 67fdb2c0a63f441ba60e6474a4eaab0b3a9f3f15
Author: Mitchell Stokes
Date:   Wed Jul 9 21:32:33 2014 -0700
https://developer.blender.org/rB67fdb2c0a63f441ba60e6474a4eaab0b3a9f3f15

Fix T40909: BGE softbodies broken.

Looks like softbody settings got lost in a recent cleanup.

===

M   source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp

===

diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp 
b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
index 8a8a8d3..69e190c 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
@@ -3079,10 +3079,81 @@ void CcdPhysicsEnvironment::ConvertObject(KX_GameObject 
*gameobj, RAS_MeshObject
if (blenderobject-bsoft)
{
ci.m_margin = blenderobject-bsoft-margin;
+   ci.m_gamesoftFlag = blenderobject-bsoft-flag;
+
+   ci.m_soft_linStiff = blenderobject-bsoft-linStiff;
+   ci.m_soft_angStiff = blenderobject-bsoft-angStiff;
/* angular stiffness 0..1 */
+   ci.m_soft_volume = blenderobject-bsoft-volume;
/* volume preservation 0..1 */
+
+   ci.m_soft_viterations = 
blenderobject-bsoft-viterations;  /* Velocities solver iterations 
*/
+   ci.m_soft_piterations = 
blenderobject-bsoft-piterations;  /* Positions solver iterations 
*/
+   ci.m_soft_diterations = 
blenderobject-bsoft-diterations;  /* Drift solver iterations */
+   ci.m_soft_citerations = 
blenderobject-bsoft-citerations;  /* Cluster solver iterations */
+
+   ci.m_soft_kSRHR_CL = blenderobject-bsoft-kSRHR_CL;
/* Soft vs rigid hardness [0,1] (cluster only) */
+   ci.m_soft_kSKHR_CL = blenderobject-bsoft-kSKHR_CL;
/* Soft vs kinetic hardness [0,1] (cluster only) */
+   ci.m_soft_kSSHR_CL = blenderobject-bsoft-kSSHR_CL;
/* Soft vs soft hardness [0,1] (cluster only) */
+   ci.m_soft_kSR_SPLT_CL = 
blenderobject-bsoft-kSR_SPLT_CL;  /* Soft vs rigid impulse split [0,1] 
(cluster only) */
+
+   ci.m_soft_kSK_SPLT_CL = 
blenderobject-bsoft-kSK_SPLT_CL;  /* Soft vs rigid impulse split [0,1] 
(cluster only) */
+   ci.m_soft_kSS_SPLT_CL = 
blenderobject-bsoft-kSS_SPLT_CL;  /* Soft vs rigid impulse split [0,1] 
(cluster only) */
+   ci.m_soft_kVCF = blenderobject-bsoft-kVCF;
/* Velocities correction factor (Baumgarte) */
+   ci.m_soft_kDP = blenderobject-bsoft-kDP;  
/* Damping coefficient [0,1] */
+
+   ci.m_soft_kDG = blenderobject-bsoft-kDG;  
/* Drag coefficient [0,+inf] */
+   ci.m_soft_kLF = blenderobject-bsoft-kLF;  
/* Lift coefficient [0,+inf] */
+   ci.m_soft_kPR = blenderobject-bsoft-kPR;  
/* Pressure coefficient [-inf,+inf] */
+   ci.m_soft_kVC = blenderobject-bsoft-kVC;  
/* Volume conversation coefficient [0,+inf] */
+
+   ci.m_soft_kDF = blenderobject-bsoft-kDF;  
/* Dynamic friction coefficient [0,1] */
+   ci.m_soft_kMT = blenderobject-bsoft-kMT;  
/* Pose matching coefficient [0,1] */
+   ci.m_soft_kCHR = blenderobject-bsoft-kCHR;
/* Rigid contacts hardness [0,1] */
+   ci.m_soft_kKHR = blenderobject-bsoft-kKHR;
/* Kinetic contacts hardness [0,1] */
+
+   ci.m_soft_kSHR = blenderobject-bsoft-kSHR;
/* Soft contacts hardness [0,1] */
+   ci.m_soft_kAHR = blenderobject-bsoft-kAHR;
/* Anchors hardness [0,1] */
+   ci.m_soft_collisionflags = 
blenderobject-bsoft-collisionflags;/* Vertex/Face or Signed Distance 
Field(SDF) or Clusters, Soft versus Soft or Rigid */
+   ci.m_soft_numclusteriterations = 
blenderobject-bsoft-numclusteriterations;/* number of iterations to 
refine collision clusters*/
+
}
else
{
ci.m_margin = 0.f;
+   ci.m_gamesoftFlag = OB_BSB_BENDING_CONSTRAINTS | 
OB_BSB_SHAPE_MATCHING | OB_BSB_AERO_VPOINT;
+
+   ci.m_soft_linStiff = 0.5;
+   ci.m_soft_angStiff = 1.f;   /* angular stiffness 
0..1 */
+   ci.m_soft_volume

[Bf-blender-cvs] [315609e] master: Fix T40257: Frustum culling not working properly

2014-07-10 Thread Mitchell Stokes
Commit: 315609ec0c1e28eb12bde3e8bbd2a5b03672b1a9
Author: Mitchell Stokes
Date:   Thu Jul 10 22:11:25 2014 -0700
https://developer.blender.org/rB315609ec0c1e28eb12bde3e8bbd2a5b03672b1a9

Fix T40257: Frustum culling not working properly

This is mostly the same fix as before, but now code depending on culling
checks is executed after KX_Scene-CalculateVisibleMeshes(). As a
side-effect, LoD checks and animation culling now use the current
frame's culling information rather than the previous frame's.

===

M   source/gameengine/Ketsji/KX_Dome.cpp
M   source/gameengine/Ketsji/KX_GameObject.cpp
M   source/gameengine/Ketsji/KX_GameObject.h
M   source/gameengine/Ketsji/KX_KetsjiEngine.cpp
M   source/gameengine/Ketsji/KX_KetsjiEngine.h
M   source/gameengine/Ketsji/KX_Scene.cpp
M   source/gameengine/Ketsji/KX_Scene.h
M   source/gameengine/VideoTexture/ImageRender.cpp

===

diff --git a/source/gameengine/Ketsji/KX_Dome.cpp 
b/source/gameengine/Ketsji/KX_Dome.cpp
index 657eaef..c7f7f58 100644
--- a/source/gameengine/Ketsji/KX_Dome.cpp
+++ b/source/gameengine/Ketsji/KX_Dome.cpp
@@ -2044,6 +2044,7 @@ void KX_Dome::RenderDomeFrame(KX_Scene* scene, KX_Camera* 
cam, int i)
cam-NodeUpdateGS(0.f);
 
scene-CalculateVisibleMeshes(m_rasterizer,cam);
+   scene-UpdateAnimations(m_engine-GetFrameTime());
scene-RenderBuckets(camtrans, m_rasterizer);
 }
 
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp 
b/source/gameengine/Ketsji/KX_GameObject.cpp
index de528ae..f61d08e 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -928,6 +928,27 @@ KX_GameObject::SetVisible(
}
 }
 
+bool KX_GameObject::GetCulled()
+{
+   // If we're set to not cull, double-check with
+   // the mesh slots first. This is kind of nasty, but
+   // it allows us to get proper culling information.
+   if (!m_bCulled)
+   {
+   SG_QList::iteratorRAS_MeshSlot mit(m_meshSlots);
+   for (mit.begin(); !mit.end(); ++mit)
+   {
+   if ((*mit)-m_bCulled)
+   {
+   m_bCulled = true;
+   break;
+   }
+   }
+   }
+
+   return m_bCulled;
+}
+
 static void setOccluder_recursive(SG_Node* node, bool v)
 {
NodeList children = node-GetSGChildren();
diff --git a/source/gameengine/Ketsji/KX_GameObject.h 
b/source/gameengine/Ketsji/KX_GameObject.h
index 7450be4..f7f40ac 100644
--- a/source/gameengine/Ketsji/KX_GameObject.h
+++ b/source/gameengine/Ketsji/KX_GameObject.h
@@ -852,10 +852,10 @@ public:
/**
 * Was this object culled?
 */
-   inline bool
+   bool
GetCulled(
void
-   ) { return m_bCulled; }
+   );
 
/**
 * Set culled flag of this object
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp 
b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
index 7d7e15a..dde9e0c 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
@@ -140,7 +140,6 @@ KX_KetsjiEngine::KX_KetsjiEngine(KX_ISystem* system)
m_frameTime(0.f),
m_clockTime(0.f),
m_previousClockTime(0.f),
-   m_previousAnimTime(0.f),
 
 
m_exitcode(KX_EXIT_REQUEST_NO_REQUEST),
@@ -686,16 +685,6 @@ bool KX_KetsjiEngine::NextFrame()
SG_SetActiveStage(SG_STAGE_ACTUATOR_UPDATE);
scene-UpdateParents(m_frameTime);
 
-   // update levels of detail
-   scene-UpdateObjectLods();
-
-   if (!GetRestrictAnimationFPS())
-   {
-   m_logger-StartLog(tc_animations, 
m_kxsystem-GetTimeInSeconds(), true);
-   
SG_SetActiveStage(SG_STAGE_ANIMATION_UPDATE);
-   scene-UpdateAnimations(m_frameTime);
-   }
-
m_logger-StartLog(tc_physics, 
m_kxsystem-GetTimeInSeconds(), true);
SG_SetActiveStage(SG_STAGE_PHYSICS2);
scene-GetPhysicsEnvironment()-BeginFrame();
@@ -797,27 +786,6 @@ bool KX_KetsjiEngine::NextFrame()
m_logger-StartLog(tc_services, 
m_kxsystem-GetTimeInSeconds(), true);
}
}
-
-   
-   // Handle the animations independently of the logic time step
-   if (GetRestrictAnimationFPS())
-   {
-   double clocktime = m_kxsystem-GetTimeInSeconds();
-   m_logger-StartLog(tc_animations, clocktime, true);
-   SG_SetActiveStage

[Bf-blender-cvs] [3a9e588] master: Fix T40909: BGE softbodies broken.

2014-07-09 Thread Mitchell Stokes
Commit: 3a9e588d1a4e5ec4a9d2acd2d9f244c24a38c64f
Author: Mitchell Stokes
Date:   Wed Jul 9 21:32:33 2014 -0700
https://developer.blender.org/rB3a9e588d1a4e5ec4a9d2acd2d9f244c24a38c64f

Fix T40909: BGE softbodies broken.

Looks like softbody settings got lost in a recent cleanup.

===

M   source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp

===

diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp 
b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
index 8a8a8d3..69e190c 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
@@ -3079,10 +3079,81 @@ void CcdPhysicsEnvironment::ConvertObject(KX_GameObject 
*gameobj, RAS_MeshObject
if (blenderobject-bsoft)
{
ci.m_margin = blenderobject-bsoft-margin;
+   ci.m_gamesoftFlag = blenderobject-bsoft-flag;
+
+   ci.m_soft_linStiff = blenderobject-bsoft-linStiff;
+   ci.m_soft_angStiff = blenderobject-bsoft-angStiff;
/* angular stiffness 0..1 */
+   ci.m_soft_volume = blenderobject-bsoft-volume;
/* volume preservation 0..1 */
+
+   ci.m_soft_viterations = 
blenderobject-bsoft-viterations;  /* Velocities solver iterations 
*/
+   ci.m_soft_piterations = 
blenderobject-bsoft-piterations;  /* Positions solver iterations 
*/
+   ci.m_soft_diterations = 
blenderobject-bsoft-diterations;  /* Drift solver iterations */
+   ci.m_soft_citerations = 
blenderobject-bsoft-citerations;  /* Cluster solver iterations */
+
+   ci.m_soft_kSRHR_CL = blenderobject-bsoft-kSRHR_CL;
/* Soft vs rigid hardness [0,1] (cluster only) */
+   ci.m_soft_kSKHR_CL = blenderobject-bsoft-kSKHR_CL;
/* Soft vs kinetic hardness [0,1] (cluster only) */
+   ci.m_soft_kSSHR_CL = blenderobject-bsoft-kSSHR_CL;
/* Soft vs soft hardness [0,1] (cluster only) */
+   ci.m_soft_kSR_SPLT_CL = 
blenderobject-bsoft-kSR_SPLT_CL;  /* Soft vs rigid impulse split [0,1] 
(cluster only) */
+
+   ci.m_soft_kSK_SPLT_CL = 
blenderobject-bsoft-kSK_SPLT_CL;  /* Soft vs rigid impulse split [0,1] 
(cluster only) */
+   ci.m_soft_kSS_SPLT_CL = 
blenderobject-bsoft-kSS_SPLT_CL;  /* Soft vs rigid impulse split [0,1] 
(cluster only) */
+   ci.m_soft_kVCF = blenderobject-bsoft-kVCF;
/* Velocities correction factor (Baumgarte) */
+   ci.m_soft_kDP = blenderobject-bsoft-kDP;  
/* Damping coefficient [0,1] */
+
+   ci.m_soft_kDG = blenderobject-bsoft-kDG;  
/* Drag coefficient [0,+inf] */
+   ci.m_soft_kLF = blenderobject-bsoft-kLF;  
/* Lift coefficient [0,+inf] */
+   ci.m_soft_kPR = blenderobject-bsoft-kPR;  
/* Pressure coefficient [-inf,+inf] */
+   ci.m_soft_kVC = blenderobject-bsoft-kVC;  
/* Volume conversation coefficient [0,+inf] */
+
+   ci.m_soft_kDF = blenderobject-bsoft-kDF;  
/* Dynamic friction coefficient [0,1] */
+   ci.m_soft_kMT = blenderobject-bsoft-kMT;  
/* Pose matching coefficient [0,1] */
+   ci.m_soft_kCHR = blenderobject-bsoft-kCHR;
/* Rigid contacts hardness [0,1] */
+   ci.m_soft_kKHR = blenderobject-bsoft-kKHR;
/* Kinetic contacts hardness [0,1] */
+
+   ci.m_soft_kSHR = blenderobject-bsoft-kSHR;
/* Soft contacts hardness [0,1] */
+   ci.m_soft_kAHR = blenderobject-bsoft-kAHR;
/* Anchors hardness [0,1] */
+   ci.m_soft_collisionflags = 
blenderobject-bsoft-collisionflags;/* Vertex/Face or Signed Distance 
Field(SDF) or Clusters, Soft versus Soft or Rigid */
+   ci.m_soft_numclusteriterations = 
blenderobject-bsoft-numclusteriterations;/* number of iterations to 
refine collision clusters*/
+
}
else
{
ci.m_margin = 0.f;
+   ci.m_gamesoftFlag = OB_BSB_BENDING_CONSTRAINTS | 
OB_BSB_SHAPE_MATCHING | OB_BSB_AERO_VPOINT;
+
+   ci.m_soft_linStiff = 0.5;
+   ci.m_soft_angStiff = 1.f;   /* angular stiffness 
0..1 */
+   ci.m_soft_volume

[Bf-blender-cvs] [a1aa969] master: Revert Fix T40257: Frustum culling not working properly

2014-07-09 Thread Mitchell Stokes
Commit: a1aa96940c74f51a8661a497286c8e9b7ecc460f
Author: Mitchell Stokes
Date:   Wed Jul 9 22:34:45 2014 -0700
https://developer.blender.org/rBa1aa96940c74f51a8661a497286c8e9b7ecc460f

Revert Fix T40257: Frustum culling not working properly

This reverts commit 978dba4616852e0b94374f2ae56934049d9b3669. The change
still doesn't provide accurate culling information, and actually breaks
animation culling.

===

M   source/gameengine/Ketsji/KX_GameObject.cpp
M   source/gameengine/Ketsji/KX_GameObject.h

===

diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp 
b/source/gameengine/Ketsji/KX_GameObject.cpp
index f61d08e..de528ae 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -928,27 +928,6 @@ KX_GameObject::SetVisible(
}
 }
 
-bool KX_GameObject::GetCulled()
-{
-   // If we're set to not cull, double-check with
-   // the mesh slots first. This is kind of nasty, but
-   // it allows us to get proper culling information.
-   if (!m_bCulled)
-   {
-   SG_QList::iteratorRAS_MeshSlot mit(m_meshSlots);
-   for (mit.begin(); !mit.end(); ++mit)
-   {
-   if ((*mit)-m_bCulled)
-   {
-   m_bCulled = true;
-   break;
-   }
-   }
-   }
-
-   return m_bCulled;
-}
-
 static void setOccluder_recursive(SG_Node* node, bool v)
 {
NodeList children = node-GetSGChildren();
diff --git a/source/gameengine/Ketsji/KX_GameObject.h 
b/source/gameengine/Ketsji/KX_GameObject.h
index f7f40ac..7450be4 100644
--- a/source/gameengine/Ketsji/KX_GameObject.h
+++ b/source/gameengine/Ketsji/KX_GameObject.h
@@ -852,10 +852,10 @@ public:
/**
 * Was this object culled?
 */
-   bool
+   inline bool
GetCulled(
void
-   );
+   ) { return m_bCulled; }
 
/**
 * Set culled flag of this object

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [49aff41] master: Fix T40912: Collision Callbacks Don't Work if Set Directly

2014-07-02 Thread Mitchell Stokes
Commit: 49aff416f8db98d858cb4c822ad4425377fc7acd
Author: Mitchell Stokes
Date:   Wed Jul 2 20:15:36 2014 -0700
https://developer.blender.org/rB49aff416f8db98d858cb4c822ad4425377fc7acd

Fix T40912: Collision Callbacks Don't Work if Set Directly

===

M   source/gameengine/Ketsji/KX_GameObject.cpp

===

diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp 
b/source/gameengine/Ketsji/KX_GameObject.cpp
index 7b78134..44646f1 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -2188,9 +2188,15 @@ int KX_GameObject::pyattr_set_collisionCallbacks(void 
*self_v, const KX_PYATTRIB
return PY_SET_ATTR_FAIL;
}
 
-   Py_XDECREF(self-m_collisionCallbacks);
+   if (self-m_collisionCallbacks == NULL) {
+   self-RegisterCollisionCallbacks();
+   } else {
+   Py_DECREF(self-m_collisionCallbacks);
+   }
+
Py_INCREF(value);
 
+
self-m_collisionCallbacks = value;
 
return PY_SET_ATTR_SUCCESS;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [4af848e] master: Fix T40923: An error from a python controller on a LibFreed object causes a crash

2014-07-02 Thread Mitchell Stokes
Commit: 4af848e557fa8789ac0cc802d6479bd53145e1fd
Author: Mitchell Stokes
Date:   Wed Jul 2 21:55:29 2014 -0700
https://developer.blender.org/rB4af848e557fa8789ac0cc802d6479bd53145e1fd

Fix T40923: An error from a python controller on a LibFreed object causes a 
crash

===

M   source/gameengine/GameLogic/SCA_PythonController.cpp
M   source/gameengine/Ketsji/KX_Scene.cpp

===

diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp 
b/source/gameengine/GameLogic/SCA_PythonController.cpp
index 3a9e8ff..dbcbbea 100644
--- a/source/gameengine/GameLogic/SCA_PythonController.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonController.cpp
@@ -263,7 +263,11 @@ PyAttributeDef SCA_PythonController::Attributes[] = {
 
 void SCA_PythonController::ErrorPrint(const char *error_msg)
 {
-   printf(%s - object '%s', controller '%s':\n, error_msg, 
GetParent()-GetName().Ptr(), GetName().Ptr());
+   // If GetParent() is NULL, then most likely the object this controller
+   // was attached to is gone (e.g., removed by LibFree()).
+   const char *obj_name = (GetParent()) ? GetParent()-GetName().ReadPtr() 
: Unavailable;
+   const char *ctr_name = (GetParent()) ? GetName().ReadPtr() : 
Unavailable;
+   printf(%s - object '%s', controller '%s':\n, error_msg, obj_name, 
ctr_name);
PyErr_Print();

/* Added in 2.48a, the last_traceback can reference Objects for 
example, increasing
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp 
b/source/gameengine/Ketsji/KX_Scene.cpp
index 0dfdb3d..3d71327 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -1038,6 +1038,7 @@ int KX_Scene::NewRemoveObject(class CValue* gameobj)
 !(itc==controllers.end());itc++)
{
m_logicmgr-RemoveController(*itc);
+   (*itc)-ReParent(NULL);
}
 
SCA_ActuatorList actuators = newobj-GetActuators();

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [04fdd35] master: Slight cleanup for 4af848e.

2014-07-02 Thread Mitchell Stokes
Commit: 04fdd35ba538dda8ec47b7267dee82320fda723f
Author: Mitchell Stokes
Date:   Wed Jul 2 22:55:39 2014 -0700
https://developer.blender.org/rB04fdd35ba538dda8ec47b7267dee82320fda723f

Slight cleanup for 4af848e.

===

M   source/gameengine/GameLogic/SCA_PythonController.cpp

===

diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp 
b/source/gameengine/GameLogic/SCA_PythonController.cpp
index dbcbbea..8c3ce38 100644
--- a/source/gameengine/GameLogic/SCA_PythonController.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonController.cpp
@@ -264,9 +264,16 @@ PyAttributeDef SCA_PythonController::Attributes[] = {
 void SCA_PythonController::ErrorPrint(const char *error_msg)
 {
// If GetParent() is NULL, then most likely the object this controller
-   // was attached to is gone (e.g., removed by LibFree()).
-   const char *obj_name = (GetParent()) ? GetParent()-GetName().ReadPtr() 
: Unavailable;
-   const char *ctr_name = (GetParent()) ? GetName().ReadPtr() : 
Unavailable;
+   // was attached to is gone (e.g., removed by LibFree()). Also, GetName()
+   // can be a bad pointer if GetParent() is NULL, so better be safe and
+   // flag it as unavailable as well
+   const char *obj_name, *ctr_name;
+   if (GetParent()) {
+   obj_name = GetParent()-GetName().ReadPtr();
+   ctr_name = GetName().ReadPtr();
+   } else {
+   obj_name = ctr_name = Unavailable;
+   }
printf(%s - object '%s', controller '%s':\n, error_msg, obj_name, 
ctr_name);
PyErr_Print();

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [978dba4] master: Fix T40257: Frustum culling not working properly

2014-07-01 Thread Mitchell Stokes
Commit: 978dba4616852e0b94374f2ae56934049d9b3669
Author: Mitchell Stokes
Date:   Tue Jul 1 12:39:17 2014 -0700
https://developer.blender.org/rB978dba4616852e0b94374f2ae56934049d9b3669

Fix T40257: Frustum culling not working properly

Adding a hack so that KX_GameObjects' culling status is updated based on
mesh slots.

===

M   source/gameengine/Ketsji/KX_GameObject.cpp
M   source/gameengine/Ketsji/KX_GameObject.h

===

diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp 
b/source/gameengine/Ketsji/KX_GameObject.cpp
index 9e8e58e..7b78134 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -928,6 +928,27 @@ KX_GameObject::SetVisible(
}
 }
 
+bool KX_GameObject::GetCulled()
+{
+   // If we're set to not cull, double-check with
+   // the mesh slots first. This is kind of nasty, but
+   // it allows us to get proper culling information.
+   if (!m_bCulled)
+   {
+   SG_QList::iteratorRAS_MeshSlot mit(m_meshSlots);
+   for (mit.begin(); !mit.end(); ++mit)
+   {
+   if ((*mit)-m_bCulled)
+   {
+   m_bCulled = true;
+   break;
+   }
+   }
+   }
+
+   return m_bCulled;
+}
+
 static void setOccluder_recursive(SG_Node* node, bool v)
 {
NodeList children = node-GetSGChildren();
diff --git a/source/gameengine/Ketsji/KX_GameObject.h 
b/source/gameengine/Ketsji/KX_GameObject.h
index 7450be4..f7f40ac 100644
--- a/source/gameengine/Ketsji/KX_GameObject.h
+++ b/source/gameengine/Ketsji/KX_GameObject.h
@@ -852,10 +852,10 @@ public:
/**
 * Was this object culled?
 */
-   inline bool
+   bool
GetCulled(
void
-   ) { return m_bCulled; }
+   );
 
/**
 * Set culled flag of this object

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [c92c3ef] master: Fix T40761: Bone constraints broken in the BGE

2014-06-30 Thread Mitchell Stokes
Commit: c92c3ef61132b7116b55a883cbcfd08f7225aaa0
Author: Mitchell Stokes
Date:   Mon Jun 30 20:59:15 2014 -0700
https://developer.blender.org/rBc92c3ef61132b7116b55a883cbcfd08f7225aaa0

Fix T40761: Bone constraints broken in the BGE

Extra bonus: calculating bone constraints now happens parallel!

===

M   source/gameengine/Converter/BL_ArmatureObject.cpp

===

diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp 
b/source/gameengine/Converter/BL_ArmatureObject.cpp
index 0392280..e11bc84 100644
--- a/source/gameengine/Converter/BL_ArmatureObject.cpp
+++ b/source/gameengine/Converter/BL_ArmatureObject.cpp
@@ -319,6 +319,10 @@ void 
BL_ArmatureObject::LoadConstraints(KX_BlenderSceneConverter* converter)
}
}
}
+
+   // If we have constraints, make sure we get treated as an animated 
object
+   if (m_constraintNumber  0)
+   GetActionManager();
 }
 
 BL_ArmatureConstraint* BL_ArmatureObject::GetConstraint(const char* 
posechannel, const char* constraintname)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [84e8cab] master: Fix T40697: Skinned meshes with shapekeys crashing in the BGE

2014-06-19 Thread Mitchell Stokes
Commit: 84e8cabac604a59b7abe4cce37df02d6ef12a0bf
Author: Mitchell Stokes
Date:   Thu Jun 19 18:20:56 2014 -0700
https://developer.blender.org/rB84e8cabac604a59b7abe4cce37df02d6ef12a0bf

Fix T40697: Skinned meshes with shapekeys crashing in the BGE

===

M   source/gameengine/Ketsji/KX_Scene.cpp

===

diff --git a/source/gameengine/Ketsji/KX_Scene.cpp 
b/source/gameengine/Ketsji/KX_Scene.cpp
index d06b9a0..0dfdb3d 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -1616,7 +1616,7 @@ static void update_anim_thread_func(TaskPool *pool, void 
*taskdata, int UNUSED(t
gameobj-UpdateActionManager(curtime);
children = gameobj-GetChildren();
 
-   if (gameobj-GetDeformer())
+   if (!gameobj-GetParent()  gameobj-GetDeformer())
gameobj-GetDeformer()-Update();
 
for (int j=0; jchildren-GetCount(); ++j) {

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [6c9dd17] master: Fix T39053: Replace mesh actuator does not replace material (only mesh)

2014-06-02 Thread Mitchell Stokes
Commit: 6c9dd174a8bc2cd9a857c96f3ddfdb398aa6f88c
Author: Mitchell Stokes
Date:   Mon Jun 2 18:52:13 2014 -0700
https://developer.blender.org/rB6c9dd174a8bc2cd9a857c96f3ddfdb398aa6f88c

Fix T39053: Replace mesh actuator does not replace material (only mesh)

The replace mesh actuator was reconverting the mesh data which causes
conflicts with the LoD code. Instead, we just look for an already
converted mesh, which should already be in the scene.

===

M   source/gameengine/Converter/KX_ConvertActuators.cpp

===

diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp 
b/source/gameengine/Converter/KX_ConvertActuators.cpp
index b59c26a..7d5527d 100644
--- a/source/gameengine/Converter/KX_ConvertActuators.cpp
+++ b/source/gameengine/Converter/KX_ConvertActuators.cpp
@@ -514,15 +514,7 @@ void BL_ConvertActuators(const char* maggiename,
break;
case ACT_EDOB_REPLACE_MESH:
{
-   RAS_MeshObject *tmpmesh = NULL;
-   if (editobact-me)
-   tmpmesh = 
BL_ConvertMesh(
-   
editobact-me,
-   
blenderobject,
-   scene,
-   converter,
-   false
-   );
+   RAS_MeshObject *tmpmesh = 
converter-FindGameMesh(editobact-me);
 
KX_SCA_ReplaceMeshActuator* 
tmpreplaceact = new KX_SCA_ReplaceMeshActuator(
gameobj,

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [f469185] master: Fix T40344: Levels of Detail not smooth with Armature Modifier

2014-05-27 Thread Mitchell Stokes
Commit: f469185f2540378cf0cec9af11e94015f83ecbe1
Author: Mitchell Stokes
Date:   Tue May 27 12:52:56 2014 -0700
https://developer.blender.org/rBf469185f2540378cf0cec9af11e94015f83ecbe1

Fix T40344: Levels of Detail not smooth with Armature Modifier

Due to skinning changes for multi-threaded animations, the LOD check was
being done after skinning. Now the LOD check is run before animations.
This means the culling information is a frame old, but this should be
fine.

===

M   source/gameengine/Ketsji/KX_Dome.cpp
M   source/gameengine/Ketsji/KX_KetsjiEngine.cpp

===

diff --git a/source/gameengine/Ketsji/KX_Dome.cpp 
b/source/gameengine/Ketsji/KX_Dome.cpp
index 71d7257..657eaef 100644
--- a/source/gameengine/Ketsji/KX_Dome.cpp
+++ b/source/gameengine/Ketsji/KX_Dome.cpp
@@ -2045,8 +2045,5 @@ void KX_Dome::RenderDomeFrame(KX_Scene* scene, KX_Camera* 
cam, int i)
 
scene-CalculateVisibleMeshes(m_rasterizer,cam);
scene-RenderBuckets(camtrans, m_rasterizer);
-
-   // update levels of detail
-   scene-UpdateObjectLods();
 }
 
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp 
b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
index 96a3845..dc81bae 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
@@ -686,6 +686,9 @@ bool KX_KetsjiEngine::NextFrame()
SG_SetActiveStage(SG_STAGE_ACTUATOR_UPDATE);
scene-UpdateParents(m_frameTime);
 
+   // update levels of detail
+   scene-UpdateObjectLods();
+
if (!GetRestrictAnimationFPS())
{
m_logger-StartLog(tc_animations, 
m_kxsystem-GetTimeInSeconds(), true);
@@ -1316,9 +1319,6 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, 
KX_Camera* cam)
 
scene-CalculateVisibleMeshes(m_rasterizer,cam);
 
-   // update levels of detail
-   scene-UpdateObjectLods();
-
m_logger-StartLog(tc_rasterizer, m_kxsystem-GetTimeInSeconds(), true);
SG_SetActiveStage(SG_STAGE_RENDER);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [5c5ca13] master: Fix T40362: Projected texture from spotlight doesn't scale with spotsize when changed in-game via Python

2014-05-27 Thread Mitchell Stokes
Commit: 5c5ca1355fd079fa5a4ee6540b1800170f2aaadd
Author: Mitchell Stokes
Date:   Tue May 27 13:48:03 2014 -0700
https://developer.blender.org/rB5c5ca1355fd079fa5a4ee6540b1800170f2aaadd

Fix T40362: Projected texture from spotlight doesn't scale with spotsize when 
changed in-game via Python

GPULamp::winmat needs to be updated after the spot size has changed.

===

M   source/blender/gpu/intern/gpu_material.c

===

diff --git a/source/blender/gpu/intern/gpu_material.c 
b/source/blender/gpu/intern/gpu_material.c
index 4b070a4..d7fa36a 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -1665,6 +1665,23 @@ void GPU_materials_free(void)
 
 /* Lamps and shadow buffers */
 
+static void gpu_lamp_calc_winmat(GPULamp *lamp)
+{
+   float temp, angle, pixsize, wsize;
+
+   if (lamp-type == LA_SUN) {
+   wsize = lamp-la-shadow_frustum_size;
+   orthographic_m4(lamp-winmat, -wsize, wsize, -wsize, wsize, 
lamp-d, lamp-clipend);
+   }
+   else {
+   angle= saacos(lamp-spotsi);
+   temp= 0.5f*lamp-size*cosf(angle)/sinf(angle);
+   pixsize= (lamp-d)/temp;
+   wsize= pixsize*0.5f*lamp-size;
+   perspective_m4(lamp-winmat, -wsize, wsize, -wsize, wsize, 
lamp-d, lamp-clipend);
+   }
+}
+
 void GPU_lamp_update(GPULamp *lamp, int lay, int hide, float obmat[4][4])
 {
float mat[4][4];
@@ -1702,12 +1719,12 @@ void GPU_lamp_update_spot(GPULamp *lamp, float 
spotsize, float spotblend)
 {
lamp-spotsi = cosf(spotsize * 0.5f);
lamp-spotbl = (1.0f - lamp-spotsi) * spotblend;
+
+   gpu_lamp_calc_winmat(lamp);
 }
 
 static void gpu_lamp_from_blender(Scene *scene, Object *ob, Object *par, Lamp 
*la, GPULamp *lamp)
 {
-   float temp, angle, pixsize, wsize;
-
lamp-scene = scene;
lamp-ob = ob;
lamp-par = par;
@@ -1750,17 +1767,7 @@ static void gpu_lamp_from_blender(Scene *scene, Object 
*ob, Object *par, Lamp *l
lamp-bias *= 0.25f;
 
/* makeshadowbuf */
-   if (lamp-type == LA_SUN) {
-   wsize = la-shadow_frustum_size;
-   orthographic_m4(lamp-winmat, -wsize, wsize, -wsize, wsize, 
lamp-d, lamp-clipend);
-   }
-   else {
-   angle= saacos(lamp-spotsi);
-   temp= 0.5f*lamp-size*cosf(angle)/sinf(angle);
-   pixsize= (lamp-d)/temp;
-   wsize= pixsize*0.5f*lamp-size;
-   perspective_m4(lamp-winmat, -wsize, wsize, -wsize, wsize, 
lamp-d, lamp-clipend);
-   }
+   gpu_lamp_calc_winmat(lamp);
 }
 
 static void gpu_lamp_shadow_free(GPULamp *lamp)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [8dafbed] master: BGE cleanup: Remove unused KX_TrackToActuator::m_tracktime member.

2014-05-27 Thread Mitchell Stokes
Commit: 8dafbed4b5f7fc733a55fb6fbc64e122abf4fc3a
Author: Mitchell Stokes
Date:   Tue May 27 14:12:53 2014 -0700
https://developer.blender.org/rB8dafbed4b5f7fc733a55fb6fbc64e122abf4fc3a

BGE cleanup: Remove unused KX_TrackToActuator::m_tracktime member.

===

M   source/gameengine/Ketsji/KX_Scene.cpp
M   source/gameengine/Ketsji/KX_TrackToActuator.h

===

diff --git a/source/gameengine/Ketsji/KX_Scene.cpp 
b/source/gameengine/Ketsji/KX_Scene.cpp
index 4d2a842..dd75809 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -1528,6 +1528,11 @@ void KX_Scene::CalculateVisibleMeshes(RAS_IRasterizer* 
rasty,KX_Camera* cam, int
MarkVisible(rasty, 
static_castKX_GameObject*(m_objectlist-GetValue(i)), cam, layer);
}
}
+
+   for (int i=0; i  m_objectlist-GetCount(); i++) {
+   KX_GameObject *go = 
static_castKX_GameObject*(m_objectlist-GetValue(i));
+   printf(Name: %s, Culled: %s\n, go-GetName().ReadPtr(), 
(go-GetCulled()) ? True : False);
+   }
 }
 
 // logic stuff
diff --git a/source/gameengine/Ketsji/KX_TrackToActuator.h 
b/source/gameengine/Ketsji/KX_TrackToActuator.h
index f5f5c4c..4df240a 100644
--- a/source/gameengine/Ketsji/KX_TrackToActuator.h
+++ b/source/gameengine/Ketsji/KX_TrackToActuator.h
@@ -47,7 +47,6 @@ class KX_TrackToActuator : public SCA_IActuator
bool m_allow3D;
// time field
int m_time;
-   int m_trackTime;
int m_trackflag;
int m_upflag;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [3b39080] master: BGE cleanup: Removing some potential memory leaks from KX_NavMeshObject when it fails to build a navmesh.

2014-05-27 Thread Mitchell Stokes
Commit: 3b3908020e5ed2af06f5e10d116bc82b0c014bf9
Author: Mitchell Stokes
Date:   Tue May 27 14:19:45 2014 -0700
https://developer.blender.org/rB3b3908020e5ed2af06f5e10d116bc82b0c014bf9

BGE cleanup: Removing some potential memory leaks from KX_NavMeshObject when it 
fails to build a navmesh.

===

M   source/gameengine/Ketsji/KX_NavMeshObject.cpp

===

diff --git a/source/gameengine/Ketsji/KX_NavMeshObject.cpp 
b/source/gameengine/Ketsji/KX_NavMeshObject.cpp
index 39ce1d8..998b856 100644
--- a/source/gameengine/Ketsji/KX_NavMeshObject.cpp
+++ b/source/gameengine/Ketsji/KX_NavMeshObject.cpp
@@ -304,6 +304,7 @@ bool KX_NavMeshObject::BuildNavMesh()
|| vertsPerPoly3)
{
printf(Can't build navigation mesh data for object:%s\n, 
m_name.ReadPtr());
+   if (vertices) delete[] vertices;
return false;
}

@@ -325,7 +326,10 @@ bool KX_NavMeshObject::BuildNavMesh()
float cs = 0.2f;
 
if (!nverts || !npolys)
+   {
+   if (vertices) delete[] vertices;
return false;
+   }
 
float bmin[3], bmax[3];
calcMeshBounds(vertices, nverts, bmin, bmax);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [04623e8] master: BGE: Accidentally committed some debug code in 8dafbe.

2014-05-27 Thread Mitchell Stokes
Commit: 04623e8b1fa804bdd9dd3a75a5238342ddf913b2
Author: Mitchell Stokes
Date:   Tue May 27 14:32:32 2014 -0700
https://developer.blender.org/rB04623e8b1fa804bdd9dd3a75a5238342ddf913b2

BGE: Accidentally committed some debug code in 8dafbe.

===

M   source/gameengine/Ketsji/KX_Scene.cpp

===

diff --git a/source/gameengine/Ketsji/KX_Scene.cpp 
b/source/gameengine/Ketsji/KX_Scene.cpp
index dd75809..4d2a842 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -1528,11 +1528,6 @@ void KX_Scene::CalculateVisibleMeshes(RAS_IRasterizer* 
rasty,KX_Camera* cam, int
MarkVisible(rasty, 
static_castKX_GameObject*(m_objectlist-GetValue(i)), cam, layer);
}
}
-
-   for (int i=0; i  m_objectlist-GetCount(); i++) {
-   KX_GameObject *go = 
static_castKX_GameObject*(m_objectlist-GetValue(i));
-   printf(Name: %s, Culled: %s\n, go-GetName().ReadPtr(), 
(go-GetCulled()) ? True : False);
-   }
 }
 
 // logic stuff

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [7317b4f] master: Fix 40343: Using replace mesh (e.g., LODs) on a skinned mesh crashes.

2014-05-27 Thread Mitchell Stokes
Commit: 7317b4fcf10edb367b48c32bd8d44ee1902148fe
Author: Mitchell Stokes
Date:   Tue May 27 17:05:35 2014 -0700
https://developer.blender.org/rB7317b4fcf10edb367b48c32bd8d44ee1902148fe

Fix 40343: Using replace mesh (e.g., LODs) on a skinned mesh crashes.

Need to use parent-AddRef() in a few places.

===

M   source/gameengine/Ketsji/KX_Scene.cpp

===

diff --git a/source/gameengine/Ketsji/KX_Scene.cpp 
b/source/gameengine/Ketsji/KX_Scene.cpp
index 4d2a842..d06b9a0 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -1185,7 +1185,7 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* 
meshobj, bool use_gfx, bool u
oldblendobj, blendobj,
mesh,
true,
-   
static_castBL_ArmatureObject*( parentobj )
+   
static_castBL_ArmatureObject*( parentobj-AddRef() )
);

modifierDeformer-LoadShapeDrivers(parentobj);
}
@@ -1212,7 +1212,7 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* 
meshobj, bool use_gfx, bool u
mesh,
true,
true,
-   
static_castBL_ArmatureObject*( parentobj )
+   
static_castBL_ArmatureObject*( parentobj-AddRef() )
);

shapeDeformer-LoadShapeDrivers(parentobj);
}
@@ -1237,7 +1237,7 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* 
meshobj, bool use_gfx, bool u
mesh,
true,
true,
-   static_castBL_ArmatureObject*( 
parentobj )
+   static_castBL_ArmatureObject*( 
parentobj-AddRef() )
);
newobj-SetDeformer(skinDeformer);
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [0865b4f] master: BGE LibNew: Only warn about meshes with users in debug builds.

2014-05-20 Thread Mitchell Stokes
Commit: 0865b4f48e911b1565334ea7df5c55d85708e938
Author: Mitchell Stokes
Date:   Tue May 20 15:04:25 2014 -0700
https://developer.blender.org/rB0865b4f48e911b1565334ea7df5c55d85708e938

BGE LibNew: Only warn about meshes with users in debug builds.

This information only really seems to be for helping developers track
down bugs, and isn't really something the user needs. So, lets not spam
their console.

===

M   source/gameengine/Converter/KX_BlenderSceneConverter.cpp

===

diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp 
b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
index 88fd10b..a20ebb3 100644
--- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
+++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
@@ -1522,7 +1522,9 @@ RAS_MeshObject 
*KX_BlenderSceneConverter::ConvertMeshSpecial(KX_Scene* kx_scene,

/* Watch this!, if its used in the original scene can cause big 
troubles */
if (me-us  0) {
+#ifdef DEBUG
printf(Mesh has a user \%s\\n, name);
+#endif
me = (ID*)BKE_mesh_copy_ex(from_maggie, (Mesh*)me);
me-us--;
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [3abb2e0] master: BGE cleanup: Removing the unused KX_Scene::UpdateMeshTransformations() function.

2014-05-19 Thread Mitchell Stokes
Commit: 3abb2e0a3de51544d66cb85d5e5f8aad6845aac1
Author: Mitchell Stokes
Date:   Mon May 19 21:13:33 2014 -0700
https://developer.blender.org/rB3abb2e0a3de51544d66cb85d5e5f8aad6845aac1

BGE cleanup: Removing the unused KX_Scene::UpdateMeshTransformations() function.

===

M   source/gameengine/Ketsji/KX_Scene.cpp
M   source/gameengine/Ketsji/KX_Scene.h

===

diff --git a/source/gameengine/Ketsji/KX_Scene.cpp 
b/source/gameengine/Ketsji/KX_Scene.cpp
index 7cab6a8..4d2a842 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -1348,17 +1348,6 @@ void KX_Scene::SetCameraOnTop(KX_Camera* cam)
}
 }
 
-
-void KX_Scene::UpdateMeshTransformations()
-{
-   // do this incrementally in the future
-   for (int i = 0; i  m_objectlist-GetCount(); i++)
-   {
-   KX_GameObject* gameobj = 
(KX_GameObject*)m_objectlist-GetValue(i);
-   gameobj-GetOpenGLMatrix();
-   }
-}
-
 void KX_Scene::MarkVisible(SG_Tree *node, RAS_IRasterizer* rasty, KX_Camera* 
cam, int layer)
 {
int intersect = KX_Camera::INTERSECT;
diff --git a/source/gameengine/Ketsji/KX_Scene.h 
b/source/gameengine/Ketsji/KX_Scene.h
index 50fac92..2e1ee9f 100644
--- a/source/gameengine/Ketsji/KX_Scene.h
+++ b/source/gameengine/Ketsji/KX_Scene.h
@@ -524,7 +524,6 @@ public:
void SetWorldInfo(class KX_WorldInfo* wi);
KX_WorldInfo* GetWorldInfo();
void CalculateVisibleMeshes(RAS_IRasterizer* rasty, KX_Camera *cam, int 
layer=0);
-   void UpdateMeshTransformations();
KX_Camera* GetpCamera();
NG_NetworkDeviceInterface* GetNetworkDeviceInterface();
NG_NetworkScene* GetNetworkScene();

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [2e20c16] master: Fix T38895: Unstable behavior using VehicleWrapper after Bullet 2.82 update

2014-05-16 Thread Mitchell Stokes
Commit: 2e20c1689798b84fd63d84cd6fc7fb282af05588
Author: Mitchell Stokes
Date:   Fri May 16 10:40:23 2014 -0700
https://developer.blender.org/rB2e20c1689798b84fd63d84cd6fc7fb282af05588

Fix T38895: Unstable behavior using VehicleWrapper after Bullet 2.82 update

The Bullet 2.82 update uses a different method for ray casting that
seems incompatible with our older files. So, for now we just force the
vehicle physics to use the older ray casting method.

===

M   source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp

===

diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp 
b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
index ce6eb22..8a8a8d3 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
@@ -296,6 +296,44 @@ public:
 
 
 };
+
+class BlenderVehicleRaycaster: public btDefaultVehicleRaycaster
+{
+   btDynamicsWorld*m_dynamicsWorld;
+public:
+   BlenderVehicleRaycaster(btDynamicsWorld* world)
+   :btDefaultVehicleRaycaster(world), m_dynamicsWorld(world)
+   {
+   }
+
+   virtual void* castRay(const btVector3 from,const btVector3 to, 
btVehicleRaycasterResult result)
+   {
+   //  RayResultCallback resultCallback;
+
+   btCollisionWorld::ClosestRayResultCallback rayCallback(from,to);
+
+   // We override btDefaultVehicleRaycaster so we can set this 
flag, otherwise our
+   // vehicles go crazy 
(http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=9662)
+   rayCallback.m_flags |= 
btTriangleRaycastCallback::kF_UseSubSimplexConvexCastRaytest;
+
+   m_dynamicsWorld-rayTest(from, to, rayCallback);
+
+   if (rayCallback.hasHit())
+   {
+
+   const btRigidBody* body = 
btRigidBody::upcast(rayCallback.m_collisionObject);
+   if (body  body-hasContactResponse())
+   {
+   result.m_hitPointInWorld = 
rayCallback.m_hitPointWorld;
+   result.m_hitNormalInWorld = 
rayCallback.m_hitNormalWorld;
+   result.m_hitNormalInWorld.normalize();
+   result.m_distFraction = 
rayCallback.m_closestHitFraction;
+   return (void*)body;
+   }
+   }
+   return 0;
+   }
+};
 #endif //NEW_BULLET_VEHICLE_SUPPORT
 
 class CcdOverlapFilterCallBack : public btOverlapFilterCallback
@@ -2824,7 +2862,7 @@ int   
CcdPhysicsEnvironment::CreateConstraint(class PHY_IPhysicsController* ctrl
{
btRaycastVehicle::btVehicleTuning* tuning = new 
btRaycastVehicle::btVehicleTuning();
btRigidBody* chassis = rb0;
-   btDefaultVehicleRaycaster* raycaster = new 
btDefaultVehicleRaycaster(m_dynamicsWorld);
+   btDefaultVehicleRaycaster* raycaster = new 
BlenderVehicleRaycaster(m_dynamicsWorld);
btRaycastVehicle* vehicle = new 
btRaycastVehicle(*tuning,chassis,raycaster);
WrapperVehicle* wrapperVehicle = new 
WrapperVehicle(vehicle,ctrl0);
m_wrapperVehicles.push_back(wrapperVehicle);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [183b417] master: BGE Physics: Better follow the old (pre-cleanup) logic for determining bounds types.

2014-05-15 Thread Mitchell Stokes
Commit: 183b417cce6de2ea00ca1f0d89b0170827aa75b3
Author: Mitchell Stokes
Date:   Wed May 14 22:36:28 2014 -0700
https://developer.blender.org/rB183b417cce6de2ea00ca1f0d89b0170827aa75b3

BGE Physics: Better follow the old (pre-cleanup) logic  for determining bounds 
types.

This prevents older files from breaking.

===

M   source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp

===

diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp 
b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
index bbc3968..ce6eb22 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
@@ -3056,27 +3056,26 @@ void CcdPhysicsEnvironment::ConvertObject(KX_GameObject 
*gameobj, RAS_MeshObject
 
btCollisionShape* bm = 0;
 
-   char bounds;
-   if (blenderobject-gameflag  OB_BOUNDS)
-   {
-   bounds = blenderobject-collision_boundtype;
-   }
-   else
+   char bounds = isbulletdyna ? OB_BOUND_SPHERE : OB_BOUND_TRIANGLE_MESH;
+   if (!(blenderobject-gameflag  OB_BOUNDS))
{
if (blenderobject-gameflag  OB_SOFT_BODY)
bounds = OB_BOUND_TRIANGLE_MESH;
else if (blenderobject-gameflag  OB_CHARACTER)
bounds = OB_BOUND_SPHERE;
-   else if (isbulletdyna)
+   }
+   else
+   {
+   if (ELEM(blenderobject-collision_boundtype, 
OB_BOUND_CONVEX_HULL, OB_BOUND_TRIANGLE_MESH)
+blenderobject-type != OB_MESH)
+   {
+   // Can't use triangle mesh or convex hull on a non-mesh 
object, fall-back to sphere
bounds = OB_BOUND_SPHERE;
+   }
else
-   bounds = OB_BOUND_TRIANGLE_MESH;
+   bounds = blenderobject-collision_boundtype;
}
 
-   // Can't use triangle mesh or convex hull on a non-mesh object, 
fall-back to sphere
-   if (ELEM(bounds, OB_BOUND_TRIANGLE_MESH, OB_BOUND_CONVEX_HULL)  
blenderobject-type != OB_MESH)
-   bounds = OB_BOUND_SPHERE;
-
// Get bounds information
float bounds_center[3], bounds_extends[3];
BoundBox *bb= BKE_object_boundbox_get(blenderobject);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [064ef3f] master: Fix T40182: Crash when using KX_GameObject.rayCast/rayCastTo().

2014-05-14 Thread Mitchell Stokes
Commit: 064ef3f00f286a5bb4b17c83cc8246c0ef0b123d
Author: Mitchell Stokes
Date:   Tue May 13 22:26:03 2014 -0700
https://developer.blender.org/rB064ef3f00f286a5bb4b17c83cc8246c0ef0b123d

Fix T40182: Crash when using KX_GameObject.rayCast/rayCastTo().

Missed another parent-release().

===

M   source/gameengine/Ketsji/KX_GameObject.cpp

===

diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp 
b/source/gameengine/Ketsji/KX_GameObject.cpp
index 9ea7698..9e8e58e 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -3253,8 +3253,6 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCastTo,
KX_GameObject *parent = GetParent();
if (!spc  parent)
spc = parent-GetPhysicsController();
-   if (parent)
-   parent-Release();

m_pHitObject = NULL;
if (propName)
@@ -3399,8 +3397,6 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCast,
KX_GameObject *parent = GetParent();
if (!spc  parent)
spc = parent-GetPhysicsController();
-   if (parent)
-   parent-Release();

m_pHitObject = NULL;
if (propName)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [ff2ec05] master: Fix T40199: bge.logic.LibFree() could cause crashes by leaving dangling pointers in the rasterizer.

2014-05-14 Thread Mitchell Stokes
Commit: ff2ec0566208a3594ef46577062a97119cfe9b2c
Author: Mitchell Stokes
Date:   Wed May 14 19:11:08 2014 -0700
https://developer.blender.org/rBff2ec0566208a3594ef46577062a97119cfe9b2c

Fix T40199: bge.logic.LibFree() could cause crashes by leaving dangling 
pointers in the rasterizer.

===

M   source/gameengine/Converter/KX_BlenderSceneConverter.cpp
M   source/gameengine/Rasterizer/RAS_BucketManager.h

===

diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp 
b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
index 7d7f8eb..88fd10b 100644
--- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
+++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
@@ -1382,10 +1382,42 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct 
Main *maggie)
}
 
vectorpairKX_Scene*,RAS_MeshObject* ::iterator meshit;
+   RAS_BucketManager::BucketList::iterator bit;
+   listRAS_MeshSlot::iterator msit;
+   RAS_BucketManager::BucketList buckets;
+
size = m_meshobjects.size();
for (i=0, meshit=m_meshobjects.begin(); isize; ) {
RAS_MeshObject *me= (*meshit).second;
if (IS_TAGGED(me-GetMesh())) {
+   // Before deleting the mesh object, make sure the 
rasterizer is
+   // no longer referencing it.
+   buckets = 
meshit-first-GetBucketManager()-GetSolidBuckets();
+   for (bit=buckets.begin(); bit!=buckets.end(); bit++) {
+   msit = (*bit)-msBegin();
+
+   while (msit != (*bit)-msEnd()) {
+   if (msit-m_mesh == meshit-second)
+   (*bit)-RemoveMesh((*msit++));
+   else
+   msit++;
+   }
+   }
+
+   // And now the alpha buckets
+   buckets = 
meshit-first-GetBucketManager()-GetAlphaBuckets();
+   for (bit=buckets.begin(); bit!=buckets.end(); bit++) {
+   msit = (*bit)-msBegin();
+
+   while (msit != (*bit)-msEnd()) {
+   if (msit-m_mesh == meshit-second)
+   (*bit)-RemoveMesh((*msit++));
+   else
+   msit++;
+   }
+   }
+
+   // Now it should be safe to delete
delete (*meshit).second;
*meshit = m_meshobjects.back();
m_meshobjects.pop_back();
@@ -1536,7 +1568,8 @@ RAS_MeshObject 
*KX_BlenderSceneConverter::ConvertMeshSpecial(KX_Scene* kx_scene,
}
}
}
-   
+
+   m_currentScene = kx_scene; // This needs to be set in case we LibLoaded 
earlier
RAS_MeshObject *meshobj = BL_ConvertMesh((Mesh *)me, NULL, kx_scene, 
this, false);

kx_scene-GetLogicManager()-RegisterMeshName(meshobj-GetName(),meshobj);
m_map_mesh_to_gamemesh.clear(); /* This is at runtime so no need to 
keep this, BL_ConvertMesh adds */
diff --git a/source/gameengine/Rasterizer/RAS_BucketManager.h 
b/source/gameengine/Rasterizer/RAS_BucketManager.h
index f8c6375..5ed212e 100644
--- a/source/gameengine/Rasterizer/RAS_BucketManager.h
+++ b/source/gameengine/Rasterizer/RAS_BucketManager.h
@@ -39,7 +39,9 @@
 
 class RAS_BucketManager
 {
+public:
typedef std::vectorclass RAS_MaterialBucket* BucketList;
+private:
BucketList m_SolidBuckets;
BucketList m_AlphaBuckets;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [2055e96] master: Fix T38379: Mesh vertices only update when in cone of last created spotlight

2014-05-13 Thread Mitchell Stokes
Commit: 2055e968df654ade2a7a477dcc7c134b1f65dcb8
Author: Mitchell Stokes
Date:   Mon May 12 23:13:27 2014 -0700
https://developer.blender.org/rB2055e968df654ade2a7a477dcc7c134b1f65dcb8

Fix T38379: Mesh vertices only update when in cone of last created spotlight

The shadow render passes could set a mesh's modified status to false
even if they were not rendered. This means their display lists do not
get updated. For now, just skip setting all buckets' modified to false
during shadow render passes.

===

M   source/gameengine/Rasterizer/RAS_BucketManager.cpp

===

diff --git a/source/gameengine/Rasterizer/RAS_BucketManager.cpp 
b/source/gameengine/Rasterizer/RAS_BucketManager.cpp
index eaa9b3d..f90b595 100644
--- a/source/gameengine/Rasterizer/RAS_BucketManager.cpp
+++ b/source/gameengine/Rasterizer/RAS_BucketManager.cpp
@@ -228,28 +228,24 @@ void RAS_BucketManager::Renderbuckets(const MT_Transform 
cameratrans, RAS_IRast
RenderSolidBuckets(cameratrans, rasty);
RenderAlphaBuckets(cameratrans, rasty);
 
-   /* All meshes should be up to date now */
-   /* Don't do this while processing buckets because some meshes are split 
between buckets */
-   BucketList::iterator bit;
-   listRAS_MeshSlot::iterator mit;
-   for (bit = m_SolidBuckets.begin(); bit != m_SolidBuckets.end(); ++bit) {
-   /* This (and the similar lines of code for the alpha buckets) 
is kind of a hacky fix for #34382. If we're
-* drawing shadows and the material doesn't cast shadows, then 
the mesh is still modified, so we don't want to
-* set MeshModified to false yet. This will happen correctly in 
the main render pass.
-*/
-   if (rasty-GetDrawingMode() == RAS_IRasterizer::KX_SHADOW  
!(*bit)-GetPolyMaterial()-CastsShadows())
-   continue;
-
-   for (mit = (*bit)-msBegin(); mit != (*bit)-msEnd(); ++mit) {
-   mit-m_mesh-SetMeshModified(false);
+   /* If we're drawing shadows and bucket wasn't rendered (outside of the 
lamp frustum or doesn't cast shadows)
+* then the mesh is still modified, so we don't want to set 
MeshModified to false yet (it will mess up
+* updating display lists). Just leave this step for the main render 
pass.
+*/
+   if (rasty-GetDrawingMode() != RAS_IRasterizer::KX_SHADOW) {
+   /* All meshes should be up to date now */
+   /* Don't do this while processing buckets because some meshes 
are split between buckets */
+   BucketList::iterator bit;
+   listRAS_MeshSlot::iterator mit;
+   for (bit = m_SolidBuckets.begin(); bit != m_SolidBuckets.end(); 
++bit) {
+   for (mit = (*bit)-msBegin(); mit != (*bit)-msEnd(); 
++mit) {
+   mit-m_mesh-SetMeshModified(false);
+   }
}
-   }
-   for (bit = m_AlphaBuckets.begin(); bit != m_AlphaBuckets.end(); ++bit) {
-   if (rasty-GetDrawingMode() == RAS_IRasterizer::KX_SHADOW  
!(*bit)-GetPolyMaterial()-CastsShadows())
-   continue;
-
-   for (mit = (*bit)-msBegin(); mit != (*bit)-msEnd(); ++mit) {
-   mit-m_mesh-SetMeshModified(false);
+   for (bit = m_AlphaBuckets.begin(); bit != m_AlphaBuckets.end(); 
++bit) {
+   for (mit = (*bit)-msBegin(); mit != (*bit)-msEnd(); 
++mit) {
+   mit-m_mesh-SetMeshModified(false);
+   }
}
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [1d1560e] master: BGE: Fixing some NavMesh memory leaks.

2014-05-13 Thread Mitchell Stokes
Commit: 1d1560eec45b18d964155277384e1532e22677d1
Author: Mitchell Stokes
Date:   Tue May 13 13:45:49 2014 -0700
https://developer.blender.org/rB1d1560eec45b18d964155277384e1532e22677d1

BGE: Fixing some NavMesh memory leaks.

===

M   source/gameengine/Ketsji/KX_NavMeshObject.cpp

===

diff --git a/source/gameengine/Ketsji/KX_NavMeshObject.cpp 
b/source/gameengine/Ketsji/KX_NavMeshObject.cpp
index 42f6288..39ce1d8 100644
--- a/source/gameengine/Ketsji/KX_NavMeshObject.cpp
+++ b/source/gameengine/Ketsji/KX_NavMeshObject.cpp
@@ -463,9 +463,10 @@ bool KX_NavMeshObject::BuildNavMesh()
if (dtris) MEM_freeN(dtris);
 
if (dvertices)
-   {
delete [] dvertices;
-   }
+
+   if (vertsi)
+   delete [] vertsi;
 
return true;
 }
@@ -591,6 +592,8 @@ int KX_NavMeshObject::FindPath(const MT_Point3 from, const 
MT_Point3 to, float
waypoint.getValue(path[i*3]);
}
}
+
+   delete[] polys;
}
 
return pathLen;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [23b682d] master: Fix T40172: LibFree() crashes with shared materials (e.g., from multiple LibNew() calls)

2014-05-13 Thread Mitchell Stokes
Commit: 23b682d5948e98264340e6dc81237b81d299b5b0
Author: Mitchell Stokes
Date:   Tue May 13 15:50:28 2014 -0700
https://developer.blender.org/rB23b682d5948e98264340e6dc81237b81d299b5b0

Fix T40172: LibFree() crashes with shared materials (e.g., from multiple 
LibNew() calls)

===

M   source/gameengine/Converter/KX_BlenderSceneConverter.cpp

===

diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp 
b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
index 5930d5e..7d7f8eb 100644
--- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
+++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
@@ -1237,6 +1237,16 @@ bool KX_BlenderSceneConverter::FreeBlendFile(struct Main 
*maggie)

gameobj-RemoveMeshes(); /* XXX - slack, should only remove meshes that are 
library items but mostly objects only have 1 mesh */
break;
}
+   else {
+   /* also free 
the mesh if it's using a tagged material */
+   int mat_index = 
mesh-NumMaterials();
+   while 
(mat_index--) {
+   if 
(IS_TAGGED(mesh-GetMeshMaterial(mat_index)-m_bucket-GetPolyMaterial()-GetBlenderMaterial()))
 {
+   
gameobj-RemoveMeshes(); /* XXX - slack, same as above */
+   
break;
+   }
+   }
+   }
}
 
/* make sure action actuators 
are not referencing tagged actions */

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [43f3e79] master: Fix T40111: replaceMesh() crashes BGE when used on a parented object

2014-05-12 Thread Mitchell Stokes
Commit: 43f3e79ceeb92c5373b22fb64fdf2ed9c781d5cd
Author: Mitchell Stokes
Date:   Mon May 12 22:52:14 2014 -0700
https://developer.blender.org/rB43f3e79ceeb92c5373b22fb64fdf2ed9c781d5cd

Fix T40111: replaceMesh() crashes BGE when used on a parented object

The replace mesh code was still calling release() on the parent object when it
no longer needed to (due to earlier commits).

===

M   source/gameengine/Ketsji/KX_Scene.cpp

===

diff --git a/source/gameengine/Ketsji/KX_Scene.cpp 
b/source/gameengine/Ketsji/KX_Scene.cpp
index c826f39..7cab6a8 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -1166,8 +1166,6 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* 
meshobj, bool use_gfx, bool u
 #ifdef WITH_BULLET
bool bHasSoftBody = (!parentobj  (blendobj-gameflag 
 OB_SOFT_BODY));
 #endif
-   bool releaseParent = true;
-

if (oldblendobj==NULL) {
if (bHasModifier || bHasShapeKey || bHasDvert 
|| bHasArmature) {
@@ -1189,7 +1187,6 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* 
meshobj, bool use_gfx, bool u
true,

static_castBL_ArmatureObject*( parentobj )
);
-   releaseParent= false;

modifierDeformer-LoadShapeDrivers(parentobj);
}
else
@@ -1217,7 +1214,6 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* 
meshobj, bool use_gfx, bool u
true,

static_castBL_ArmatureObject*( parentobj )
);
-   releaseParent= false;

shapeDeformer-LoadShapeDrivers(parentobj);
}
else
@@ -1243,7 +1239,6 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* 
meshobj, bool use_gfx, bool u
true,
static_castBL_ArmatureObject*( 
parentobj )
);
-   releaseParent= false;
newobj-SetDeformer(skinDeformer);
}
else if (bHasDvert)
@@ -1260,10 +1255,6 @@ void KX_Scene::ReplaceMesh(class CValue* obj,void* 
meshobj, bool use_gfx, bool u
newobj-SetDeformer(softdeformer);
}
 #endif
-
-   // release parent reference if its not being used 
-   if ( releaseParent  parentobj)
-   parentobj-Release();
}
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [ff08acc] master: BGE VideoTexture: Fix for loading PNG (and possibly other) files.

2014-05-09 Thread Mitchell Stokes
Commit: ff08acc556d8e40d501522efcbecac68bb8973c6
Author: Mitchell Stokes
Date:   Fri May 9 13:51:57 2014 -0700
https://developer.blender.org/rBff08acc556d8e40d501522efcbecac68bb8973c6

BGE VideoTexture: Fix for loading PNG (and possibly other) files.

===

M   source/gameengine/VideoTexture/VideoFFmpeg.cpp

===

diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.cpp 
b/source/gameengine/VideoTexture/VideoFFmpeg.cpp
index 44017f3..179f1ce 100644
--- a/source/gameengine/VideoTexture/VideoFFmpeg.cpp
+++ b/source/gameengine/VideoTexture/VideoFFmpeg.cpp
@@ -1005,9 +1005,20 @@ AVFrame *VideoFFmpeg::grabFrame(long position)
{
if (packet.stream_index == m_videoStream) 
{
-   avcodec_decode_video2(m_codecCtx, 
-   m_frame, frameFinished, 
+   if (m_isImage)
+   {
+   // If we're an image, we're probably not going 
to be here often,
+   // so we don't want to deal with delayed frames 
from threading.
+   // There might be a better way to handle this, 
but I'll leave that
+   // for people more knowledgeable with ffmpeg 
than myself. We don't
+   // need threading for a single image anyways.
+   m_codecCtx-thread_count = 1;
+   }
+
+   avcodec_decode_video2(m_codecCtx,
+   m_frame, frameFinished,
packet);
+
// remember dts to compute exact frame number
dts = packet.dts;
if (frameFinished  !posFound)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [d5588fd] master: Fix T40113: Skinned meshes with non-animated shape keys crashes the BGE.

2014-05-09 Thread Mitchell Stokes
Commit: d5588fd658dc0c776a33e55ccbfaed1a3974b396
Author: Mitchell Stokes
Date:   Fri May 9 16:05:23 2014 -0700
https://developer.blender.org/rBd5588fd658dc0c776a33e55ccbfaed1a3974b396

Fix T40113: Skinned meshes with non-animated shape keys crashes the BGE.

===

M   source/gameengine/Converter/BL_ShapeDeformer.cpp

===

diff --git a/source/gameengine/Converter/BL_ShapeDeformer.cpp 
b/source/gameengine/Converter/BL_ShapeDeformer.cpp
index b9b2732..5e31dab 100644
--- a/source/gameengine/Converter/BL_ShapeDeformer.cpp
+++ b/source/gameengine/Converter/BL_ShapeDeformer.cpp
@@ -129,7 +129,7 @@ bool BL_ShapeDeformer::LoadShapeDrivers(KX_GameObject* 
parent)
}
 
// Fix drivers since BL_ArmatureObject makes copies
-   if (parent-GetGameObjectType() == SCA_IObject::OBJ_ARMATURE) {
+   if (parent-GetGameObjectType() == SCA_IObject::OBJ_ARMATURE  
GetKey()-adt) {
BL_ArmatureObject *arma = (BL_ArmatureObject*)parent;
FCurve *fcu;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [087bbe6] master: BGE: Fixing shape key animations on meshes with no armature.

2014-05-09 Thread Mitchell Stokes
Commit: 087bbe624f6e0de50c409866faa8fce4585808c0
Author: Mitchell Stokes
Date:   Fri May 9 16:03:54 2014 -0700
https://developer.blender.org/rB087bbe624f6e0de50c409866faa8fce4585808c0

BGE: Fixing shape key animations on meshes with no armature.

Their transverts were not being updated after code changes for
multi-threaded skinning.

===

M   source/gameengine/Converter/BL_ShapeDeformer.cpp
M   source/gameengine/Converter/BL_SkinDeformer.cpp
M   source/gameengine/Converter/BL_SkinDeformer.h
M   source/gameengine/Ketsji/KX_Scene.cpp

===

diff --git a/source/gameengine/Converter/BL_ShapeDeformer.cpp 
b/source/gameengine/Converter/BL_ShapeDeformer.cpp
index 8bb9f85..b9b2732 100644
--- a/source/gameengine/Converter/BL_ShapeDeformer.cpp
+++ b/source/gameengine/Converter/BL_ShapeDeformer.cpp
@@ -222,6 +222,9 @@ bool BL_ShapeDeformer::Update(void)
if (m_recalcNormal)
RecalcNormals();
 #endif
+
+   // We also need to handle transverts now (used to be in 
BL_SkinDeformer::Apply())
+   UpdateTransverts();
bSkinUpdate = true;
}
 
diff --git a/source/gameengine/Converter/BL_SkinDeformer.cpp 
b/source/gameengine/Converter/BL_SkinDeformer.cpp
index 8e1f512..e7137a5 100644
--- a/source/gameengine/Converter/BL_SkinDeformer.cpp
+++ b/source/gameengine/Converter/BL_SkinDeformer.cpp
@@ -287,6 +287,43 @@ void BL_SkinDeformer::BGEDeformVerts()
m_copyNormals = true;
 }
 
+void BL_SkinDeformer::UpdateTransverts()
+{
+   RAS_MeshSlot::iterator it;
+   RAS_MeshMaterial *mmat;
+   RAS_MeshSlot *slot;
+   size_t i, nmat, imat;
+
+   if (m_transverts) {
+   // the vertex cache is unique to this deformer, no need to 
update it
+   // if it wasn't updated! We must update all the materials at 
once
+   // because we will not get here again for the other material
+   nmat = m_pMeshObject-NumMaterials();
+   for (imat=0; imatnmat; imat++) {
+   mmat = m_pMeshObject-GetMeshMaterial(imat);
+   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 each vertex
+   // copy the untransformed data from the 
original mvert
+   for (i=it.startvertex; iit.endvertex; i++) {
+   RAS_TexVert v = it.vertex[i];
+   
v.SetXYZ(m_transverts[v.getOrigIndex()]);
+   if (m_copyNormals)
+   
v.SetNormal(m_transnors[v.getOrigIndex()]);
+   }
+   }
+   }
+
+   if (m_copyNormals)
+   m_copyNormals = false;
+   }
+}
+
 bool BL_SkinDeformer::UpdateInternal(bool shape_applied)
 {
/* See if the armature has been updated for this frame */
@@ -317,40 +354,10 @@ bool BL_SkinDeformer::UpdateInternal(bool shape_applied)
m_armobj-RestorePose();
/* dynamic vertex, cannot use display list */
m_bDynamic = true;
-   /* indicate that the m_transverts and normals are up to date */
-   RAS_MeshSlot::iterator it;
-   RAS_MeshMaterial *mmat;
-   RAS_MeshSlot *slot;
-   size_t i, nmat, imat;
-
-   if (m_transverts) {
-   // the vertex cache is unique to this deformer, no need 
to update it
-   // if it wasn't updated! We must update all the 
materials at once
-   // because we will not get here again for the other 
material
-   nmat = m_pMeshObject-NumMaterials();
-   for (imat=0; imatnmat; imat++) {
-   mmat = m_pMeshObject-GetMeshMaterial(imat);
-   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 each vertex
-   // copy the untransformed data from the 
original mvert
-   for (i=it.startvertex; iit.endvertex; 
i++) {
-   RAS_TexVert v = it.vertex[i

[Bf-blender-cvs] [ee5284f] master: BGE: Dynamically-allocated action layers

2014-05-07 Thread Mitchell Stokes
Commit: ee5284faf6db96bb5029f6d2ab0b62336ef84e53
Author: Mitchell Stokes
Date:   Wed May 7 18:14:36 2014 -0700
https://developer.blender.org/rBee5284faf6db96bb5029f6d2ab0b62336ef84e53

BGE: Dynamically-allocated action layers

This patch removes the limitations on the number of action layers in the BGE.

BL_ActionManager currently uses a fixed array to keep track of the action 
layers. This patch replaces the fixed array with a map which allows for dynamic 
allocation of action layers. Layers (map items) are automatically removed on 
BL_ActionManager's update function. The maximum number of layers is roughly the 
value of a short. Backwards functionality is maintained and there are no 
changes to the Python API.

Task Discussion:
https://developer.blender.org/T39572

Author: Kevin Ednalino

Reviewers: moguri

Differential Revision: https://developer.blender.org/D491

===

M   source/blender/makesrna/intern/rna_actuator.c
M   source/gameengine/Converter/BL_ActionActuator.cpp
M   source/gameengine/Ketsji/BL_ActionManager.cpp
M   source/gameengine/Ketsji/BL_ActionManager.h

===

diff --git a/source/blender/makesrna/intern/rna_actuator.c 
b/source/blender/makesrna/intern/rna_actuator.c
index 9880e7d..fd04fb4 100644
--- a/source/blender/makesrna/intern/rna_actuator.c
+++ b/source/blender/makesrna/intern/rna_actuator.c
@@ -661,7 +661,7 @@ static void rna_def_action_actuator(BlenderRNA *brna)
RNA_def_property_update(prop, NC_LOGIC, NULL);
 
prop = RNA_def_property(srna, layer, PROP_INT, PROP_NONE);
-   RNA_def_property_range(prop, 0, 7); /* This should match 
BL_ActionManager::MAX_ACTION_LAYERS - 1 */
+   RNA_def_property_range(prop, 0, 32766); /* This should match 
BL_ActionManager::MAX_ACTION_LAYERS - 1 */
RNA_def_property_ui_text(prop, Layer, The animation layer to play 
the action on);
RNA_def_property_update(prop, NC_LOGIC, NULL);
 
diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp 
b/source/gameengine/Converter/BL_ActionActuator.cpp
index f8c5ffb..3dd013d 100644
--- a/source/gameengine/Converter/BL_ActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ActionActuator.cpp
@@ -35,6 +35,7 @@
 #include BL_ArmatureObject.h
 #include BL_SkinDeformer.h
 #include BL_Action.h
+#include BL_ActionManager.h
 #include KX_GameObject.h
 #include STR_HashedString.h
 #include MEM_guardedalloc.h
@@ -536,7 +537,7 @@ PyAttributeDef BL_ActionActuator::Attributes[] = {
KX_PYATTRIBUTE_RW_FUNCTION(action, BL_ActionActuator, 
pyattr_get_action, pyattr_set_action),
KX_PYATTRIBUTE_RO_FUNCTION(channelNames, BL_ActionActuator, 
pyattr_get_channel_names),
KX_PYATTRIBUTE_SHORT_RW(priority, 0, 100, false, BL_ActionActuator, 
m_priority),
-   KX_PYATTRIBUTE_SHORT_RW(layer, 0, 7, true, BL_ActionActuator, 
m_layer),
+   KX_PYATTRIBUTE_SHORT_RW(layer, 0, MAX_ACTION_LAYERS-1, true, 
BL_ActionActuator, m_layer),
KX_PYATTRIBUTE_FLOAT_RW(layerWeight, 0, 1.0, BL_ActionActuator, 
m_layer_weight),
KX_PYATTRIBUTE_RW_FUNCTION(frame, BL_ActionActuator, 
pyattr_get_frame, pyattr_set_frame),
KX_PYATTRIBUTE_STRING_RW(propName, 0, MAX_PROP_NAME, false, 
BL_ActionActuator, m_propname),
diff --git a/source/gameengine/Ketsji/BL_ActionManager.cpp 
b/source/gameengine/Ketsji/BL_ActionManager.cpp
index 404f276..07adce7 100644
--- a/source/gameengine/Ketsji/BL_ActionManager.cpp
+++ b/source/gameengine/Ketsji/BL_ActionManager.cpp
@@ -24,44 +24,72 @@
  *  \ingroup ketsji
  */
 
-#include BL_ActionManager.h
 #include BL_Action.h
+#include BL_ActionManager.h
 
-BL_ActionManager::BL_ActionManager(class KX_GameObject *obj)
+BL_ActionManager::BL_ActionManager(class KX_GameObject *obj):
+   m_obj(obj)
 {
-   for (int i=0; iMAX_ACTION_LAYERS; ++i)
-   m_layers[i] = new BL_Action(obj);
 }
 
 BL_ActionManager::~BL_ActionManager()
 {
-   for (int i=0; iMAX_ACTION_LAYERS; ++i)
-   delete m_layers[i];
+   BL_ActionMap::iterator it;
+
+   for (it = m_layers.begin(); it != m_layers.end(); it++)
+   delete it-second;
+
+   m_layers.clear();
+}
+
+BL_Action *BL_ActionManager::GetAction(short layer)
+{
+   BL_ActionMap::iterator it = m_layers.find(layer);
+
+   return (it != m_layers.end()) ? it-second : 0;
+}
+
+BL_Action* BL_ActionManager::AddAction(short layer)
+{
+   BL_Action *action = new BL_Action(m_obj);
+   m_layers[layer] = action;
+
+   return action;
 }
 
 float BL_ActionManager::GetActionFrame(short layer)
 {
-   return m_layers[layer]-GetFrame();
+   BL_Action *action = GetAction(layer);
+
+   return action ? action-GetFrame() : 0.f;
 }
 
 void BL_ActionManager::SetActionFrame(short layer, float frame)
 {
-   m_layers[layer]-SetFrame(frame);
+   BL_Action *action = GetAction(layer);
+
+   if (action) action-SetFrame

[Bf-blender-cvs] [362b25b3] master: Fix T39928: Blender crash/freeze when game engine is started with animation played directly on camera object with parents.

2014-05-04 Thread Mitchell Stokes
Commit: 362b25b38287cb75e4d22b30bdbc7f47e8eb3fdf
Author: Mitchell Stokes
Date:   Sun May 4 15:37:18 2014 -0700
https://developer.blender.org/rB362b25b38287cb75e4d22b30bdbc7f47e8eb3fdf

Fix T39928: Blender crash/freeze when game engine is started with animation 
played directly on camera object with parents.

Updating object IPOs is not currently thread-safe since it also updates
children. This leads to problems when parents and children are both
animated. For now, updating object IPOs is done in its own loop to avoid
threading issues.

===

M   source/gameengine/Ketsji/BL_Action.cpp
M   source/gameengine/Ketsji/BL_Action.h
M   source/gameengine/Ketsji/BL_ActionManager.cpp
M   source/gameengine/Ketsji/BL_ActionManager.h
M   source/gameengine/Ketsji/KX_GameObject.cpp
M   source/gameengine/Ketsji/KX_GameObject.h
M   source/gameengine/Ketsji/KX_Scene.cpp

===

diff --git a/source/gameengine/Ketsji/BL_Action.cpp 
b/source/gameengine/Ketsji/BL_Action.cpp
index e4ab2d5..a50c07a 100644
--- a/source/gameengine/Ketsji/BL_Action.cpp
+++ b/source/gameengine/Ketsji/BL_Action.cpp
@@ -485,8 +485,15 @@ void BL_Action::Update(float curtime)
}
}
 
-   m_obj-UpdateIPO(m_localtime, m_ipo_flags  ACT_IPOFLAG_CHILD);
+   // This isn't thread-safe, so we move it into it's own function for now
+   //m_obj-UpdateIPO(m_localtime, m_ipo_flags  ACT_IPOFLAG_CHILD);
 
if (m_done)
ClearControllerList();
 }
+
+void BL_Action::UpdateIPOs()
+{
+   if (!m_done)
+   m_obj-UpdateIPO(m_localtime, m_ipo_flags  ACT_IPOFLAG_CHILD);
+}
diff --git a/source/gameengine/Ketsji/BL_Action.h 
b/source/gameengine/Ketsji/BL_Action.h
index 463d177..dd1cd1f 100644
--- a/source/gameengine/Ketsji/BL_Action.h
+++ b/source/gameengine/Ketsji/BL_Action.h
@@ -105,6 +105,10 @@ public:
 * Update the action's frame, etc.
 */
void Update(float curtime);
+   /**
+* Update object IPOs (note: not thread-safe!)
+*/
+   void UpdateIPOs();
 
// Accessors
float GetFrame();
diff --git a/source/gameengine/Ketsji/BL_ActionManager.cpp 
b/source/gameengine/Ketsji/BL_ActionManager.cpp
index 2e882ce..404f276 100644
--- a/source/gameengine/Ketsji/BL_ActionManager.cpp
+++ b/source/gameengine/Ketsji/BL_ActionManager.cpp
@@ -102,3 +102,14 @@ void BL_ActionManager::Update(float curtime)
}
}
 }
+
+void BL_ActionManager::UpdateIPOs()
+{
+   for (int i=0; iMAX_ACTION_LAYERS; ++i)
+   {
+   if (!m_layers[i]-IsDone())
+   {
+   m_layers[i]-UpdateIPOs();
+   }
+   }
+}
diff --git a/source/gameengine/Ketsji/BL_ActionManager.h 
b/source/gameengine/Ketsji/BL_ActionManager.h
index 8c5b8e9..be9097c 100644
--- a/source/gameengine/Ketsji/BL_ActionManager.h
+++ b/source/gameengine/Ketsji/BL_ActionManager.h
@@ -98,6 +98,11 @@ public:
 */
void Update(float);
 
+   /**
+* Update object IPOs (note: not thread-safe!)
+*/
+   void UpdateIPOs();
+
 #ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS(GE:BL_ActionManager)
 #endif
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp 
b/source/gameengine/Ketsji/KX_GameObject.cpp
index 7042e6e..9ea7698 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -462,6 +462,11 @@ void KX_GameObject::UpdateActionManager(float curtime)
GetActionManager()-Update(curtime);
 }
 
+void KX_GameObject::UpdateActionIPOs()
+{
+   GetActionManager()-UpdateIPOs();
+}
+
 float KX_GameObject::GetActionFrame(short layer)
 {
return GetActionManager()-GetActionFrame(layer);
diff --git a/source/gameengine/Ketsji/KX_GameObject.h 
b/source/gameengine/Ketsji/KX_GameObject.h
index ac0afca..7450be4 100644
--- a/source/gameengine/Ketsji/KX_GameObject.h
+++ b/source/gameengine/Ketsji/KX_GameObject.h
@@ -300,6 +300,12 @@ public:
 */
void UpdateActionManager(float curtime);
 
+   /**
+* Have the action manager update IPOs
+* note: not thread-safe!
+*/
+   void UpdateActionIPOs();
+
/*
 * End Animation API
 */
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp 
b/source/gameengine/Ketsji/KX_Scene.cpp
index 5a33a61..4c9fba8 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -1658,6 +1658,10 @@ void KX_Scene::UpdateAnimations(double curtime)
 
BLI_task_pool_work_and_wait(pool);
BLI_task_pool_free(pool);
+
+   for (int i=0; im_animatedlist-GetCount(); ++i) {
+   
((KX_GameObject*)m_animatedlist-GetValue(i))-UpdateActionIPOs();
+   }
 }
 
 void KX_Scene::LogicUpdateFrame(double

[Bf-blender-cvs] [1a8b176] master: Fix T35552: LibLoading objects with Collision sensors gives an error

2014-05-02 Thread Mitchell Stokes
Commit: 1a8b17661f61efc743f5e311afa8041015ed7dac
Author: Mitchell Stokes
Date:   Fri May 2 00:08:00 2014 -0700
https://developer.blender.org/rB1a8b17661f61efc743f5e311afa8041015ed7dac

Fix T35552: LibLoading objects with Collision sensors gives an error

The collision sensors were not being properly unregistered from the
physics system before they were merged into the current scene.

===

M   source/gameengine/Ketsji/KX_Scene.cpp

===

diff --git a/source/gameengine/Ketsji/KX_Scene.cpp 
b/source/gameengine/Ketsji/KX_Scene.cpp
index b2dca14..5a33a61 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -1864,7 +1864,7 @@ short KX_Scene::GetAnimationFPS()
return m_blenderScene-r.frs_sec;
 }
 
-static void MergeScene_LogicBrick(SCA_ILogicBrick* brick, KX_Scene *to)
+static void MergeScene_LogicBrick(SCA_ILogicBrick* brick, KX_Scene *from, 
KX_Scene *to)
 {
SCA_LogicManager *logicmgr= to-GetLogicManager();
 
@@ -1874,7 +1874,10 @@ static void MergeScene_LogicBrick(SCA_ILogicBrick* 
brick, KX_Scene *to)
/* near sensors have physics controllers */
KX_TouchSensor *touch_sensor = dynamic_castclass KX_TouchSensor 
*(brick);
if (touch_sensor) {
+   KX_TouchEventManager *tmgr = 
(KX_TouchEventManager*)from-GetLogicManager()-FindEventManager(SCA_EventManager::TOUCH_EVENTMGR);
+   touch_sensor-UnregisterSumo(tmgr);

touch_sensor-GetPhysicsController()-SetPhysicsEnvironment(to-GetPhysicsEnvironment());
+   touch_sensor-RegisterSumo(tmgr);
}
 
// If we end up replacing a KX_TouchEventManager, we need to make sure
@@ -1912,7 +1915,7 @@ static void MergeScene_GameObject(KX_GameObject* gameobj, 
KX_Scene *to, KX_Scene
 
for (ita = actuators.begin(); !(ita==actuators.end()); ++ita)
{
-   MergeScene_LogicBrick(*ita, to);
+   MergeScene_LogicBrick(*ita, from, to);
}
}
 
@@ -1923,7 +1926,7 @@ static void MergeScene_GameObject(KX_GameObject* gameobj, 
KX_Scene *to, KX_Scene
 
for (its = sensors.begin(); !(its==sensors.end()); ++its)
{
-   MergeScene_LogicBrick(*its, to);
+   MergeScene_LogicBrick(*its, from, to);
}
}
 
@@ -1934,17 +1937,17 @@ static void MergeScene_GameObject(KX_GameObject* 
gameobj, KX_Scene *to, KX_Scene
for (itc = controllers.begin(); !(itc==controllers.end()); 
++itc)
{
SCA_IController *cont= *itc;
-   MergeScene_LogicBrick(cont, to);
+   MergeScene_LogicBrick(cont, from, to);
 
vectorSCA_ISensor* linkedsensors = 
cont-GetLinkedSensors();
vectorSCA_IActuator* linkedactuators = 
cont-GetLinkedActuators();
 
for (vectorSCA_IActuator*::iterator ita = 
linkedactuators.begin();!(ita==linkedactuators.end());++ita) {
-   MergeScene_LogicBrick(*ita, to);
+   MergeScene_LogicBrick(*ita, from, to);
}
 
for (vectorSCA_ISensor*::iterator its = 
linkedsensors.begin();!(its==linkedsensors.end());++its) {
-   MergeScene_LogicBrick(*its, to);
+   MergeScene_LogicBrick(*its, from, to);
}
}
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [5f80a7f] master: Fix T39932: LibNew can't find LibLoaded meshes.

2014-05-01 Thread Mitchell Stokes
Commit: 5f80a7ffe25fdda77904d06c8e7b6ff37731d25b
Author: Mitchell Stokes
Date:   Thu May 1 14:49:42 2014 -0700
https://developer.blender.org/rB5f80a7ffe25fdda77904d06c8e7b6ff37731d25b

Fix T39932: LibNew can't find LibLoaded meshes.

LibNew now searchs dynamic (i.e., LibLoaded)  mains instead of just the current 
main.

===

M   source/gameengine/Converter/KX_BlenderSceneConverter.cpp

===

diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp 
b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
index bad99b5..5930d5e 100644
--- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
+++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
@@ -1458,6 +1458,20 @@ RAS_MeshObject 
*KX_BlenderSceneConverter::ConvertMeshSpecial(KX_Scene* kx_scene,
 {
/* Find a mesh in the current main */
ID *me= static_castID *(BLI_findstring(m_maggie-mesh, name, 
offsetof(ID, name) + 2));
+   Main *from_maggie = m_maggie;
+
+   if (me == NULL) {
+   // The mesh wasn't in the current main, try any dynamic (i.e., 
LibLoaded) ones
+   vectorMain*::iterator it;
+
+   for (it = GetMainDynamic().begin(); it != 
GetMainDynamic().end(); it++) {
+   me = static_castID *(BLI_findstring((*it)-mesh, 
name, offsetof(ID, name) + 2));
+   from_maggie = *it;
+
+   if (me)
+   break;
+   }
+   }

if (me==NULL) {
printf(Could not be found \%s\\n, name);
@@ -1467,10 +1481,10 @@ RAS_MeshObject 
*KX_BlenderSceneConverter::ConvertMeshSpecial(KX_Scene* kx_scene,
/* Watch this!, if its used in the original scene can cause big 
troubles */
if (me-us  0) {
printf(Mesh has a user \%s\\n, name);
-   me = (ID*)BKE_mesh_copy((Mesh*)me);
+   me = (ID*)BKE_mesh_copy_ex(from_maggie, (Mesh*)me);
me-us--;
}
-   BLI_remlink(m_maggie-mesh, me); /* even if we made the copy it needs 
to be removed */
+   BLI_remlink(from_maggie-mesh, me); /* even if we made the copy it 
needs to be removed */
BLI_addtail(maggie-mesh, me);
 

@@ -1496,7 +1510,7 @@ RAS_MeshObject 
*KX_BlenderSceneConverter::ConvertMeshSpecial(KX_Scene* kx_scene,
mat_new-id.flag |= LIB_DOIT;
mat_old-id.us--;

-   BLI_remlink(m_maggie-mat, mat_new);
+   BLI_remlink(G.main-mat, mat_new); // 
BKE_material_copy uses G.main, and there is no BKE_material_copy_ex
BLI_addtail(maggie-mat, mat_new);

mesh-mat[i] = mat_new;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [9f16428] master: BGE cleanup: Moving the PHY_* includes in BL_BlenderDataConversion.cpp

2014-05-01 Thread Mitchell Stokes
Commit: 9f16428cb5f047bf46bc338746a0fa84add6e720
Author: Mitchell Stokes
Date:   Thu May 1 15:24:50 2014 -0700
https://developer.blender.org/rB9f16428cb5f047bf46bc338746a0fa84add6e720

BGE cleanup: Moving the PHY_* includes in BL_BlenderDataConversion.cpp

These includes are now with the rest of the includes instead of in the
middle of the file. This should also help building on OS X.

===

M   source/gameengine/Converter/BL_BlenderDataConversion.cpp

===

diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp 
b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index 2fefea7..e511f01 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -62,6 +62,8 @@
 // Collision  Fuzzics LTD
 
 #include PHY_Pro.h
+#include PHY_IPhysicsEnvironment.h
+#include PHY_DynamicTypes.h
 
 
 #include KX_Scene.h
@@ -1762,10 +1764,6 @@ static void UNUSED_FUNCTION(RBJconstraints)(Object 
*ob)//not used
}
 }
 
-#include PHY_IPhysicsEnvironment.h
-#include PHY_DynamicTypes.h
-
-
 static KX_GameObject* getGameOb(STR_String busc,CListValue* sumolist)
 {

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [685316b] master: BGE: Forgot a NULL check in CcdPhysicsEnvironment::MergeEnvironment()

2014-05-01 Thread Mitchell Stokes
Commit: 685316b406b5139b61d16e7df071918b179cda2f
Author: Mitchell Stokes
Date:   Thu May 1 18:34:10 2014 -0700
https://developer.blender.org/rB685316b406b5139b61d16e7df071918b179cda2f

BGE: Forgot a NULL check in CcdPhysicsEnvironment::MergeEnvironment()

===

M   source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp

===

diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp 
b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
index 3c9c5d0..bbc3968 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
@@ -1901,8 +1901,10 @@ btDispatcher*CcdPhysicsEnvironment::GetDispatcher()
 void CcdPhysicsEnvironment::MergeEnvironment(PHY_IPhysicsEnvironment 
*other_env)
 {
CcdPhysicsEnvironment *other = 
dynamic_castCcdPhysicsEnvironment*(other_env);
-   printf(KX_Scene::MergeScene: Other scene is not using Bullet physics, 
not merging physics.\n);
-   return;
+   if (other == NULL) {
+   printf(KX_Scene::MergeScene: Other scene is not using Bullet 
physics, not merging physics.\n);
+   return;
+   }
 
std::setCcdPhysicsController*::iterator it;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [27cbb28] master: BGE cleanup: Removing the unused SCA_EventManager::Replace_PhysicsScene().

2014-05-01 Thread Mitchell Stokes
Commit: 27cbb28659c1bb5d5a0c4a4371ca2a6a02842f5b
Author: Mitchell Stokes
Date:   Thu May 1 19:42:22 2014 -0700
https://developer.blender.org/rB27cbb28659c1bb5d5a0c4a4371ca2a6a02842f5b

BGE cleanup: Removing the unused SCA_EventManager::Replace_PhysicsScene().

===

M   source/gameengine/GameLogic/SCA_EventManager.h
M   source/gameengine/Ketsji/KX_TouchEventManager.h

===

diff --git a/source/gameengine/GameLogic/SCA_EventManager.h 
b/source/gameengine/GameLogic/SCA_EventManager.h
index 83322fe..eb9a6d9 100644
--- a/source/gameengine/GameLogic/SCA_EventManager.h
+++ b/source/gameengine/GameLogic/SCA_EventManager.h
@@ -77,7 +77,6 @@ public:
 
 
voidReplace_LogicManager(SCA_LogicManager* 
logicmgr) { m_logicmgr= logicmgr; }
-   virtual voidReplace_PhysicsScene(class PHY_IPhysicsEnvironment* 
env) { } /* only for event managers that use one */
 
 protected:
EVENT_MANAGER_TYPE  m_mgrtype;
diff --git a/source/gameengine/Ketsji/KX_TouchEventManager.h 
b/source/gameengine/Ketsji/KX_TouchEventManager.h
index 63e9d15..bd4903c 100644
--- a/source/gameengine/Ketsji/KX_TouchEventManager.h
+++ b/source/gameengine/Ketsji/KX_TouchEventManager.h
@@ -77,7 +77,6 @@ public:
virtual void RemoveSensor(SCA_ISensor* sensor);
SCA_LogicManager* GetLogicManager() { return m_logicmgr;}
PHY_IPhysicsEnvironment *GetPhysicsEnvironment() { return m_physEnv; }
-   virtual voidReplace_PhysicsScene(PHY_IPhysicsEnvironment* env) { 
m_physEnv= env; }
 

 #ifdef WITH_CXX_GUARDEDALLOC

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [cdc5d65] master: BGE: Fixing a memory leak from the recent physics changes.

2014-04-30 Thread Mitchell Stokes
Commit: cdc5d6537f09bceccbfaa0273bfc72696960c305
Author: Mitchell Stokes
Date:   Tue Apr 29 23:53:10 2014 -0700
https://developer.blender.org/rBcdc5d6537f09bceccbfaa0273bfc72696960c305

BGE: Fixing a memory leak from the recent physics changes.

===

M   source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp

===

diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp 
b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
index 3c9c5d0..966afa0 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
@@ -3200,6 +3200,8 @@ void CcdPhysicsEnvironment::ConvertObject(KX_GameObject 
*gameobj, RAS_MeshObject
{
delete motionstate;
shapeInfo-Release();
+   if (parent)
+   parent-Release();
return;
}
 
@@ -3252,6 +3254,8 @@ void CcdPhysicsEnvironment::ConvertObject(KX_GameObject 
*gameobj, RAS_MeshObject
shapeInfo-Release();
// delete motionstate as it's not used
delete motionstate;
+   if (parent)
+   parent-Release();
return;
}
 
@@ -3428,4 +3432,7 @@ void CcdPhysicsEnvironment::ConvertObject(KX_GameObject 
*gameobj, RAS_MeshObject
}
}
 #endif
+
+   if (parent)
+   parent-Release();
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [60c8c13] master: BGE cleanup: KX_GameObject::GetParent() no longer increases the object's refcount.

2014-04-30 Thread Mitchell Stokes
Commit: 60c8c130fed60dc1fe5387b960549385188feadf
Author: Mitchell Stokes
Date:   Wed Apr 30 18:37:47 2014 -0700
https://developer.blender.org/rB60c8c130fed60dc1fe5387b960549385188feadf

BGE cleanup: KX_GameObject::GetParent() no longer increases the object's 
refcount.

I'm not sure why this function ever increased the object's refcount. Any
place in the code that calls KX_GameObject::GetParent() has to turn
around and call parent-Release(). Forgetting to call Release() was a
common cause of memory leaks (in fact, KX_SteeringActuator was probably
leaking). If the refcount needs to be increased, the calling code can
handle calling AddRef().

===

M   source/gameengine/Ketsji/KX_ConstraintActuator.cpp
M   source/gameengine/Ketsji/KX_GameObject.cpp
M   source/gameengine/Ketsji/KX_RaySensor.cpp
M   source/gameengine/Ketsji/KX_Scene.cpp
M   source/gameengine/Ketsji/KX_TouchSensor.cpp
M   source/gameengine/Ketsji/KX_TrackToActuator.cpp
M   source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
M   
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp

===

diff --git a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp 
b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp
index 0c5e213..e5662b5 100644
--- a/source/gameengine/Ketsji/KX_ConstraintActuator.cpp
+++ b/source/gameengine/Ketsji/KX_ConstraintActuator.cpp
@@ -342,7 +342,6 @@ bool KX_ConstraintActuator::Update(double curtime, bool 
frame)
KX_GameObject *parent = 
obj-GetParent();
if (parent) {
spc = 
parent-GetPhysicsController();
-   parent-Release();
}
}
KX_RayCast::CallbackKX_ConstraintActuator 
callback(this,dynamic_castPHY_IPhysicsController*(spc));
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp 
b/source/gameengine/Ketsji/KX_GameObject.cpp
index 2e39614..7042e6e 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -306,9 +306,6 @@ KX_GameObject* KX_GameObject::GetParent()
if (node)
result = (KX_GameObject*)node-GetSGClientObject();
}
-   
-   if (result)
-   result-AddRef();
 
return result;

@@ -2113,7 +2110,6 @@ PyObject *KX_GameObject::pyattr_get_parent(void *self_v, 
const KX_PYATTRIBUTE_DE
KX_GameObject* self = static_castKX_GameObject*(self_v);
KX_GameObject* parent = self-GetParent();
if (parent) {
-   parent-Release(); /* self-GetParent() AddRef's */
return parent-GetProxy();
}
Py_RETURN_NONE;
diff --git a/source/gameengine/Ketsji/KX_RaySensor.cpp 
b/source/gameengine/Ketsji/KX_RaySensor.cpp
index 84e615b..0f47dfd 100644
--- a/source/gameengine/Ketsji/KX_RaySensor.cpp
+++ b/source/gameengine/Ketsji/KX_RaySensor.cpp
@@ -265,9 +265,6 @@ bool KX_RaySensor::Evaluate()
if (!spc  parent)
spc = parent-GetPhysicsController();

-   if (parent)
-   parent-Release();
-   
 
PHY_IPhysicsEnvironment* physics_environment = 
this-m_scene-GetPhysicsEnvironment();

diff --git a/source/gameengine/Ketsji/KX_Scene.cpp 
b/source/gameengine/Ketsji/KX_Scene.cpp
index 65f5ff1..b2dca14 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -575,9 +575,6 @@ KX_GameObject* KX_Scene::AddNodeReplicaObject(class 
SG_IObject* node, class CVal
newctrl-SetNewClientInfo(newobj-getClientInfo());
newobj-SetPhysicsController(newctrl, newobj-IsDynamic());
newctrl-PostProcessReplica(motionstate, parentctrl);
-
-   if (parent)
-   parent-Release();
}
 
return newobj;
@@ -758,8 +755,6 @@ void KX_Scene::DupliGroupRecurse(CValue* obj, int level)
KX_GameObject *parent = gameobj-GetParent();
if (parent != NULL)
{
-   parent-Release(); // GetParent() increased the refcount
-
// this object is not a top parent. Either it is the 
child of another
// object in the group and it will be added 
automatically when the parent
// is added. Or it is the child of an object outside 
the group and the group
diff --git a/source/gameengine/Ketsji/KX_TouchSensor.cpp 
b/source/gameengine/Ketsji/KX_TouchSensor.cpp
index 1b8ef09..5cb1d5f 100644
--- a/source/gameengine/Ketsji/KX_TouchSensor.cpp
+++ b/source/gameengine/Ketsji/KX_TouchSensor.cpp
@@ -208,10 +208,6 @@ bool   
KX_TouchSensor

[Bf-blender-cvs] [3448822] master: Fix T39614: Ping Pong Action doesn't work correctly

2014-04-28 Thread Mitchell Stokes
Commit: 3448822b2ffc2a560c6902470d5a572dfa344e1d
Author: Mitchell Stokes
Date:   Mon Apr 28 16:22:20 2014 -0700
https://developer.blender.org/rB3448822b2ffc2a560c6902470d5a572dfa344e1d

Fix T39614: Ping Pong Action doesn't work correctly

===

M   source/gameengine/Converter/BL_ActionActuator.cpp

===

diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp 
b/source/gameengine/Converter/BL_ActionActuator.cpp
index 34d3684..b606cd1 100644
--- a/source/gameengine/Converter/BL_ActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ActionActuator.cpp
@@ -254,12 +254,17 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
// Handle a finished animation
if ((m_flag  ACT_FLAG_PLAY_END)  (m_flag  ACT_FLAG_ACTIVE)  
obj-IsActionDone(m_layer))
{
-   m_flag = ~ACT_FLAG_ACTIVE;
-   m_flag = ~ACT_FLAG_ATTEMPT_PLAY;
-
if (m_playtype == ACT_ACTION_PINGPONG)
+   {
m_flag ^= ACT_FLAG_REVERSE;
-   return false;
+   }
+   else
+   {
+   m_flag = ~ACT_FLAG_ACTIVE;
+   m_flag = ~ACT_FLAG_ATTEMPT_PLAY;
+
+   return false;
+   }
}

// If a different action is playing, we've been overruled and are no 
longer active

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [d8282da] master: Correction to last commit

2014-04-28 Thread Mitchell Stokes
Commit: d8282da5452b9bb8487d9bce611b922244a74a08
Author: Mitchell Stokes
Date:   Mon Apr 28 16:33:26 2014 -0700
https://developer.blender.org/rBd8282da5452b9bb8487d9bce611b922244a74a08

Correction to last commit

===

M   source/gameengine/Converter/BL_ActionActuator.cpp

===

diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp 
b/source/gameengine/Converter/BL_ActionActuator.cpp
index b606cd1..f8c5ffb 100644
--- a/source/gameengine/Converter/BL_ActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ActionActuator.cpp
@@ -254,17 +254,13 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
// Handle a finished animation
if ((m_flag  ACT_FLAG_PLAY_END)  (m_flag  ACT_FLAG_ACTIVE)  
obj-IsActionDone(m_layer))
{
+   m_flag = ~ACT_FLAG_ACTIVE;
+   m_flag = ~ACT_FLAG_ATTEMPT_PLAY;
+
if (m_playtype == ACT_ACTION_PINGPONG)
-   {
m_flag ^= ACT_FLAG_REVERSE;
-   }
else
-   {
-   m_flag = ~ACT_FLAG_ACTIVE;
-   m_flag = ~ACT_FLAG_ATTEMPT_PLAY;
-
return false;
-   }
}

// If a different action is playing, we've been overruled and are no 
longer active

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [3442a65] master: BGE Cleanup: Reducing KX_Scene's dependence on Bullet.

2014-04-23 Thread Mitchell Stokes
Commit: 3442a658fc24267d0fd77da72eb7b254e7079c65
Author: Mitchell Stokes
Date:   Wed Apr 23 14:08:49 2014 -0700
https://developer.blender.org/rB3442a658fc24267d0fd77da72eb7b254e7079c65

BGE Cleanup: Reducing KX_Scene's dependence on Bullet.

Instead, it now relies more on our physics abstractions (e.g.,
PHY_IPhysicsEnvironment).

===

M   source/gameengine/Ketsji/KX_Scene.cpp
M   source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
M   source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
M   source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h
M   source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h

===

diff --git a/source/gameengine/Ketsji/KX_Scene.cpp 
b/source/gameengine/Ketsji/KX_Scene.cpp
index 64ba17f..5088551 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -84,6 +84,7 @@
 #include NG_NetworkScene.h
 #include PHY_IPhysicsEnvironment.h
 #include PHY_IGraphicController.h
+#include PHY_IPhysicsController.h
 #include KX_BlenderSceneConverter.h
 #include KX_MotionState.h
 
@@ -95,8 +96,6 @@
 #ifdef WITH_BULLET
 #include KX_SoftBodyDeformer.h
 #include KX_ConvertPhysicsObject.h
-#include CcdPhysicsEnvironment.h
-#include CcdPhysicsController.h
 #endif
 
 #include KX_Light.h
@@ -565,7 +564,6 @@ KX_GameObject* KX_Scene::AddNodeReplicaObject(class 
SG_IObject* node, class CVal
newobj-SetGraphicController(newctrl);
}
 
-#ifdef WITH_BULLET
// replicate physics controller
if (orgobj-GetPhysicsController())
{
@@ -582,7 +580,6 @@ KX_GameObject* KX_Scene::AddNodeReplicaObject(class 
SG_IObject* node, class CVal
if (parent)
parent-Release();
}
-#endif
 
return newobj;
 }
@@ -1882,12 +1879,10 @@ static void MergeScene_LogicBrick(SCA_ILogicBrick* 
brick, KX_Scene *to)
brick-Replace_NetworkScene(to-GetNetworkScene());
 
/* near sensors have physics controllers */
-#ifdef WITH_BULLET
KX_TouchSensor *touch_sensor = dynamic_castclass KX_TouchSensor 
*(brick);
if (touch_sensor) {

touch_sensor-GetPhysicsController()-SetPhysicsEnvironment(to-GetPhysicsEnvironment());
}
-#endif
 
// If we end up replacing a KX_TouchEventManager, we need to make sure
// physics controllers are properly in place. In other words, do this
@@ -1916,10 +1911,6 @@ static void MergeScene_LogicBrick(SCA_ILogicBrick* 
brick, KX_Scene *to)
 #endif
 }
 
-#ifdef WITH_BULLET
-#include CcdGraphicController.h // XXX  
ctrl-SetPhysicsEnvironment(to-GetPhysicsEnvironment());
-#endif
-
 static void MergeScene_GameObject(KX_GameObject* gameobj, KX_Scene *to, 
KX_Scene *from)
 {
{
@@ -1972,12 +1963,10 @@ static void MergeScene_GameObject(KX_GameObject* 
gameobj, KX_Scene *to, KX_Scene
ctrl-SetPhysicsEnvironment(to-GetPhysicsEnvironment());
}
 
-#ifdef WITH_BULLET
ctrl = gameobj-GetPhysicsController();
if (ctrl) {
ctrl-SetPhysicsEnvironment(to-GetPhysicsEnvironment());
}
-#endif
 
/* SG_Node can hold a scene reference */
SG_Node *sg= gameobj-GetSGNode();
@@ -2008,9 +1997,8 @@ static void MergeScene_GameObject(KX_GameObject* gameobj, 
KX_Scene *to, KX_Scene
 
 bool KX_Scene::MergeScene(KX_Scene *other)
 {
-#ifdef WITH_BULLET
-   CcdPhysicsEnvironment *env= 
dynamic_castCcdPhysicsEnvironment *(this-GetPhysicsEnvironment());
-   CcdPhysicsEnvironment *env_other=   
dynamic_castCcdPhysicsEnvironment *(other-GetPhysicsEnvironment());
+   PHY_IPhysicsEnvironment *env = this-GetPhysicsEnvironment();
+   PHY_IPhysicsEnvironment *env_other = other-GetPhysicsEnvironment();
 
if ((env==NULL) != (env_other==NULL)) /* TODO - even when both scenes 
have NONE physics, the other is loaded with bullet enabled, ??? */
{
@@ -2018,7 +2006,6 @@ bool KX_Scene::MergeScene(KX_Scene *other)
printf(\tsource %d, terget %d\n, (int)(env!=NULL), 
(int)(env_other!=NULL));
return false;
}
-#endif // WITH_BULLET
 
if (GetSceneConverter() != other-GetSceneConverter()) {
printf(KX_Scene::MergeScene: converters differ, aborting\n);
@@ -2060,10 +2047,8 @@ bool KX_Scene::MergeScene(KX_Scene *other)
GetLightList()-MergeList(other-GetLightList());
other-GetLightList()-ReleaseAndRemoveAll();
 
-#ifdef WITH_BULLET
-   if (env) /* bullet scene? - dummy scenes don't need touching */
+   if (env)
env-MergeEnvironment(env_other);
-#endif
 
/* move materials across, assume they both use the same scene-converters
 * Do this after lights are merged so materials can use the lights in 
shaders
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp

[Bf-blender-cvs] [81e28b8] master: BGE Cleanup: Removing the empty KX_ClearBulletSharedShapes() function

2014-04-23 Thread Mitchell Stokes
Commit: 81e28b8802a65a3efd6410e75a3fb92a21ed69a3
Author: Mitchell Stokes
Date:   Wed Apr 23 13:59:04 2014 -0700
https://developer.blender.org/rB81e28b8802a65a3efd6410e75a3fb92a21ed69a3

BGE Cleanup: Removing the empty KX_ClearBulletSharedShapes() function

===

M   source/gameengine/Converter/KX_BlenderSceneConverter.cpp
M   source/gameengine/Ketsji/KX_ConvertPhysicsObject.h
M   source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp

===

diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp 
b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
index 854e9fe..6b7a53c 100644
--- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
+++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
@@ -190,9 +190,6 @@ KX_BlenderSceneConverter::~KX_BlenderSceneConverter()
}
m_meshobjects.clear();
 
-#ifdef WITH_BULLET
-   KX_ClearBulletSharedShapes();
-#endif
 
/* free any data that was dynamically loaded */
while (m_DynamicMaggie.size() != 0)
diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h 
b/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h
index 5e2556b..4f341d7 100644
--- a/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h
+++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h
@@ -47,8 +47,7 @@ void  KX_ConvertBulletObject(classKX_GameObject* gameobj,
int activeLayerBitInfo,
bool isCompoundChild,
bool hasCompoundChildren);
-   
-void   KX_ClearBulletSharedShapes();
+
 bool KX_ReInstanceBulletShapeFromMesh(KX_GameObject *gameobj, KX_GameObject 
*from_gameobj, RAS_MeshObject* from_meshobj);
 
 #endif
diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp 
b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
index f1a52e1..5791c9f 100644
--- a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
+++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
@@ -567,11 +567,6 @@ void   KX_ConvertBulletObject( class   KX_GameObject* 
gameobj,
 
 }
 
-
-void   KX_ClearBulletSharedShapes()
-{
-}
-
 /* Refresh the physics object from either an object or a mesh.
  * gameobj must be valid
  * from_gameobj and from_meshobj can be NULL

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [8cee587] master: BGE Cleanup: Physics conversion is now handled by PHY_IPhysicsEnvironment

2014-04-23 Thread Mitchell Stokes
Commit: 8cee587bcb44b24cc17a9d6527a63d19dade4e5d
Author: Mitchell Stokes
Date:   Wed Apr 23 18:39:33 2014 -0700
https://developer.blender.org/rB8cee587bcb44b24cc17a9d6527a63d19dade4e5d

BGE Cleanup: Physics conversion is now handled by PHY_IPhysicsEnvironment

The current physics conversion code was moved from
KX_ConvertPhysicsObjects to CcdPhysicsEnvironment.

===

M   source/gameengine/Converter/BL_BlenderDataConversion.cpp
M   source/gameengine/Ketsji/KX_ConvertPhysicsObject.h
M   source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
M   source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
M   source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h
M   source/gameengine/Physics/Dummy/DummyPhysicsEnvironment.h
M   source/gameengine/Physics/common/PHY_IPhysicsEnvironment.h

===

diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp 
b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index 3501add..47d25c5 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -80,6 +80,7 @@
 #include SCA_TimeEventManager.h
 #include KX_Light.h
 #include KX_Camera.h
+#include KX_ClientObjectInfo.h
 #include KX_EmptyObject.h
 #include KX_FontObject.h
 #include MT_Point3.h
@@ -1359,7 +1360,6 @@ static void BL_CreatePhysicsObjectNew(KX_GameObject* 
gameobj,
   RAS_MeshObject* meshobj,
   KX_Scene* kxscene,
   int activeLayerBitInfo,
-  e_PhysicsEngine  physics_engine,
   KX_BlenderSceneConverter *converter,
   bool processCompoundChildren
   )
@@ -1413,19 +1413,31 @@ static void BL_CreatePhysicsObjectNew(KX_GameObject* 
gameobj,
DerivedMesh* dm = NULL;
if (gameobj-GetDeformer())
dm = gameobj-GetDeformer()-GetPhysicsMesh();
-   
-   switch (physics_engine)
-   {
-#ifdef WITH_BULLET
-   case UseBullet:
-   KX_ConvertBulletObject(gameobj, meshobj, dm, kxscene, 
shapeprops, smmaterial, activeLayerBitInfo, isCompoundChild, 
hasCompoundChildren);
-   break;
 
-#endif
-   case UseNone:
-   default:
-   break;
+   class PHY_IMotionState* motionstate = new 
KX_MotionState(gameobj-GetSGNode());
+
+   kxscene-GetPhysicsEnvironment()-ConvertObject(gameobj, meshobj, dm, 
kxscene, shapeprops, smmaterial, motionstate, activeLayerBitInfo, 
isCompoundChild, hasCompoundChildren);
+
+   bool isActor = (blenderobject-gameflag  OB_ACTOR)!=0;
+   bool isSensor = (blenderobject-gameflag  OB_SENSOR) != 0;
+   gameobj-getClientInfo()-m_type =
+   (isSensor) ? ((isActor) ? KX_ClientObjectInfo::OBACTORSENSOR : 
KX_ClientObjectInfo::OBSENSOR) :
+   (isActor) ? KX_ClientObjectInfo::ACTOR : 
KX_ClientObjectInfo::STATIC;
+
+   // should we record animation for this object?
+   if ((blenderobject-gameflag  OB_RECORD_ANIMATION) != 0)
+   gameobj-SetRecordAnimation(true);
+
+   // store materialname in auxinfo, needed for touchsensors
+   if (meshobj)
+   {
+   const STR_String matname=meshobj-GetMaterialName(0);
+   gameobj-getClientInfo()-m_auxilary_info = (matname.Length() ? 
(void*)(matname.ReadPtr()+2) : NULL);
+   } else
+   {
+   gameobj-getClientInfo()-m_auxilary_info = 0;
}
+
delete shapeprops;
delete smmaterial;
if (dm) {
@@ -2342,7 +2354,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
meshobj = gameobj-GetMesh(0);
}
int layerMask = (groupobj.find(blenderobject) == 
groupobj.end()) ? activeLayerBitInfo : 0;
-   
BL_CreatePhysicsObjectNew(gameobj,blenderobject,meshobj,kxscene,layerMask,physics_engine,converter,processCompoundChildren);
+   
BL_CreatePhysicsObjectNew(gameobj,blenderobject,meshobj,kxscene,layerMask,converter,processCompoundChildren);
}
 
processCompoundChildren = true;
@@ -2358,7 +2370,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
meshobj = gameobj-GetMesh(0);
}
int layerMask = (groupobj.find(blenderobject) == 
groupobj.end()) ? activeLayerBitInfo : 0;
-   
BL_CreatePhysicsObjectNew(gameobj,blenderobject,meshobj,kxscene,layerMask,physics_engine,converter,processCompoundChildren);
+   
BL_CreatePhysicsObjectNew(gameobj,blenderobject,meshobj,kxscene,layerMask,converter,processCompoundChildren);
}

//set ini linearVel and int

[Bf-blender-cvs] [89c61b2] master: BGE Cleanup: Reducing KX_BlenderSceneConverter's dependence on Bullet.

2014-04-23 Thread Mitchell Stokes
Commit: 89c61b20f019766fa57835b3548c4f84d36f6214
Author: Mitchell Stokes
Date:   Wed Apr 23 17:53:25 2014 -0700
https://developer.blender.org/rB89c61b20f019766fa57835b3548c4f84d36f6214

BGE Cleanup: Reducing KX_BlenderSceneConverter's dependence on Bullet.

  * Moving the BlenderDebugDraw (derived from btIDebugDraw) from
KX_BlenderSceneConverter to CcdPhysicsEnvironment
  * Moving CcdPhysicsEnvironment initialization to CcdPhysicsEnvironment
(this could probably be cleaned up some more with some sort of
factory, or at least moving code to CcdPhysicsEnvironment's
constructor)
  * Simplifying physics environment initialization (went from two
switches to one)

===

M   source/gameengine/Converter/KX_BlenderSceneConverter.cpp
M   source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
M   source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.h

===

diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp 
b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
index 6b7a53c..1df5184 100644
--- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
+++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
@@ -246,60 +246,6 @@ Scene 
*KX_BlenderSceneConverter::GetBlenderSceneForName(const STR_String name)
 
 }
 
-#ifdef WITH_BULLET
-
-#include LinearMath/btIDebugDraw.h
-
-
-struct BlenderDebugDraw : public btIDebugDraw
-{
-   BlenderDebugDraw () :
-   m_debugMode(0) 
-   {
-   }
-   
-   int m_debugMode;
-
-   virtual voiddrawLine(const btVector3 from,const btVector3 
to,const btVector3 color)
-   {
-   if (m_debugMode 0)
-   {
-   MT_Vector3 kxfrom(from[0],from[1],from[2]);
-   MT_Vector3 kxto(to[0],to[1],to[2]);
-   MT_Vector3 kxcolor(color[0],color[1],color[2]);
-
-   KX_RasterizerDrawDebugLine(kxfrom,kxto,kxcolor);
-   }
-   }
-   
-   virtual voidreportErrorWarning(const char* warningString)
-   {
-
-   }
-
-   virtual voiddrawContactPoint(const btVector3 PointOnB,const 
btVector3 normalOnB,float distance,int lifeTime,const btVector3 color)
-   {
-   //not yet
-   }
-
-   virtual voidsetDebugMode(int debugMode)
-   {
-   m_debugMode = debugMode;
-   }
-   virtual int getDebugMode() const
-   {
-   return m_debugMode;
-   }
-   ///todo: find out if Blender can do this
-   virtual voiddraw3dText(const btVector3 location,const char* 
textString)
-   {
-
-   }
-   
-};
-
-#endif
-
 void KX_BlenderSceneConverter::ConvertScene(class KX_Scene* destinationscene,

class RAS_IRasterizer* rendertools,

class RAS_ICanvas* canvas,
@@ -308,8 +254,9 @@ void KX_BlenderSceneConverter::ConvertScene(class KX_Scene* 
destinationscene,
//find out which physics engine
Scene *blenderscene = destinationscene-GetBlenderScene();
 
+   PHY_IPhysicsEnvironment *phy_env = NULL;
+
e_PhysicsEngine physics_engine = UseBullet;
-   bool useDbvtCulling = false;
// hook for registration function during conversion.
m_currentScene = destinationscene;
destinationscene-SetSceneConverter(this);
@@ -318,56 +265,31 @@ void KX_BlenderSceneConverter::ConvertScene(class 
KX_Scene* destinationscene,
// when doing threaded conversion, so it's disabled for now.
// SG_SetActiveStage(SG_STAGE_CONVERTER);
 
-   if (blenderscene)
+   switch (blenderscene-gm.physicsEngine)
{
-   
-   switch (blenderscene-gm.physicsEngine)
+#ifdef WITH_BULLET
+   case WOPHY_BULLET:
{
-   case WOPHY_BULLET:
-   {
-   physics_engine = UseBullet;
-   useDbvtCulling = (blenderscene-gm.mode  
WO_DBVT_CULLING) != 0;
-   break;
-   }
-   default:
-   case WOPHY_NONE:
-   {
-   physics_engine = UseNone;
-   break;
-   }
-   }
-   }
+   SYS_SystemHandle syshandle = SYS_GetSystem(); /*unused*/
+   int visualizePhysics = 
SYS_GetCommandLineInt(syshandle,show_physics,0);
 
-   switch (physics_engine)
-   {
-#ifdef WITH_BULLET
-   case UseBullet:
-   {
-   CcdPhysicsEnvironment* ccdPhysEnv = new 
CcdPhysicsEnvironment

[Bf-blender-cvs] [f5c3c62] master: BGE Cleanup: Moving reinstancing physics shapes from KX_ConvertPhysicsObject to PHY_IPhysicsController

2014-04-23 Thread Mitchell Stokes
Commit: f5c3c624f8e62f266994be42fa4c85ce579321c0
Author: Mitchell Stokes
Date:   Wed Apr 23 19:37:54 2014 -0700
https://developer.blender.org/rBf5c3c624f8e62f266994be42fa4c85ce579321c0

BGE Cleanup: Moving reinstancing physics shapes from KX_ConvertPhysicsObject to 
PHY_IPhysicsController

This was the last item in KX_ConvertPhysicsObject. Therefore,
KX_ConvertPhysicsObject.h and KX_ConvertPhysicsObjects.cpp have been
removed.

===

M   source/gameengine/Converter/BL_BlenderDataConversion.cpp
M   source/gameengine/Converter/KX_BlenderSceneConverter.cpp
M   source/gameengine/Converter/KX_SoftBodyDeformer.cpp
M   source/gameengine/Ketsji/CMakeLists.txt
D   source/gameengine/Ketsji/KX_ConvertPhysicsObject.h
D   source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
M   source/gameengine/Ketsji/KX_GameObject.cpp
M   source/gameengine/Ketsji/KX_MeshProxy.cpp
M   source/gameengine/Ketsji/KX_Scene.cpp
M   source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
M   source/gameengine/Physics/Bullet/CcdPhysicsController.h
M   source/gameengine/Physics/common/PHY_IPhysicsController.h

===

diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp 
b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index 47d25c5..2fefea7 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -180,7 +180,6 @@ extern Material defmaterial;/* material.c */
 #include SG_BBox.h
 #include SG_Tree.h
 
-#include KX_ConvertPhysicsObject.h
 #ifdef WITH_BULLET
 #include CcdPhysicsEnvironment.h
 #include CcdGraphicController.h
diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp 
b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
index 1df5184..bad99b5 100644
--- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
+++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
@@ -50,7 +50,6 @@
 
 #include DummyPhysicsEnvironment.h
 
-#include KX_ConvertPhysicsObject.h
 
 #ifdef WITH_BULLET
 #include CcdPhysicsEnvironment.h
diff --git a/source/gameengine/Converter/KX_SoftBodyDeformer.cpp 
b/source/gameengine/Converter/KX_SoftBodyDeformer.cpp
index fcd..877aebf 100644
--- a/source/gameengine/Converter/KX_SoftBodyDeformer.cpp
+++ b/source/gameengine/Converter/KX_SoftBodyDeformer.cpp
@@ -36,7 +36,6 @@
 
 #include MT_assert.h
 
-#include KX_ConvertPhysicsObject.h
 #include KX_SoftBodyDeformer.h
 #include RAS_MeshObject.h
 #include CTR_Map.h
diff --git a/source/gameengine/Ketsji/CMakeLists.txt 
b/source/gameengine/Ketsji/CMakeLists.txt
index 141dd5e..09ef167 100644
--- a/source/gameengine/Ketsji/CMakeLists.txt
+++ b/source/gameengine/Ketsji/CMakeLists.txt
@@ -77,7 +77,6 @@ set(SRC
KX_CharacterWrapper.cpp
KX_ConstraintActuator.cpp
KX_ConstraintWrapper.cpp
-   KX_ConvertPhysicsObjects.cpp
KX_Dome.cpp
KX_EmptyObject.cpp
KX_FontObject.cpp
@@ -151,7 +150,6 @@ set(SRC
KX_ClientObjectInfo.h
KX_ConstraintActuator.h
KX_ConstraintWrapper.h
-   KX_ConvertPhysicsObject.h
KX_Dome.h
KX_EmptyObject.h
KX_FontObject.h
diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h 
b/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h
deleted file mode 100644
index efe4f2e..000
--- a/source/gameengine/Ketsji/KX_ConvertPhysicsObject.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 *
- */
-
-/** \file KX_ConvertPhysicsObject.h
- *  \ingroup ketsji
- */
-
-#ifndef __KX_CONVERTPHYSICSOBJECT_H__
-#define __KX_CONVERTPHYSICSOBJECT_H__
-
-class KX_GameObject;
-class RAS_MeshObject;
-
-#ifdef WITH_BULLET
-
-bool KX_ReInstanceBulletShapeFromMesh(KX_GameObject *gameobj, KX_GameObject 
*from_gameobj, RAS_MeshObject* from_meshobj);
-
-#endif
-#endif  /* __KX_CONVERTPHYSICSOBJECT_H__ */
diff --git

[Bf-blender-cvs] [0f91d2c] master: Fix T39458: Switching physics type from Character to Dynamic enables ghost flag silently

2014-04-22 Thread Mitchell Stokes
Commit: 0f91d2cec9fce85c5557c5669da6685180b756cb
Author: Mitchell Stokes
Date:   Tue Apr 22 16:38:34 2014 -0700
https://developer.blender.org/rB0f91d2cec9fce85c5557c5669da6685180b756cb

Fix T39458: Switching physics type from Character to Dynamic enables ghost flag 
silently

Enabling ghost for Sensors and Characters is now done in conversion
rather than when setting the RNA.

===

M   source/blender/makesrna/intern/rna_object.c
M   source/gameengine/Converter/BL_BlenderDataConversion.cpp

===

diff --git a/source/blender/makesrna/intern/rna_object.c 
b/source/blender/makesrna/intern/rna_object.c
index 4a81780..3807329 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -987,7 +987,7 @@ static void 
rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value)
 
switch (ob-body_type) {
case OB_BODY_TYPE_SENSOR:
-   ob-gameflag |= OB_SENSOR | OB_COLLISION | OB_GHOST;
+   ob-gameflag |= OB_SENSOR | OB_COLLISION;
ob-gameflag = ~(OB_OCCLUDER | OB_CHARACTER | 
OB_DYNAMIC | OB_RIGID_BODY | OB_SOFT_BODY | OB_ACTOR |
  OB_ANISOTROPIC_FRICTION | OB_DO_FH | 
OB_ROT_FH | OB_COLLISION_RESPONSE | OB_NAVMESH);
break;
@@ -1009,7 +1009,7 @@ static void 
rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value)
ob-gameflag = ~(OB_SENSOR | OB_RIGID_BODY | 
OB_SOFT_BODY | OB_COLLISION | OB_CHARACTER | OB_OCCLUDER | OB_DYNAMIC | 
OB_NAVMESH);
break;
case OB_BODY_TYPE_CHARACTER:
-   ob-gameflag |= OB_COLLISION | OB_GHOST | OB_CHARACTER;
+   ob-gameflag |= OB_COLLISION | OB_CHARACTER;
ob-gameflag = ~(OB_SENSOR | OB_OCCLUDER | OB_DYNAMIC 
| OB_RIGID_BODY | OB_SOFT_BODY | OB_ACTOR |
  OB_ANISOTROPIC_FRICTION | OB_DO_FH | 
OB_ROT_FH | OB_COLLISION_RESPONSE | OB_NAVMESH);
break;
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp 
b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index f03f4a9..041dde2 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -1645,7 +1645,7 @@ static void BL_CreatePhysicsObjectNew(KX_GameObject* 
gameobj,
}
}
 
-   objprop.m_ghost = (blenderobject-gameflag  OB_GHOST) != 0;
+   objprop.m_ghost = (blenderobject-gameflag  (OB_GHOST | OB_SENSOR | 
OB_CHARACTER)) != 0;
objprop.m_disableSleeping = (blenderobject-gameflag  
OB_COLLISION_RESPONSE) != 0;//abuse the OB_COLLISION_RESPONSE flag
//mmm, for now, taks this for the size of the dynamicobject
// Blender uses inertia for radius of dynamic object

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [df1a199] master: BGE Cleanup: Removing KX_ObjectProperties, KX_BoundBoxClass, KX_BoxBounds, and KX_CBounds

2014-04-22 Thread Mitchell Stokes
Commit: df1a199787a59e5e2af09df56d9f9ebce779f6d9
Author: Mitchell Stokes
Date:   Tue Apr 22 20:12:22 2014 -0700
https://developer.blender.org/rBdf1a199787a59e5e2af09df56d9f9ebce779f6d9

BGE Cleanup: Removing KX_ObjectProperties, KX_BoundBoxClass, KX_BoxBounds, and 
KX_CBounds

These were used in BL_CreatePhysicsObjectNew() in the converter. However, all
of the data put into KX_ObjectProperties was then copied again in
KX_ConvertBulletObject(). So, instead KX_ConvertBulletObject() now gathers the
information it needs itself, which avoid this odd double conversion step for
physics.

As a side-effect, the old code would result in static non-mesh objects with no 
bounds
set to still have triangle mesh bounds. This would result in no bounds for 
these objects.
If a bounds was set that required a mesh, non-mesh objects would become sphere 
bounds.
This is now true regardless of whether user bounds were set. In other words, 
static
non-mesh objects now use sphere bounds by default instead of mesh bounds. This 
might
slightly alter some games, but these objects should generally be set to No 
Collision
anyways.

===

M   source/gameengine/Converter/BL_BlenderDataConversion.cpp
M   source/gameengine/Ketsji/KX_ConvertPhysicsObject.h
M   source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp

===

diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp 
b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index 041dde2..b5c9f7a 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -1312,121 +1312,6 @@ static float my_boundbox_mesh(Mesh *me, float *loc, 
float *size)
return sqrtf_signed(radius_sq);
 }
 
-
-static void my_tex_space_mesh(Mesh *me)
-{
-   KeyBlock *kb;
-   float *fp, loc[3], size[3], min[3], max[3];
-   int a;
-
-   my_boundbox_mesh(me, loc, size);
-   
-   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; akb-totelem; a++, fp += 3) {
-   minmax_v3v3_v3(min, max, fp);
-   }
-   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;
-   }
-   else {
-   loc[0] = loc[1] = loc[2] = 0.0;
-   size[0] = size[1] = size[2] = 0.0;
-   }
-   
-   }
-   }
-
-   copy_v3_v3(me-loc, loc);
-   copy_v3_v3(me-size, size);
-   me-rot[0] = me-rot[1] = me-rot[2] = 0.0f;
-
-   if (me-size[0] == 0.0f) me-size[0] = 1.0f;
-   else if (me-size[0]  0.0f  me-size[0] 0.1f) 
me-size[0] = 0.1f;
-   else if (me-size[0]  0.0f  me-size[0] -0.1f) 
me-size[0] = -0.1f;
-
-   if (me-size[1] == 0.0f) me-size[1] = 1.0f;
-   else if (me-size[1]  0.0f  me-size[1] 0.1f) 
me-size[1] = 0.1f;
-   else if (me-size[1]  0.0f  me-size[1] -0.1f) 
me-size[1] = -0.1f;
-
-   if (me-size[2] == 0.0f) me-size[2] = 1.0f;
-   else if (me-size[2]  0.0f  me-size[2] 0.1f) 
me-size[2] = 0.1f;
-   else if (me-size[2]  0.0f  me-size[2] -0.1f) 
me-size[2] = -0.1f;
-   }
-   
-}
-
-static void my_get_local_bounds(Object *ob, DerivedMesh *dm, float *center, 
float *size)
-{
-   BoundBox *bb= NULL;
-   /* uses boundbox, function used by Ketsji */
-   switch (ob-type)
-   {
-   case OB_MESH:
-   if (dm)
-   {
-   float min_r[3], max_r[3];
-   INIT_MINMAX(min_r, max_r);
-   dm-getMinMax(dm, min_r, max_r);
-   size[0] = 0.5f * fabsf(max_r[0] - min_r[0]);
-   size[1] = 0.5f * fabsf(max_r[1] - min_r[1]);
-   size[2] = 0.5f * fabsf(max_r[2] - min_r[2]);
-   
-   center[0] = 0.5f * (max_r[0] + min_r[0]);
-   center[1] = 0.5f * (max_r[1] + min_r[1]);
-   center[2] = 0.5f * (max_r[2] + min_r[2

[Bf-blender-cvs] [4609593] master: BGE Cleanup: Removing all of the my_* functions in KX_ConvertPhysicsObjects.cpp that were used to get bounds information

2014-04-22 Thread Mitchell Stokes
Commit: 4609593a178c98e0c3487edafe5595c494c0c2c0
Author: Mitchell Stokes
Date:   Tue Apr 22 20:36:36 2014 -0700
https://developer.blender.org/rB4609593a178c98e0c3487edafe5595c494c0c2c0

BGE Cleanup: Removing all of the my_* functions in KX_ConvertPhysicsObjects.cpp 
that were used to get bounds information

Now we just use BKE_object_boundbox_get().

===

M   source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp

===

diff --git a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp 
b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
index 8832d97..f1a52e1 100644
--- a/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
+++ b/source/gameengine/Ketsji/KX_ConvertPhysicsObjects.cpp
@@ -56,8 +56,6 @@
 
 extern C{
#include BLI_utildefines.h
-   #include BLI_math.h
-   #include BKE_DerivedMesh.h
#include BKE_object.h
 }
 
@@ -86,177 +84,6 @@ extern C{
 #endif //_MSC_VER 
 #endif //WIN32
 
-// my_tex_space_mesh and my_get_local_bounds were moved from 
BL_BlenderDataConversion.cpp (my_boundbox_mesh is just copied)
-// there has to be a better way to do this...
-static float my_boundbox_mesh(Mesh *me, float *loc, float *size)
-{
-   MVert *mvert;
-   BoundBox *bb;
-   float min[3], max[3];
-   float mloc[3], msize[3];
-   float radius_sq=0.0f, vert_radius_sq, *co;
-   int a;
-
-   if (me-bb==0) {
-   me-bb = BKE_boundbox_alloc_unit();
-   }
-   bb= me-bb;
-
-   INIT_MINMAX(min, max);
-
-   if (!loc) loc= mloc;
-   if (!size) size= msize;
-
-   mvert= me-mvert;
-   for (a = 0; ame-totvert; a++, mvert++) {
-   co = mvert-co;
-
-   /* bounds */
-   minmax_v3v3_v3(min, max, co);
-
-   /* radius */
-
-   vert_radius_sq = len_squared_v3(co);
-   if (vert_radius_sq  radius_sq)
-   radius_sq = vert_radius_sq;
-   }
-
-   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;
-
-   size[0] = (max[0] - min[0]) / 2.0f;
-   size[1] = (max[1] - min[1]) / 2.0f;
-   size[2] = (max[2] - min[2]) / 2.0f;
-   }
-   else {
-   loc[0] = loc[1] = loc[2] = 0.0f;
-   size[0] = size[1] = size[2] = 0.0f;
-   }
-
-   bb-vec[0][0] = bb-vec[1][0] = bb-vec[2][0] = bb-vec[3][0] = 
loc[0]-size[0];
-   bb-vec[4][0] = bb-vec[5][0] = bb-vec[6][0] = bb-vec[7][0] = 
loc[0]+size[0];
-
-   bb-vec[0][1] = bb-vec[1][1] = bb-vec[4][1] = bb-vec[5][1] = 
loc[1]-size[1];
-   bb-vec[2][1] = bb-vec[3][1] = bb-vec[6][1] = bb-vec[7][1] = 
loc[1]+size[1];
-
-   bb-vec[0][2] = bb-vec[3][2] = bb-vec[4][2] = bb-vec[7][2] = 
loc[2]-size[2];
-   bb-vec[1][2] = bb-vec[2][2] = bb-vec[5][2] = bb-vec[6][2] = 
loc[2]+size[2];
-
-   return sqrtf_signed(radius_sq);
-}
-
-static void my_tex_space_mesh(Mesh *me)
-{
-   KeyBlock *kb;
-   float *fp, loc[3], size[3], min[3], max[3];
-   int a;
-
-   my_boundbox_mesh(me, loc, size);
-
-   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; akb-totelem; a++, fp += 3) {
-   minmax_v3v3_v3(min, max, fp);
-   }
-   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;
-   }
-   else {
-   loc[0] = loc[1] = loc[2] = 0.0;
-   size[0] = size[1] = size[2] = 0.0;
-   }
-
-   }
-   }
-
-   copy_v3_v3(me-loc, loc);
-   copy_v3_v3(me-size, size);
-   me-rot[0] = me-rot[1] = me-rot[2] = 0.0f;
-
-   if (me-size[0] == 0.0f) me-size[0] = 1.0f;
-   else if (me-size[0]  0.0f  me-size[0] 0.1f) 
me-size[0] = 0.1f;
-   else if (me-size[0]  0.0f  me-size[0] -0.1f) 
me-size[0] = -0.1f;
-
-   if (me-size[1] == 0.0f) me-size[1] = 1.0f;
-   else if (me-size[1]  0.0f  me-size[1] 0.1f) 
me-size[1] = 0.1f;
-   else if (me-size[1]  0.0f  me-size[1] -0.1f) 
me-size[1] = -0.1f;
-
-   if (me-size[2] == 0.0f) me

[Bf-blender-cvs] [b4cb467] master: BGE: Fixing memory leaks when deactivating Sensors, Controllers, or actuators.

2014-04-19 Thread Mitchell Stokes
Commit: b4cb46735960c2f3c8842a06571eca168b6dcb8a
Author: Mitchell Stokes
Date:   Sat Apr 19 14:51:29 2014 -0700
https://developer.blender.org/rBb4cb46735960c2f3c8842a06571eca168b6dcb8a

BGE: Fixing memory leaks when deactivating Sensors, Controllers, or actuators.

Found by Coverity and confirmed with Valgrind.

===

M   source/gameengine/Converter/KX_ConvertActuators.cpp
M   source/gameengine/Converter/KX_ConvertControllers.cpp
M   source/gameengine/Converter/KX_ConvertSensors.cpp

===

diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp 
b/source/gameengine/Converter/KX_ConvertActuators.cpp
index d7578c3..b59c26a 100644
--- a/source/gameengine/Converter/KX_ConvertActuators.cpp
+++ b/source/gameengine/Converter/KX_ConvertActuators.cpp
@@ -1122,6 +1122,8 @@ void BL_ConvertActuators(const char* maggiename,
// done with baseact, release it
baseact-Release();
}
+   else if (baseact)
+   baseact-Release();

bact = bact-next;
}
diff --git a/source/gameengine/Converter/KX_ConvertControllers.cpp 
b/source/gameengine/Converter/KX_ConvertControllers.cpp
index cd7a560..0215b60 100644
--- a/source/gameengine/Converter/KX_ConvertControllers.cpp
+++ b/source/gameengine/Converter/KX_ConvertControllers.cpp
@@ -240,6 +240,8 @@ void BL_ConvertControllers(
//done with gamecontroller
gamecontroller-Release();
}
+   else if (gamecontroller)
+   gamecontroller-Release();

bcontr = bcontr-next;
}
diff --git a/source/gameengine/Converter/KX_ConvertSensors.cpp 
b/source/gameengine/Converter/KX_ConvertSensors.cpp
index 6ab382f..b3c6f6d 100644
--- a/source/gameengine/Converter/KX_ConvertSensors.cpp
+++ b/source/gameengine/Converter/KX_ConvertSensors.cpp
@@ -640,6 +640,9 @@ void BL_ConvertSensors(struct Object* blenderobject,
gamesensor-Release();

}
+   else if (gamesensor)
+   gamesensor-Release();
+
sens=sens-next;
}
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [d050577] master: Fix T39445: Async LibLoad Crash

2014-04-16 Thread Mitchell Stokes
Commit: d050577176366617bcfdc86f9dd659143e024648
Author: Mitchell Stokes
Date:   Wed Apr 16 01:15:40 2014 -0700
https://developer.blender.org/rBd050577176366617bcfdc86f9dd659143e024648

Fix T39445: Async LibLoad Crash

There was some deadlock due to trying manage Python's GIL. Instead of
continuing to fight with it, anything needing to call into Python while
conversion during lib loading is just delayed until it can be done in
the main thread.

===

M   source/gameengine/Converter/BL_BlenderDataConversion.cpp
M   source/gameengine/Converter/KX_ConvertControllers.cpp
M   source/gameengine/Converter/KX_ConvertControllers.h
M   source/gameengine/Ketsji/KX_Scene.cpp

===

diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp 
b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index b283330..f03f4a9 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -2874,7 +2874,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
struct Object* blenderobj = gameobj-GetBlenderObject();
int layerMask = (groupobj.find(blenderobj) == groupobj.end()) ? 
activeLayerBitInfo : 0;
bool isInActiveLayer = (blenderobj-lay  layerMask)!=0;
-   BL_ConvertControllers(blenderobj,gameobj,logicmgr, 
layerMask,isInActiveLayer,converter);
+   BL_ConvertControllers(blenderobj,gameobj,logicmgr, 
layerMask,isInActiveLayer,converter, libloading);
}
for ( i=0;ilogicbrick_conversionlist-GetCount();i++)
{
diff --git a/source/gameengine/Converter/KX_ConvertControllers.cpp 
b/source/gameengine/Converter/KX_ConvertControllers.cpp
index 5d3d0f3..ab5f161 100644
--- a/source/gameengine/Converter/KX_ConvertControllers.cpp
+++ b/source/gameengine/Converter/KX_ConvertControllers.cpp
@@ -94,7 +94,8 @@ void BL_ConvertControllers(
SCA_LogicManager* logicmgr,
int activeLayerBitInfo,
bool isInActiveLayer,
-   KX_BlenderSceneConverter* converter
+   KX_BlenderSceneConverter* converter,
+   bool libloading
 ) {
int uniqueint=0;
int count = 0;
@@ -157,8 +158,9 @@ void BL_ConvertControllers(
SCA_PythonController* pyctrl = new 
SCA_PythonController(gameobj, pycont-mode);
gamecontroller = pyctrl;
 #ifdef WITH_PYTHON
-   PyGILState_STATE gstate = PyGILState_Ensure();
-   
pyctrl-SetNamespace(converter-GetPyNamespace());
+   // When libloading, this is delayed to 
KX_Scene::MergeScene_LogicBrick to avoid GIL issues
+   if (!libloading)
+   
pyctrl-SetNamespace(converter-GetPyNamespace());

if 
(pycont-mode==SCA_PythonController::SCA_PYEXEC_SCRIPT) {
if (pycont-text)
@@ -185,8 +187,6 @@ void BL_ConvertControllers(
pyctrl-SetDebug(true);
}
}
-   
-   PyGILState_Release(gstate);
 #endif // WITH_PYTHON
 
break;
@@ -219,8 +219,8 @@ void BL_ConvertControllers(
converter-RegisterGameController(gamecontroller, 
bcontr);
 
 #ifdef WITH_PYTHON
-   PyGILState_STATE gstate = PyGILState_Ensure();
-   if (bcontr-type==CONT_PYTHON) {
+   // When libloading, this is delayed to 
KX_Scene::MergeScene_LogicBrick to avoid GIL issues
+   if (!libloading  bcontr-type==CONT_PYTHON) {
SCA_PythonController *pyctrl= 
static_castSCA_PythonController*(gamecontroller);
/* not strictly needed but gives syntax errors 
early on and
 * gives more predictable performance for 
larger scripts */
@@ -235,7 +235,6 @@ void BL_ConvertControllers(
}
}
 
-   PyGILState_Release(gstate);
 #endif // WITH_PYTHON
 
//done with gamecontroller
diff --git a/source/gameengine/Converter/KX_ConvertControllers.h 
b/source/gameengine/Converter/KX_ConvertControllers.h
index 817a49e..babe3e2 100644
--- a/source/gameengine/Converter/KX_ConvertControllers.h
+++ b/source/gameengine/Converter/KX_ConvertControllers.h
@@ -40,7 +40,8 @@ void BL_ConvertControllers(
class SCA_LogicManager* logicmgr,
int activeLayerBitInfo,
bool isInActiveLayer, 
-   class KX_BlenderSceneConverter* converter
+   class

[Bf-blender-cvs] [1ce726a] master: BGE: Allow skinned meshes with modifiers to do skinning updates in parallel.

2014-04-09 Thread Mitchell Stokes
Commit: 1ce726adb91ebcc5d51cc017ffd8776ac744a36c
Author: Mitchell Stokes
Date:   Wed Apr 9 17:04:17 2014 -0700
https://developer.blender.org/rB1ce726adb91ebcc5d51cc017ffd8776ac744a36c

BGE: Allow skinned meshes with modifiers to do skinning updates in parallel.

===

M   source/gameengine/Converter/BL_ModifierDeformer.cpp
M   source/gameengine/Ketsji/KX_Scene.cpp

===

diff --git a/source/gameengine/Converter/BL_ModifierDeformer.cpp 
b/source/gameengine/Converter/BL_ModifierDeformer.cpp
index 7e64d16..71dc1bd 100644
--- a/source/gameengine/Converter/BL_ModifierDeformer.cpp
+++ b/source/gameengine/Converter/BL_ModifierDeformer.cpp
@@ -197,6 +197,15 @@ bool BL_ModifierDeformer::Update(void)
}
m_lastModifierUpdate=m_gameobj-GetLastFrame();
bShapeUpdate = true;
+
+   int nmat = m_pMeshObject-NumMaterials();
+   for (int imat=0; imatnmat; imat++) {
+   RAS_MeshMaterial *mmat = 
m_pMeshObject-GetMeshMaterial(imat);
+   RAS_MeshSlot **slot = mmat-m_slots[(void*)m_gameobj];
+   if (!slot || !*slot)
+   continue;
+   (*slot)-m_pDerivedMesh = m_dm;
+   }
}
return bShapeUpdate;
 }
@@ -206,14 +215,5 @@ bool BL_ModifierDeformer::Apply(RAS_IPolyMaterial *mat)
if (!Update())
return false;
 
-   // drawing is based on derived mesh, must set it in the mesh slots
-   int nmat = m_pMeshObject-NumMaterials();
-   for (int imat=0; imatnmat; imat++) {
-   RAS_MeshMaterial *mmat = m_pMeshObject-GetMeshMaterial(imat);
-   RAS_MeshSlot **slot = mmat-m_slots[(void*)m_gameobj];
-   if (!slot || !*slot)
-   continue;
-   (*slot)-m_pDerivedMesh = m_dm;
-   }
return true;
 }
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp 
b/source/gameengine/Ketsji/KX_Scene.cpp
index e125dec..2e56029 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -1601,7 +1601,6 @@ void KX_Scene::AddAnimatedObject(CValue* gameobj)
 static void update_anim_thread_func(TaskPool *pool, void *taskdata, int 
UNUSED(threadid))
 {
KX_GameObject *gameobj, *child;
-   RAS_Deformer *deformer;
CListValue *children;
bool needs_update;
double curtime = *(double*)BLI_task_pool_userdata(pool);
@@ -1649,12 +1648,7 @@ static void update_anim_thread_func(TaskPool *pool, void 
*taskdata, int UNUSED(t
for (int j=0; jchildren-GetCount(); ++j) {
child = (KX_GameObject*)children-GetValue(j);
 
-   deformer = child-GetDeformer();
-
-   // This check is ugly, but the modifier deformer 
currently doesn't
-   // work if called from here. This is a quick 
work-around to prevent
-   // crashing, but it really should be fixed.
-   if (deformer  
!dynamic_castBL_ModifierDeformer*(deformer)) {
+   if (child-GetDeformer()) {
child-GetDeformer()-Update();
}
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [fe05f97] master: BGE: Multi-threading animation updates and skinning.

2014-04-06 Thread Mitchell Stokes
Commit: fe05f97841c0ee3e2a6e15f2252ad160fefc3509
Author: Mitchell Stokes
Date:   Sun Apr 6 16:30:59 2014 -0700
https://developer.blender.org/rBfe05f97841c0ee3e2a6e15f2252ad160fefc3509

BGE: Multi-threading animation updates and skinning.

This required BL_ArmatureObject to have tighter control over armatures and 
poses.
Also, (Blender) armature objects are now copied instead of shared between
BL_ArmatureObjects to avoid race conditions. Also, due to the armature copy,
shape key drivers need a bit of extra fiddling to get the correct armature copy.

Initially OpenMP was used for threading, but then BLI_task was used due to being
less compiler dependent.

This commit also places time spent on skinning updates in the Animation
profiler category (was previously under the Rasterizer category).

===

M   source/gameengine/Converter/BL_ActionActuator.cpp
M   source/gameengine/Converter/BL_ActionActuator.h
M   source/gameengine/Converter/BL_ArmatureActuator.cpp
M   source/gameengine/Converter/BL_ArmatureObject.cpp
M   source/gameengine/Converter/BL_ArmatureObject.h
M   source/gameengine/Converter/BL_BlenderDataConversion.cpp
M   source/gameengine/Converter/BL_ShapeDeformer.cpp
M   source/gameengine/Converter/BL_ShapeDeformer.h
M   source/gameengine/Converter/BL_SkinDeformer.cpp
M   source/gameengine/Ketsji/BL_Action.cpp
M   source/gameengine/Ketsji/BL_Action.h
M   source/gameengine/Ketsji/KX_KetsjiEngine.cpp
M   source/gameengine/Ketsji/KX_KetsjiEngine.h
M   source/gameengine/Ketsji/KX_Scene.cpp

===

diff --git a/source/gameengine/Converter/BL_ActionActuator.cpp 
b/source/gameengine/Converter/BL_ActionActuator.cpp
index a289062..34d3684 100644
--- a/source/gameengine/Converter/BL_ActionActuator.cpp
+++ b/source/gameengine/Converter/BL_ActionActuator.cpp
@@ -93,9 +93,6 @@ BL_ActionActuator::BL_ActionActuator(SCA_IObject *gameobj,
m_priority(priority),
m_layer(layer),
m_ipo_flags(ipo_flags),
-   m_pose(NULL),
-   m_blendpose(NULL),
-   m_userpose(NULL),
m_action(action),
m_propname(propname),
m_framepropname(framepropname)
@@ -106,20 +103,12 @@ BL_ActionActuator::BL_ActionActuator(SCA_IObject *gameobj,
 
 BL_ActionActuator::~BL_ActionActuator()
 {
-   if (m_pose)
-   game_free_pose(m_pose);
-   if (m_userpose)
-   game_free_pose(m_userpose);
-   if (m_blendpose)
-   game_free_pose(m_blendpose);
 }
 
 void BL_ActionActuator::ProcessReplica()
 {
SCA_IActuator::ProcessReplica();
-   
-   m_pose = NULL;
-   m_blendpose = NULL;
+
m_localtime=m_startframe;
m_lastUpdate=-1;

diff --git a/source/gameengine/Converter/BL_ActionActuator.h 
b/source/gameengine/Converter/BL_ActionActuator.h
index 4579a21..f488b0c 100644
--- a/source/gameengine/Converter/BL_ActionActuator.h
+++ b/source/gameengine/Converter/BL_ActionActuator.h
@@ -134,9 +134,6 @@ protected:
short   m_priority;
short   m_layer;
short   m_ipo_flags;
-   struct bPose* m_pose;
-   struct bPose* m_blendpose;
-   struct bPose* m_userpose;
struct bAction *m_action;
STR_String  m_propname;
STR_String  m_framepropname;
diff --git a/source/gameengine/Converter/BL_ArmatureActuator.cpp 
b/source/gameengine/Converter/BL_ArmatureActuator.cpp
index f0c4b3d..e38cb6e 100644
--- a/source/gameengine/Converter/BL_ArmatureActuator.cpp
+++ b/source/gameengine/Converter/BL_ArmatureActuator.cpp
@@ -155,7 +155,7 @@ bool BL_ArmatureActuator::Update(double curtime, bool frame)
switch (m_type) {
case ACT_ARM_RUN:
result = true;
-   obj-SetActiveAction(NULL, 0, curtime);
+   obj-UpdateTimestep(curtime);
break;
case ACT_ARM_ENABLE:
if (m_constraint)
diff --git a/source/gameengine/Converter/BL_ArmatureObject.cpp 
b/source/gameengine/Converter/BL_ArmatureObject.cpp
index 619797a..3eb7829 100644
--- a/source/gameengine/Converter/BL_ArmatureObject.cpp
+++ b/source/gameengine/Converter/BL_ArmatureObject.cpp
@@ -42,7 +42,13 @@
 #include BIK_api.h
 #include BKE_action.h
 #include BKE_armature.h
+#include BKE_object.h
 #include BKE_library.h
+#include BKE_global.h
+
+extern C {
+#include BKE_animsys.h
+}
 
 #include BKE_constraint.h
 #include CTR_Map.h
@@ -53,6 +59,7 @@
 #include DNA_object_types.h
 #include DNA_scene_types.h
 #include DNA_constraint_types.h
+#include RNA_access.h
 #include KX_PythonSeq.h
 #include KX_PythonInit.h
 #include KX_KetsjiEngine.h
@@ -70,7 +77,7 @@
  * When it is about to evaluate the pose, set the KX object position in the 
obmat of the corresponding
  * Blender objects and restore after the evaluation.
  */
-void

[Bf-blender-cvs] [11299f5] master: BGE doc cleanup: Some small cleanups in the BGE docs:

2014-03-31 Thread Mitchell Stokes
Commit: 11299f5ff405a7668ae06ee7ea5495b624f9ce9a
Author: Mitchell Stokes
Date:   Mon Mar 31 22:20:03 2014 -0700
https://developer.blender.org/rB11299f5ff405a7668ae06ee7ea5495b624f9ce9a

BGE doc cleanup: Some small cleanups in the BGE docs:

  * Fixing trailing whitespace in some files
  * Fixing some indentation
  * SCA_PythonController.owner is now documented
  * SCA_PythonKeyboard members now use the member directive instead of function

===

M   doc/python_api/rst/bge.constraints.rst
M   doc/python_api/rst/bge.events.rst
M   doc/python_api/rst/bge_types/bge.types.KX_CharacterWrapper.rst
M   doc/python_api/rst/bge_types/bge.types.KX_GameObject.rst
M   doc/python_api/rst/bge_types/bge.types.SCA_PythonController.rst
M   doc/python_api/rst/bge_types/bge.types.SCA_PythonKeyboard.rst

===

diff --git a/doc/python_api/rst/bge.constraints.rst 
b/doc/python_api/rst/bge.constraints.rst
index 7757e11..4d3e4ce 100644
--- a/doc/python_api/rst/bge.constraints.rst
+++ b/doc/python_api/rst/bge.constraints.rst
@@ -78,7 +78,7 @@ Physics Constraints (bge.constraints)
 
:return: a vehicle constraint object.
:rtype: :class:`bge.types.KX_VehicleWrapper`
-   
+
 .. function:: getCharacter(gameobj)
 
:arg gameobj: The game object with the character physics.
@@ -237,101 +237,101 @@ Physics Constraints (bge.constraints)
Not implemented.
 
 .. data:: DBG_NODEBUG
-   
+
.. note::
   Debug mode to be used with function :class:`setDebugMode`
-   
+
No debug.
 
 .. data:: DBG_DRAWWIREFRAME
-   
+
.. note::
   Debug mode to be used with function :class:`setDebugMode`
-   
+
Draw wireframe in debug.
 
 .. data:: DBG_DRAWAABB
-   
+
.. note::
   Debug mode to be used with function :class:`setDebugMode`
-   
+
Draw Axis Aligned Bounding Box in debug.
 
 .. data:: DBG_DRAWFREATURESTEXT
-   
+
.. note::
   Debug mode to be used with function :class:`setDebugMode`
-   
+
Draw freatures text in debug.
 
 .. data:: DBG_DRAWCONTACTPOINTS
-   
+
.. note::
   Debug mode to be used with function :class:`setDebugMode`
-   
+
Draw contact points in debug.
 
 .. data:: DBG_NOHELPTEXT
-   
+
.. note::
   Debug mode to be used with function :class:`setDebugMode`
-   
+
Debug without help text.
 
 .. data:: DBG_DRAWTEXT
-   
+
.. note::
   Debug mode to be used with function :class:`setDebugMode`
-   
+
Draw text in debug.
 
 .. data:: DBG_PROFILETIMINGS
-   
+
.. note::
   Debug mode to be used with function :class:`setDebugMode`
-   
+
Draw profile timings in debug.
 
 .. data:: DBG_ENABLESATCOMPARISION
-   
+
.. note::
   Debug mode to be used with function :class:`setDebugMode`
-   
+
Enable sat comparision in debug.
 
 .. data:: DBG_DISABLEBULLETLCP
-   
+
.. note::
   Debug mode to be used with function :class:`setDebugMode`
-   
+
Disable Bullet LCP.
 
 .. data:: DBG_ENABLECCD
 
.. note::
   Debug mode to be used with function :class:`setDebugMode`
-   
+
Enable Continous Colision Detection in debug.
 
 .. data:: DBG_DRAWCONSTRAINTS
-   
+
.. note::
   Debug mode to be used with function :class:`setDebugMode`
-   
+
Draw constraints in debug.
 
 .. data:: DBG_DRAWCONSTRAINTLIMITS
-   
+
.. note::
   Debug mode to be used with function :class:`setDebugMode`
-   
+
Draw constraint limits in debug.
 
 .. data:: DBG_FASTWIREFRAME
-   
+
.. note::
   Debug mode to be used with function :class:`setDebugMode`
-   
+
Draw a fast wireframe in debug.
 
 .. data:: POINTTOPOINT_CONSTRAINT
diff --git a/doc/python_api/rst/bge.events.rst 
b/doc/python_api/rst/bge.events.rst
index 2238fae..8dbded6 100644
--- a/doc/python_api/rst/bge.events.rst
+++ b/doc/python_api/rst/bge.events.rst
@@ -14,7 +14,7 @@ This module holds key constants for the SCA_KeyboardSensor.
 
# Set a connected keyboard sensor to accept F1
import bge
-   
+
co = bge.logic.getCurrentController()
# 'Keyboard' is a keyboard sensor
sensor = co.sensors[Keyboard]
@@ -24,7 +24,7 @@ This module holds key constants for the SCA_KeyboardSensor.
 
# Do the all keys thing
import bge
-   
+
co = bge.logic.getCurrentController()
# 'Keyboard' is a keyboard sensor
sensor = co.sensors[Keyboard]
@@ -46,20 +46,20 @@ This module holds key constants for the SCA_KeyboardSensor.
# The all keys thing without a keyboard sensor (but you will
# need an always sensor with pulse mode on)
import bge
-   
+
# Just shortening names here
keyboard = bge.logic.keyboard
JUST_ACTIVATED = bge.logic.KX_INPUT_JUST_ACTIVATED
-   
+
if keyboard.events[bge.events.WKEY] == JUST_ACTIVATED:
print(Activate Forward!)
if keyboard.events

[Bf-blender-cvs] [f5b79df] master: Fix T39490: BGE: Text to Mesh, then MouseOver does not work

2014-03-30 Thread Mitchell Stokes
Commit: f5b79dff412f61a2aa453a6ce50804e3425463a1
Author: Mitchell Stokes
Date:   Sun Mar 30 13:55:10 2014 -0700
https://developer.blender.org/rBf5b79dff412f61a2aa453a6ce50804e3425463a1

Fix T39490: BGE: Text to Mesh, then MouseOver does not work

Non-mesh objects default to no collisions. lordloki provided a
patch that sets the collision properties for a mesh converted from
a curve/meta/surf/text to the default collision properties for
a mesh.

===

M   source/blender/editors/object/object_add.c

===

diff --git a/source/blender/editors/object/object_add.c 
b/source/blender/editors/object/object_add.c
index b29fafe..182a9f7 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -1478,8 +1478,13 @@ static void curvetomesh(Main *bmain, Scene *scene, 
Object *ob)
convert_ensure_curve_cache(bmain, scene, ob);
BKE_mesh_from_nurbs(ob); /* also does users */
 
-   if (ob-type == OB_MESH)
+   if (ob-type == OB_MESH) {
BKE_object_free_modifiers(ob);
+
+   /* Game engine defaults for mesh objects */
+   ob-body_type = OB_BODY_TYPE_STATIC;
+   ob-gameflag = OB_PROP | OB_COLLISION;
+   }
 }
 
 static int convert_poll(bContext *C)

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [7ff123c] master: Fix T39452: Meshes without materials causes a memory leak in the game engine

2014-03-27 Thread Mitchell Stokes
Commit: 7ff123ce5c08953a31f5728922be9d56c4ed850c
Author: Mitchell Stokes
Date:   Thu Mar 27 13:46:22 2014 -0700
https://developer.blender.org/rB7ff123ce5c08953a31f5728922be9d56c4ed850c

Fix T39452: Meshes without materials causes a memory leak in the game engine

These types of meshes do not use material caching, and thus only the first 
created
material would be saved, but subsequent ones were not. Those subsequent 
materials
were then not being freed. Now we make sure to track all of the materials.

Note: Meshes that cannot make use of material caching (no materials or using 
face textures)
can still use up a large amount of RAM since a material is created per face.

===

M   source/gameengine/Converter/BL_BlenderDataConversion.cpp

===

diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp 
b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index 9eba103..8779cdd 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -942,11 +942,12 @@ static RAS_MaterialBucket *material_from_mesh(Material 
*ma, MFace *mface, MTFace
// this way only one KX_BlenderMaterial object has to exist per bucket
bool bucketCreated; 
RAS_MaterialBucket* bucket = scene-FindBucket(polymat, bucketCreated);
-   if (bucketCreated) {
-   // this is needed to free up memory afterwards
-   converter-RegisterPolyMaterial(polymat);
-   converter-RegisterBlenderMaterial(bl_mat);
-   }
+
+   // this is needed to free up memory afterwards.
+   // the converter will also prevent duplicates from being registered,
+   // so just register everything.
+   converter-RegisterPolyMaterial(polymat);
+   converter-RegisterBlenderMaterial(bl_mat);
 
return bucket;
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [df9d673] master: BGE code cleanup: Removing OpenGL and bf_gpu code from KX_LightObject

2014-03-27 Thread Mitchell Stokes
Commit: df9d6737b912b71fb91579b43ea6c7786d88f803
Author: Mitchell Stokes
Date:   Thu Mar 27 22:32:06 2014 -0700
https://developer.blender.org/rBdf9d6737b912b71fb91579b43ea6c7786d88f803

BGE code cleanup: Removing OpenGL and bf_gpu code from KX_LightObject

The ultimate goal is to only allow the rasterizer to handle OpenGL and bf_gpu
calls. This commit creates a RAS_ILightObject interface and a RAS_OpenGLLight
implementation.

===

M   source/gameengine/Converter/BL_BlenderDataConversion.cpp
M   source/gameengine/Ketsji/KX_KetsjiEngine.cpp
M   source/gameengine/Ketsji/KX_Light.cpp
M   source/gameengine/Ketsji/KX_Light.h
M   source/gameengine/Ketsji/KX_LightIpoSGController.cpp
M   source/gameengine/Ketsji/KX_LightIpoSGController.h
M   source/gameengine/Ketsji/KX_Scene.cpp
M   source/gameengine/Rasterizer/CMakeLists.txt
A   source/gameengine/Rasterizer/RAS_ILightObject.h
M   source/gameengine/Rasterizer/RAS_IRasterizer.h
D   source/gameengine/Rasterizer/RAS_LightObject.h
M   source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt
A   source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.cpp
A   source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLLight.h
M   
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
M   source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
M   source/gameengine/VideoTexture/Texture.cpp

===

diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp 
b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index 8779cdd..e604b7b 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -68,6 +68,8 @@
 #include KX_GameObject.h
 #include RAS_FramingManager.h
 #include RAS_MeshObject.h
+#include RAS_IRasterizer.h
+#include RAS_ILightObject.h
 
 #include KX_ConvertActuators.h
 #include KX_ConvertControllers.h
@@ -1767,22 +1769,22 @@ static void BL_CreatePhysicsObjectNew(KX_GameObject* 
gameobj,
 
 static KX_LightObject *gamelight_from_blamp(Object *ob, Lamp *la, unsigned int 
layerflag, KX_Scene *kxscene, RAS_IRasterizer *rasterizer, 
KX_BlenderSceneConverter *converter)
 {
-   RAS_LightObject lightobj;
+   RAS_ILightObject *lightobj = rasterizer-CreateLight();
KX_LightObject *gamelight;

-   lightobj.m_att1 = la-att1;
-   lightobj.m_att2 = (la-mode  LA_QUAD) ? la-att2 : 0.0f;
-   lightobj.m_red = la-r;
-   lightobj.m_green = la-g;
-   lightobj.m_blue = la-b;
-   lightobj.m_distance = la-dist;
-   lightobj.m_energy = la-energy;
-   lightobj.m_layer = layerflag;
-   lightobj.m_spotblend = la-spotblend;
-   lightobj.m_spotsize = la-spotsize;
+   lightobj-m_att1 = la-att1;
+   lightobj-m_att2 = (la-mode  LA_QUAD) ? la-att2 : 0.0f;
+   lightobj-m_color[0] = la-r;
+   lightobj-m_color[1] = la-g;
+   lightobj-m_color[2] = la-b;
+   lightobj-m_distance = la-dist;
+   lightobj-m_energy = la-energy;
+   lightobj-m_layer = layerflag;
+   lightobj-m_spotblend = la-spotblend;
+   lightobj-m_spotsize = la-spotsize;

-   lightobj.m_nodiffuse = (la-mode  LA_NO_DIFF) != 0;
-   lightobj.m_nospecular = (la-mode  LA_NO_SPEC) != 0;
+   lightobj-m_nodiffuse = (la-mode  LA_NO_DIFF) != 0;
+   lightobj-m_nospecular = (la-mode  LA_NO_SPEC) != 0;

bool glslmat = converter-GetGLSLMaterials();
 
@@ -1790,18 +1792,18 @@ static KX_LightObject *gamelight_from_blamp(Object *ob, 
Lamp *la, unsigned int l
if (glslmat==0) {
if (la-mode  LA_NEG)
{
-   lightobj.m_red = -lightobj.m_red;
-   lightobj.m_green = -lightobj.m_green;
-   lightobj.m_blue = -lightobj.m_blue;
+   lightobj-m_color[0] = -lightobj-m_color[0];
+   lightobj-m_color[1] = -lightobj-m_color[1];
+   lightobj-m_color[2] = -lightobj-m_color[2];
}
}

if (la-type==LA_SUN) {
-   lightobj.m_type = RAS_LightObject::LIGHT_SUN;
+   lightobj-m_type = RAS_ILightObject::LIGHT_SUN;
} else if (la-type==LA_SPOT) {
-   lightobj.m_type = RAS_LightObject::LIGHT_SPOT;
+   lightobj-m_type = RAS_ILightObject::LIGHT_SPOT;
} else {
-   lightobj.m_type = RAS_LightObject::LIGHT_NORMAL;
+   lightobj-m_type = RAS_ILightObject::LIGHT_NORMAL;
}
 
gamelight = new KX_LightObject(kxscene, KX_Scene::m_callbacks, 
rasterizer,
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp 
b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
index 1bcfc4c..231590c 100644
--- a/source/gameengine/Ketsji

[Bf-blender-cvs] [93c896d] master: BGE code cleanup: Removing an unused include in KX_Light.cpp

2014-03-27 Thread Mitchell Stokes
Commit: 93c896d53b2980f5ce552b257ecd55dbf88691ce
Author: Mitchell Stokes
Date:   Thu Mar 27 22:44:30 2014 -0700
https://developer.blender.org/rB93c896d53b2980f5ce552b257ecd55dbf88691ce

BGE code cleanup: Removing an unused include in KX_Light.cpp

===

M   source/gameengine/Ketsji/KX_Light.cpp

===

diff --git a/source/gameengine/Ketsji/KX_Light.cpp 
b/source/gameengine/Ketsji/KX_Light.cpp
index 8813831..37c36da 100644
--- a/source/gameengine/Ketsji/KX_Light.cpp
+++ b/source/gameengine/Ketsji/KX_Light.cpp
@@ -46,7 +46,6 @@
 #include DNA_object_types.h
 #include DNA_scene_types.h
 #include DNA_lamp_types.h
-#include GPU_material.h
 
 #include BKE_scene.h
 #include MEM_guardedalloc.h

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [b66a954] master: Fix T38929: BGE: Strange behaving from addObject after trying to add an nonexisting overlay scene

2014-03-24 Thread Mitchell Stokes
Commit: b66a9543bbcf86646b46af1da7ed0c4d035c7f98
Author: Mitchell Stokes
Date:   Mon Mar 24 17:57:02 2014 -0700
https://developer.blender.org/rBb66a9543bbcf86646b46af1da7ed0c4d035c7f98

Fix T38929: BGE: Strange behaving from addObject after trying to add an 
nonexisting overlay scene

If bge.logic.addScene() could not find the scene to add it would add the
first scene again, which is just silly. Now, if no scene is found, a warning
is printed and nothing is added.

===

M   source/gameengine/Converter/KX_BlenderSceneConverter.cpp
M   source/gameengine/Ketsji/KX_KetsjiEngine.cpp

===

diff --git a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp 
b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
index c0c28d1..854e9fe 100644
--- a/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
+++ b/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
@@ -233,8 +233,7 @@ Scene 
*KX_BlenderSceneConverter::GetBlenderSceneForName(const STR_String name)
Scene *sce;
 
/**
-* Find the specified scene by name, or the first
-* scene if nothing matches (shouldn't happen).
+* Find the specified scene by name, or NULL if nothing matches.
 */
if ((sce= (Scene *)BLI_findstring(m_maggie-scene, name.ReadPtr(), 
offsetof(ID, name) + 2)))
return sce;
@@ -246,7 +245,7 @@ Scene 
*KX_BlenderSceneConverter::GetBlenderSceneForName(const STR_String name)
return sce;
}
 
-   return (Scene*)m_maggie-scene.first;
+   return NULL;
 
 }
 
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp 
b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
index 3aa5a9f..e6b2242 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
@@ -1702,6 +1702,8 @@ KX_Scene* KX_KetsjiEngine::CreateScene(Scene *scene, bool 
libloading)
 KX_Scene* KX_KetsjiEngine::CreateScene(const STR_String scenename)
 {
Scene *scene = m_sceneconverter-GetBlenderSceneForName(scenename);
+   if (!scene)
+   return NULL;
return CreateScene(scene);
 }
 
@@ -1717,8 +1719,12 @@ void KX_KetsjiEngine::AddScheduledScenes()
{
STR_String scenename = *scenenameit;
KX_Scene* tmpscene = CreateScene(scenename);
-   m_scenes.push_back(tmpscene);
-   PostProcessScene(tmpscene);
+   if (tmpscene) {
+   m_scenes.push_back(tmpscene);
+   PostProcessScene(tmpscene);
+   } else {
+   printf(warning: scene %s could not be found, 
not added!\n,scenename.ReadPtr());
+   }
}
m_addingOverlayScenes.clear();
}
@@ -1731,9 +1737,12 @@ void KX_KetsjiEngine::AddScheduledScenes()
{
STR_String scenename = *scenenameit;
KX_Scene* tmpscene = CreateScene(scenename);
-   m_scenes.insert(m_scenes.begin(),tmpscene);
-   PostProcessScene(tmpscene);
-
+   if (tmpscene) {
+   m_scenes.insert(m_scenes.begin(),tmpscene);
+   PostProcessScene(tmpscene);
+   } else {
+   printf(warning: scene %s could not be found, 
not added!\n,scenename.ReadPtr());
+   }
}
m_addingBackgroundScenes.clear();
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [9d244e0] master: Code cleanup: Removing KX_KetsjiEngine::m_drawingmode

2014-03-24 Thread Mitchell Stokes
Commit: 9d244e0ad7cb523e58ba76758da28655a942ac09
Author: Mitchell Stokes
Date:   Mon Mar 24 20:11:11 2014 -0700
https://developer.blender.org/rB9d244e0ad7cb523e58ba76758da28655a942ac09

Code cleanup: Removing KX_KetsjiEngine::m_drawingmode

The rasterizer is already handling this, and there is
no need to duplicate the data.

===

M   source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
M   source/gameengine/Ketsji/KX_Dome.cpp
M   source/gameengine/Ketsji/KX_KetsjiEngine.cpp
M   source/gameengine/Ketsji/KX_KetsjiEngine.h
M   source/gameengine/Rasterizer/RAS_IRasterizer.h
M   
source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
M   source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
M   source/gameengine/VideoTexture/ImageRender.cpp

===

diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp 
b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
index d136131..03401f0 100644
--- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
+++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
@@ -361,8 +361,7 @@ extern C void StartKetsjiShell(struct bContext *C, struct 
ARegion *ar, rcti *c
camzoom = 2.0;
}
 
-
-   ketsjiengine-SetDrawType(v3d-drawtype);
+   rasterizer-SetDrawingMode(v3d-drawtype);
ketsjiengine-SetCameraZoom(camzoom);

// if we got an exitcode 3 (KX_EXIT_REQUEST_START_OTHER_GAME) 
load a different file
diff --git a/source/gameengine/Ketsji/KX_Dome.cpp 
b/source/gameengine/Ketsji/KX_Dome.cpp
index 43d7448..71d7257 100644
--- a/source/gameengine/Ketsji/KX_Dome.cpp
+++ b/source/gameengine/Ketsji/KX_Dome.cpp
@@ -61,7 +61,7 @@ KX_Dome::KX_Dome (
 ):
 dlistSupported(false),
 canvaswidth(-1), canvasheight(-1),
-m_drawingmode(engine-GetDrawType()),
+m_drawingmode(rasterizer-GetDrawingMode()),
 m_resolution(res),
 m_mode(mode),
 m_angle(angle),
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp 
b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
index e6b2242..1bcfc4c 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
@@ -142,8 +142,7 @@ KX_KetsjiEngine::KX_KetsjiEngine(KX_ISystem* system)
 
m_exitcode(KX_EXIT_REQUEST_NO_REQUEST),
m_exitstring(),
-   
-   m_drawingmode(5),
+
m_cameraZoom(1.0),

m_overrideCam(false),
@@ -184,6 +183,7 @@ KX_KetsjiEngine::KX_KetsjiEngine(KX_ISystem* system)
 #ifdef WITH_PYTHON
m_pyprofiledict = PyDict_New();
 #endif
+
 }
 
 
@@ -487,7 +487,7 @@ bool KX_KetsjiEngine::BeginFrame()
{
ClearFrame();
 
-   m_rasterizer-BeginFrame(m_drawingmode , 
m_kxsystem-GetTimeInSeconds());
+   m_rasterizer-BeginFrame(m_kxsystem-GetTimeInSeconds());
 
return true;
}
@@ -837,7 +837,7 @@ void KX_KetsjiEngine::Render()
// clear the entire game screen with the border color
// only once per frame
m_canvas-BeginDraw();
-   if (m_drawingmode == RAS_IRasterizer::KX_TEXTURED) {
+   if (m_rasterizer-GetDrawingMode() == RAS_IRasterizer::KX_TEXTURED) {
m_canvas-SetViewPort(0, 0, m_canvas-GetWidth(), 
m_canvas-GetHeight());
if (m_overrideFrameColor)
{
@@ -1018,7 +1018,7 @@ void KX_KetsjiEngine::SetBackGround(KX_WorldInfo* wi)
 {
if (wi-hasWorld())
{
-   if (m_drawingmode == RAS_IRasterizer::KX_TEXTURED)
+   if (m_rasterizer-GetDrawingMode() == 
RAS_IRasterizer::KX_TEXTURED)
{
m_rasterizer-SetBackColor(
wi-getBackColorRed(),
@@ -1043,7 +1043,7 @@ void KX_KetsjiEngine::SetWorldSettings(KX_WorldInfo* wi)
wi-getAmbientColorBlue()
);
 
-   if (m_drawingmode = RAS_IRasterizer::KX_SOLID)
+   if (m_rasterizer-GetDrawingMode() = RAS_IRasterizer::KX_SOLID)
{
if (wi-hasMist())
{
@@ -1060,13 +1060,6 @@ void KX_KetsjiEngine::SetWorldSettings(KX_WorldInfo* wi)
 }
 
 
-
-void KX_KetsjiEngine::SetDrawType(int drawingmode)
-{
-   m_drawingmode = drawingmode;
-}
-
-

 void KX_KetsjiEngine::EnableCameraOverride(const STR_String forscene)
 {
@@ -1166,7 +1159,7 @@ void KX_KetsjiEngine::RenderShadowBuffers(KX_Scene *scene)
 
light-Update();
 
-   if (m_drawingmode == RAS_IRasterizer::KX_TEXTURED  
light-HasShadowBuffer()) {
+   if (m_rasterizer-GetDrawingMode() == 
RAS_IRasterizer::KX_TEXTURED  light-HasShadowBuffer()) {
/* make temporary camera

[Bf-blender-cvs] [eedde31] master: Fix T36566: 2D filters broken in the Blenderplayer when using side by side stereo

2014-03-20 Thread Mitchell Stokes
Commit: eedde311bb58764f238e02a369d947402fccaec9
Author: Mitchell Stokes
Date:   Wed Mar 19 22:33:26 2014 -0700
https://developer.blender.org/rBeedde311bb58764f238e02a369d947402fccaec9

Fix T36566: 2D filters broken in the Blenderplayer when using side by side 
stereo

GPC_Canvas::GetWindowArea() and KX_BlenderCanvas::GetWindowArea() are tracking 
two
different things. The 2d filter system doesn't actually need the window area and
can get by just using the viewport dimensions, which it now does. The 
GetWindowArea()
mess should probably be cleaned up.

===

M   source/gameengine/Rasterizer/RAS_2DFilterManager.cpp

===

diff --git a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp 
b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
index e85b57f..abbe657 100644
--- a/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
+++ b/source/gameengine/Rasterizer/RAS_2DFilterManager.cpp
@@ -395,10 +395,8 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* 
canvas)
return;
 
const int *viewport = canvas-GetViewPort();
-   RAS_Rect rect = canvas-GetWindowArea();
-   int rect_width = rect.GetWidth()+1, rect_height = rect.GetHeight()+1;
 
-   if (texturewidth != rect_width || textureheight != rect_height)
+   if (texturewidth != viewport[2] || textureheight != viewport[3])
{
UpdateOffsetMatrix(canvas);
UpdateCanvasTextureCoord(viewport);
@@ -414,22 +412,22 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* 
canvas)
if (need_depth) {
glActiveTextureARB(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, texname[1]);
-   glCopyTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH_COMPONENT, 
rect.GetLeft(), rect.GetBottom(), rect_width, rect_height, 0);
+   glCopyTexImage2D(GL_TEXTURE_2D,0,GL_DEPTH_COMPONENT, 
viewport[0], viewport[1], viewport[2], viewport[3], 0);
}

if (need_luminance) {
glActiveTextureARB(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, texname[2]);
-   glCopyTexImage2D(GL_TEXTURE_2D,0,GL_LUMINANCE16, 
rect.GetLeft(), rect.GetBottom(), rect_width, rect_height, 0);
+   glCopyTexImage2D(GL_TEXTURE_2D,0,GL_LUMINANCE16, viewport[0], 
viewport[1], viewport[2], viewport[3], 0);
}
 
// reverting to texunit 0, without this we get bug [#28462]
glActiveTextureARB(GL_TEXTURE0);
-   canvas-SetViewPort(0, 0, rect_width-1, rect_height-1);
 
// We do this to make side-by-side stereo rendering work correctly with 
2D filters. It would probably be nicer to just set the viewport,
// but it can be easier for writing shaders to have the coordinates for 
the whole screen instead of just part of the screen. 
RAS_Rect scissor_rect = canvas-GetDisplayArea();
+
glScissor(scissor_rect.GetLeft() + viewport[0],
  scissor_rect.GetBottom() + viewport[1],
  scissor_rect.GetWidth() + 1,
@@ -459,7 +457,7 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas)
 
glActiveTextureARB(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texname[0]);
-   glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 
rect.GetLeft(), rect.GetBottom(), rect_width, rect_height, 0); // Don't use 
texturewidth and textureheight in case we don't have NPOT support
+   glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, 
viewport[0], viewport[1], viewport[2], viewport[3], 0); // Don't use 
texturewidth and textureheight in case we don't have NPOT support
glClear(GL_COLOR_BUFFER_BIT);
 
glBegin(GL_QUADS);
@@ -473,8 +471,6 @@ void RAS_2DFilterManager::RenderFilters(RAS_ICanvas* canvas)
}
 
glEnable(GL_DEPTH_TEST);
-   //We can't pass the results of canvas-GetViewPort() directly because 
canvas-SetViewPort() does some extra math [#34517]
-   canvas-SetViewPort(0, 0, viewport[2]-1, viewport[3]-1);
EndShaderProgram();
glPopMatrix();
glMatrixMode(GL_MODELVIEW);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [e02b9c8] master: BGE: Adding support for the Cast Only material option.

2014-03-20 Thread Mitchell Stokes
Commit: e02b9c8a45266993e5cefb71d55234128aca208c
Author: Mitchell Stokes
Date:   Sun Jan 26 19:28:26 2014 -0800
https://developer.blender.org/rBe02b9c8a45266993e5cefb71d55234128aca208c

BGE: Adding support for the Cast Only material option.

Note: This does not add support for the option in the viewport.

===

M   source/gameengine/Converter/BL_BlenderDataConversion.cpp
M   source/gameengine/Ketsji/BL_Material.h
M   source/gameengine/Ketsji/KX_BlenderMaterial.cpp
M   source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
M   source/gameengine/Rasterizer/RAS_IPolygonMaterial.h
M   source/gameengine/Rasterizer/RAS_MaterialBucket.cpp

===

diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp 
b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index 0ec5441..9eba103 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -611,6 +611,10 @@ static bool ConvertMaterial(
 
// cast shadows?
material-ras_mode |= ( mat-mode  MA_SHADBUF )?CAST_SHADOW:0;
+
+   // only shadows?
+   material-ras_mode |= ( mat-mode  MA_ONLYCAST )?ONLY_SHADOW:0;
+
MTex *mttmp = 0;
int valid_index = 0;

diff --git a/source/gameengine/Ketsji/BL_Material.h 
b/source/gameengine/Ketsji/BL_Material.h
index be66e2e..83f9b60 100644
--- a/source/gameengine/Ketsji/BL_Material.h
+++ b/source/gameengine/Ketsji/BL_Material.h
@@ -144,7 +144,8 @@ enum BL_ras_mode
WIRE=64,
CAST_SHADOW=128,
TEX=256,
-   TWOSIDED=512
+   TWOSIDED=512,
+   ONLY_SHADOW=1024,
 };
 
 // -
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp 
b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
index efaaed7..68a7121 100644
--- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
+++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
@@ -110,6 +110,7 @@ void KX_BlenderMaterial::Initialize(
m_flag |= ((mMaterial-ras_mode  USE_LIGHT)!=0)? RAS_MULTILIGHT: 0;
m_flag |= (mMaterial-glslmat)? RAS_BLENDERGLSL: 0;
m_flag |= ((mMaterial-ras_mode  CAST_SHADOW)!=0)? RAS_CASTSHADOW: 0;
+   m_flag |= ((mMaterial-ras_mode  ONLY_SHADOW)!=0)? RAS_ONLYSHADOW: 0;
 
// test the sum of the various modes for equality
// so we can ether accept or reject this material
diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp 
b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
index 47e5231..03f6e56 100644
--- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
+++ b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.cpp
@@ -282,6 +282,11 @@ bool RAS_IPolyMaterial::CastsShadows() const
return (m_flag  RAS_CASTSHADOW) != 0;
 }
 
+bool RAS_IPolyMaterial::OnlyShadow() const
+{
+   return (m_flag  RAS_ONLYSHADOW) != 0;
+}
+
 bool RAS_IPolyMaterial::UsesObjectColor() const
 {
return !(m_flag  RAS_BLENDERGLSL);
diff --git a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h 
b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h
index 2db71c3..14223fc 100644
--- a/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h
+++ b/source/gameengine/Rasterizer/RAS_IPolygonMaterial.h
@@ -61,7 +61,8 @@ enum MaterialProps
RAS_NORMAL  =256,
RAS_DEFMULTI=512,
RAS_BLENDERGLSL =1024,
-   RAS_CASTSHADOW  =2048
+   RAS_CASTSHADOW  =2048,
+   RAS_ONLYSHADOW  =4096,
 };
 
 /**
@@ -174,6 +175,7 @@ public:
virtual boolUsesLighting(RAS_IRasterizer *rasty) const;
virtual boolUsesObjectColor() const;
virtual boolCastsShadows() const;
+   virtual boolOnlyShadow() const;
 
virtual voidReplace_IScene(SCA_IScene *val) {} /* 
overridden by KX_BlenderMaterial */
 
diff --git a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp 
b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
index 0c71552..4b5fc65 100644
--- a/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
+++ b/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
@@ -587,6 +587,9 @@ bool RAS_MaterialBucket::ActivateMaterial(const 
MT_Transform cameratrans, RAS_I
if (rasty-GetDrawingMode() == RAS_IRasterizer::KX_SHADOW  
!m_material-CastsShadows())
return false;
 
+   if (rasty-GetDrawingMode() != RAS_IRasterizer::KX_SHADOW  
m_material-OnlyShadow())
+   return false;
+
if (!rasty-SetMaterial(*m_material))
return false;

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [411650f] master: Partial fix for T3817: BGE crashing when using LibNew.

2014-02-23 Thread Mitchell Stokes
Commit: 411650f2faab16e9f4e6f0fdba27ff278d25e61a
Author: Mitchell Stokes
Date:   Sun Feb 23 12:44:33 2014 -0800
https://developer.blender.org/rB411650f2faab16e9f4e6f0fdba27ff278d25e61a

Partial fix for T3817: BGE crashing when using LibNew.

The BGE needs to use BKE_main_new() isntead of calloc for
allocating a Main struct since the threaded depsgraph changes.

===

M   source/gameengine/Ketsji/KX_PythonInit.cpp

===

diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp 
b/source/gameengine/Ketsji/KX_PythonInit.cpp
index 5d0c6a8..234d03a 100644
--- a/source/gameengine/Ketsji/KX_PythonInit.cpp
+++ b/source/gameengine/Ketsji/KX_PythonInit.cpp
@@ -130,6 +130,7 @@ extern C {
 #include PHY_IPhysicsEnvironment.h
 #include BKE_main.h
 #include BKE_global.h
+#include BKE_library.h
 #include BLI_blenlib.h
 #include GPU_material.h
 #include MEM_guardedalloc.h
@@ -752,7 +753,7 @@ static PyObject *gLibNew(PyObject *, PyObject *args)
return NULL;
}

-   Main *maggie= (Main *)MEM_callocN( sizeof(Main), BgeMain);
+   Main *maggie=BKE_main_new();
kx_scene-GetSceneConverter()-GetMainDynamic().push_back(maggie);
strncpy(maggie-name, path, sizeof(maggie-name)-1);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [16c75cf] master: Fix T38654: Using a non-camera object for the SetCamera Scene Actuator causes a segfault.

2014-02-17 Thread Mitchell Stokes
Commit: 16c75cf594a92b232e46f922d644ac0a70088bad
Author: Mitchell Stokes
Date:   Mon Feb 17 14:35:09 2014 -0800
https://developer.blender.org/rB16c75cf594a92b232e46f922d644ac0a70088bad

Fix T38654: Using a non-camera object for the SetCamera Scene Actuator causes a 
segfault.

Non-camera objects are not supported as cameras, and trying to use them
just causes memory errors (some bad typecasts are involved). When converting
a Scene Actuator, only use the object as a camera if it is actually a camera.
Also, the logic brick UI now filters for camera objects, which should help
avoid confusion.

===

M   source/blender/makesrna/intern/rna_actuator.c
M   source/gameengine/Converter/KX_ConvertActuators.cpp

===

diff --git a/source/blender/makesrna/intern/rna_actuator.c 
b/source/blender/makesrna/intern/rna_actuator.c
index 7747c5e..e5545f9 100644
--- a/source/blender/makesrna/intern/rna_actuator.c
+++ b/source/blender/makesrna/intern/rna_actuator.c
@@ -1479,10 +1479,10 @@ static void rna_def_scene_actuator(BlenderRNA *brna)
RNA_def_property_enum_items(prop, prop_type_items);
RNA_def_property_ui_text(prop, Mode, );
RNA_def_property_update(prop, NC_LOGIC, NULL);
-   
-   /*XXX filter only camera objects */
+
prop = RNA_def_property(srna, camera, PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, Object);
+   RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, 
rna_Camera_object_poll);
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, Camera Object, Set this Camera (leave 
empty to refer to self object));
RNA_def_property_update(prop, NC_LOGIC, NULL);
diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp 
b/source/gameengine/Converter/KX_ConvertActuators.cpp
index 26401fc..725e981 100644
--- a/source/gameengine/Converter/KX_ConvertActuators.cpp
+++ b/source/gameengine/Converter/KX_ConvertActuators.cpp
@@ -758,7 +758,9 @@ void BL_ConvertActuators(const char* maggiename,
mode = 
KX_SceneActuator::KX_SCENE_SET_CAMERA;
if (sceneact-camera)
{
-   cam = (KX_Camera*) 
converter-FindGameObject(sceneact-camera);
+   KX_GameObject *tmp = 
converter-FindGameObject(sceneact-camera);
+   if (tmp  
tmp-GetGameObjectType() == SCA_IObject::OBJ_CAMERA)
+   cam = (KX_Camera*)tmp;
}
break;
case ACT_SCENE_RESTART:

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [f3c7cb0] master: Fix T37964: KX_GameObject missing NULL checks for m_physicsController.

2014-02-14 Thread Mitchell Stokes
Commit: f3c7cb02b2a5e7b7ee780b598a73b08bf39dae76
Author: Mitchell Stokes
Date:   Fri Feb 14 13:13:32 2014 -0800
https://developer.blender.org/rBf3c7cb02b2a5e7b7ee780b598a73b08bf39dae76

Fix T37964: KX_GameObject missing NULL checks for m_physicsController.

KX_GameObject::PySuspendDynamics() and KX_GameObjectPyRestoreDynamics()
now make sure GetPhysicsController() is non NULL before attempting
to use it.

===

M   source/gameengine/Ketsji/KX_GameObject.cpp

===

diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp 
b/source/gameengine/Ketsji/KX_GameObject.cpp
index b6844a6..f1f12ca 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -3032,7 +3032,8 @@ PyObject *KX_GameObject::PyApplyImpulse(PyObject *args)
 
 PyObject *KX_GameObject::PySuspendDynamics()
 {
-   GetPhysicsController()-SuspendDynamics();
+   if (GetPhysicsController())
+   GetPhysicsController()-SuspendDynamics();
Py_RETURN_NONE;
 }
 
@@ -3040,7 +3041,8 @@ PyObject *KX_GameObject::PySuspendDynamics()
 
 PyObject *KX_GameObject::PyRestoreDynamics()
 {
-   GetPhysicsController()-RestoreDynamics();
+   if (GetPhysicsController())
+   GetPhysicsController()-RestoreDynamics();
Py_RETURN_NONE;
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [88843ca] master: BGE: Fixing memory corruption/double free when duplicating (e.g., addObject) LibLoaded lights.

2014-02-04 Thread Mitchell Stokes
Commit: 88843caaa3dd95e887f43f4c66ff7e47c6d31d66
Author: Mitchell Stokes
Date:   Tue Feb 4 10:54:09 2014 -0800
https://developer.blender.org/rB88843caaa3dd95e887f43f4c66ff7e47c6d31d66

BGE: Fixing memory corruption/double free when duplicating (e.g., addObject) 
LibLoaded lights.

===

M   source/gameengine/Ketsji/KX_Light.cpp

===

diff --git a/source/gameengine/Ketsji/KX_Light.cpp 
b/source/gameengine/Ketsji/KX_Light.cpp
index 3a8821e..20db6d2 100644
--- a/source/gameengine/Ketsji/KX_Light.cpp
+++ b/source/gameengine/Ketsji/KX_Light.cpp
@@ -101,6 +101,8 @@ CValue* KX_LightObject::GetReplica()

replica-m_lightobj.m_light = replica;
m_rasterizer-AddLight(replica-m_lightobj);
+   if (m_base)
+   m_base = NULL;
 
return replica;
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [6a2c467] master: Blenderplayer: Fixing a memory leak.

2014-02-03 Thread Mitchell Stokes
Commit: 6a2c467443f9d6d47fc9727457459a8ed92f1961
Author: Mitchell Stokes
Date:   Wed Jan 29 13:39:44 2014 -0800
https://developer.blender.org/rB6a2c467443f9d6d47fc9727457459a8ed92f1961

Blenderplayer: Fixing a memory leak.

IMB_moviecache_destruct() was not being called.

===

M   source/gameengine/GamePlayer/ghost/GPG_ghost.cpp

===

diff --git a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp 
b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
index 7d792ca..44e02ee0 100644
--- a/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
+++ b/source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
@@ -77,6 +77,7 @@ extern C
 #include BKE_sound.h
 
 #include IMB_imbuf.h
+#include IMB_moviecache.h

int GHOST_HACK_getFirstFile(char buf[]);

@@ -1071,6 +1072,7 @@ int main(int argc, char** argv)
IMB_exit();
BKE_images_exit();
DAG_exit();
+   IMB_moviecache_destruct();
 
SYS_DeleteSystem(syshandle);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [f91368d] master: .gitignore: Adding CMakeLists.txt.user for QtCreator users.

2014-01-26 Thread Mitchell Stokes
Commit: f91368d82216497482a011e6b0987d3a5cdac951
Author: Mitchell Stokes
Date:   Sun Jan 26 17:52:14 2014 -0800
https://developer.blender.org/rBf91368d82216497482a011e6b0987d3a5cdac951

.gitignore: Adding CMakeLists.txt.user for QtCreator users.

===

M   .gitignore

===

diff --git a/.gitignore b/.gitignore
index e0228f2..6bc7b33 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,9 @@ __pycache__/
 *.swo
 *#
 
+# QtCreator
+CMakeLists.txt.user
+
 # ms-windows
 Thumbs.db
 ehthumbs.db

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [eba07b7] master: Fix T37566: KX_GameObject.resumeDynamics() was not properly restoring collision groups and masks.

2013-11-29 Thread Mitchell Stokes
Commit: eba07b77da43425cf539e8a13f9e0a2ad0ffa405
Author: Mitchell Stokes
Date:   Fri Nov 29 14:31:19 2013 -0800
http://developer.blender.org/rBeba07b77da43425cf539e8a13f9e0a2ad0ffa405

Fix T37566: KX_GameObject.resumeDynamics() was not properly restoring collision 
groups and masks.

===

M   source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
M   source/gameengine/Physics/Bullet/CcdPhysicsController.h

===

diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp 
b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
index 6ce52b6..6be6400 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
@@ -145,6 +145,8 @@ CcdPhysicsController::CcdPhysicsController (const 
CcdConstructionInfo ci)
m_bulletMotionState = 0;
m_characterController = 0;
m_savedCollisionFlags = 0;
+   m_savedCollisionFilterGroup = 0;
+   m_savedCollisionFilterMask = 0;
m_savedMass = 0.0;
m_suspended = false;

@@ -1057,8 +1059,12 @@ void CcdPhysicsController::SuspendDynamics(bool 
ghost)
btRigidBody *body = GetRigidBody();
if (body  !m_suspended  !GetConstructionInfo().m_bSensor)
{
+   btBroadphaseProxy* handle = body-getBroadphaseHandle();
+
m_savedCollisionFlags = body-getCollisionFlags();
m_savedMass = GetMass();
+   m_savedCollisionFilterGroup = handle-m_collisionFilterGroup;
+   m_savedCollisionFilterMask = handle-m_collisionFilterMask;
m_suspended = true;
GetPhysicsEnvironment()-UpdateCcdPhysicsController(this,
0.0,
@@ -1078,8 +1084,8 @@ void  CcdPhysicsController::RestoreDynamics()
GetPhysicsEnvironment()-UpdateCcdPhysicsController(this,
m_savedMass,
m_savedCollisionFlags,
-   GetConstructionInfo().m_collisionFilterGroup,
-   GetConstructionInfo().m_collisionFilterMask);
+   m_savedCollisionFilterGroup,
+   m_savedCollisionFilterMask);
body-activate();
m_suspended = false;
}
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.h 
b/source/gameengine/Physics/Bullet/CcdPhysicsController.h
index 194a47a..0d6d408 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsController.h
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.h
@@ -478,9 +478,12 @@ protected:
CcdPhysicsController* m_parentCtrl;
 
int m_savedCollisionFlags;
+   short m_savedCollisionFilterGroup;
+   short m_savedCollisionFilterMask;
MT_Scalar m_savedMass;
bool m_suspended;
 
+
void GetWorldOrientation(btMatrix3x3 mat);
 
void CreateRigidbody();

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [8aff45d] master: Fix T36804: the property sensor when set to interval was causing a memory leak

2013-11-29 Thread Mitchell Stokes
Commit: 8aff45d8f671e7eb2f404c8f194e06d88c5147c9
Author: Mitchell Stokes
Date:   Fri Nov 29 18:34:06 2013 -0800
http://developer.blender.org/rB8aff45d8f671e7eb2f404c8f194e06d88c5147c9

Fix T36804: the property sensor when set to interval was causing a memory leak

The property sensor was using CValue::FindIdentifier(), which does an AddRef(). 
However,
the property sensor was not calling Release() when it was done with the value. 
This could
cause more leaks when used in conjunction with the copy property actuator since 
it would
really throw off ref counts.

===

M   source/gameengine/GameLogic/SCA_PropertySensor.cpp

===

diff --git a/source/gameengine/GameLogic/SCA_PropertySensor.cpp 
b/source/gameengine/GameLogic/SCA_PropertySensor.cpp
index f02ac49..ad57e52 100644
--- a/source/gameengine/GameLogic/SCA_PropertySensor.cpp
+++ b/source/gameengine/GameLogic/SCA_PropertySensor.cpp
@@ -207,6 +207,7 @@ boolSCA_PropertySensor::CheckPropertyCondition()
 
result = (min = val)  (val = max);
}
+   orgprop-Release();
 
break;
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [c73f82b] master: Fix T37040: Removing vehicles in BGE causes a crash

2013-11-18 Thread Mitchell Stokes
Commit: c73f82b6f07c76705be52d7bb40ee866aea98b9c
Author: Mitchell Stokes
Date:   Mon Nov 18 09:30:46 2013 -0800
http://developer.blender.org/rBc73f82b6f07c76705be52d7bb40ee866aea98b9c

Fix T37040: Removing vehicles in BGE causes a crash

The vehicle constraint is now properly removed if 
bge.constraints.removeConstraint()
is used or the object is deleted. This also fixes a memory leak with the
vehicle wrapper.

===

M   source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp

===

diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp 
b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
index 71ed6af..cddc12c 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
@@ -83,6 +83,11 @@ public:
{
}
 
+   ~WrapperVehicle()
+   {
+   delete m_vehicle;
+   }
+
btRaycastVehicle*   GetVehicle()
{
return m_vehicle;
@@ -440,6 +445,19 @@ bool   
CcdPhysicsEnvironment::RemoveCcdPhysicsController(CcdPhysicsController* ctr
//delete con; //might be kept by python 
KX_ConstraintWrapper
}
m_dynamicsWorld-removeRigidBody(ctrl-GetRigidBody());
+
+   // Handle potential vehicle constraints
+   int numVehicles = m_wrapperVehicles.size();
+   int vehicle_constraint = 0;
+   for (int i=0;inumVehicles;i++)
+   {
+   WrapperVehicle* wrapperVehicle = m_wrapperVehicles[i];
+   if (wrapperVehicle-GetChassis() == ctrl)
+   vehicle_constraint = 
wrapperVehicle-GetVehicle()-getUserConstraintId();
+   }
+
+   if (vehicle_constraint  0)
+   RemoveConstraint(vehicle_constraint);
} else
{
//if a softbody
@@ -984,6 +1002,14 @@ void  
CcdPhysicsEnvironment::RemoveConstraint(int constraintId)
break;
}
}
+
+   WrapperVehicle *vehicle;
+   if ((vehicle = (WrapperVehicle*)GetVehicleConstraint(constraintId)))
+   {
+   m_dynamicsWorld-removeVehicle(vehicle-GetVehicle());
+   m_wrapperVehicles.erase(std::remove(m_wrapperVehicles.begin(), 
m_wrapperVehicles.end(), vehicle));
+   delete vehicle;
+   }
 }

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [55e3be5] master: Fix T36756: Use Frame Rate option toolip was unclear about which FPS value to respect

2013-11-18 Thread Mitchell Stokes
Commit: 55e3be560e5895be593dcf93a50dcd09631729b8
Author: Mitchell Stokes
Date:   Mon Nov 18 14:18:46 2013 -0800
http://developer.blender.org/rB55e3be560e5895be593dcf93a50dcd09631729b8

Fix T36756: Use Frame Rate option toolip was unclear about which FPS value to 
respect

===

M   source/blender/makesrna/intern/rna_scene.c

===

diff --git a/source/blender/makesrna/intern/rna_scene.c 
b/source/blender/makesrna/intern/rna_scene.c
index 2a68f0a..4d8592e 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -3428,7 +3428,8 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
prop = RNA_def_property(srna, use_frame_rate, PROP_BOOLEAN, 
PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, flag, 
GAME_ENABLE_ALL_FRAMES);
RNA_def_property_ui_text(prop, Use Frame Rate,
-Respect the frame rate rather than rendering 
as many frames as possible);
+Respect the frame rate from the Physics panel 
in the world properties 
+rather than rendering as many frames as 
possible);
 
prop = RNA_def_property(srna, use_display_lists, PROP_BOOLEAN, 
PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, flag, GAME_DISPLAY_LISTS);

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [0f32bc4] master: Fix T37171: Camera parented to a bone doesn't move with the bone, unless another object is parented too

2013-11-18 Thread Mitchell Stokes
Commit: 0f32bc49ecb54911eea705d661443fbb09d0ff9d
Author: Mitchell Stokes
Date:   Mon Nov 18 14:52:07 2013 -0800
http://developer.blender.org/rB0f32bc49ecb54911eea705d661443fbb09d0ff9d

Fix T37171: Camera parented to a bone doesn't move with the bone, unless 
another object is parented too

Armatures used to check if any of their meshes were culled to see if they needed
to be updated. However, this meant armatures with no meshes would never update,
since non-mesh objects are always considered culled. Instead, if a non-culled
child was not found, we now check to see if the armature contained only
non-mesh objects. If this is the case, always update the armature. If this
becomes a problem, we can look into being able to cull non-mesh objects.

===

M   source/gameengine/Ketsji/KX_Scene.cpp

===

diff --git a/source/gameengine/Ketsji/KX_Scene.cpp 
b/source/gameengine/Ketsji/KX_Scene.cpp
index 5a956ff..2f23bda 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -1613,16 +1613,29 @@ void KX_Scene::UpdateAnimations(double curtime)
CListValue *children = gameobj-GetChildren();
KX_GameObject *child;
 
+   bool has_mesh = false, has_non_mesh = false;
+
// Check for meshes that haven't been culled
for (int j=0; jchildren-GetCount(); ++j) {
child = (KX_GameObject*)children-GetValue(j);
 
-   if (child-GetMeshCount()  0  
!child-GetCulled()) {
+   if (!child-GetCulled()) {
needs_update = true;
break;
}
+
+   if (child-GetMeshCount() == 0)
+   has_non_mesh = true;
+   else
+   has_mesh = true;
}
 
+   // If we didn't find a non-culled mesh, check to see
+   // if we even have any meshes, and update if this
+   // armature has only non-mesh children.
+   if (!needs_update  !has_mesh  has_non_mesh)
+   needs_update = true;
+
children-Release();
}

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


[Bf-blender-cvs] [537f28f] master: Fix T37325: applyRotation() wasn't working correctly on rigid bodies in the game engine.

2013-11-17 Thread Mitchell Stokes
Commit: 537f28fc0eba79fd735c71eeaec17e387b4629c3
Author: Mitchell Stokes
Date:   Sun Nov 17 16:04:26 2013 -0800
http://developer.blender.org/rB537f28fc0eba79fd735c71eeaec17e387b4629c3

Fix T37325: applyRotation() wasn't working correctly on rigid bodies in the 
game engine.

During the physics cleanup/refactor, the rotation matrix in
CcdPhysicsController::RelativeRotate() became transposed.

===

M   source/gameengine/Physics/Bullet/CcdPhysicsController.cpp

===

diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp 
b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
index 71bdce0..6ce52b6 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
@@ -947,9 +947,9 @@ void
CcdPhysicsController::RelativeRotate(const MT_Matrix3x3 rotval,bool local
return;
}
 
-   btMatrix3x3 drotmat(rotval[0].x(), rotval[1].x(), rotval[2].x(),
-   rotval[0].y(), rotval[1].y(), rotval[2].y(),
-   rotval[0].z(), rotval[1].z(), rotval[2].z());
+   btMatrix3x3 drotmat(rotval[0].x(), rotval[0].y(), rotval[0].z(),
+   rotval[1].x(), rotval[1].y(), rotval[1].z(),
+   rotval[2].x(), rotval[2].y(), rotval[2].z());
 
 
btMatrix3x3 currentOrn;

___
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 [61174] trunk/blender/source/gameengine/ Physics/Bullet/CcdPhysicsEnvironment.cpp: BGE: Fix for #37335 Moving the camera with a key (after the recen

2013-11-06 Thread Mitchell Stokes
Revision: 61174
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=61174
Author:   moguri
Date: 2013-11-06 19:40:37 + (Wed, 06 Nov 2013)
Log Message:
---
BGE: Fix for #37335 Moving the camera with a key (after the recent BGE cleanup 
commits) now crashes the game reported by Ace Dragon.

CcdPhysicsEnvironment-GetCharacterController(); was missing a NULL check.

Modified Paths:
--
trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp

Modified: 
trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
===
--- trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
2013-11-06 19:21:42 UTC (rev 61173)
+++ trunk/blender/source/gameengine/Physics/Bullet/CcdPhysicsEnvironment.cpp
2013-11-06 19:40:37 UTC (rev 61174)
@@ -2288,7 +2288,7 @@
 PHY_ICharacter* CcdPhysicsEnvironment::GetCharacterController(KX_GameObject 
*ob)
 {
CcdPhysicsController* controller = 
(CcdPhysicsController*)ob-GetPhysicsController();
-   return 
dynamic_castBlenderBulletCharacterController*(controller-GetCharacterController());
+   return (controller) ? 
dynamic_castBlenderBulletCharacterController*(controller-GetCharacterController())
 : NULL;
 }
 
 

___
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 [61088] trunk/blender/source/gameengine: BGE Rasterizer Cleanup: Removing KX_BlenderGL since it was mostly one-line functions used by KX_BlenderCanvas

2013-11-04 Thread Mitchell Stokes
Revision: 61088
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=61088
Author:   moguri
Date: 2013-11-04 19:21:16 + (Mon, 04 Nov 2013)
Log Message:
---
BGE Rasterizer Cleanup: Removing KX_BlenderGL since it was mostly one-line 
functions used by KX_BlenderCanvas. KX_BlenderCanvas now just calls those 
functions directly.

Modified Paths:
--
trunk/blender/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
trunk/blender/source/gameengine/BlenderRoutines/CMakeLists.txt
trunk/blender/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
trunk/blender/source/gameengine/BlenderRoutines/KX_BlenderCanvas.h
trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp
trunk/blender/source/gameengine/Converter/BlenderWorldInfo.cpp
trunk/blender/source/gameengine/Converter/BlenderWorldInfo.h
trunk/blender/source/gameengine/Converter/KX_ConvertSensors.cpp

Removed Paths:
-
trunk/blender/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
trunk/blender/source/gameengine/BlenderRoutines/KX_BlenderGL.h

Modified: 
trunk/blender/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
===
--- trunk/blender/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp 
2013-11-04 19:21:07 UTC (rev 61087)
+++ trunk/blender/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp 
2013-11-04 19:21:16 UTC (rev 61088)
@@ -42,7 +42,6 @@
 
 #include GL/glew.h
 
-#include KX_BlenderGL.h
 #include KX_BlenderCanvas.h
 #include KX_BlenderKeyboardDevice.h
 #include KX_BlenderMouseDevice.h

Modified: trunk/blender/source/gameengine/BlenderRoutines/CMakeLists.txt
===
--- trunk/blender/source/gameengine/BlenderRoutines/CMakeLists.txt  
2013-11-04 19:21:07 UTC (rev 61087)
+++ trunk/blender/source/gameengine/BlenderRoutines/CMakeLists.txt  
2013-11-04 19:21:16 UTC (rev 61088)
@@ -39,7 +39,6 @@
BL_KetsjiEmbedStart.cpp
BL_System.cpp
KX_BlenderCanvas.cpp
-   KX_BlenderGL.cpp
KX_BlenderInputDevice.cpp
KX_BlenderKeyboardDevice.cpp
KX_BlenderMouseDevice.cpp
@@ -47,7 +46,6 @@
 
BL_System.h
KX_BlenderCanvas.h
-   KX_BlenderGL.h
KX_BlenderInputDevice.h
KX_BlenderKeyboardDevice.h
KX_BlenderMouseDevice.h

Modified: trunk/blender/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
===
--- trunk/blender/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
2013-11-04 19:21:07 UTC (rev 61087)
+++ trunk/blender/source/gameengine/BlenderRoutines/KX_BlenderCanvas.cpp
2013-11-04 19:21:16 UTC (rev 61088)
@@ -29,13 +29,33 @@
  *  \ingroup blroutines
  */
 
+#include GL/glew.h
 
+#include MEM_guardedalloc.h
+
 #include KX_BlenderCanvas.h
+
+#include DNA_image_types.h
+#include DNA_scene_types.h
 #include DNA_screen_types.h
 #include DNA_windowmanager_types.h
-#include stdio.h
+
+#include BKE_image.h
+#include BKE_global.h
+#include BKE_main.h
+
+#include BLI_path_util.h
+#include BLI_string.h
+
 #include assert.h
 
+extern C {
+#include IMB_imbuf.h
+#include IMB_imbuf_types.h
+#include WM_api.h
+#include wm_cursors.h
+#include wm_window.h
+}
 
 KX_BlenderCanvas::KX_BlenderCanvas(wmWindowManager *wm, wmWindow *win, 
RAS_Rect rect, struct ARegion *ar) :
 m_wm(wm),
@@ -63,17 +83,17 @@
 
 void KX_BlenderCanvas::SwapBuffers()
 {
-   BL_SwapBuffers(m_win);
+   wm_window_swap_buffers(m_win);
 }
 
 void KX_BlenderCanvas::SetSwapInterval(int interval)
 {
-   BL_SetSwapInterval(m_win, interval);
+   wm_window_set_swap_interval(m_win, interval);
 }
 
 intKX_BlenderCanvas::GetSwapInterval()
 {
-   return BL_GetSwapInterval(m_win);
+   return wm_window_get_swap_interval(m_win);
 }
 
 void KX_BlenderCanvas::ResizeWindow(int width, int height)
@@ -96,7 +116,7 @@
 {
// in case of multi-window we need to ensure we are drawing to the 
correct
// window always, because it may change in window event handling
-   BL_MakeDrawable(m_wm, m_win);
+   wm_window_make_drawable(m_wm, m_win);
return true;
 }
 
@@ -247,17 +267,17 @@
{
case MOUSE_INVISIBLE:
{
-   BL_HideMouse(m_win);
+   WM_cursor_set(m_win, CURSOR_NONE);
break;
}
case MOUSE_WAIT:
{
-   BL_WaitMouse(m_win);
+   WM_cursor_set(m_win, CURSOR_WAIT);
break;
}
case MOUSE_NORMAL:
{
-   BL_NormalMouse(m_win);
+   WM_cursor_set(m_win, CURSOR_STD);
break;
}
default:
@@ -275,18 +295,71 @@
int winY = 

[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [61090] trunk/blender/source/gameengine/ Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp: BGE Rasterizer Cleanup: Getting rid of the BL_Mater

2013-11-04 Thread Mitchell Stokes
Revision: 61090
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=61090
Author:   moguri
Date: 2013-11-04 19:21:25 + (Mon, 04 Nov 2013)
Log Message:
---
BGE Rasterizer Cleanup: Getting rid of the BL_Material.h include in 
RAS_OpenGLRasterizer.cpp.

Modified Paths:
--

trunk/blender/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp

Modified: 
trunk/blender/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
===
--- 
trunk/blender/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
2013-11-04 19:21:21 UTC (rev 61089)
+++ 
trunk/blender/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
2013-11-04 19:21:25 UTC (rev 61090)
@@ -64,7 +64,6 @@
 
 
 // XXX Clean these up 
-#include BL_Material.h // MAXTEX
 #include Value.h
 #include KX_BlenderMaterial.h
 #include KX_PolygonMaterial.h
@@ -1370,7 +1369,7 @@
glDisable(GL_COLOR_MATERIAL);
 
if (GLEW_ARB_multitexture) {
-   for (int i=0; iMAXTEX; i++) {
+   for (int i=0; iRAS_MAX_TEXCO; i++) {
glActiveTextureARB(GL_TEXTURE0_ARB+i);
 
if (GLEW_ARB_texture_cube_map)

___
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 [61087] trunk/blender/source/gameengine: BGE Rasterizer Cleanup: Removing RAS_IRenderTools and moving the functionality to RAS_IRasterizer.

2013-11-04 Thread Mitchell Stokes
Revision: 61087
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=61087
Author:   moguri
Date: 2013-11-04 19:21:07 + (Mon, 04 Nov 2013)
Log Message:
---
BGE Rasterizer Cleanup: Removing RAS_IRenderTools and moving the functionality 
to RAS_IRasterizer. RAS_OpenGLRasterizer is a bit of a mess now with references 
to Ketsji and other modules it shouldn't be accessing.

Modified Paths:
--
trunk/blender/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
trunk/blender/source/gameengine/BlenderRoutines/CMakeLists.txt
trunk/blender/source/gameengine/BlenderRoutines/KX_BlenderGL.cpp
trunk/blender/source/gameengine/BlenderRoutines/KX_BlenderGL.h
trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp
trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.h
trunk/blender/source/gameengine/Converter/KX_BlenderSceneConverter.cpp
trunk/blender/source/gameengine/Converter/KX_BlenderSceneConverter.h
trunk/blender/source/gameengine/GamePlayer/common/CMakeLists.txt
trunk/blender/source/gameengine/GamePlayer/ghost/GPG_Application.cpp
trunk/blender/source/gameengine/GamePlayer/ghost/GPG_Application.h
trunk/blender/source/gameengine/Ketsji/KX_Dome.cpp
trunk/blender/source/gameengine/Ketsji/KX_Dome.h
trunk/blender/source/gameengine/Ketsji/KX_FontObject.cpp
trunk/blender/source/gameengine/Ketsji/KX_FontObject.h
trunk/blender/source/gameengine/Ketsji/KX_ISceneConverter.h
trunk/blender/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
trunk/blender/source/gameengine/Ketsji/KX_KetsjiEngine.h
trunk/blender/source/gameengine/Ketsji/KX_Light.cpp
trunk/blender/source/gameengine/Ketsji/KX_Light.h
trunk/blender/source/gameengine/Ketsji/KX_Scene.cpp
trunk/blender/source/gameengine/Ketsji/KX_Scene.h
trunk/blender/source/gameengine/Rasterizer/CMakeLists.txt
trunk/blender/source/gameengine/Rasterizer/RAS_BucketManager.cpp
trunk/blender/source/gameengine/Rasterizer/RAS_BucketManager.h
trunk/blender/source/gameengine/Rasterizer/RAS_IRasterizer.h
trunk/blender/source/gameengine/Rasterizer/RAS_MaterialBucket.cpp
trunk/blender/source/gameengine/Rasterizer/RAS_MaterialBucket.h

trunk/blender/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/CMakeLists.txt

trunk/blender/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp

trunk/blender/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
trunk/blender/source/gameengine/VideoTexture/ImageRender.cpp
trunk/blender/source/gameengine/VideoTexture/ImageRender.h

Removed Paths:
-
trunk/blender/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.cpp
trunk/blender/source/gameengine/BlenderRoutines/KX_BlenderRenderTools.h
trunk/blender/source/gameengine/GamePlayer/common/GPC_RenderTools.cpp
trunk/blender/source/gameengine/GamePlayer/common/GPC_RenderTools.h
trunk/blender/source/gameengine/Rasterizer/RAS_IRenderTools.cpp
trunk/blender/source/gameengine/Rasterizer/RAS_IRenderTools.h

Modified: 
trunk/blender/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp
===
--- trunk/blender/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp 
2013-11-04 18:58:22 UTC (rev 61086)
+++ trunk/blender/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp 
2013-11-04 19:21:07 UTC (rev 61087)
@@ -46,7 +46,6 @@
 #include KX_BlenderCanvas.h
 #include KX_BlenderKeyboardDevice.h
 #include KX_BlenderMouseDevice.h
-#include KX_BlenderRenderTools.h
 #include KX_BlenderSystem.h
 #include BL_Material.h
 
@@ -276,7 +275,7 @@
 
if (animation_record) usefixed= false; /* override since you 
don't want to run full-speed for sim recording */
 
-   // create the canvas, rasterizer and rendertools
+   // create the canvas and rasterizer
RAS_ICanvas* canvas = new KX_BlenderCanvas(wm, win, area_rect, 
ar);

// default mouse state set on render panel
@@ -292,7 +291,6 @@
else
canvas-SetSwapInterval((startscene-gm.vsync == 
VSYNC_ON) ? 1 : 0);
 
-   RAS_IRenderTools* rendertools = new KX_BlenderRenderTools();
RAS_IRasterizer* rasterizer = NULL;
//Don't use displaylists with VBOs
//If auto starts using VBOs, make sure to check for that here
@@ -324,7 +322,6 @@
ketsjiengine-SetMouseDevice(mousedevice);
ketsjiengine-SetNetworkDevice(networkdevice);
ketsjiengine-SetCanvas(canvas);
-   ketsjiengine-SetRenderTools(rendertools);
ketsjiengine-SetRasterizer(rasterizer);
ketsjiengine-SetUseFixedTime(usefixed);
ketsjiengine-SetTimingDisplay(frameRate, profile, properties);
@@ 

[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [61089] trunk/blender/source/gameengine/ Rasterizer: BGE Rasterizer Cleanup: Getting rid of RAS_IRasterizer:: RenderText(), and just adding the code t

2013-11-04 Thread Mitchell Stokes
Revision: 61089
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=61089
Author:   moguri
Date: 2013-11-04 19:21:21 + (Mon, 04 Nov 2013)
Log Message:
---
BGE Rasterizer Cleanup: Getting rid of RAS_IRasterizer::RenderText(), and just 
adding the code to IndexPrimitives_3DText(), which is the only function that 
uses RenderText().

Modified Paths:
--
trunk/blender/source/gameengine/Rasterizer/RAS_IRasterizer.h

trunk/blender/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp

trunk/blender/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h

Modified: trunk/blender/source/gameengine/Rasterizer/RAS_IRasterizer.h
===
--- trunk/blender/source/gameengine/Rasterizer/RAS_IRasterizer.h
2013-11-04 19:21:16 UTC (rev 61088)
+++ trunk/blender/source/gameengine/Rasterizer/RAS_IRasterizer.h
2013-11-04 19:21:21 UTC (rev 61089)
@@ -495,16 +495,6 @@
int height
) = 0;
 
-   // 3d text, mapped on polygon
-   virtual void RenderText(int mode,
-   RAS_IPolyMaterial* 
polymat,
-   float v1[3],
-   float v2[3],
-   float v3[3],
-   float v4[3],
-   int glattrib
-   )=0;
-
virtual void ProcessLighting(bool uselights, const MT_Transform 
trans)=0;
 
virtual void PushMatrix()=0;

Modified: 
trunk/blender/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
===
--- 
trunk/blender/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
2013-11-04 19:21:16 UTC (rev 61088)
+++ 
trunk/blender/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
2013-11-04 19:21:21 UTC (rev 61089)
@@ -681,7 +681,13 @@
bool obcolor = ms.m_bObjectColor;
MT_Vector4 rgba = ms.m_RGBAcolor;
RAS_MeshSlot::iterator it;
+   struct MTFace* tface = 0;
 
+   const STR_String mytext = 
((CValue*)m_clientobject)-GetPropertyText(Text);
+
+   const unsigned int flag = polymat-GetFlag();
+   unsigned int *col = 0;
+
// handle object color
if (obcolor) {
glDisableClientState(GL_COLOR_ARRAY);
@@ -732,10 +738,19 @@
for (unit=0; unitm_attrib_num; unit++)
if (m_attrib[unit] == 
RAS_TEXCO_UV)
glattrib = unit;
-   
-   RenderText(polymat-GetDrawingMode(), polymat,
-   v[0], v[1], v[2], (numvert == 4)? v[3]: 
NULL, glattrib);
 
+   if (flag  RAS_BLENDERMAT) {
+   KX_BlenderMaterial *bl_mat = 
static_castKX_BlenderMaterial*(polymat);
+   tface = bl_mat-GetMTFace();
+   col = bl_mat-GetMCol();
+   } else {
+   KX_PolygonMaterial* blenderpoly = 
static_castKX_PolygonMaterial*(polymat);
+   tface = blenderpoly-GetMTFace();
+   col = blenderpoly-GetMCol();
+   }
+
+   GPU_render_text(tface, 
polymat-GetDrawingMode(), mytext, mytext.Length(), col, v[1], v[2], v[3], 
v[4], glattrib);
+
ClearCachingInfo();
}
}
@@ -1500,34 +1515,6 @@
glEnable(GL_DEPTH_TEST);
 }
 
-/* Render Text renders text into a (series of) polygon, using a texture font,
- * Each character consists of one polygon (one quad or two triangles) */
-
-void RAS_OpenGLRasterizer::RenderText(
-   int mode,
-   RAS_IPolyMaterial* polymat,
-   float v1[3], float v2[3], float v3[3], float v4[3], int glattrib)
-{
-   const STR_String mytext = 
((CValue*)m_clientobject)-GetPropertyText(Text);
-
-   const unsigned int flag = polymat-GetFlag();
-   struct MTFace* tface = 0;
-   unsigned int *col = 0;
-
-   if (flag  RAS_BLENDERMAT) {
-   KX_BlenderMaterial *bl_mat = 
static_castKX_BlenderMaterial*(polymat);
-   tface = bl_mat-GetMTFace();
-   col = bl_mat-GetMCol();
-   } else {
-   KX_PolygonMaterial* blenderpoly = 

[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [61092] trunk/blender/source/gameengine/ Rasterizer/RAS_OpenGLRasterizer: BGE Rasterizer Cleanup: Moving the RAS_OpenGLRasterizer::ApplyLights() code

2013-11-04 Thread Mitchell Stokes
Revision: 61092
  
http://projects.blender.org/scm/viewvc.php?view=revroot=bf-blenderrevision=61092
Author:   moguri
Date: 2013-11-04 19:21:37 + (Mon, 04 Nov 2013)
Log Message:
---
BGE Rasterizer Cleanup: Moving the RAS_OpenGLRasterizer::ApplyLights() code 
into RAS_OpenGLRasterizer::ProcessLighting().

Modified Paths:
--

trunk/blender/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp

trunk/blender/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h

Modified: 
trunk/blender/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
===
--- 
trunk/blender/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
2013-11-04 19:21:32 UTC (rev 61091)
+++ 
trunk/blender/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
2013-11-04 19:21:37 UTC (rev 61092)
@@ -1159,9 +1159,34 @@
m_lastauxinfo = m_auxilaryClientInfo;
 
/* enable/disable lights as needed */
-   if (layer = 0)
-   enable = ApplyLights(layer, viewmat);
+   if (layer = 0) {
+   //enable = ApplyLights(layer, viewmat);
+   // taken from blender source, incompatibility between Blender 
Object / GameObject
+   KX_Scene* kxscene = (KX_Scene*)m_auxilaryClientInfo;
+   float glviewmat[16];
+   unsigned int count;
+   std::vectorstruct  RAS_LightObject*::iterator lit = 
m_lights.begin();
 
+   for (count=0; countm_numgllights; count++)
+   glDisable((GLenum)(GL_LIGHT0+count));
+
+   viewmat.getValue(glviewmat);
+
+   glPushMatrix();
+   glLoadMatrixf(glviewmat);
+   for (lit = m_lights.begin(), count = 0; !(lit==m_lights.end()) 
 count  m_numgllights; ++lit)
+   {
+   RAS_LightObject* lightdata = (*lit);
+   KX_LightObject *kxlight = 
(KX_LightObject*)lightdata-m_light;
+
+   if (kxlight-ApplyLight(kxscene, layer, count))
+   count++;
+   }
+   glPopMatrix();
+
+   enable = count  0;
+   }
+
if (enable)
EnableOpenGLLights();
else
@@ -1508,35 +1533,6 @@
glPopMatrix();
 }
 
-
-int RAS_OpenGLRasterizer::ApplyLights(int objectlayer, const MT_Transform 
viewmat)
-{
-   // taken from blender source, incompatibility between Blender Object / 
GameObject
-   KX_Scene* kxscene = (KX_Scene*)m_auxilaryClientInfo;
-   float glviewmat[16];
-   unsigned int count;
-   std::vectorstruct  RAS_LightObject*::iterator lit = 
m_lights.begin();
-
-   for (count=0; countm_numgllights; count++)
-   glDisable((GLenum)(GL_LIGHT0+count));
-
-   viewmat.getValue(glviewmat);
-
-   glPushMatrix();
-   glLoadMatrixf(glviewmat);
-   for (lit = m_lights.begin(), count = 0; !(lit==m_lights.end())  count 
 m_numgllights; ++lit)
-   {
-   RAS_LightObject* lightdata = (*lit);
-   KX_LightObject *kxlight = (KX_LightObject*)lightdata-m_light;
-
-   if (kxlight-ApplyLight(kxscene, objectlayer, count))
-   count++;
-   }
-   glPopMatrix();
-
-   return count;
-}
-
 void RAS_OpenGLRasterizer::MotionBlur()
 {
int state = GetMotionBlurState();

Modified: 
trunk/blender/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
===
--- 
trunk/blender/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
  2013-11-04 19:21:32 UTC (rev 61091)
+++ 
trunk/blender/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.h
  2013-11-04 19:21:37 UTC (rev 61092)
@@ -367,7 +367,6 @@
 int height);
 
voidapplyTransform(double* oglmatrix, int objectdrawmode);
-   int applyLights(int objectlayer, const MT_Transform 
viewmat);
 
voidPushMatrix();
voidPopMatrix();

___
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs


  1   2   3   4   5   6   7   >