Revision: 16239
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16239
Author:   campbellbarton
Date:     2008-08-24 04:46:03 +0200 (Sun, 24 Aug 2008)

Log Message:
-----------
svn merge -r 16227:HEAD https://svn.blender.org/svnroot/bf-blender/trunk/blender

Thanks for bens state level commit will be able to clean up duplicate sensors a 
bit :)
http://members.optusnet.com.au/cjbarton/frank_logic.png

Modified Paths:
--------------
    branches/apricot/projectfiles_vc7/blender/blenkernel/BKE_blenkernel.vcproj
    branches/apricot/release/text/copyright.txt
    branches/apricot/source/blender/blenkernel/BKE_deform.h
    branches/apricot/source/blender/blenkernel/intern/shrinkwrap.c
    branches/apricot/source/blender/blenlib/BLI_winstuff.h
    branches/apricot/source/blender/blenlib/intern/BLI_kdopbvh.c
    branches/apricot/source/blender/python/api2_2x/Particle.c
    branches/apricot/source/gameengine/GameLogic/SCA_IController.cpp
    branches/apricot/source/gameengine/GameLogic/SCA_ISensor.cpp
    branches/apricot/source/gameengine/GameLogic/SCA_ISensor.h
    branches/apricot/source/gameengine/GameLogic/SCA_KeyboardSensor.cpp
    branches/apricot/source/gameengine/GameLogic/SCA_LogicManager.cpp
    branches/apricot/source/gameengine/GameLogic/SCA_LogicManager.h
    branches/apricot/source/gameengine/GameLogic/SCA_PythonController.cpp
    branches/apricot/source/gameengine/GameLogic/SCA_PythonController.h
    branches/apricot/source/gameengine/Ketsji/KX_PythonInit.cpp
    branches/apricot/source/gameengine/PyDoc/SCA_ISensor.py
    branches/apricot/source/nan_definitions.mk

Modified: 
branches/apricot/projectfiles_vc7/blender/blenkernel/BKE_blenkernel.vcproj
===================================================================
--- branches/apricot/projectfiles_vc7/blender/blenkernel/BKE_blenkernel.vcproj  
2008-08-23 18:08:04 UTC (rev 16238)
+++ branches/apricot/projectfiles_vc7/blender/blenkernel/BKE_blenkernel.vcproj  
2008-08-24 02:46:03 UTC (rev 16239)
@@ -495,6 +495,9 @@
                                
RelativePath="..\..\..\source\blender\blenkernel\intern\script.c">
                        </File>
                        <File
+                               
RelativePath="..\..\..\source\blender\blenkernel\intern\shrinkwrap.c">
+                       </File>
+                       <File
                                
RelativePath="..\..\..\source\blender\blenkernel\intern\softbody.c">
                        </File>
                        <File
@@ -709,6 +712,9 @@
                                
RelativePath="..\..\..\source\blender\blenkernel\BKE_script.h">
                        </File>
                        <File
+                               
RelativePath="..\..\..\source\blender\blenkernel\BKE_shrinkwrap.h">
+                       </File>
+                       <File
                                
RelativePath="..\..\..\source\blender\blenkernel\BKE_softbody.h">
                        </File>
                        <File

Modified: branches/apricot/release/text/copyright.txt
===================================================================
--- branches/apricot/release/text/copyright.txt 2008-08-23 18:08:04 UTC (rev 
16238)
+++ branches/apricot/release/text/copyright.txt 2008-08-24 02:46:03 UTC (rev 
16239)
@@ -56,7 +56,7 @@
   information, claims of third parties, damages as a result of injury to
   any person, or any other loss) arising out of or in connection with the
   license granted under this License Agreement or the use of or inability
-  to use the Software, even if VF has been advised of the possibility of
+  to use the Software, even if BF has been advised of the possibility of
   such damages. 
    
   5. User warning and indemnification

Modified: branches/apricot/source/blender/blenkernel/BKE_deform.h
===================================================================
--- branches/apricot/source/blender/blenkernel/BKE_deform.h     2008-08-23 
18:08:04 UTC (rev 16238)
+++ branches/apricot/source/blender/blenkernel/BKE_deform.h     2008-08-24 
02:46:03 UTC (rev 16239)
@@ -38,6 +38,7 @@
 struct Object;
 struct ListBase;
 struct bDeformGroup;
+struct MDeformVert;
 
 void copy_defgroups (struct ListBase *lb1, struct ListBase *lb2);
 struct bDeformGroup *copy_defgroup (struct bDeformGroup *ingroup);

Modified: branches/apricot/source/blender/blenkernel/intern/shrinkwrap.c
===================================================================
--- branches/apricot/source/blender/blenkernel/intern/shrinkwrap.c      
2008-08-23 18:08:04 UTC (rev 16238)
+++ branches/apricot/source/blender/blenkernel/intern/shrinkwrap.c      
2008-08-24 02:46:03 UTC (rev 16239)
@@ -113,23 +113,23 @@
 
 void space_transform_apply(const SpaceTransform *data, float *co)
 {
-       VecMat4MulVecfl(co, data->local2target, co);
+       VecMat4MulVecfl(co, ((SpaceTransform*)data)->local2target, co);
 }
 
 void space_transform_invert(const SpaceTransform *data, float *co)
 {
-       VecMat4MulVecfl(co, data->target2local, co);
+       VecMat4MulVecfl(co, ((SpaceTransform*)data)->target2local, co);
 }
 
 void space_transform_apply_normal(const SpaceTransform *data, float *no)
 {
-       Mat4Mul3Vecfl(data->local2target, no);
+       Mat4Mul3Vecfl( ((SpaceTransform*)data)->local2target, no);
        Normalize(no); // TODO: could we just determine de scale value from the 
matrix?
 }
 
 void space_transform_invert_normal(const SpaceTransform *data, float *no)
 {
-       Mat4Mul3Vecfl(data->target2local, no);
+       Mat4Mul3Vecfl(((SpaceTransform*)data)->target2local, no);
        Normalize(no); // TODO: could we just determine de scale value from the 
matrix?
 }
 
@@ -291,7 +291,7 @@
                space_transform_apply_normal( transf, tmp_no );
                no = tmp_no;
 
-               hit_tmp.dist *= Mat4ToScalef( transf->local2target );
+               hit_tmp.dist *= Mat4ToScalef( 
((SpaceTransform*)transf)->local2target );
        }
        else
        {
@@ -318,7 +318,7 @@
                        space_transform_invert( transf, hit_tmp.co );
                        space_transform_invert_normal( transf, hit_tmp.no );
 
-                       hit_tmp.dist = VecLenf( vert, hit_tmp.co );
+                       hit_tmp.dist = VecLenf( (float*)vert, hit_tmp.co );
                }
 
                memcpy(hit, &hit_tmp, sizeof(hit_tmp) );

Modified: branches/apricot/source/blender/blenlib/BLI_winstuff.h
===================================================================
--- branches/apricot/source/blender/blenlib/BLI_winstuff.h      2008-08-23 
18:08:04 UTC (rev 16238)
+++ branches/apricot/source/blender/blenlib/BLI_winstuff.h      2008-08-24 
02:46:03 UTC (rev 16239)
@@ -61,6 +61,10 @@
 
        // These definitions are also in arithb for simplicity
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #ifndef M_PI
 #define M_PI           3.14159265358979323846
 #endif
@@ -116,5 +120,9 @@
 void get_default_root(char *root);
 int check_file_chars(char *filename);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __WINSTUFF_H__ */
 

Modified: branches/apricot/source/blender/blenlib/intern/BLI_kdopbvh.c
===================================================================
--- branches/apricot/source/blender/blenlib/intern/BLI_kdopbvh.c        
2008-08-23 18:08:04 UTC (rev 16238)
+++ branches/apricot/source/blender/blenlib/intern/BLI_kdopbvh.c        
2008-08-24 02:46:03 UTC (rev 16239)
@@ -82,7 +82,7 @@
 typedef struct BVHNearestData
 {
        BVHTree *tree;
-       float   *co;
+       const float     *co;
        BVHTree_NearestPointCallback callback;
        void    *userdata;
        float proj[13];                 //coordinates projection over axis
@@ -1248,7 +1248,6 @@
 
 static void dfs_find_nearest_begin(BVHNearestData *data, BVHNode *node)
 {
-       int i;
        float nearest[3], sdist;
        sdist = calc_nearest_point(data, node, nearest);
        if(sdist >= data->nearest.dist) return;

Modified: branches/apricot/source/blender/python/api2_2x/Particle.c
===================================================================
--- branches/apricot/source/blender/python/api2_2x/Particle.c   2008-08-23 
18:08:04 UTC (rev 16238)
+++ branches/apricot/source/blender/python/api2_2x/Particle.c   2008-08-24 
02:46:03 UTC (rev 16239)
@@ -804,7 +804,7 @@
 {
        ParticleSystem *psys = 0L;
        Object *ob = 0L;
-       PyObject *partlist,*seglist;
+       PyObject *partlist,*seglist=0L;
        ParticleCacheKey **cache,*path;
        PyObject* loc = 0L;
        ParticleKey state;
@@ -1107,7 +1107,7 @@
        ParticleSystem *psys = 0L;
        ParticleData *data;
        Object *ob = 0L;
-       PyObject *partlist,*tuple;
+       PyObject *partlist,*tuple=0L;
        DerivedMesh* dm;
        float vm[4][4],wm[4][4];
        float size;
@@ -1217,7 +1217,7 @@
        ParticleSystem *psys = 0L;
        ParticleData *data;
        Object *ob = 0L;
-       PyObject *partlist,*tuple;
+       PyObject *partlist,*tuple=0L;
        DerivedMesh* dm;
        float vm[4][4],wm[4][4];
        float life;

Modified: branches/apricot/source/gameengine/GameLogic/SCA_IController.cpp
===================================================================
--- branches/apricot/source/gameengine/GameLogic/SCA_IController.cpp    
2008-08-23 18:08:04 UTC (rev 16238)
+++ branches/apricot/source/gameengine/GameLogic/SCA_IController.cpp    
2008-08-24 02:46:03 UTC (rev 16239)
@@ -188,6 +188,8 @@
                        for (sensit = 
m_linkedsensors.begin();!(sensit==m_linkedsensors.end());++sensit)
                        {
                                (*sensit)->IncLink();
+                               // remember that this controller just activated 
that sensor
+                               (*sensit)->AddNewController(this);
                        }
                        SetActive(true);
                }

Modified: branches/apricot/source/gameengine/GameLogic/SCA_ISensor.cpp
===================================================================
--- branches/apricot/source/gameengine/GameLogic/SCA_ISensor.cpp        
2008-08-23 18:08:04 UTC (rev 16238)
+++ branches/apricot/source/gameengine/GameLogic/SCA_ISensor.cpp        
2008-08-24 02:46:03 UTC (rev 16239)
@@ -32,6 +32,8 @@
 #include "SCA_ISensor.h"
 #include "SCA_EventManager.h"
 #include "SCA_LogicManager.h"
+// needed for IsTriggered()
+#include "SCA_PythonController.h"
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
@@ -132,10 +134,8 @@
        }
        if (!m_links)
        {
-               // sensor is detached from all controllers, initialize it so 
that it
-               // is fresh as at startup when it is reattached again.
+               // sensor is detached from all controllers, remove it from 
manager
                UnregisterToManager();
-               Init();
        }
 }
 
@@ -168,7 +168,9 @@
 };
 PyMethodDef SCA_ISensor::Methods[] = {
        {"isPositive", (PyCFunction) SCA_ISensor::sPyIsPositive, 
-        METH_VARARGS, IsPositive_doc},
+        METH_NOARGS, IsPositive_doc},
+       {"isTriggered", (PyCFunction) SCA_ISensor::sPyIsTriggered, 
+        METH_VARARGS, IsTriggered_doc},
        {"getUsePosPulseMode", (PyCFunction) 
SCA_ISensor::sPyGetUsePosPulseMode, 
         METH_NOARGS, GetUsePosPulseMode_doc},
        {"setUsePosPulseMode", (PyCFunction) 
SCA_ISensor::sPySetUsePosPulseMode, 
@@ -204,6 +206,9 @@
 
 void SCA_ISensor::RegisterToManager()
 {
+       // sensor is just activated, initialize it
+       Init();
+       m_newControllers.erase(m_newControllers.begin(), 
m_newControllers.end());
        m_eventmgr->RegisterSensor(this);
 }
 
@@ -249,19 +254,47 @@
                                }
                        }
                }
+               if (!m_newControllers.empty())
+               {
+                       if (!IsActive() && m_level)
+                       {
+                               // This level sensor is connected to at least 
one controller that was just made 
+                               // active but it did not generate an event yet, 
do it now to those controllers only 
+                               for (std::vector<SCA_IController*>::iterator 
ci=m_newControllers.begin();
+                                        ci != m_newControllers.end(); ci++)
+                               {
+                                       logicmgr->AddTriggeredController(*ci, 
this);
+                               }
+                       }
+                       // clear the list. Instead of using clear, which also 
release the memory,
+                       // use erase, which keeps the memory available for next 
time.
+                       m_newControllers.erase(m_newControllers.begin(), 
m_newControllers.end());
+               }
        } 
 }
 
 /* Python functions: */
 char SCA_ISensor::IsPositive_doc[] = 
 "isPositive()\n"
-"\tReturns whether the sensor is registered a positive event.\n";
-PyObject* SCA_ISensor::PyIsPositive(PyObject* self, PyObject* args, PyObject* 
kwds)
+"\tReturns whether the sensor is in an active state.\n";
+PyObject* SCA_ISensor::PyIsPositive(PyObject* self)
 {
        int retval = IsPositiveTrigger();
        return PyInt_FromLong(retval);
 }
 
+char SCA_ISensor::IsTriggered_doc[] = 
+"isTriggered()\n"
+"\tReturns whether the sensor has triggered the current controller.\n";
+PyObject* SCA_ISensor::PyIsTriggered(PyObject* self)
+{
+       // check with the current controller
+       int retval = 0;
+       if (SCA_PythonController::m_sCurrentController)
+               retval = 
SCA_PythonController::m_sCurrentController->IsTriggered(this);
+       return PyInt_FromLong(retval);
+}
+
 /**
  * getUsePulseMode: getter for the pulse mode (KX_TRUE = on)
  */

Modified: branches/apricot/source/gameengine/GameLogic/SCA_ISensor.h
===================================================================

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to