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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-04-15 17:50:56 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-04-15 17:50:56 +0400
commit514c78ba39f296fcac60b33d9a040af2051d23cc (patch)
tree4f824d3dbfcec6c5397ceeb44e7379ad2ae7cf2f /source/gameengine/Ketsji/KX_MouseFocusSensor.h
parente8f4d9322112e64677df11ba834a26159874b332 (diff)
BGE MouseFocusSensor
- fix for multiple viewpors broke single viewport (both work now) - python could get uninitialized values from m_prevTargetPoint and m_prevSourcePoint - getting the RayDirection for python could crash blender trying to normalize a zero length vector. - added python attributes - removed unused canvas from the MouseFocusSensor class
Diffstat (limited to 'source/gameengine/Ketsji/KX_MouseFocusSensor.h')
-rw-r--r--source/gameengine/Ketsji/KX_MouseFocusSensor.h26
1 files changed, 17 insertions, 9 deletions
diff --git a/source/gameengine/Ketsji/KX_MouseFocusSensor.h b/source/gameengine/Ketsji/KX_MouseFocusSensor.h
index 804f34e6076..8de1f88c5c3 100644
--- a/source/gameengine/Ketsji/KX_MouseFocusSensor.h
+++ b/source/gameengine/Ketsji/KX_MouseFocusSensor.h
@@ -54,7 +54,6 @@ class KX_MouseFocusSensor : public SCA_MouseSensor
int starty,
short int mousemode,
int focusmode,
- RAS_ICanvas* canvas,
KX_Scene* kxscene,
KX_KetsjiEngine* kxengine,
SCA_IObject* gameobj,
@@ -82,7 +81,10 @@ class KX_MouseFocusSensor : public SCA_MouseSensor
bool RayHit(KX_ClientObjectInfo* client, KX_RayCast* result, void * const data);
bool NeedRayCast(KX_ClientObjectInfo* client) { return true; }
-
+ const MT_Point3& RaySource() const;
+ const MT_Point3& RayTarget() const;
+ const MT_Point3& HitPosition() const;
+ const MT_Vector3& HitNormal() const;
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
@@ -97,6 +99,14 @@ class KX_MouseFocusSensor : public SCA_MouseSensor
KX_PYMETHOD_DOC_NOARGS(KX_MouseFocusSensor,GetHitNormal);
KX_PYMETHOD_DOC_NOARGS(KX_MouseFocusSensor,GetRayDirection);
+ /* attributes */
+ static PyObject* pyattr_get_ray_source(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_ray_target(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_ray_direction(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_hit_object(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_hit_position(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+ static PyObject* pyattr_get_hit_normal(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+
/* --------------------------------------------------------------------- */
SCA_IObject* m_hitObject;
@@ -116,9 +126,13 @@ class KX_MouseFocusSensor : public SCA_MouseSensor
*/
bool m_positive_event;
+ /**
+ * Tests whether the object is in mouse focus for this camera
+ */
+ bool ParentObjectHasFocusCamera(KX_Camera *cam);
/**
- * Tests whether the object is in mouse focus in this frame.
+ * Tests whether the object is in mouse focus in this scene.
*/
bool ParentObjectHasFocus(void);
@@ -142,12 +156,6 @@ class KX_MouseFocusSensor : public SCA_MouseSensor
* the object was hit. */
MT_Vector3 m_hitNormal;
-
- /**
- * The active canvas. The size of this canvas determines a part of
- * the start position of the picking ray. */
- RAS_ICanvas* m_gp_canvas;
-
/**
* The KX scene that holds the camera. The camera position
* determines a part of the start location of the picking ray. */