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
path: root/source
diff options
context:
space:
mode:
authorKester Maddock <Christopher.Maddock.1@uni.massey.ac.nz>2004-05-30 15:09:46 +0400
committerKester Maddock <Christopher.Maddock.1@uni.massey.ac.nz>2004-05-30 15:09:46 +0400
commitd38329b5aa6be472ea49c3a52b61875a772a6c9a (patch)
tree8f8ebf5a0438725b6d5398f1cb5d1f3c028ce668 /source
parentb97c77df2bafd7add01ea9dc8bfcad1e82714559 (diff)
Added Python module for Lights.
Added attributes to the vertex class.
Diffstat (limited to 'source')
-rw-r--r--source/gameengine/Ketsji/KX_Light.cpp175
-rw-r--r--source/gameengine/Ketsji/KX_Light.h8
-rw-r--r--source/gameengine/Ketsji/KX_PyMath.cpp56
-rw-r--r--source/gameengine/Ketsji/KX_PyMath.h20
-rw-r--r--source/gameengine/Ketsji/KX_VertexProxy.cpp149
-rw-r--r--source/gameengine/Ketsji/KX_VertexProxy.h2
-rw-r--r--source/gameengine/PyDoc/BL_ActionActuator.py137
-rw-r--r--source/gameengine/PyDoc/GameKeys.py1
-rw-r--r--source/gameengine/PyDoc/GameLogic.py1
-rw-r--r--source/gameengine/PyDoc/KX_CDActuator.py1
-rw-r--r--source/gameengine/PyDoc/KX_Camera.py43
-rw-r--r--source/gameengine/PyDoc/KX_CameraActuator.py11
-rw-r--r--source/gameengine/PyDoc/KX_GameActuator.py1
-rw-r--r--source/gameengine/PyDoc/KX_GameObject.py1
-rw-r--r--source/gameengine/PyDoc/KX_Light.py37
-rw-r--r--source/gameengine/PyDoc/KX_MeshProxy.py1
-rw-r--r--source/gameengine/PyDoc/KX_MouseFocusSensor.py1
-rw-r--r--source/gameengine/PyDoc/KX_NearSensor.py1
-rw-r--r--source/gameengine/PyDoc/KX_NetworkMessageSensor.py1
-rw-r--r--source/gameengine/PyDoc/KX_RadarSensor.py1
-rw-r--r--source/gameengine/PyDoc/KX_RaySensor.py1
-rw-r--r--source/gameengine/PyDoc/KX_TouchSensor.py1
-rw-r--r--source/gameengine/PyDoc/KX_VertexProxy.py22
-rw-r--r--source/gameengine/PyDoc/Rasterizer.py1
-rw-r--r--source/gameengine/PyDoc/SCA_ANDController.py11
-rw-r--r--source/gameengine/PyDoc/SCA_AlwaysSensor.py1
-rw-r--r--source/gameengine/PyDoc/SCA_ILogicBrick.py1
-rw-r--r--source/gameengine/PyDoc/SCA_ISensor.py1
-rw-r--r--source/gameengine/PyDoc/SCA_KeyboardSensor.py1
-rw-r--r--source/gameengine/PyDoc/SCA_MouseSensor.py1
-rw-r--r--source/gameengine/PyDoc/SCA_ORController.py11
-rw-r--r--source/gameengine/PyDoc/SCA_PropertySensor.py1
-rw-r--r--source/gameengine/PyDoc/SCA_PythonController.py1
-rw-r--r--source/gameengine/PyDoc/SCA_RandomSensor.py1
-rw-r--r--source/gameengine/Rasterizer/RAS_TexVert.cpp9
-rw-r--r--source/gameengine/Rasterizer/RAS_TexVert.h1
36 files changed, 681 insertions, 32 deletions
diff --git a/source/gameengine/Ketsji/KX_Light.cpp b/source/gameengine/Ketsji/KX_Light.cpp
index 658f45a49b0..9be4256f58f 100644
--- a/source/gameengine/Ketsji/KX_Light.cpp
+++ b/source/gameengine/Ketsji/KX_Light.cpp
@@ -41,13 +41,16 @@
#include "KX_Light.h"
#include "RAS_IRenderTools.h"
+#include "KX_PyMath.h"
+
KX_LightObject::KX_LightObject(void* sgReplicationInfo,SG_Callbacks callbacks,
class RAS_IRenderTools* rendertools,
- const RAS_LightObject& lightobj
+ const RAS_LightObject& lightobj,
+ PyTypeObject* T
)
:
- KX_GameObject(sgReplicationInfo,callbacks),
+ KX_GameObject(sgReplicationInfo,callbacks,T),
m_rendertools(rendertools)
{
m_lightobj = lightobj;
@@ -77,3 +80,171 @@ CValue* KX_LightObject::GetReplica()
m_rendertools->AddLight(&replica->m_lightobj);
return replica;
}
+
+PyObject* KX_LightObject::_getattr(const STR_String& attr)
+{
+ if (attr == "layer")
+ return PyInt_FromLong(m_lightobj.m_layer);
+
+ if (attr == "energy")
+ return PyFloat_FromDouble(m_lightobj.m_energy);
+
+ if (attr == "distance")
+ return PyFloat_FromDouble(m_lightobj.m_distance);
+
+ if (attr == "colour" || attr == "color")
+ return Py_BuildValue("[fff]", m_lightobj.m_red, m_lightobj.m_green, m_lightobj.m_blue);
+
+ if (attr == "lin_attenuation")
+ return PyFloat_FromDouble(m_lightobj.m_att1);
+
+ if (attr == "spotsize")
+ return PyFloat_FromDouble(m_lightobj.m_spotsize);
+
+ if (attr == "spotblend")
+ return PyFloat_FromDouble(m_lightobj.m_spotblend);
+
+ if (attr == "SPOT")
+ return PyInt_FromLong(RAS_LightObject::LIGHT_SPOT);
+
+ if (attr == "SUN")
+ return PyInt_FromLong(RAS_LightObject::LIGHT_SUN);
+
+ if (attr == "NORMAL")
+ return PyInt_FromLong(RAS_LightObject::LIGHT_NORMAL);
+
+ if (attr == "type")
+ return PyInt_FromLong(m_lightobj.m_type);
+
+ _getattr_up(KX_GameObject);
+}
+
+int KX_LightObject::_setattr(const STR_String& attr, PyObject *pyvalue)
+{
+ if (attr == "SPOT" || attr == "SUN" || attr == "NORMAL")
+ {
+ PyErr_Format(PyExc_RuntimeError, "Attribute %s is read only.", attr.ReadPtr());
+ return 1;
+ }
+
+ if (PyInt_Check(pyvalue))
+ {
+ int value = PyInt_AsLong(pyvalue);
+ if (attr == "layer")
+ {
+ m_lightobj.m_layer = value;
+ return 0;
+ }
+
+ if (attr == "type")
+ {
+ if (value >= RAS_LightObject::LIGHT_SPOT && value <= RAS_LightObject::LIGHT_NORMAL)
+ m_lightobj.m_type = (RAS_LightObject::LightType) value;
+ return 0;
+ }
+ }
+
+ if (PyFloat_Check(pyvalue))
+ {
+ float value = PyFloat_AsDouble(pyvalue);
+ if (attr == "energy")
+ {
+ m_lightobj.m_energy = value;
+ return 0;
+ }
+
+ if (attr == "distance")
+ {
+ m_lightobj.m_distance = value;
+ return 0;
+ }
+
+ if (attr == "lin_attenuation")
+ {
+ m_lightobj.m_att1 = value;
+ return 0;
+ }
+
+ if (attr == "spotsize")
+ {
+ m_lightobj.m_spotsize = value;
+ return 0;
+ }
+
+ if (attr == "spotblend")
+ {
+ m_lightobj.m_spotblend = value;
+ return 0;
+ }
+ }
+
+ if (PySequence_Check(pyvalue))
+ {
+ if (attr == "colour" || attr == "color")
+ {
+ MT_Vector3 colour(MT_Vector3FromPyList(pyvalue));
+ m_lightobj.m_red = colour[0];
+ m_lightobj.m_green = colour[1];
+ m_lightobj.m_blue = colour[2];
+ return 0;
+ }
+ }
+
+ return KX_GameObject::_setattr(attr, pyvalue);
+}
+
+PyMethodDef KX_LightObject::Methods[] = {
+ {NULL,NULL} //Sentinel
+};
+
+char KX_LightObject::doc[] = "Module KX_LightObject\n\n"
+"Constants:\n"
+"\tSPOT\n"
+"\tSUN\n"
+"\tNORMAL\n"
+"Attributes:\n"
+"\ttype -> SPOT, SUN or NORMAL\n"
+"\t\tThe type of light.\n"
+"\tlayer -> integer bit field.\n"
+"\t\tThe layers this light applies to.\n"
+"\tenergy -> float.\n"
+"\t\tThe brightness of the light.\n"
+"\tdistance -> float.\n"
+"\t\tThe effect radius of the light.\n"
+"\tcolour -> list [r, g, b].\n"
+"\tcolor -> list [r, g, b].\n"
+"\t\tThe colour of the light.\n"
+"\tlin_attenuation -> float.\n"
+"\t\tThe attenuation factor for the light.\n"
+"\tspotsize -> float.\n"
+"\t\tThe size of the spot.\n"
+"\tspotblend -> float.\n"
+"\t\tThe blend? of the spot.\n";
+
+PyTypeObject KX_LightObject::Type = {
+ PyObject_HEAD_INIT(&PyType_Type)
+ 0,
+ "KX_LightObject",
+ sizeof(KX_LightObject),
+ 0,
+ PyDestructor,
+ 0,
+ __getattr,
+ __setattr,
+ 0, //&MyPyCompare,
+ __repr,
+ 0, //&cvalue_as_number,
+ 0,
+ 0,
+ 0,
+ 0, 0, 0, 0, 0, 0,
+ doc
+};
+
+PyParentObject KX_LightObject::Parents[] = {
+ &KX_LightObject::Type,
+ &KX_GameObject::Type,
+ &SCA_IObject::Type,
+ &CValue::Type,
+ NULL
+};
diff --git a/source/gameengine/Ketsji/KX_Light.h b/source/gameengine/Ketsji/KX_Light.h
index 311780af755..11fe7155c82 100644
--- a/source/gameengine/Ketsji/KX_Light.h
+++ b/source/gameengine/Ketsji/KX_Light.h
@@ -37,14 +37,20 @@
class KX_LightObject : public KX_GameObject
{
+ Py_Header;
+protected:
RAS_LightObject m_lightobj;
class RAS_IRenderTools* m_rendertools; //needed for registering and replication of lightobj
+ static char doc[];
public:
- KX_LightObject(void* sgReplicationInfo,SG_Callbacks callbacks,class RAS_IRenderTools* rendertools,const struct RAS_LightObject& lightobj);
+ KX_LightObject(void* sgReplicationInfo,SG_Callbacks callbacks,class RAS_IRenderTools* rendertools,const struct RAS_LightObject& lightobj, PyTypeObject *T = &Type);
virtual ~KX_LightObject();
virtual CValue* GetReplica();
RAS_LightObject* GetLightData() { return &m_lightobj;}
+
+ virtual PyObject* _getattr(const STR_String& attr); /* lens, near, far, projection_matrix */
+ virtual int _setattr(const STR_String& attr, PyObject *pyvalue);
};
#endif //__KX_LIGHT
diff --git a/source/gameengine/Ketsji/KX_PyMath.cpp b/source/gameengine/Ketsji/KX_PyMath.cpp
index 11bc5d750ff..ba687744dfc 100644
--- a/source/gameengine/Ketsji/KX_PyMath.cpp
+++ b/source/gameengine/Ketsji/KX_PyMath.cpp
@@ -42,6 +42,7 @@
#include "MT_Vector3.h"
#include "MT_Vector4.h"
#include "MT_Matrix4x4.h"
+#include "MT_Point2.h"
#include "ListValue.h"
@@ -135,6 +136,50 @@ MT_Point3 MT_Point3FromPyList(PyObject* pylist)
return point;
}
+MT_Point2 MT_Point2FromPyList(PyObject* pylist)
+{
+ MT_Point2 point(0., 0.);
+ bool error=false;
+ if (pylist->ob_type == &CListValue::Type)
+ {
+ CListValue* listval = (CListValue*) pylist;
+ unsigned int numitems = listval->GetCount();
+ if (numitems <= 2)
+ {
+ for (unsigned int index=0;index<numitems;index++)
+ {
+ point[index] = listval->GetValue(index)->GetNumber();
+ }
+ } else
+ {
+ error = true;
+ }
+
+ } else
+ {
+ // assert the list is long enough...
+ unsigned int numitems = PySequence_Size(pylist);
+ if (numitems <= 2)
+ {
+ for (unsigned int index=0;index<numitems;index++)
+ {
+ PyObject *item = PySequence_GetItem(pylist,index); /* new ref */
+ point[index] = PyFloat_AsDouble(item);
+ Py_DECREF(item);
+ }
+ }
+ else
+ {
+ error = true;
+ }
+
+ }
+ if (error)
+ PyErr_SetString(PyExc_TypeError, "Expected list of twos items for point argument.");
+
+ return point;
+}
+
MT_Vector4 MT_Vector4FromPyList(PyObject* pylist)
{
MT_Vector4 vec(0., 0., 0., 1.);
@@ -360,6 +405,12 @@ PyObject* PyObjectFromMT_Matrix3x3(const MT_Matrix3x3 &mat)
mat[2][0], mat[2][1], mat[2][2]);
}
+PyObject* PyObjectFromMT_Vector4(const MT_Vector4 &vec)
+{
+ return Py_BuildValue("[ffff]",
+ vec[0], vec[1], vec[2], vec[3]);
+}
+
PyObject* PyObjectFromMT_Vector3(const MT_Vector3 &vec)
{
return Py_BuildValue("[fff]",
@@ -371,3 +422,8 @@ PyObject* PyObjectFromMT_Point3(const MT_Point3 &pos)
return Py_BuildValue("[fff]",
pos[0], pos[1], pos[2]);
}
+
+PyObject* PyObjectFromMT_Point2(const MT_Point2 &pos)
+{
+ return Py_BuildValue("[ff]", pos[0], pos[1]);
+}
diff --git a/source/gameengine/Ketsji/KX_PyMath.h b/source/gameengine/Ketsji/KX_PyMath.h
index 7fdf207e435..72793a6cbae 100644
--- a/source/gameengine/Ketsji/KX_PyMath.h
+++ b/source/gameengine/Ketsji/KX_PyMath.h
@@ -34,11 +34,12 @@
#ifndef __KX_PYMATH_H__
#define __KX_PYMATH_H__
-#include "MT_Vector3.h"
+#include "MT_Point2.h"
#include "MT_Point3.h"
+#include "MT_Vector3.h"
#include "MT_Vector4.h"
-#include "MT_Matrix4x4.h"
#include "MT_Matrix3x3.h"
+#include "MT_Matrix4x4.h"
#include "KX_Python.h"
@@ -58,6 +59,11 @@ MT_Point3 MT_Point3FromPyList(PyObject* pylist);
MT_Vector4 MT_Vector4FromPyList(PyObject* pylist);
/**
+ * Converts a python list to an MT_Vector2
+ */
+MT_Point2 MT_Point2FromPyList(PyObject* pylist);
+
+/**
* Converts a python list to an MT_Quaternion
*/
MT_Quaternion MT_QuaternionFromPyList(PyObject* pylist);
@@ -93,11 +99,21 @@ PyObject* PyObjectFromMT_Matrix3x3(const MT_Matrix3x3 &mat);
PyObject* PyObjectFromMT_Vector3(const MT_Vector3 &vec);
/**
+ * Converts an MT_Vector4 to a python object
+ */
+PyObject* PyObjectFromMT_Vector4(const MT_Vector4 &vec);
+
+/**
* Converts an MT_Vector3 to a python object.
*/
PyObject* PyObjectFromMT_Point3(const MT_Point3 &pos);
/**
+ * Converts an MT_Point2 to a python object.
+ */
+PyObject* PyObjectFromMT_Point2(const MT_Point2 &vec);
+
+/**
* True if the given PyObject can be converted to an MT_Matrix
* @param rank = 3 (for MT_Matrix3x3) or 4 (for MT_Matrix4x4)
*/
diff --git a/source/gameengine/Ketsji/KX_VertexProxy.cpp b/source/gameengine/Ketsji/KX_VertexProxy.cpp
index a8c6d0f921c..d4f82c31ea2 100644
--- a/source/gameengine/Ketsji/KX_VertexProxy.cpp
+++ b/source/gameengine/Ketsji/KX_VertexProxy.cpp
@@ -36,6 +36,8 @@
#include <config.h>
#endif
+#include "KX_PyMath.h"
+
PyTypeObject KX_VertexProxy::Type = {
PyObject_HEAD_INIT(&PyType_Type)
0,
@@ -77,10 +79,157 @@ PyMethodDef KX_VertexProxy::Methods[] = {
PyObject*
KX_VertexProxy::_getattr(const STR_String& attr)
{
+ if (attr == "XYZ")
+ return PyObjectFromMT_Vector3(m_vertex->getLocalXYZ());
+
+ if (attr == "UV")
+ return PyObjectFromMT_Point2(MT_Point2(m_vertex->getUV1()));
+
+ if (attr == "colour" || attr == "color")
+ {
+ unsigned int icol = m_vertex->getRGBA();
+ unsigned char *colp = (unsigned char *) &icol;
+ MT_Vector4 colour(colp[0], colp[1], colp[2], colp[3]);
+ colour /= 255.0;
+ return PyObjectFromMT_Vector4(colour);
+ }
+
+ if (attr == "normal")
+ {
+ MT_Vector3 normal(m_vertex->getNormal()[0], m_vertex->getNormal()[1], m_vertex->getNormal()[2]);
+ return PyObjectFromMT_Vector3(normal/32767.);
+ }
+
+ // pos
+ if (attr == "x")
+ return PyFloat_FromDouble(m_vertex->getLocalXYZ()[0]);
+ if (attr == "y")
+ return PyFloat_FromDouble(m_vertex->getLocalXYZ()[1]);
+ if (attr == "z")
+ return PyFloat_FromDouble(m_vertex->getLocalXYZ()[2]);
+
+ // Col
+ if (attr == "r")
+ return PyFloat_FromDouble(((unsigned char*)m_vertex->getRGBA())[0]/255.0);
+ if (attr == "g")
+ return PyFloat_FromDouble(((unsigned char*)m_vertex->getRGBA())[1]/255.0);
+ if (attr == "b")
+ return PyFloat_FromDouble(((unsigned char*)m_vertex->getRGBA())[2]/255.0);
+ if (attr == "a")
+ return PyFloat_FromDouble(((unsigned char*)m_vertex->getRGBA())[3]/255.0);
+
+ // UV
+ if (attr == "u")
+ return PyFloat_FromDouble(m_vertex->getUV1()[0]);
+ if (attr == "v")
+ return PyFloat_FromDouble(m_vertex->getUV1()[1]);
+
_getattr_up(SCA_IObject);
}
+int KX_VertexProxy::_setattr(const STR_String& attr, PyObject *pyvalue)
+{
+ if (PySequence_Check(pyvalue))
+ {
+ if (attr == "XYZ")
+ {
+ m_vertex->SetXYZ(MT_Point3FromPyList(pyvalue));
+ return 0;
+ }
+
+ if (attr == "UV")
+ {
+ m_vertex->SetUV(MT_Point2FromPyList(pyvalue));
+ return 0;
+ }
+
+ if (attr == "colour" || attr == "color")
+ {
+ m_vertex->SetRGBA(MT_Vector4FromPyList(pyvalue));
+ return 0;
+ }
+
+ if (attr == "normal")
+ {
+ m_vertex->SetNormal(MT_Vector3FromPyList(pyvalue));
+ return 0;
+ }
+ }
+
+ if (PyFloat_Check(pyvalue))
+ {
+ float val = PyFloat_AsDouble(pyvalue);
+ // pos
+ MT_Point3 pos(m_vertex->getLocalXYZ());
+ if (attr == "x")
+ {
+ pos.x() = val;
+ m_vertex->SetXYZ(pos);
+ return 0;
+ }
+
+ if (attr == "y")
+ {
+ pos.y() = val;
+ m_vertex->SetXYZ(pos);
+ return 0;
+ }
+
+ if (attr == "z")
+ {
+ pos.z() = val;
+ m_vertex->SetXYZ(pos);
+ return 0;
+ }
+
+ // uv
+ MT_Point2 uv = m_vertex->getUV1();
+ if (attr == "u")
+ {
+ uv[0] = val;
+ m_vertex->SetUV(uv);
+ return 0;
+ }
+ if (attr == "v")
+ {
+ uv[1] = val;
+ m_vertex->SetUV(uv);
+ return 0;
+ }
+
+ // col
+ unsigned int icol = m_vertex->getRGBA();
+ unsigned char *cp = (unsigned char*) &icol;
+ val *= 255.0;
+ if (attr == "r")
+ {
+ cp[0] = (unsigned char) val;
+ m_vertex->SetRGBA(icol);
+ return 0;
+ }
+ if (attr == "g")
+ {
+ cp[1] = (unsigned char) val;
+ m_vertex->SetRGBA(icol);
+ return 0;
+ }
+ if (attr == "b")
+ {
+ cp[2] = (unsigned char) val;
+ m_vertex->SetRGBA(icol);
+ return 0;
+ }
+ if (attr == "a")
+ {
+ cp[3] = (unsigned char) val;
+ m_vertex->SetRGBA(icol);
+ return 0;
+ }
+ }
+
+ return SCA_IObject::_setattr(attr, pyvalue);
+}
KX_VertexProxy::KX_VertexProxy(RAS_TexVert* vertex)
:m_vertex(vertex)
diff --git a/source/gameengine/Ketsji/KX_VertexProxy.h b/source/gameengine/Ketsji/KX_VertexProxy.h
index f447014b8b8..29fee7d6ae7 100644
--- a/source/gameengine/Ketsji/KX_VertexProxy.h
+++ b/source/gameengine/Ketsji/KX_VertexProxy.h
@@ -37,6 +37,7 @@
class KX_VertexProxy : public SCA_IObject
{
Py_Header;
+protected:
class RAS_TexVert* m_vertex;
public:
@@ -56,6 +57,7 @@ public:
// stuff for python integration
virtual PyObject* _getattr(const STR_String& attr);
+ virtual int KX_VertexProxy::_setattr(const STR_String& attr, PyObject *pyvalue);
KX_PYMETHOD(KX_VertexProxy,GetXYZ);
KX_PYMETHOD(KX_VertexProxy,SetXYZ);
diff --git a/source/gameengine/PyDoc/BL_ActionActuator.py b/source/gameengine/PyDoc/BL_ActionActuator.py
new file mode 100644
index 00000000000..a1b0777054e
--- /dev/null
+++ b/source/gameengine/PyDoc/BL_ActionActuator.py
@@ -0,0 +1,137 @@
+# $Id$
+# Documentation for BL_ActionActuator
+from SCA_ILogicBrick import *
+
+class BL_ActionActuator(SCA_ILogicBrick):
+ """
+ Action Actuators apply an action to an actor.
+ """
+ def setAction(action, reset = True):
+ """
+ Sets the current action.
+
+ @param action: The name of the action to set as the current action.
+ @type action: string
+ @param reset: Optional parameter indicating whether to reset the
+ blend timer or not. A value of 1 indicates that the
+ timer should be reset. A value of 0 will leave it
+ unchanged. If reset is not specified, the timer will
+ be reset.
+ """
+
+ def setStart(start):
+ """
+ Specifies the starting frame of the animation.
+
+ @param start: the starting frame of the animation
+ @type start: float
+ """
+
+ def setEnd(end):
+ """
+ Specifies the ending frame of the animation.
+
+ @param end: the ending frame of the animation
+ @type end: float
+ """
+ def setBlendin(blendin):
+ """
+ Specifies the number of frames of animation to generate
+ when making transitions between actions.
+
+ @param blendin: the number of frames in transition.
+ @type blendin: float
+ """
+
+ def setPriority(priority):
+ """
+ Sets the priority of this actuator.
+
+ @param priority: Specifies the new priority. Actuators will lower
+ priority numbers will override actuators with higher
+ numbers.
+ @type priority: integer
+ """
+ def setFrame(frame):
+ """
+ Sets the current frame for the animation.
+
+ @param frame: Specifies the new current frame for the animation
+ @type frame: float
+ """
+
+ def setProperty(prop):
+ """
+ Sets the property to be used in FromProp playback mode.
+
+ @param prop: the name of the property to use.
+ @type prop: string.
+ """
+
+ def setBlendtime(blendtime):
+ """
+ Sets the internal frame timer.
+
+ Allows the script to directly modify the internal timer
+ used when generating transitions between actions.
+
+ @param blendtime: The new time. This parameter must be in the range from 0.0 to 1.0.
+ @type blendtime: float
+ """
+
+ def getAction():
+ """
+ getAction() returns the name of the action associated with this actuator.
+
+ @rtype: string
+ """
+
+ def getStart():
+ """
+ Returns the starting frame of the action.
+
+ @rtype: float
+ """
+ def getEnd():
+ """
+ Returns the last frame of the action.
+
+ @rtype: float
+ """
+ def getBlendin():
+ """
+ Returns the number of interpolation animation frames to be generated when this actuator is triggered.
+
+ @rtype: float
+ """
+ def getPriority():
+ """
+ Returns the priority for this actuator. Actuators with lower Priority numbers will
+ override actuators with higher numbers.
+
+ @rtype: integer
+ """
+ def getFrame():
+ """
+ Returns the current frame number.
+
+ @rtype: float
+ """
+ def getProperty():
+ """
+ Returns the name of the property to be used in FromProp mode.
+
+ @rtype: string
+ """
+ def setChannel(channel, matrix, mode = False):
+ """
+ @param channel: A string specifying the name of the bone channel.
+ @type channel: string
+ @param matrix: A 4x4 matrix specifying the overriding transformation
+ as an offset from the bone's rest position.
+ @type matrix: list [[float]]
+ @param mode: True for armature/world space, False for bone space
+ @type mode: boolean
+ """
+
+
diff --git a/source/gameengine/PyDoc/GameKeys.py b/source/gameengine/PyDoc/GameKeys.py
index 2c938d27fa3..58fc53b0961 100644
--- a/source/gameengine/PyDoc/GameKeys.py
+++ b/source/gameengine/PyDoc/GameKeys.py
@@ -1,3 +1,4 @@
+# $Id$
"""
Documentation for the GameKeys module.
diff --git a/source/gameengine/PyDoc/GameLogic.py b/source/gameengine/PyDoc/GameLogic.py
index 3672a16be44..05dfd0cd481 100644
--- a/source/gameengine/PyDoc/GameLogic.py
+++ b/source/gameengine/PyDoc/GameLogic.py
@@ -1,3 +1,4 @@
+# $Id$
"""
Documentation for the GameLogic Module.
diff --git a/source/gameengine/PyDoc/KX_CDActuator.py b/source/gameengine/PyDoc/KX_CDActuator.py
index fa210f8534c..12e74f166b5 100644
--- a/source/gameengine/PyDoc/KX_CDActuator.py
+++ b/source/gameengine/PyDoc/KX_CDActuator.py
@@ -1,3 +1,4 @@
+# $Id$
# Documentation for CD Actuator
from SCA_ILogicBrick import *
diff --git a/source/gameengine/PyDoc/KX_Camera.py b/source/gameengine/PyDoc/KX_Camera.py
index fc44824b854..729380ddfb0 100644
--- a/source/gameengine/PyDoc/KX_Camera.py
+++ b/source/gameengine/PyDoc/KX_Camera.py
@@ -1,3 +1,4 @@
+# $Id$
# Documentation for Camera game objects.
from KX_GameObject import *
@@ -128,7 +129,7 @@ class KX_Camera(KX_GameObject):
Sets the camera's projection matrix.
You should use normalised device coordinates for the clipping planes:
- left = -1.0, right = 1.0, top = 1.0, bottom = -1.0, near = 0.0, far = 1.0
+ left = -1.0, right = 1.0, top = 1.0, bottom = -1.0, near = cam.near, far = cam.far
@type matrix: 4x4 matrix.
@param matrix: The new projection matrix for this camera.
@@ -137,41 +138,31 @@ class KX_Camera(KX_GameObject):
@verbatim{
import GameLogic
- # Scale a matrix
- def Scale(matrix, scalar):
- for row in matrix:
- for col in row:
- col = col * scalar
-
# Generate an identiy matrix.
def Identity():
return [[1.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0], [0.0, 0.0, 1.0, 0.0], [0.0, 0.0, 0.0, 1.0]]
# Generate a perspective projection matrix
- def Perspective():
- m = Identity()
- m[0][0] = m[0][2] = 2.0
- m[1][1] = m[1][2] = 2.0
- m[2][2] = m[2][3] = -1.0
- m[3][2] = -1.0
- m[3][3] = 0.0
- return m
+ def Perspective(cam):
+ return [[cam.near, 0.0 , 0.0 , 0.0 ],
+ [0.0 , cam.near, 0.0 , 0.0 ],
+ [0.0 , 0.0 , -(cam.far+cam.near)/(cam.far-cam.near), -2.0*cam.far*cam.near/(cam.far - cam.near)],
+ [0.0 , 0.0 , -1.0 , 0.0 ]]
# Generate an orthographic projection matrix
- # You will need to Scale this matrix.
- def Orthographic():
- m = Identity()
- m[0][0] = 2.0
- m[0][3] = 0.0
- m[1][1] = 2.0
- m[1][3] = 0.0
- m[2][2] = 1.0
- m[2][3] = 1.0
- m[3][3] = 1.0
- return m
+ # You will need to scale the camera
+ def Orthographic(cam):
+ return [[1.0/cam.scaling[0], 0.0 , 0.0 , 0.0 ],
+ [0.0 , 1.0/cam.scaling[1], 0.0 , 0.0 ],
+ [0.0 , 0.0 , -2.0/(cam.far-cam.near), -(cam.far+cam.near)/(cam.far-cam.near)],
+ [0.0 , 0.0 , 0.0 , 1.0 ]]
# Generate an isometric projection matrix
def Isometric():
+ return [[0.866, 0.0 , 0.866, 0.0],
+ [0.25 , 0.866,-0.25 , 0.0],
+ [0.0 , 0.0 ,-1.0 , 0.0],
+ [0.0 , 0.0 , 0.0 , 1.0]]
m = Identity()
m[0][0] = m[0][2] = m[1][1] = 0.8660254037844386
m[1][0] = 0.25
diff --git a/source/gameengine/PyDoc/KX_CameraActuator.py b/source/gameengine/PyDoc/KX_CameraActuator.py
new file mode 100644
index 00000000000..1030f0ca836
--- /dev/null
+++ b/source/gameengine/PyDoc/KX_CameraActuator.py
@@ -0,0 +1,11 @@
+# $Id$
+# Documentation for KX_CameraActuator
+from SCA_ILogicBrick import *
+
+class KX_CameraActuator(SCA_ILogicBrick):
+ """
+ Applies changes to a camera.
+
+ This actuator has no python methods.
+ """
+
diff --git a/source/gameengine/PyDoc/KX_GameActuator.py b/source/gameengine/PyDoc/KX_GameActuator.py
index 6c2a989286b..740177dcfca 100644
--- a/source/gameengine/PyDoc/KX_GameActuator.py
+++ b/source/gameengine/PyDoc/KX_GameActuator.py
@@ -1,3 +1,4 @@
+# $Id$
# Documentation for KX_GameActuator
class KX_GameActuator:
diff --git a/source/gameengine/PyDoc/KX_GameObject.py b/source/gameengine/PyDoc/KX_GameObject.py
index b4a88e83129..cdde9d03968 100644
--- a/source/gameengine/PyDoc/KX_GameObject.py
+++ b/source/gameengine/PyDoc/KX_GameObject.py
@@ -1,3 +1,4 @@
+# $Id$
# Documentation for game objects
class KX_GameObject:
diff --git a/source/gameengine/PyDoc/KX_Light.py b/source/gameengine/PyDoc/KX_Light.py
new file mode 100644
index 00000000000..95f6622faf0
--- /dev/null
+++ b/source/gameengine/PyDoc/KX_Light.py
@@ -0,0 +1,37 @@
+# $Id$
+# Documentation for Light game objects.
+from KX_GameObject import *
+
+class KX_Light(KX_GameObject):
+ """
+ A Light object.
+
+ Constants:
+ @cvar SPOT: A spot light source. See attribute 'type'
+ @cvar SUN: A point light source with no attenuation. See attribute 'type'
+ @cvar NORMAL: A point light source. See attribute 'type'
+
+ Attributes:
+ @cvar type: The type of light - must be SPOT, SUN or NORMAL
+ @cvar layer: The layer mask that this light affects object on. (bitfield)
+ @cvar energy: The brightness of this light. (float)
+ @cvar distance: The maximum distance this light can illuminate. (float) (SPOT and NORMAL lights only)
+ @cvar colour: The colour of this light. ([r, g, b]) Black = [0.0, 0.0, 0.0], White = [1.0, 1.0, 1.0]
+ @cvar color: Synonym for colour.
+ @cvar lin_attenuation: The linear component of this lights attenuation. (SPOT and NORMAL lights only)
+ @cvar spotsize: The cone angle of the spot light, in degrees. (float) (SPOT lights only)
+ 0.0 <= spotsize <= 180.0. Spotsize = 360.0 is also accepted.
+ @cvar spotblend: Specifies the intensity distribution of the spot light. (float) (SPOT lights only)
+ Higher values result in a more focused light source.
+ 0.0 <= spotblend <= 1.0.
+
+ Example:
+ # Turn on a red alert light.
+ import GameLogic
+
+ co = GameLogic.getCurrentController()
+ light = co.getOwner()
+
+ light.energy = 1.0
+ light.colour = [1.0, 0.0, 0.0]
+ """
diff --git a/source/gameengine/PyDoc/KX_MeshProxy.py b/source/gameengine/PyDoc/KX_MeshProxy.py
index a5cb8e7ace2..30858ace97f 100644
--- a/source/gameengine/PyDoc/KX_MeshProxy.py
+++ b/source/gameengine/PyDoc/KX_MeshProxy.py
@@ -1,3 +1,4 @@
+# $Id$
# Documentation for KX_MeshProxy
class KX_MeshProxy:
diff --git a/source/gameengine/PyDoc/KX_MouseFocusSensor.py b/source/gameengine/PyDoc/KX_MouseFocusSensor.py
index 9e0d523725b..28d584037f8 100644
--- a/source/gameengine/PyDoc/KX_MouseFocusSensor.py
+++ b/source/gameengine/PyDoc/KX_MouseFocusSensor.py
@@ -1,3 +1,4 @@
+# $Id$
# Documentation for KX_MouseFocusSensor
from SCA_MouseSensor import *
diff --git a/source/gameengine/PyDoc/KX_NearSensor.py b/source/gameengine/PyDoc/KX_NearSensor.py
index 95d83ae008e..fef2e4b2acc 100644
--- a/source/gameengine/PyDoc/KX_NearSensor.py
+++ b/source/gameengine/PyDoc/KX_NearSensor.py
@@ -1,3 +1,4 @@
+# $Id$
# Documentation for KX_NearSensor
from KX_TouchSensor import *
diff --git a/source/gameengine/PyDoc/KX_NetworkMessageSensor.py b/source/gameengine/PyDoc/KX_NetworkMessageSensor.py
index 94ccccc3e09..85f87ecbaa7 100644
--- a/source/gameengine/PyDoc/KX_NetworkMessageSensor.py
+++ b/source/gameengine/PyDoc/KX_NetworkMessageSensor.py
@@ -1,3 +1,4 @@
+# $Id$
# Documentation for KX_NetworkMessageSensor
from SCA_ISensor import *
diff --git a/source/gameengine/PyDoc/KX_RadarSensor.py b/source/gameengine/PyDoc/KX_RadarSensor.py
index 5800cd3e135..64be858371a 100644
--- a/source/gameengine/PyDoc/KX_RadarSensor.py
+++ b/source/gameengine/PyDoc/KX_RadarSensor.py
@@ -1,3 +1,4 @@
+# $Id$
# Documentation for KX_RadarSensor
from KX_NearSensor import *
diff --git a/source/gameengine/PyDoc/KX_RaySensor.py b/source/gameengine/PyDoc/KX_RaySensor.py
index ede288d9578..e487edcb655 100644
--- a/source/gameengine/PyDoc/KX_RaySensor.py
+++ b/source/gameengine/PyDoc/KX_RaySensor.py
@@ -1,3 +1,4 @@
+# $Id$
# Documentation for KX_RaySensor
from SCA_ISensor import *
diff --git a/source/gameengine/PyDoc/KX_TouchSensor.py b/source/gameengine/PyDoc/KX_TouchSensor.py
index 013da4b57c0..88278d57f76 100644
--- a/source/gameengine/PyDoc/KX_TouchSensor.py
+++ b/source/gameengine/PyDoc/KX_TouchSensor.py
@@ -1,3 +1,4 @@
+# $Id$
# Documentation for KX_TouchSensor
from SCA_ISensor import *
diff --git a/source/gameengine/PyDoc/KX_VertexProxy.py b/source/gameengine/PyDoc/KX_VertexProxy.py
index 41afdbab3d7..198298a5394 100644
--- a/source/gameengine/PyDoc/KX_VertexProxy.py
+++ b/source/gameengine/PyDoc/KX_VertexProxy.py
@@ -1,3 +1,4 @@
+# $Id$
# Documentation for the vertex proxy class
class KX_VertexProxy:
@@ -5,8 +6,27 @@ class KX_VertexProxy:
A vertex holds position, UV, colour and normal information.
Note:
- The physics simulation is NOT currently updated - physics will not respond correctly
+ The physics simulation is NOT currently updated - physics will not respond
to changes in the vertex position.
+
+ Attributes:
+ @cvar XYZ: The position of the vertex. (list [x, y, z])
+ @cvar UV: The texture coordinates of the vertex. (list [u, v])
+ @cvar normal: The normal of the vertex (list [nx, ny, nz])
+ @cvar colour: The colour of the vertex. (list [r, g, b, a]) Black = [0.0, 0.0, 0.0, 1.0], White = [1.0, 1.0, 1.0, 1.0]
+ @cvar color: Synonym for colour.
+
+ @cvar x: The x coordinate of the vertex. (float)
+ @cvar y: The y coordinate of the vertex. (float)
+ @cvar z: The z coordinate of the vertex. (float)
+
+ @cvar u: The u texture coordinate of the vertex. (float)
+ @cvar v: The v texture coordinate of the vertex. (float)
+
+ @cvar r: The red component of the vertex colour. (float) 0.0 <= r <= 1.0
+ @cvar g: The green component of the vertex colour. (float) 0.0 <= g <= 1.0
+ @cvar b: The blue component of the vertex colour. (float) 0.0 <= b <= 1.0
+ @cvar a: The alpha component of the vertex colour. (float) 0.0 <= a <= 1.0
"""
def getXYZ():
diff --git a/source/gameengine/PyDoc/Rasterizer.py b/source/gameengine/PyDoc/Rasterizer.py
index 1dd64a996a2..2c4e368a819 100644
--- a/source/gameengine/PyDoc/Rasterizer.py
+++ b/source/gameengine/PyDoc/Rasterizer.py
@@ -1,3 +1,4 @@
+# $Id$
"""
Documentation for the Rasterizer module.
diff --git a/source/gameengine/PyDoc/SCA_ANDController.py b/source/gameengine/PyDoc/SCA_ANDController.py
new file mode 100644
index 00000000000..eec66f59e5d
--- /dev/null
+++ b/source/gameengine/PyDoc/SCA_ANDController.py
@@ -0,0 +1,11 @@
+# $Id$
+# Documentation for SCA_ANDController
+form SCA_ILogicBrick import *
+
+class SCA_ANDController(SCA_ILogicBrick):
+ """
+ An AND controller activates only when all linked sensors are activated.
+
+ There are no special python methods for this controller.
+ """
+
diff --git a/source/gameengine/PyDoc/SCA_AlwaysSensor.py b/source/gameengine/PyDoc/SCA_AlwaysSensor.py
index 8ab761ce02b..54ab07a8a99 100644
--- a/source/gameengine/PyDoc/SCA_AlwaysSensor.py
+++ b/source/gameengine/PyDoc/SCA_AlwaysSensor.py
@@ -1,3 +1,4 @@
+# $Id$
# Documentation for SCA_AlwaysSensor
from SCA_ISensor import *
diff --git a/source/gameengine/PyDoc/SCA_ILogicBrick.py b/source/gameengine/PyDoc/SCA_ILogicBrick.py
index 860094b9758..6bb6d7fd43d 100644
--- a/source/gameengine/PyDoc/SCA_ILogicBrick.py
+++ b/source/gameengine/PyDoc/SCA_ILogicBrick.py
@@ -1,3 +1,4 @@
+# $Id$
# Documentation for the logic brick base class SCA_ILogicBrick
from KX_GameObject import *
diff --git a/source/gameengine/PyDoc/SCA_ISensor.py b/source/gameengine/PyDoc/SCA_ISensor.py
index a5583b0f63f..c964788f447 100644
--- a/source/gameengine/PyDoc/SCA_ISensor.py
+++ b/source/gameengine/PyDoc/SCA_ISensor.py
@@ -1,3 +1,4 @@
+# $Id$
# Documentation for SCA_ISensor
from SCA_ILogicBrick import *
diff --git a/source/gameengine/PyDoc/SCA_KeyboardSensor.py b/source/gameengine/PyDoc/SCA_KeyboardSensor.py
index 21e2390e39e..e90fb9cc2f1 100644
--- a/source/gameengine/PyDoc/SCA_KeyboardSensor.py
+++ b/source/gameengine/PyDoc/SCA_KeyboardSensor.py
@@ -1,3 +1,4 @@
+# $Id$
# Documentation for SCA_KeyboardSensor
from SCA_ISensor import *
diff --git a/source/gameengine/PyDoc/SCA_MouseSensor.py b/source/gameengine/PyDoc/SCA_MouseSensor.py
index 24867f192b2..06b261f67fa 100644
--- a/source/gameengine/PyDoc/SCA_MouseSensor.py
+++ b/source/gameengine/PyDoc/SCA_MouseSensor.py
@@ -1,3 +1,4 @@
+# $Id$
# Documentation for SCA_MouseSensor
from SCA_ISensor import *
diff --git a/source/gameengine/PyDoc/SCA_ORController.py b/source/gameengine/PyDoc/SCA_ORController.py
new file mode 100644
index 00000000000..ccea5837569
--- /dev/null
+++ b/source/gameengine/PyDoc/SCA_ORController.py
@@ -0,0 +1,11 @@
+# $Id$
+# Documentation for SCA_ORController
+from SCA_ILogicBrick import *
+
+class SCA_ORController(SCA_ILogicBrick):
+ """
+ An OR controller activates when any connected sensor activates.
+
+ There are no special python methods for this controller.
+ """
+
diff --git a/source/gameengine/PyDoc/SCA_PropertySensor.py b/source/gameengine/PyDoc/SCA_PropertySensor.py
index ad5b1e87a7d..f0a14477b24 100644
--- a/source/gameengine/PyDoc/SCA_PropertySensor.py
+++ b/source/gameengine/PyDoc/SCA_PropertySensor.py
@@ -1,3 +1,4 @@
+# $Id$
# Documentation for SCA_PropertySensor
from SCA_ISensor import *
diff --git a/source/gameengine/PyDoc/SCA_PythonController.py b/source/gameengine/PyDoc/SCA_PythonController.py
index a07edd03a8c..f0926178288 100644
--- a/source/gameengine/PyDoc/SCA_PythonController.py
+++ b/source/gameengine/PyDoc/SCA_PythonController.py
@@ -1,3 +1,4 @@
+# $Id$
# Documentation for SCA_PythonController
from SCA_ILogicBrick import *
diff --git a/source/gameengine/PyDoc/SCA_RandomSensor.py b/source/gameengine/PyDoc/SCA_RandomSensor.py
index bab92f2afc8..940b8f879ff 100644
--- a/source/gameengine/PyDoc/SCA_RandomSensor.py
+++ b/source/gameengine/PyDoc/SCA_RandomSensor.py
@@ -1,3 +1,4 @@
+# $Id$
# Documentation for SCA_RandomSensor
from SCA_ISensor import *
diff --git a/source/gameengine/Rasterizer/RAS_TexVert.cpp b/source/gameengine/Rasterizer/RAS_TexVert.cpp
index add1a652d12..febe5dac5ee 100644
--- a/source/gameengine/Rasterizer/RAS_TexVert.cpp
+++ b/source/gameengine/Rasterizer/RAS_TexVert.cpp
@@ -60,6 +60,15 @@ const MT_Point3& RAS_TexVert::xyz()
return g_pt3;
}
+void RAS_TexVert::SetRGBA(const MT_Vector4& rgba)
+{
+ unsigned char *colp = (unsigned char*) &m_rgba;
+ colp[0] = rgba[0]*255.0;
+ colp[1] = rgba[1]*255.0;
+ colp[2] = rgba[2]*255.0;
+ colp[3] = rgba[3]*255.0;
+}
+
#ifndef RAS_TexVert_INLINE
void RAS_TexVert::SetXYZ(const MT_Point3& xyz)
diff --git a/source/gameengine/Rasterizer/RAS_TexVert.h b/source/gameengine/Rasterizer/RAS_TexVert.h
index d5fa18744af..0480c97421d 100644
--- a/source/gameengine/Rasterizer/RAS_TexVert.h
+++ b/source/gameengine/Rasterizer/RAS_TexVert.h
@@ -124,6 +124,7 @@ public:
void SetFlag(const short flag);
#endif
+ void SetRGBA(const MT_Vector4& rgba);
const MT_Point3& xyz();
// compare two vertices, and return TRUE if both are almost identical (they can be shared)