when python is disabled videotextures are not built.
if env['WITH_BF_INTERNATIONAL']:
defs.append('INTERNATIONAL')
-env.BlenderLib ( 'bf_editors_interface', sources, Split(incs), Split(defs), libtype=['core'], priority=[110] )
+if not env['WITH_BF_PYTHON']:
+ defs.append('DISABLE_PYTHON')
+
+env.BlenderLib ( 'bf_editors_interface', sources, Split(incs), defs, libtype=['core'], priority=[110] )
#include <signal.h>
#include <stdlib.h>
+#include <stdio.h>
#ifdef WIN32
// don't show stl-warnings
BLI_strncpy(pathname, blenderdata->name, sizeof(pathname));
BLI_strncpy(oldsce, G.sce, sizeof(oldsce));
+#ifndef DISABLE_PYTHON
resetGamePythonPath(); // need this so running a second time wont use an old blendfiles path
setGamePythonPath(G.sce);
PyGILState_STATE gilstate = PyGILState_Ensure();
PyObject *pyGlobalDict = PyDict_New(); /* python utility storage, spans blend file loading */
+#endif
bgl::InitExtensions(true);
ketsjiengine->SetUseFixedTime(usefixed);
ketsjiengine->SetTimingDisplay(frameRate, profile, properties);
+#ifndef DISABLE_PYTHON
CValue::SetDeprecationWarnings(nodepwarnings);
-
+#endif
//lock frame and camera enabled - storing global values
int tmp_lay= scene->lay;
if(blenderdata) {
BLI_strncpy(G.sce, blenderdata->name, sizeof(G.sce));
BLI_strncpy(pathname, blenderdata->name, sizeof(pathname));
+#ifndef DISABLE_PYTHON
setGamePythonPath(G.sce);
+#endif
}
}
// else forget it, we can't find it
networkdevice,
startscenename,
blscene);
-
+
+#ifndef DISABLE_PYTHON
// some python things
PyObject* dictionaryobject = initGamePythonScripting("Ketsji", psl_Lowest, blenderdata);
ketsjiengine->SetPythonDictionary(dictionaryobject);
#ifdef WITH_FFMPEG
initVideoTexture();
#endif
+#endif // DISABLE_PYTHON
//initialize Dome Settings
if(blscene->gm.stereoflag == STEREO_DOME)
// convert and add scene
sceneconverter->ConvertScene(
startscene,
+#ifndef DISABLE_PYTHON
dictionaryobject,
+#endif
rendertools,
canvas);
ketsjiengine->AddScene(startscene);
// when exiting the mainloop
-
+#ifndef DISABLE_PYTHON
// Clears the dictionary by hand:
// This prevents, extra references to global variables
// inside the GameLogic dictionary when the python interpreter is finalized.
}
Py_DECREF(gameLogic_keys_new);
gameLogic_keys_new = NULL;
-
+#endif
ketsjiengine->StopEngine();
+#ifndef DISABLE_PYTHON
exitGamePythonScripting();
+#endif
networkdevice->Disconnect();
}
if (sceneconverter)
delete sceneconverter;
sceneconverter = NULL;
}
-
+
+#ifndef DISABLE_PYTHON
Py_DECREF(gameLogic_keys);
gameLogic_keys = NULL;
+#endif
}
//lock frame and camera enabled - restoring global values
if (v3d->scenelock==0){
} while (exitrequested == KX_EXIT_REQUEST_RESTART_GAME || exitrequested == KX_EXIT_REQUEST_START_OTHER_GAME);
- Py_DECREF(pyGlobalDict);
-
if (bfd) BLO_blendfiledata_free(bfd);
BLI_strncpy(G.sce, oldsce, sizeof(G.sce));
+#ifndef DISABLE_PYTHON
+ Py_DECREF(pyGlobalDict);
+
// Release Python's GIL
PyGILState_Release(gilstate);
+#endif
+
}
extern "C" void StartKetsjiShellSimulation(struct wmWindow *win,
BLI_strncpy(pathname, blenderdata->name, sizeof(pathname));
+#ifndef DISABLE_PYTHON
// Acquire Python's GIL (global interpreter lock)
// so we can safely run Python code and API calls
PyGILState_STATE gilstate = PyGILState_Ensure();
+#endif
bgl::InitExtensions(true);
startscenename,
blscene);
+#ifndef DISABLE_PYTHON
// some python things
PyObject* dictionaryobject = initGamePythonScripting("Ketsji", psl_Lowest, blenderdata);
ketsjiengine->SetPythonDictionary(dictionaryobject);
#ifdef WITH_FFMPEG
initVideoTexture();
#endif
+#endif // DISABLE_PYTHON
if (sceneconverter)
{
// convert and add scene
sceneconverter->ConvertScene(
startscene,
+#ifndef DISABLE_PYTHON
dictionaryobject,
+#endif
rendertools,
canvas);
ketsjiengine->AddScene(startscene);
} while (exitrequested == KX_EXIT_REQUEST_RESTART_GAME || exitrequested == KX_EXIT_REQUEST_START_OTHER_GAME);
+#ifndef DISABLE_PYTHON
// Release Python's GIL
PyGILState_Release(gilstate);
+#endif
}
../../../source/blender/gpu
../../../extern/bullet2/src
../../../extern/glew/include
- ${PYTHON_INC}
)
IF(WITH_FFMPEG)
ADD_DEFINITIONS(-DWITH_FFMPEG)
ENDIF(WITH_FFMPEG)
+IF(WITH_PYTHON)
+ SET(INC ${INC} ${PYTHON_INC})
+ELSE(WITH_PYTHON)
+ ADD_DEFINITIONS(-DDISABLE_PYTHON)
+ENDIF(WITH_PYTHON)
+
BLENDERLIB(bf_blroutines "${SRC}" "${INC}")
#env.BlenderLib ( 'bf_bloutines', sources, Split(incs), [], libtype=['game', 'game2', 'player'], priority=[0, 0, 55] , compileflags=cxxflags)
if env['WITH_BF_FFMPEG']:
defs.append('WITH_FFMPEG')
-incs += ' ' + env['BF_PYTHON_INC']
+if env['WITH_BF_PYTHON']:
+ incs += ' ' + env['BF_PYTHON_INC']
+else:
+ defs.append('DISABLE_PYTHON')
+
incs += ' ' + env['BF_BULLET_INC']
incs += ' ' + env['BF_OPENGL_INC']
ADD_SUBDIRECTORY(Rasterizer/RAS_OpenGLRasterizer)
ADD_SUBDIRECTORY(SceneGraph)
ADD_SUBDIRECTORY(Physics/Bullet)
-ADD_SUBDIRECTORY(VideoTexture)
+
+IF(WITH_PYTHON)
+ ADD_SUBDIRECTORY(VideoTexture)
+ENDIF(WITH_PYTHON)
IF(WITH_PLAYER)
ADD_SUBDIRECTORY(GamePlayer)
return keepgoing;
};
+#ifndef DISABLE_PYTHON
+
/* ------------------------------------------------------------------------- */
/* Python functions */
/* ------------------------------------------------------------------------- */
return ret;
}
+
+#endif // DISABLE_PYTHON
bAction* GetAction() { return m_action; }
void SetAction(bAction* act) { m_action= act; }
+#ifndef DISABLE_PYTHON
+
KX_PYMETHOD_O(BL_ActionActuator,GetChannel);
KX_PYMETHOD_DOC(BL_ActionActuator,setChannel);
return 1;
}
}
+#endif // DISABLE_PYTHON
protected:
return result;
}
+#ifndef DISABLE_PYTHON
+
/* ------------------------------------------------------------------------- */
/* Python Integration Hooks */
/* ------------------------------------------------------------------------- */
return constraint->GetProxy();
}
-
+#endif // DISABLE_PYTHON
virtual bool Update(double curtime, bool frame);
virtual void ReParent(SCA_IObject* parent);
+#ifndef DISABLE_PYTHON
+
/* These are used to get and set m_target */
static PyObject* pyattr_get_constraint(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+#endif // DISABLE_PYTHON
+
private:
// identify the constraint that this actuator controls
void FindConstraint();
#include "BLI_arithb.h"
#include "BLI_string.h"
+#ifndef DISABLE_PYTHON
+
PyTypeObject BL_ArmatureChannel::Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"BL_ArmatureChannel",
return NewProxyPlus_Ext(this, &Type, m_posechannel, py_owns);
}
+#endif // DISABLE_PYTHON
+
BL_ArmatureChannel::BL_ArmatureChannel(
BL_ArmatureObject *armature,
bPoseChannel *posechannel)
{
}
+#ifndef DISABLE_PYTHON
+
// PYTHON
PyMethodDef BL_ArmatureChannel::Methods[] = {
return childrenlist;
}
+
+#endif // DISABLE_PYTHON
struct bPoseChannel *posechannel);
virtual ~BL_ArmatureChannel();
+#ifndef DISABLE_PYTHON
+ // Python access
virtual PyObject* py_repr(void);
- // Python access
static PyObject* py_attr_getattr(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static int py_attr_setattr(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
static PyObject* py_attr_get_joint_rotation(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static int py_attr_set_joint_rotation(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
-
+#endif // DISABLE_PYTHON
};
/* this is a factory class to access bBone data field in the GE.
virtual ~BL_ArmatureBone() {}
public:
+
+#ifndef DISABLE_PYTHON
static PyObject *py_bone_repr(PyObject *self);
static PyObject *py_bone_get_parent(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static PyObject *py_bone_get_children(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
+#endif
};
#include "BLI_arithb.h"
#include "BLI_string.h"
+#ifndef DISABLE_PYTHON
+
PyTypeObject BL_ArmatureConstraint::Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"BL_ArmatureConstraint",
return PyUnicode_FromString(m_name);
}
+#endif // DISABLE_PYTHON
+
BL_ArmatureConstraint::BL_ArmatureConstraint(
BL_ArmatureObject *armature,
bPoseChannel *posechannel,
}
+#ifndef DISABLE_PYTHON
+
// PYTHON
PyMethodDef BL_ArmatureConstraint::Methods[] = {
return PY_SET_ATTR_FAIL;
}
+#endif // DISABLE_PYTHON
KX_GameObject* subtarget);
virtual ~BL_ArmatureConstraint();
-
- virtual PyObject* py_repr(void);
-
BL_ArmatureConstraint* GetReplica() const;
void ReParent(BL_ArmatureObject* armature);
void Relink(GEN_Map<GEN_HashedPtr, void*> *map);
void SetTarget(KX_GameObject* target);
void SetSubtarget(KX_GameObject* subtarget);
+#ifndef DISABLE_PYTHON
+
// Python access
+ virtual PyObject* py_repr(void);
+
static PyObject* py_attr_getattr(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static int py_attr_setattr(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
-
+#endif // DISABLE_PYTHON
};
#endif //__BL_ARMATURECONSTRAINT
return (float)(MT_Point3(bone->head) - MT_Point3(bone->tail)).length();
}
+#ifndef DISABLE_PYTHON
+
// PYTHON
PyTypeObject BL_ArmatureObject::Type = {
SetActiveAction(NULL, 0, KX_GetActiveEngine()->GetFrameTime());
Py_RETURN_NONE;
}
+
+#endif // DISABLE_PYTHON
virtual int GetGameObjectType() { return OBJ_ARMATURE; }
+#ifndef DISABLE_PYTHON
+
// PYTHON
static PyObject* pyattr_get_constraints(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_channels(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
KX_PYMETHOD_DOC_NOARGS(BL_ArmatureObject, update);
+#endif // DISABLE_PYTHON
+
protected:
/* list element: BL_ArmatureConstraint. Use SG_DListHead to have automatic list replication */
SG_DListHead<BL_ArmatureConstraint> m_controlledConstraints;
KX_Scene* kxscene,
KX_KetsjiEngine* ketsjiEngine,
e_PhysicsEngine physics_engine,
+#ifndef DISABLE_PYTHON
PyObject* pythondictionary,
+#endif
RAS_IRenderTools* rendertools,
RAS_ICanvas* canvas,
KX_BlenderSceneConverter* converter,
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,pythondictionary,layerMask,isInActiveLayer,converter);
+ BL_ConvertControllers(blenderobj,gameobj,logicmgr,
+#ifndef DISABLE_PYTHON
+ pythondictionary,
+#endif
+ layerMask,isInActiveLayer,converter);
}
for ( i=0;i<logicbrick_conversionlist->GetCount();i++)
{
class KX_Scene* kxscene,
class KX_KetsjiEngine* ketsjiEngine,
e_PhysicsEngine physics_engine,
+#ifndef DISABLE_PYTHON
PyObject* pythondictionary,
+#endif
class RAS_IRenderTools* rendertools,
class RAS_ICanvas* canvas,
class KX_BlenderSceneConverter* sceneconverter,
return keepgoing;
};
+#ifndef DISABLE_PYTHON
+
/* ------------------------------------------------------------------------- */
/* Python functions */
/* ------------------------------------------------------------------------- */
return PY_SET_ATTR_SUCCESS;
}
+
+#endif // DISABLE_PYTHON
bAction* GetAction() { return m_action; }
void SetAction(bAction* act) { m_action= act; }
+#ifndef DISABLE_PYTHON
+
static PyObject* pyattr_get_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_action(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
}
+#endif // DISABLE_PYTHON
+
protected:
void SetStartTime(float curtime);
../../../source/blender/gpu
../../../source/blender/ikplugin
../../../extern/bullet2/src
- ${PYTHON_INC}
)
+IF(WITH_PYTHON)
+ SET(INC ${INC} ${PYTHON_INC})
+ELSE(WITH_PYTHON)
+ ADD_DEFINITIONS(-DDISABLE_PYTHON)
+ENDIF(WITH_PYTHON)
+
BLENDERLIB(bf_converter "${SRC}" "${INC}")
#env.BlenderLib ( 'bf_converter', sources, Split(incs), [], libtype=['game','player'], priority=[5,70] )
#endif
void KX_BlenderSceneConverter::ConvertScene(class KX_Scene* destinationscene,
+#ifndef DISABLE_PYTHON
PyObject* dictobj,
+#endif
class RAS_IRenderTools* rendertools,
class RAS_ICanvas* canvas)
{
destinationscene,
m_ketsjiEngine,
physics_engine,
+#ifndef DISABLE_PYTHON
dictobj,
+#endif
rendertools,
canvas,
this,
*/
virtual void ConvertScene(
class KX_Scene* destinationscene,
+#ifndef DISABLE_PYTHON
PyObject* dictobj,
+#endif
class RAS_IRenderTools* rendertools,
class RAS_ICanvas* canvas
);
void BL_ConvertControllers(
struct Object* blenderobject,
class KX_GameObject* gameobj,
- SCA_LogicManager* logicmgr,
+ SCA_LogicManager* logicmgr,
+#ifndef DISABLE_PYTHON
PyObject* pythondictionary,
+#endif
int activeLayerBitInfo,
bool isInActiveLayer,
KX_BlenderSceneConverter* converter
SCA_PythonController* pyctrl = new SCA_PythonController(gameobj, pycont->mode);
gamecontroller = pyctrl;
+#ifndef DISABLE_PYTHON
+
pyctrl->SetDictionary(pythondictionary);
if(pycont->mode==SCA_PythonController::SCA_PYEXEC_SCRIPT) {
pyctrl->SetDebug(true);
}
+#endif // DISABLE_PYTHON
+
break;
}
default:
gameobj->AddController(gamecontroller);
converter->RegisterGameController(gamecontroller, bcontr);
-
+
+#ifndef DISABLE_PYTHON
if (bcontr->type==CONT_PYTHON) {
SCA_PythonController *pyctrl= static_cast<SCA_PythonController*>(gamecontroller);
/* not strictly needed but gives syntax errors early on and
// pyctrl->Import();
}
}
-
+#endif // DISABLE_PYTHON
+
//done with gamecontroller
gamecontroller->Release();
}
void BL_ConvertControllers(
struct Object* blenderobject,
class KX_GameObject* gameobj,
- class SCA_LogicManager* logicmgr,
+ class SCA_LogicManager* logicmgr,
+#ifndef DISABLE_PYTHON
PyObject* pythondictionary,
+#endif
int activeLayerBitInfo,
bool isInActiveLayer,
class KX_BlenderSceneConverter* converter
propval->Release();
}
-
+#ifndef DISABLE_PYTHON
/* Warn if we double up on attributes, this isnt quite right since it wont find inherited attributes however there arnt many */
for(PyAttributeDef *attrdef = KX_GameObject::Attributes; attrdef->m_name; attrdef++) {
if(strcmp(prop->name, attrdef->m_name)==0) {
}
}
/* end warning check */
+#endif // DISABLE_PYTHON
prop = prop->next;
}
* Conversion of Blender data blocks to KX sensor system
*/
+#include <stdio.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
incs += ' #source/blender/makesrna'
incs += ' #source/blender/ikplugin'
-incs += ' ' + env['BF_PYTHON_INC']
incs += ' ' + env['BF_BULLET_INC']
if env['BF_DEBUG']:
if env['OURPLATFORM'] in ('win32-mingw', 'win32-vc', 'win64-vc'):
defs.append('_DEBUG')
+
+if env['WITH_BF_PYTHON']:
+ incs += ' ' + env['BF_PYTHON_INC']
+else:
+ defs.append('DISABLE_PYTHON')
env.BlenderLib ( 'bf_converter', sources, Split(incs), defs, libtype=['core','player'], priority=[305,40], cxx_compileflags=env['BGE_CXXFLAGS'])
return replica;
}
-
-
+#ifndef DISABLE_PYTHON
PyObject* CBoolValue::ConvertValueToPython()
{
return PyBool_FromLong(m_bool != 0);
}
+#endif // DISABLE_PYTHON
void Configure(CValue* menuvalue);
virtual CValue* GetReplica();
+#ifndef DISABLE_PYTHON
virtual PyObject* ConvertValueToPython();
+#endif
private:
bool m_bool;
../../../intern/moto/include
../../../source/gameengine/SceneGraph
../../../source/blender/blenloader
- ${PYTHON_INC}
)
+IF(WITH_PYTHON)
+ SET(INC ${INC} ${PYTHON_INC})
+ELSE(WITH_PYTHON)
+ ADD_DEFINITIONS(-DDISABLE_PYTHON)
+ENDIF(WITH_PYTHON)
+
BLENDERLIB(bf_expressions "${SRC}" "${INC}")
#env.BlenderLib ( 'bf_expressions', sources, Split(incs), [], libtype=['game','player'], priority = [45,125] )
}
-
+#ifndef DISABLE_PYTHON
PyObject* CFloatValue::ConvertValueToPython()
{
return PyFloat_FromDouble(m_float);
}
-
+#endif // DISABLE_PYTHON
virtual CValue* GetReplica();
virtual CValue* Calc(VALUE_OPERATOR op, CValue *val);
virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val);
+#ifndef DISABLE_PYTHON
virtual PyObject* ConvertValueToPython();
+#endif
protected:
float m_float;
}
-
+#ifndef DISABLE_PYTHON
PyObject* CIntValue::ConvertValueToPython()
{
if((m_int > INT_MIN) && (m_int < INT_MAX))
else
return PyLong_FromLongLong(m_int);
}
+#endif // DISABLE_PYTHON
void Configure(CValue* menuvalue);
void AddConfigurationData(CValue* menuvalue);
virtual CValue* GetReplica();
+
+#ifndef DISABLE_PYTHON
virtual PyObject* ConvertValueToPython();
+#endif
protected:
virtual ~CIntValue();
#undef _POSIX_C_SOURCE
#endif
-
+#ifndef DISABLE_PYTHON
#include "Python.h"
#define USE_MATHUTILS // Blender 2.5x api will use mathutils, for a while we might want to test without it
+#endif
+
#ifdef __FreeBSD__
#include <osreldate.h>
#if __FreeBSD_version > 500039
*
*/
+#include <stdio.h>
+
#include "ListValue.h"
#include "StringValue.h"
#include "VoidValue.h"
#include <config.h>
#endif
-#if ((PY_MAJOR_VERSION == 2) &&(PY_MINOR_VERSION < 5))
-#define Py_ssize_t int
-#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CListValue::CListValue()
+: CPropValue()
+{
+ m_bReleaseContents=true;
+}
+
+
+
+CListValue::~CListValue()
+{
+
+ if (m_bReleaseContents) {
+ for (unsigned int i=0;i<m_pValueArray.size();i++) {
+ m_pValueArray[i]->Release();
+ }
+ }
+}
+
+
+static STR_String gstrListRep=STR_String("List");
+
+const STR_String & CListValue::GetText()
+{
+ gstrListRep = "[";
+ STR_String commastr = "";
+
+ for (int i=0;i<GetCount();i++)
+ {
+ gstrListRep += commastr;
+ gstrListRep += GetValue(i)->GetText();
+ commastr = ",";
+ }
+ gstrListRep += "]";
+
+ return gstrListRep;
+}
+
+
+
+CValue* CListValue::GetReplica() {
+ CListValue* replica = new CListValue(*this);
+
+ replica->ProcessReplica();
+
+ replica->m_bReleaseContents=true; // for copy, complete array is copied for now...
+ // copy all values
+ int numelements = m_pValueArray.size();
+ unsigned int i=0;
+ replica->m_pValueArray.resize(numelements);
+ for (i=0;i<m_pValueArray.size();i++)
+ replica->m_pValueArray[i] = m_pValueArray[i]->GetReplica();
+
+
+ return replica;
+};
+
+
+
+void CListValue::SetValue(int i, CValue *val)
+{
+ assertd(i < m_pValueArray.size());
+ m_pValueArray[i]=val;
+}
+
+
+
+void CListValue::Resize(int num)
+{
+ m_pValueArray.resize(num);
+}
+
+
+
+void CListValue::Remove(int i)
+{
+ assertd(i<m_pValueArray.size());
+ m_pValueArray.erase(m_pValueArray.begin()+i);
+}
+
+
+
+void CListValue::ReleaseAndRemoveAll()
+{
+ for (unsigned int i=0;i<m_pValueArray.size();i++)
+ m_pValueArray[i]->Release();
+ m_pValueArray.clear();//.Clear();
+}
+
+
+
+CValue* CListValue::FindValue(const STR_String & name)
+{
+ for (int i=0; i < GetCount(); i++)
+ if (GetValue(i)->GetName() == name)
+ return GetValue(i);
+
+ return NULL;
+}
+
+CValue* CListValue::FindValue(const char * name)
+{
+ for (int i=0; i < GetCount(); i++)
+ if (GetValue(i)->GetName() == name)
+ return GetValue(i);
+
+ return NULL;
+}
+
+bool CListValue::SearchValue(CValue *val)
+{
+ for (int i=0;i<GetCount();i++)
+ if (val == GetValue(i))
+ return true;
+ return false;
+}
+
+
+
+void CListValue::SetReleaseOnDestruct(bool bReleaseContents)
+{
+ m_bReleaseContents = bReleaseContents;
+}
+
+
+
+bool CListValue::RemoveValue(CValue *val)
+{
+ bool result=false;
+
+ for (int i=GetCount()-1;i>=0;i--)
+ if (val == GetValue(i))
+ {
+ Remove(i);
+ result=true;
+ }
+ return result;
+}
+
+
+
+void CListValue::MergeList(CListValue *otherlist)
+{
+
+ int numelements = this->GetCount();
+ int numotherelements = otherlist->GetCount();
+
+
+ Resize(numelements+numotherelements);
+
+ for (int i=0;i<numotherelements;i++)
+ {
+ SetValue(i+numelements,otherlist->GetValue(i)->AddRef());
+ }
+}
+
+bool CListValue::CheckEqual(CValue* first,CValue* second)
+{
+ bool result = false;
+
+ CValue* eqval = ((CValue*)first)->Calc(VALUE_EQL_OPERATOR,(CValue*)second);
+
+ if (eqval==NULL)
+ return false;
+ const STR_String& text = eqval->GetText();
+ if (&text==&CBoolValue::sTrueString)
+ {
+ result = true;
+ }
+ eqval->Release();
+ return result;
+
+}
+
+
+/* ---------------------------------------------------------------------
+ * Some stuff taken from the header
+ * --------------------------------------------------------------------- */
+CValue* CListValue::Calc(VALUE_OPERATOR op,CValue *val)
+{
+ //assert(false); // todo: implement me!
+ static int error_printed = 0;
+ if (error_printed==0) {
+ fprintf(stderr, "CValueList::Calc not yet implimented\n");
+ error_printed = 1;
+ }
+ return NULL;
+}
+
+CValue* CListValue::CalcFinal(VALUE_DATA_TYPE dtype,
+ VALUE_OPERATOR op,
+ CValue* val)
+{
+ //assert(false); // todo: implement me!
+ static int error_printed = 0;
+ if (error_printed==0) {
+ fprintf(stderr, "CValueList::CalcFinal not yet implimented\n");
+ error_printed = 1;
+ }
+ return NULL;
+}
+
+
+
+void CListValue::Add(CValue* value)
+{
+ m_pValueArray.push_back(value);
+}
+
+
+
+double CListValue::GetNumber()
+{
+ return -1;
+}
+
+
+
+void CListValue::SetModified(bool bModified)
+{
+ CValue::SetModified(bModified);
+ int numels = GetCount();
+
+ for (int i=0;i<numels;i++)
+ GetValue(i)->SetModified(bModified);
+}
+
+
+
+bool CListValue::IsModified()
+{
+ bool bmod = CValue::IsModified(); //normal own flag
+ int numels = GetCount();
+
+ for (int i=0;i<numels;i++)
+ bmod = bmod || GetValue(i)->IsModified();
+
+ return bmod;
+}
+
+#ifndef DISABLE_PYTHON
+
+/* --------------------------------------------------------------------- */
+/* Python interface ---------------------------------------------------- */
+/* --------------------------------------------------------------------- */
Py_ssize_t listvalue_bufferlen(PyObject* self)
{
{"reverse", (PyCFunction)CListValue::sPyreverse,METH_NOARGS},
{"index", (PyCFunction)CListValue::sPyindex,METH_O},
{"count", (PyCFunction)CListValue::sPycount,METH_O},
-
+
/* Dict style access */
{"get", (PyCFunction)CListValue::sPyget,METH_VARARGS},
-
+
/* Own cvalue funcs */
{"from_id", (PyCFunction)CListValue::sPyfrom_id,METH_O},
-
+
{NULL,NULL} //Sentinel
};
{ NULL } //Sentinel
};
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
-
-CListValue::CListValue()
-: CPropValue()
-{
- m_bReleaseContents=true;
-}
-
-
-
-CListValue::~CListValue()
-{
-
- if (m_bReleaseContents) {
- for (unsigned int i=0;i<m_pValueArray.size();i++) {
- m_pValueArray[i]->Release();
- }
- }
-}
-
-
-static STR_String gstrListRep=STR_String("List");
-
-const STR_String & CListValue::GetText()
-{
- gstrListRep = "[";
- STR_String commastr = "";
-
- for (int i=0;i<GetCount();i++)
- {
- gstrListRep += commastr;
- gstrListRep += GetValue(i)->GetText();
- commastr = ",";
- }
- gstrListRep += "]";
-
- return gstrListRep;
-}
-
-
-
-CValue* CListValue::GetReplica() {
- CListValue* replica = new CListValue(*this);
-
- replica->ProcessReplica();
-
- replica->m_bReleaseContents=true; // for copy, complete array is copied for now...
- // copy all values
- int numelements = m_pValueArray.size();
- unsigned int i=0;
- replica->m_pValueArray.resize(numelements);
- for (i=0;i<m_pValueArray.size();i++)
- replica->m_pValueArray[i] = m_pValueArray[i]->GetReplica();
-
-
- return replica;
-};
-
-
-
-void CListValue::SetValue(int i, CValue *val)
-{
- assertd(i < m_pValueArray.size());
- m_pValueArray[i]=val;
-}
-
-
-
-void CListValue::Resize(int num)
-{
- m_pValueArray.resize(num);
-}
-
-
-
-void CListValue::Remove(int i)
-{
- assertd(i<m_pValueArray.size());
- m_pValueArray.erase(m_pValueArray.begin()+i);
-}
-
-
-
-void CListValue::ReleaseAndRemoveAll()
-{
- for (unsigned int i=0;i<m_pValueArray.size();i++)
- m_pValueArray[i]->Release();
- m_pValueArray.clear();//.Clear();
-}
-
-
-
-CValue* CListValue::FindValue(const STR_String & name)
-{
- for (int i=0; i < GetCount(); i++)
- if (GetValue(i)->GetName() == name)
- return GetValue(i);
-
- return NULL;
-}
-
-CValue* CListValue::FindValue(const char * name)
-{
- for (int i=0; i < GetCount(); i++)
- if (GetValue(i)->GetName() == name)
- return GetValue(i);
-
- return NULL;
-}
-
-bool CListValue::SearchValue(CValue *val)
-{
- for (int i=0;i<GetCount();i++)
- if (val == GetValue(i))
- return true;
- return false;
-}
-
-
-
-void CListValue::SetReleaseOnDestruct(bool bReleaseContents)
-{
- m_bReleaseContents = bReleaseContents;
-}
-
-
-
-bool CListValue::RemoveValue(CValue *val)
-{
- bool result=false;
-
- for (int i=GetCount()-1;i>=0;i--)
- if (val == GetValue(i))
- {
- Remove(i);
- result=true;
- }
- return result;
-}
-
-
-
-void CListValue::MergeList(CListValue *otherlist)
-{
-
- int numelements = this->GetCount();
- int numotherelements = otherlist->GetCount();
-
-
- Resize(numelements+numotherelements);
-
- for (int i=0;i<numotherelements;i++)
- {
- SetValue(i+numelements,otherlist->GetValue(i)->AddRef());
- }
-}
-
-
PyObject* CListValue::Pyappend(PyObject* value)
{
CValue* objval = ConvertPythonToValue(value, "CList.append(i): CValueList, ");
if (!objval) /* ConvertPythonToValue sets the error */
return NULL;
-
+
if (!BGE_PROXY_PYOWNS(m_proxy)) {
PyErr_SetString(PyExc_TypeError, "CList.append(i): this CValueList is used internally for the game engine and can't be modified");
return NULL;
}
-
+
Add(objval);
-
+
Py_RETURN_NONE;
}
-
-
PyObject* CListValue::Pyreverse()
{
std::reverse(m_pValueArray.begin(),m_pValueArray.end());
Py_RETURN_NONE;
}
-
-
-bool CListValue::CheckEqual(CValue* first,CValue* second)
-{
- bool result = false;
-
- CValue* eqval = ((CValue*)first)->Calc(VALUE_EQL_OPERATOR,(CValue*)second);
-
- if (eqval==NULL)
- return false;
- const STR_String& text = eqval->GetText();
- if (&text==&CBoolValue::sTrueString)
- {
- result = true;
- }
- eqval->Release();
- return result;
-
-}
-
-
-
PyObject* CListValue::Pyindex(PyObject *value)
{
PyObject* result = NULL;
PyErr_SetString(PyExc_ValueError, "CList.index(x): x not in CListValue");
}
return result;
-
+
}
int numfound = 0;
CValue* checkobj = ConvertPythonToValue(value, ""); /* error ignored */
-
+
if (checkobj==NULL) { /* in this case just return that there are no items in the list */
PyErr_Clear();
return PyLong_FromSsize_t(0);
if (!PyArg_ParseTuple(args, "s|O:get", &key, &def))
return NULL;
-
+
CValue *item = FindValue((const char *)key);
- if (item) {
+ if (item) {
PyObject* pyobj = item->ConvertValueToPython();
if (pyobj)
return pyobj;
PyObject* CListValue::Pyfrom_id(PyObject* value)
{
uintptr_t id= (uintptr_t)PyLong_AsVoidPtr(value);
-
+
if (PyErr_Occurred())
return NULL;
return GetValue(i)->GetProxy();
}
PyErr_SetString(PyExc_IndexError, "from_id(#): id not found in CValueList");
- return NULL;
-
-}
-
-
-/* ---------------------------------------------------------------------
- * Some stuff taken from the header
- * --------------------------------------------------------------------- */
-CValue* CListValue::Calc(VALUE_OPERATOR op,CValue *val)
-{
- //assert(false); // todo: implement me!
- static int error_printed = 0;
- if (error_printed==0) {
- fprintf(stderr, "CValueList::Calc not yet implimented\n");
- error_printed = 1;
- }
return NULL;
-}
-
-CValue* CListValue::CalcFinal(VALUE_DATA_TYPE dtype,
- VALUE_OPERATOR op,
- CValue* val)
-{
- //assert(false); // todo: implement me!
- static int error_printed = 0;
- if (error_printed==0) {
- fprintf(stderr, "CValueList::CalcFinal not yet implimented\n");
- error_printed = 1;
- }
- return NULL;
-}
-
-
-
-void CListValue::Add(CValue* value)
-{
- m_pValueArray.push_back(value);
-}
-
-
-double CListValue::GetNumber()
-{
- return -1;
}
-
-
-void CListValue::SetModified(bool bModified)
-{
- CValue::SetModified(bModified);
- int numels = GetCount();
-
- for (int i=0;i<numels;i++)
- GetValue(i)->SetModified(bModified);
-}
-
-
-
-bool CListValue::IsModified()
-{
- bool bmod = CValue::IsModified(); //normal own flag
- int numels = GetCount();
-
- for (int i=0;i<numels;i++)
- bmod = bmod || GetValue(i)->IsModified();
-
- return bmod;
-}
+#endif // DISABLE_PYTHON
bool CheckEqual(CValue* first,CValue* second);
+#ifndef DISABLE_PYTHON
virtual PyObject* py_repr(void) {
PyObject *py_proxy= this->GetProxy();
PyObject *py_list= PySequence_List(py_proxy);
KX_PYMETHOD_O(CListValue,count);
KX_PYMETHOD_VARARGS(CListValue,get);
KX_PYMETHOD_O(CListValue,from_id);
-
+#endif
private:
#include <config.h>
#endif
-#ifndef NO_EXP_PYTHON_EMBEDDING
-
/*------------------------------
* PyObjectPlus cpp
*
#include "STR_String.h"
#include "MT_Vector3.h"
#include "MEM_guardedalloc.h"
+
+PyObjectPlus::~PyObjectPlus()
+{
+#ifndef DISABLE_PYTHON
+ if(m_proxy) {
+ BGE_PROXY_REF(m_proxy)= NULL;
+ Py_DECREF(m_proxy); /* Remove own reference, python may still have 1 */
+ }
+// assert(ob_refcnt==0);
+#endif
+}
+
+PyObjectPlus::PyObjectPlus() : SG_QList() // constructor
+{
+#ifndef DISABLE_PYTHON
+ m_proxy= NULL;
+#endif
+};
+
+void PyObjectPlus::ProcessReplica()
+{
+#ifndef DISABLE_PYTHON
+ /* Clear the proxy, will be created again if needed with GetProxy()
+ * otherwise the PyObject will point to the wrong reference */
+ m_proxy= NULL;
+#endif
+}
+
+/* Sometimes we might want to manually invalidate a BGE type even if
+ * it hasnt been released by the BGE, say for example when an object
+ * is removed from a scene, accessing it may cause problems.
+ *
+ * In this case the current proxy is made invalid, disowned,
+ * and will raise an error on access. However if python can get access
+ * to this class again it will make a new proxy and work as expected.
+ */
+void PyObjectPlus::InvalidateProxy() // check typename of each parent
+{
+#ifndef DISABLE_PYTHON
+ if(m_proxy) {
+ BGE_PROXY_REF(m_proxy)=NULL;
+ Py_DECREF(m_proxy);
+ m_proxy= NULL;
+ }
+#endif
+}
+
+
+#ifndef DISABLE_PYTHON
+
/*------------------------------
* PyObjectPlus Type -- Every class, even the abstract one should have a Type
------------------------------*/
NULL // no subtype
};
-
-PyObjectPlus::~PyObjectPlus()
-{
- if(m_proxy) {
- BGE_PROXY_REF(m_proxy)= NULL;
- Py_DECREF(m_proxy); /* Remove own reference, python may still have 1 */
- }
-// assert(ob_refcnt==0);
-}
-
-
PyObject *PyObjectPlus::py_base_repr(PyObject *self) // This should be the entry in Type.
{
PyObjectPlus *self_plus= BGE_PROXY_REF(self);
#endif
};
-PyObjectPlus::PyObjectPlus() : SG_QList() // constructor
-{
- m_proxy= NULL;
-};
-
/*------------------------------
* PyObjectPlus Methods -- Every class, even the abstract one should have a Methods
------------------------------*/
return NULL;
}
-void PyObjectPlus::ProcessReplica()
-{
- /* Clear the proxy, will be created again if needed with GetProxy()
- * otherwise the PyObject will point to the wrong reference */
- m_proxy= NULL;
-}
-
-/* Sometimes we might want to manually invalidate a BGE type even if
- * it hasnt been released by the BGE, say for example when an object
- * is removed from a scene, accessing it may cause problems.
- *
- * In this case the current proxy is made invalid, disowned,
- * and will raise an error on access. However if python can get access
- * to this class again it will make a new proxy and work as expected.
- */
-void PyObjectPlus::InvalidateProxy() // check typename of each parent
-{
- if(m_proxy) {
- BGE_PROXY_REF(m_proxy)=NULL;
- Py_DECREF(m_proxy);
- m_proxy= NULL;
- }
-}
-
PyObject *PyObjectPlus::GetProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, void *ptr)
{
if (self->m_proxy==NULL)
void PyObjectPlus::SetDeprecationWarningLinkLast(WarnLink* wlink) {m_base_wlink_last= wlink;}
void PyObjectPlus::NullDeprecationWarning() {m_base_wlink_first= m_base_wlink_last= NULL;}
-#endif //NO_EXP_PYTHON_EMBEDDING
-
+#endif // DISABLE_PYTHON
* ***** END GPL LICENSE BLOCK *****
*/
-#ifndef NO_EXP_PYTHON_EMBEDDING
-
#ifndef _adr_py_lib_h_ // only process once,
#define _adr_py_lib_h_ // even if multiply included
* Python defines
------------------------------*/
+#ifndef DISABLE_PYTHON
#ifdef USE_MATHUTILS
extern "C" {
#include "../../blender/python/generic/Mathutils.h" /* so we can have mathutils callbacks */
------------------------------*/
typedef PyTypeObject * PyParentObject; // Define the PyParent Object
+#else // DISABLE_PYTHON
+
+#define Py_Header \
+ public: \
+
+
+#define Py_HeaderPtr \
+ public: \
+
+
+#endif
+
+
+
// By making SG_QList the ultimate parent for PyObjectPlus objects, it
// allows to put them in 2 different dynamic lists at the same time
// The use of these links is interesting because they free of memory allocation
public:
PyObjectPlus();
-
- PyObject *m_proxy; /* actually a PyObjectPlus_Proxy */
virtual ~PyObjectPlus(); // destructor
+#ifndef DISABLE_PYTHON
+ PyObject *m_proxy; /* actually a PyObjectPlus_Proxy */
+
/* These static functions are referenced by ALL PyObjectPlus_Proxy types
* they take the C++ reference from the PyObjectPlus_Proxy and call
* its own virtual py_repr, py_base_dealloc ,etc. functions.
(assume object destructor takes care of it) */
static PyObject *NewProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, void *ptr, bool py_owns);
- void InvalidateProxy();
-
- /**
- * Makes sure any internal data owned by this class is deep copied.
- */
- virtual void ProcessReplica();
-
-
- static bool m_ignore_deprecation_warnings;
-
static WarnLink* GetDeprecationWarningLinkFirst(void);
static WarnLink* GetDeprecationWarningLinkLast(void);
static void SetDeprecationWarningFirst(WarnLink* wlink);
static void ShowDeprecationWarning_func(const char* method,const char* prop);
static void ClearDeprecationWarning();
-};
+#endif
+ void InvalidateProxy();
-PyObject *py_getattr_dict(PyObject *pydict, PyObject *tp_dict);
+ /**
+ * Makes sure any internal data owned by this class is deep copied.
+ */
+ virtual void ProcessReplica();
-#endif // _adr_py_lib_h_
+ static bool m_ignore_deprecation_warnings;
+};
-#endif //NO_EXP_PYTHON_EMBEDDING
+#ifndef DISABLE_PYTHON
+PyObject *py_getattr_dict(PyObject *pydict, PyObject *tp_dict);
+#endif
+#endif // _adr_py_lib_h_
sources = env.Glob('*.cpp')
incs ='. #source/kernel/gen_system #intern/guardedalloc #intern/string #intern/moto/include #source/gameengine/SceneGraph #source/blender/blenloader'
-incs += ' ' + env['BF_PYTHON_INC']
-env.BlenderLib ( 'bf_expressions', sources, Split(incs), [], libtype=['core','player'], priority = [360,80], cxx_compileflags=env['BGE_CXXFLAGS'])
+defs = []
+
+if env['WITH_BF_PYTHON']:
+ incs += ' ' + env['BF_PYTHON_INC']
+else:
+ defs.append('DISABLE_PYTHON')
+
+env.BlenderLib ( 'bf_expressions', sources, Split(incs), defs, libtype=['core','player'], priority = [360,80], cxx_compileflags=env['BGE_CXXFLAGS'])
virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val);
virtual void SetValue(CValue* newval) { m_strString = newval->GetText(); SetModified(true); };
virtual CValue* GetReplica();
+#ifndef DISABLE_PYTHON
virtual PyObject* ConvertValueToPython() {
return PyUnicode_FromString(m_strString.Ptr());
}
+#endif // DISABLE_PYTHON
private:
// data member
double CValue::m_sZeroVec[3] = {0.0,0.0,0.0};
-#ifndef NO_EXP_PYTHON_EMBEDDING
+#ifndef DISABLE_PYTHON
PyTypeObject CValue::Type = {
PyVarObject_HEAD_INIT(NULL, 0)
PyMethodDef CValue::Methods[] = {
{NULL,NULL} //Sentinel
};
+#endif // DISABLE_PYTHON
+
/*#define CVALUE_DEBUG*/
#ifdef CVALUE_DEBUG
CValue::CValue()
: PyObjectPlus(),
-#else
-CValue::CValue()
-:
-#endif //NO_EXP_PYTHON_EMBEDDING
m_pNamedPropertyArray(NULL),
m_refcount(1)
return result;
}
-
-#ifndef NO_EXP_PYTHON_EMBEDDING
+#ifndef DISABLE_PYTHON
PyAttributeDef CValue::Attributes[] = {
KX_PYATTRIBUTE_RO_FUNCTION("name", CValue, pyattr_get_name),
return pylist;
}
-#endif //NO_EXP_PYTHON_EMBEDDING
+#endif // DISABLE_PYTHON
+
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
-#ifndef NO_EXP_PYTHON_EMBEDDING
#include "PyObjectPlus.h"
+#ifndef DISABLE_PYTHON
#include "object.h"
+#endif
class CValue : public PyObjectPlus
-#else
-class CValue
-#endif //NO_EXP_PYTHON_EMBEDDING
-
{
-#ifndef NO_EXP_PYTHON_EMBEDDING
Py_Header;
-#endif //NO_EXP_PYTHON_EMBEDDING
public:
enum AllocationTYPE {
STACKVALUE = 0,
// Construction / Destruction
-#ifndef NO_EXP_PYTHON_EMBEDDING
-
CValue();
+
+#ifndef DISABLE_PYTHON
//static PyObject* PyMake(PyObject*,PyObject*);
virtual PyObject *py_repr(void)
{
static PyObject * pyattr_get_name(void * self, const KX_PYATTRIBUTE_DEF * attrdef);
virtual PyObject* ConvertKeysToPython( void );
-
-#else
- CValue();
-#endif //NO_EXP_PYTHON_EMBEDDING
+#endif // DISABLE_PYTHON
class CPropValue : public CValue
{
public:
-#ifndef NO_EXP_PYTHON_EMBEDDING
CPropValue() :
CValue(),
-#else
- CPropValue() :
-#endif //NO_EXP_PYTHON_EMBEDDING
m_strNewName()
{
../../../source/gameengine/SceneGraph
../../../intern/moto/include
../../../source/gameengine/Rasterizer
- ${PYTHON_INC}
)
IF(WITH_SDL)
ADD_DEFINITIONS(-DDISABLE_SDL)
ENDIF(WITH_SDL)
+IF(WITH_PYTHON)
+ SET(INC ${INC} ${PYTHON_INC})
+ELSE(WITH_PYTHON)
+ ADD_DEFINITIONS(-DDISABLE_PYTHON)
+ENDIF(WITH_PYTHON)
+
BLENDERLIB(bf_logic "${SRC}" "${INC}")
#env.BlenderLib ( 'bf_logic', sources, Split(incs), [], libtype=['game','player'], priority=[30, 110] )
m_shaderText = text;
}
+#ifndef DISABLE_PYTHON
+
/* ------------------------------------------------------------------------- */
/* Python functions */
/* ------------------------------------------------------------------------- */
-
-
/* Integration hooks ------------------------------------------------------- */
PyTypeObject SCA_2DFilterActuator::Type = {
PyVarObject_HEAD_INIT(NULL, 0)
KX_PYATTRIBUTE_FLOAT_RW("value", 0.0, 100.0, SCA_2DFilterActuator, m_float_arg),
{ NULL } //Sentinel
};
+
+#endif
return replica;
}
-
+#ifndef DISABLE_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
PyAttributeDef SCA_ANDController::Attributes[] = {
{ NULL } //Sentinel
};
-
+#endif // DISABLE_PYTHON
/* eof */
}
}
+#ifndef DISABLE_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
return 1;
}
+#endif // DISABLE_PYTHON
+
/* eof */
virtual void ReParent(SCA_IObject* parent);
void Update();
+#ifndef DISABLE_PYTHON
+
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
/* --------------------------------------------------------------------- */
-
+
static int CheckActuator(void *self, const PyAttributeDef*);
+
+#endif // DISABLE_PYTHON
};
#endif
return result;
}
+#ifndef DISABLE_PYTHON
+
/* ------------------------------------------------------------------------- */
/* Python functions */
/* ------------------------------------------------------------------------- */
{ NULL } //Sentinel
};
+#endif
+
/* eof */
return trigger;
}
+#ifndef DISABLE_PYTHON
+
/* ------------------------------------------------------------------------- */
/* Python functions */
/* ------------------------------------------------------------------------- */
{ NULL } //Sentinel
};
+#endif // DISABLE_PYTHON
+
/* eof */
#include "InputParser.h"
#include "MT_Transform.h" // for fuzzyZero
+#include <stdio.h>
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
*/
#include "SCA_IActuator.h"
+#include <stdio.h>
#ifdef HAVE_CONFIG_H
#include <config.h>
#include "PyObjectPlus.h"
#include "../Ketsji/KX_PythonSeq.h" /* not nice, only need for KX_PythonSeq_CreatePyObject */
+#include <stdio.h>
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
}
}
+#ifndef DISABLE_PYTHON
+
/* Python api */
PyTypeObject SCA_IController::Type = {
{
return KX_PythonSeq_CreatePyObject((static_cast<SCA_IController*>(self_v))->m_proxy, KX_PYGENSEQ_CONT_TYPE_ACTUATORS);
}
+#endif // DISABLE_PYTHON
}
}
+
+#ifndef DISABLE_PYTHON
static PyObject* pyattr_get_state(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_sensors(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_actuators(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
-
+#endif // DISABLE_PYTHON
};
#endif
+#ifndef DISABLE_PYTHON
/* python stuff */
{
return PyLong_FromSsize_t(boolarg? KX_TRUE: KX_FALSE);
}
+
+#endif // DISABLE_PYTHON
static class SCA_LogicManager* m_sCurrentLogicManager;
+#ifndef DISABLE_PYTHON
// python methods
static PyObject* pyattr_get_owner(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
/** Convert a a c++ value to KX_TRUE, KX_FALSE in Python. */
PyObject* BoolToPyArg(bool);
-
+#endif // DISABLE_PYTHON
+
};
#endif
}
}
-
+#ifndef DISABLE_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
PyAttributeDef SCA_IObject::Attributes[] = {
{ NULL } //Sentinel
};
+
+#endif // DISABLE_PYTHON
class SCA_IController;
class SCA_IActuator;
+#ifndef DISABLE_PYTHON
template<class T> T PyVecTo(PyObject*);
+#endif
typedef std::vector<SCA_ISensor *> SCA_SensorList;
typedef std::vector<SCA_IController *> SCA_ControllerList;
// needed for IsTriggered()
#include "SCA_PythonController.h"
+#include <stdio.h>
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
}
}
}
+
+#ifndef DISABLE_PYTHON
+
/* ----------------------------------------------- */
/* Python Functions */
/* ----------------------------------------------- */
self->m_level = false;
return 0;
}
+#endif // DISABLE_PYTHON
/* eof */
bool IsNoLink() const
{ return !m_links; }
+#ifndef DISABLE_PYTHON
/* Python functions: */
KX_PYMETHOD_DOC_NOARGS(SCA_ISensor,reset);
static PyObject* pyattr_get_positive(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_check_level(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_check_tap(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+#endif // DISABLE_PYTHON
};
#endif //__SCA_ISENSOR
#include "PyObjectPlus.h"
+#include <stdio.h>
#include <iostream>
return res;
}
+#ifndef DISABLE_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex);
return PyBool_FromLong( joy ? joy->Connected() : 0 );
}
+
+#endif
return m_joyindex;
}
+#ifndef DISABLE_PYTHON
+
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
/* --------------------------------------------------------------------- */
return 0;
}
+#endif // DISABLE_PYTHON
+
};
#endif
}
}
+#ifndef DISABLE_PYTHON
/* ------------------------------------------------------------------------- */
/* Python Functions */
return resultlist;
}
+#endif // DISABLE_PYTHON
/* Accessed from python */
virtual bool IsPositiveTrigger();
bool TriggerOnAllKeys();
+#ifndef DISABLE_PYTHON
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
/* --------------------------------------------------------------------- */
KX_PYMETHOD_DOC_O(SCA_KeyboardSensor,getKeyStatus);
static PyObject* pyattr_get_events(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+#endif
};
void SCA_LogicManager::AddTriggeredController(SCA_IController* controller, SCA_ISensor* sensor)
{
controller->Activate(m_triggeredControllerSet);
+
+#ifndef DISABLE_PYTHON
+
// so that the controller knows which sensor has activited it
// only needed for python controller
// Note that this is safe even if the controller is subclassed.
SCA_PythonController* pythonController = (SCA_PythonController*)controller;
pythonController->AddTriggeredSensor(sensor);
}
+#endif
}
SCA_EventManager* SCA_LogicManager::FindEventManager(int eventmgrtype)
m_mousemode = mousemode;
m_triggermode = true;
- UpdateHotkey(this, NULL);
+ UpdateHotkey(this);
Init();
}
/* Nothing to be done here. */
}
-int SCA_MouseSensor::UpdateHotkey(void *self, const PyAttributeDef*)
+void SCA_MouseSensor::UpdateHotkey(void *self)
{
// gosh, this function is so damn stupid
// its here because of a design mistake in the mouse sensor, it should only
default:
; /* ignore, no hotkey */
}
- // return value is used in py_setattro(),
- // 0=attribute checked ok (see Attributes array definition)
- return 0;
}
CValue* SCA_MouseSensor::GetReplica()
return ((m > KX_MOUSESENSORMODE_NODEF) && (m < KX_MOUSESENSORMODE_MAX));
}
+#ifndef DISABLE_PYTHON
+
/* ------------------------------------------------------------------------- */
/* Python functions */
/* ------------------------------------------------------------------------- */
{NULL,NULL} //Sentinel
};
+int SCA_MouseSensor::UpdateHotkeyPy(void *self, const PyAttributeDef*)
+{
+ UpdateHotkey(self);
+ // return value is used in py_setattro(),
+ // 0=attribute checked ok (see Attributes array definition)
+ return 0;
+}
+
PyAttributeDef SCA_MouseSensor::Attributes[] = {
- KX_PYATTRIBUTE_SHORT_RW_CHECK("mode",KX_MOUSESENSORMODE_NODEF,KX_MOUSESENSORMODE_MAX-1,true,SCA_MouseSensor,m_mousemode,UpdateHotkey),
+ KX_PYATTRIBUTE_SHORT_RW_CHECK("mode",KX_MOUSESENSORMODE_NODEF,KX_MOUSESENSORMODE_MAX-1,true,SCA_MouseSensor,m_mousemode,UpdateHotkeyPy),
KX_PYATTRIBUTE_SHORT_LIST_RO("position",SCA_MouseSensor,m_x,2),
{ NULL } //Sentinel
};
+#endif // DISABLE_PYTHON
+
/* eof */
bool isValid(KX_MOUSESENSORMODE);
- static int UpdateHotkey(void *self, const PyAttributeDef*);
-
SCA_MouseSensor(class SCA_MouseManager* keybdmgr,
int startx,int starty,
short int mousemode,
SCA_IInputDevice::KX_EnumInputs GetHotKey();
void setX(short x);
void setY(short y);
-
+
+ static void UpdateHotkey(void *self);
+
+
+#ifndef DISABLE_PYTHON
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
/* --------------------------------------------------------------------- */
+ static int UpdateHotkeyPy(void *self, const PyAttributeDef *);
+
// get button status
KX_PYMETHOD_DOC_O(SCA_MouseSensor,getButtonStatus);
-
+#endif
};
#endif //__KX_MOUSESENSOR
return replica;
}
-
+#ifndef DISABLE_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
{ NULL } //Sentinel
};
+#endif
+
/* eof */
return replica;
}
-
+#ifndef DISABLE_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
{ NULL } //Sentinel
};
+#endif // DISABLE_PYTHON
+
/* eof */
}
}
+#ifndef DISABLE_PYTHON
+
/* ------------------------------------------------------------------------- */
/* Python functions */
/* ------------------------------------------------------------------------- */
{ NULL } //Sentinel
};
+#endif // DISABLE_PYTHON
+
/* eof */
}
}
+#ifndef DISABLE_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
{ NULL } //Sentinel
};
+#endif
+
/* eof */
return GetParent()->FindIdentifier(identifiername);
}
+#ifndef DISABLE_PYTHON
+
+/* ------------------------------------------------------------------------- */
+/* Python functions */
+/* ------------------------------------------------------------------------- */
+
int SCA_PropertySensor::validValueForProperty(void *self, const PyAttributeDef*)
{
/* There is no type checking at this moment, unfortunately... */
return 0;
}
-/* ------------------------------------------------------------------------- */
-/* Python functions */
-/* ------------------------------------------------------------------------- */
-
/* Integration hooks ------------------------------------------------------- */
PyTypeObject SCA_PropertySensor::Type = {
PyVarObject_HEAD_INIT(NULL, 0)
{ NULL } //Sentinel
};
+#endif // DISABLE_PYTHON
+
/* eof */
virtual bool IsPositiveTrigger();
virtual CValue* FindIdentifier(const STR_String& identifiername);
+#ifndef DISABLE_PYTHON
+
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
/* --------------------------------------------------------------------- */
* Test whether this is a sensible value (type check)
*/
static int validValueForProperty(void* self, const PyAttributeDef*);
+
+#endif
};
#endif
#include "SCA_ISensor.h"
#include "SCA_IActuator.h"
#include "PyObjectPlus.h"
+
+#ifndef DISABLE_PYTHON
#include "compile.h"
#include "eval.h"
+#endif // DISABLE_PYTHON
+
#include <algorithm>
SCA_PythonController::SCA_PythonController(SCA_IObject* gameobj, int mode)
: SCA_IController(gameobj),
+#ifndef DISABLE_PYTHON
m_bytecode(NULL),
m_function(NULL),
+#endif
m_function_argc(0),
m_bModified(true),
m_debug(false),
- m_mode(mode),
- m_pythondictionary(NULL)
+ m_mode(mode)
+#ifndef DISABLE_PYTHON
+ , m_pythondictionary(NULL)
+#endif
+
{
}
SCA_PythonController::~SCA_PythonController()
{
+
+#ifndef DISABLE_PYTHON
//printf("released python byte script\n");
Py_XDECREF(m_bytecode);
PyDict_Clear(m_pythondictionary);
Py_DECREF(m_pythondictionary);
}
+#endif
}
CValue* SCA_PythonController::GetReplica()
{
SCA_PythonController* replica = new SCA_PythonController(*this);
-
+
+#ifndef DISABLE_PYTHON
/* why is this needed at all??? - m_bytecode is NULL'd below so this doesnt make sense
* but removing it crashes blender (with YoFrankie). so leave in for now - Campbell */
Py_XINCREF(replica->m_bytecode);
if (m_pythondictionary)
Py_INCREF(replica->m_pythondictionary);
*/
+#endif
// this will copy properties and so on...
replica->ProcessReplica();
}
-
+#ifndef DISABLE_PYTHON
void SCA_PythonController::SetDictionary(PyObject* pythondictionary)
{
if (m_pythondictionary)
PyDict_SetItemString(m_pythondictionary, "__file__", PyUnicode_FromString(m_scriptName.Ptr()));
}
+#endif
int SCA_PythonController::IsTriggered(class SCA_ISensor* sensor)
{
return 0;
}
+#ifndef DISABLE_PYTHON
+
/* warning, self is not the SCA_PythonController, its a PyObjectPlus_Proxy */
PyObject* SCA_PythonController::sPyGetCurrentController(PyObject *self)
{
return true;
}
+
void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr)
{
m_sCurrentController = this;
return PY_SET_ATTR_SUCCESS;
}
+#else // DISABLE_PYTHON
+
+void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr)
+{
+ /* intentionally blank */
+}
+
+#endif // DISABLE_PYTHON
/* eof */
class SCA_PythonController : public SCA_IController
{
Py_Header;
+#ifndef DISABLE_PYTHON
struct _object * m_bytecode; /* SCA_PYEXEC_SCRIPT only */
PyObject* m_function; /* SCA_PYEXEC_MODULE only */
+#endif
int m_function_argc;
bool m_bModified;
bool m_debug; /* use with SCA_PYEXEC_MODULE for reloading every logic run */
protected:
STR_String m_scriptText;
STR_String m_scriptName;
+#ifndef DISABLE_PYTHON
PyObject* m_pythondictionary; /* for SCA_PYEXEC_SCRIPT only */
PyObject* m_pythonfunction; /* for SCA_PYEXEC_MODULE only */
-
+#endif
std::vector<class SCA_ISensor*> m_triggeredSensors;
public:
void SetScriptText(const STR_String& text);
void SetScriptName(const STR_String& name);
+#ifndef DISABLE_PYTHON
void SetDictionary(PyObject* pythondictionary);
+#endif
void SetDebug(bool debug) { m_debug = debug; }
void AddTriggeredSensor(class SCA_ISensor* sensor)
{ m_triggeredSensors.push_back(sensor); }
bool Import();
void ErrorPrint(const char *error_msg);
-
+#ifndef DISABLE_PYTHON
static const char* sPyGetCurrentController__doc__;
static PyObject* sPyGetCurrentController(PyObject* self);
static const char* sPyAddActiveActuator__doc__;
static PyObject* pyattr_get_script(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_script(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
-
-
+#endif
};
#endif //KX_PYTHONCONTROLLER_H
}
}
+#ifndef DISABLE_PYTHON
+
/* ------------------------------------------------------------------------- */
/* Python functions */
/* ------------------------------------------------------------------------- */
enforceConstraints();
Py_RETURN_NONE;
}
-
+
+#endif
+
/* eof */
virtual CValue* GetReplica();
virtual void ProcessReplica();
+
+#ifndef DISABLE_PYTHON
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setFloatUniform);
KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setFloatNormal);
KX_PYMETHOD_DOC_VARARGS(SCA_RandomActuator, setFloatNegativeExponential);
+
+#endif // DISABLE_PYTHON
+
}; /* end of class KX_EditObjectActuator : public SCA_PropertyActuator */
#endif
return evaluateResult;
}
+#ifndef DISABLE_PYTHON
+
/* ------------------------------------------------------------------------- */
/* Python functions */
/* ------------------------------------------------------------------------- */
return PY_SET_ATTR_SUCCESS;
}
+#endif // DISABLE_PYTHON
+
/* eof */
virtual bool IsPositiveTrigger();
virtual void Init();
+#ifndef DISABLE_PYTHON
+
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
/* --------------------------------------------------------------------- */
static PyObject* pyattr_get_seed(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_seed(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
-
+#endif
};
#endif //__KX_RANDOMSENSOR
return replica;
}
-
+#ifndef DISABLE_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
{ NULL } //Sentinel
};
+#endif // DISABLE_PYTHON
+
/* eof */
return replica;
}
-
+#ifndef DISABLE_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
PyAttributeDef SCA_XORController::Attributes[] = {
{ NULL } //Sentinel
};
+#endif // DISABLE_PYTHON
/* eof */
incs += ' #/source/gameengine/Expressions #/intern/moto/include'
incs += ' #/source/gameengine/Rasterizer #/source/gameengine/SceneGraph'
-incs += ' ' + env['BF_PYTHON_INC']
-
-
defs = []
if env['WITH_BF_SDL']:
else:
defs.append('DISABLE_SDL')
+if env['WITH_BF_PYTHON']:
+ incs += ' ' + env['BF_PYTHON_INC']
+else:
+ defs.append('DISABLE_PYTHON')
+
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
if env['BF_DEBUG']:
defs.append('_DEBUG')
# 'unix/GPU_System.cpp']
# gp_common_env.Append ( CPPPATH = ['unix'])
-incs += Split(env['BF_PYTHON_INC'])
+defs = []
+
+if env['WITH_BF_PYTHON']:
+ incs += ' ' + env['BF_PYTHON_INC']
+else:
+ defs.append('DISABLE_PYTHON')
+
incs += Split(env['BF_PNG_INC'])
incs += Split(env['BF_ZLIB_INC'])
-env.BlenderLib (libname='gp_common', sources=source_files, includes=incs, defines = [], libtype=['player'], priority=[5], cxx_compileflags=env['BGE_CXXFLAGS'])
+env.BlenderLib (libname='gp_common', sources=source_files, includes=incs, defines = defs, libtype=['player'], priority=[5], cxx_compileflags=env['BGE_CXXFLAGS'])
'#source/blender/gpu',
'#extern/glew/include']
-incs += Split(env['BF_PYTHON_INC'])
-
defs = []
+
+if env['WITH_BF_PYTHON']:
+ incs += ' ' + env['BF_PYTHON_INC']
+else:
+ defs.append('DISABLE_PYTHON')
+
if env['WITH_BF_FFMPEG']:
defs.append('WITH_FFMPEG')
}
}
+#ifndef DISABLE_PYTHON
+
PyMethodDef BL_Shader::Methods[] =
{
// creation
return NULL;
}
+#endif // DISABLE_PYTHON
+
// eof
void SetUniform(int uniform, const int val);
// Python interface
+#ifndef DISABLE_PYTHON
virtual PyObject* py_repr(void) { return PyUnicode_FromFormat("BL_Shader\n\tvertex shader:%s\n\n\tfragment shader%s\n\n", vertProg, fragProg); }
// -----------------------------------
KX_PYMETHOD_DOC( BL_Shader, setUniformDef );
KX_PYMETHOD_DOC( BL_Shader, setAttrib );
KX_PYMETHOD_DOC( BL_Shader, setSampler);
+#endif
};
#endif//__BL_SHADER_H__
../../../source/blender/gpu
../../../extern/bullet2/src
../../../extern/glew/include
- ${PYTHON_INC}
)
IF(WITH_SDL)
ADD_DEFINITIONS(-DDISABLE_SDL)
ENDIF(WITH_SDL)
+IF(WITH_PYTHON)
+ SET(INC ${INC} ${PYTHON_INC})
+ELSE(WITH_PYTHON)
+ ADD_DEFINITIONS(-DDISABLE_PYTHON)
+ENDIF(WITH_PYTHON)
+
BLENDERLIB(bf_ketsji "${SRC}" "${INC}")
#env.BlenderLib ( 'bf_ketsji', sources, Split(incs), [], libtype=['game','player'], priority=[25, 72], compileflags = cflags )
../../../../source/gameengine/Expressions
../../../../source/gameengine/SceneGraph
../../../../source/gameengine/Network
- ${PYTHON_INC}
)
+IF(WITH_PYTHON)
+ SET(INC ${INC} ${PYTHON_INC})
+ELSE(WITH_PYTHON)
+ ADD_DEFINITIONS(-DDISABLE_PYTHON)
+ENDIF(WITH_PYTHON)
+
BLENDERLIB(kx_network "${SRC}" "${INC}")
#env.BlenderLib ( 'kx_network', Split(sources), Split(incs), defines=[],libtype=['game2', 'player'], priority=[5, 155] )
return replica;
}
+#ifndef DISABLE_PYTHON
+
/* -------------------------------------------------------------------- */
/* Python interface --------------------------------------------------- */
/* -------------------------------------------------------------------- */
KX_PYATTRIBUTE_STRING_RW("body", 0, 16384, false, KX_NetworkMessageActuator, m_body),
{ NULL } //Sentinel
};
+
+#endif // DISABLE_PYTHON
return m_IsUp;
}
+#ifndef DISABLE_PYTHON
+
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
/* --------------------------------------------------------------------- */
return (new CListValue())->NewProxy(true);
}
}
+
+#endif // DISABLE_PYTHON
virtual void Init();
void EndFrame();
+#ifndef DISABLE_PYTHON
+
/* ------------------------------------------------------------- */
/* Python interface -------------------------------------------- */
/* ------------------------------------------------------------- */
static PyObject* pyattr_get_bodies(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_subjects(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+#endif // DISABLE_PYTHON
+
};
#endif //__KX_NETWORKMESSAGE_SENSOR_H
incs += ' #source/gameengine/GameLogic #source/gameengine/Expressions'
incs += ' #source/gameengine/Network #source/gameengine/SceneGraph'
-incs += ' ' + env['BF_PYTHON_INC']
+defs = []
-env.BlenderLib ( 'bf_network', Split(sources), Split(incs), defines=[],libtype=['core','player'], priority=[400,125], cxx_compileflags=env['BGE_CXXFLAGS'])
+if env['WITH_BF_PYTHON']:
+ incs += ' ' + env['BF_PYTHON_INC']
+else:
+ defs.append('DISABLE_PYTHON')
+
+env.BlenderLib ( 'bf_network', Split(sources), Split(incs), defines=defs,libtype=['core','player'], priority=[400,125], cxx_compileflags=env['BGE_CXXFLAGS'])
return (reset) ? true : false;
}
+#ifndef DISABLE_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
}
Py_RETURN_NONE;
}
+
+#endif // DISABLE_PYTHON
// identify the constraint that this actuator controls
void FindConstraint();
+#ifndef DISABLE_PYTHON
+
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
/* --------------------------------------------------------------------- */
static PyObject* pyattr_get_constraint(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
+#endif // DISABLE_PYTHON
+
private:
struct bConstraint* m_constraint;
STR_String m_posechannel;
mMaterial->ref = (float)(ref);
}
+void KX_BlenderMaterial::SetBlenderGLSLShader(int layer)
+{
+ if(!mBlenderShader)
+ mBlenderShader = new BL_BlenderShader(mScene, mMaterial->material, layer);
+
+ if(!mBlenderShader->Ok()) {
+ delete mBlenderShader;
+ mBlenderShader = 0;
+ }
+}
+
+#ifndef DISABLE_PYTHON
PyMethodDef KX_BlenderMaterial::Methods[] =
{
return NULL;
}
-
-void KX_BlenderMaterial::SetBlenderGLSLShader(int layer)
-{
- if(!mBlenderShader)
- mBlenderShader = new BL_BlenderShader(mScene, mMaterial->material, layer);
-
- if(!mBlenderShader->Ok()) {
- delete mBlenderShader;
- mBlenderShader = 0;
- }
-}
-
KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getMaterialIndex, "getMaterialIndex()")
{
return PyLong_FromSsize_t( GetMaterialIndex() );
return NULL;
}
+#endif // DISABLE_PYTHON
MT_Scalar ref, MT_Scalar emit, MT_Scalar alpha
);
+#ifndef DISABLE_PYTHON
// --------------------------------
virtual PyObject* py_repr(void) { return PyUnicode_FromString(mMaterial->matname.ReadPtr()); }
KX_PYMETHOD_DOC( KX_BlenderMaterial, setTexture );
KX_PYMETHOD_DOC( KX_BlenderMaterial, setBlending );
+#endif // DISABLE_PYTHON
// --------------------------------
// pre calculate to avoid pops/lag at startup
return m_camdata.m_viewporttop;
}
+#ifndef DISABLE_PYTHON
//----------------------------------------------------------------------------
//Python
return NULL;
}
-
+#endif
#include "IntValue.h"
#include "RAS_CameraData.h"
+#ifndef DISABLE_PYTHON
/* utility conversion function */
bool ConvertPythonToCamera(PyObject * value, KX_Camera **object, bool py_none_ok, const char *error_prefix);
+#endif
class KX_Camera : public KX_GameObject
{
virtual int GetGameObjectType() { return OBJ_CAMERA; }
+#ifndef DISABLE_PYTHON
KX_PYMETHOD_DOC_VARARGS(KX_Camera, sphereInsideFrustum);
KX_PYMETHOD_DOC_O(KX_Camera, boxInsideFrustum);
KX_PYMETHOD_DOC_O(KX_Camera, pointInsideFrustum);
static PyObject* pyattr_get_INSIDE(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_OUTSIDE(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_INTERSECT(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+#endif
};
#endif //__KX_CAMERA
return NULL;
}
+#ifndef DISABLE_PYTHON
+
/* ------------------------------------------------------------------------- */
/* Python functions */
/* ------------------------------------------------------------------------- */
return PY_SET_ATTR_SUCCESS;
}
+#endif // DISABLE_PYTHON
+
/* eof */
/** Methods inherited from SCA_ILogicBrick */
virtual void Relink(GEN_Map<GEN_HashedPtr, void*> *obj_map);
+#ifndef DISABLE_PYTHON
+
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
/* --------------------------------------------------------------------- */
static PyObject* pyattr_get_object(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_object(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+#endif // DISABLE_PYTHON
+
};
#endif //__KX_CAMERAACTUATOR
#include "KX_RayCast.h"
#include "KX_PythonInit.h" // KX_GetActiveScene
+#include <stdio.h>
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
return res;
}
+#ifndef DISABLE_PYTHON
+
/* ------------------------------------------------------------------------- */
/* Python functions */
/* ------------------------------------------------------------------------- */
return 0;
}
+#endif
+
/* eof */
*
* ***** END GPL LICENSE BLOCK *****
*/
-#include <Python.h>
+
#include "PyObjectPlus.h"
#include "KX_ConstraintWrapper.h"
#include "PHY_IPhysicsEnvironment.h"
{
}
+#ifndef DISABLE_PYTHON
+
PyObject* KX_ConstraintWrapper::PyGetConstraintId()
{
return PyLong_FromSsize_t(m_constraintId);
//KX_PYATTRIBUTE_TODO("constraintId"),
{ NULL } //Sentinel
};
+
+#endif // DISABLE_PYTHON
virtual ~KX_ConstraintWrapper ();
int getConstraintId() { return m_constraintId;};
+#ifndef DISABLE_PYTHON
KX_PYMETHOD_NOARGS(KX_ConstraintWrapper,GetConstraintId);
KX_PYMETHOD(KX_ConstraintWrapper,SetParam);
KX_PYMETHOD(KX_ConstraintWrapper,GetParam);
+#endif
private:
int m_constraintId;
Contributor(s): Dalai Felinto
This code is originally inspired on some of the ideas and codes from Paul Bourke.
-Developed as part of a Research and Development project for SAT - La Société des arts technologiques.
+Developed as part of a Research and Development project for SAT - La Soci�t� des arts technologiques.
-----------------------------------------------------------------------------
*/
#include "KX_Dome.h"
+#ifndef DISABLE_PYTHON
#include <structmember.h>
+#endif
+
#include <float.h>
#include <math.h>
m_radangle = m_angle * M_PI/180.0;//calculates the radians angle, used for flattening
- //creating faces for the env mapcube 180º Dome
+ //creating faces for the env mapcube 180� Dome
// Top Face - just a triangle
cubetop[0].verts[0][0] = -sqrt_2 / 2.0;
cubetop[0].verts[0][1] = 0.0;
m_radangle = m_angle * M_PI/180.0;//calculates the radians angle, used for flattening
/*
verts_height is the exactly needed height of the cube faces (not always 1.0).
-When we want some horizontal information (e.g. for horizontal 220º domes) we don't need to create and tesselate the whole cube.
+When we want some horizontal information (e.g. for horizontal 220� domes) we don't need to create and tesselate the whole cube.
Therefore the lateral cube faces could be small, and the tesselate mesh would be completely used.
(if we always worked with verts_height = 1.0, we would be discarding a lot of the calculated and tesselated geometry).
uv_height = uv_ratio * ((verts_height/2) + 0.5);
uv_base = uv_ratio * (1.0 - ((verts_height/2) + 0.5));
- //creating faces for the env mapcube 180º Dome
+ //creating faces for the env mapcube 180� Dome
// Front Face - 2 triangles
cubefront[0].verts[0][0] =-1.0;
cubefront[0].verts[0][1] = 1.0;
nfacesbottom = 2;
- /* Left Back (135º) face - two triangles */
+ /* Left Back (135�) face - two triangles */
cubeleftback[0].verts[0][0] = 0;
cubeleftback[0].verts[0][1] = -sqrt_2;
nfacesright = 2;
- /* Right Back (-135º) face - two triangles */
+ /* Right Back (-135�) face - two triangles */
cuberightback[0].verts[0][0] = sqrt_2;
cuberightback[0].verts[0][1] = 0;
cuberightback[0].verts[0][2] = -1.0;
void KX_Dome::FlattenPanorama(MT_Vector3 verts[3])
{
-// it creates a full spherical panoramic (360º)
+// it creates a full spherical panoramic (360�)
int i;
double phi;
bool edge=false;
void KX_Dome::CalculateFrustum(KX_Camera * cam)
{
/*
- // manually creating a 90º Field of View Frustum
+ // manually creating a 90� Field of View Frustum
the original formula:
top = tan(fov*3.14159/360.0) * near [for fov in degrees]
m_frustrum.camfar = cam->GetCameraFar();
// float top = tan(90.0*MT_PI/360.0) * m_frustrum.camnear;
- float top = m_frustrum.camnear; // for deg = 90º, tan = 1
+ float top = m_frustrum.camnear; // for deg = 90�, tan = 1
m_frustrum.x1 = -top;
m_frustrum.x2 = top;
void KX_Dome::CalculateCameraOrientation()
{
/*
-Uses 4 cameras for angles up to 180º
-Uses 5 cameras for angles up to 250º
-Uses 6 cameras for angles up to 360º
+Uses 4 cameras for angles up to 180�
+Uses 5 cameras for angles up to 250�
+Uses 6 cameras for angles up to 360�
*/
int i;
float deg45 = MT_PI / 4;
|| m_mode == DOME_TRUNCATED_FRONT
|| m_mode == DOME_TRUNCATED_REAR)){
- m_locRot[0] = MT_Matrix3x3( // 90º - Top
+ m_locRot[0] = MT_Matrix3x3( // 90� - Top
c, -s, 0.0,
0.0,0.0, -1.0,
s, c, 0.0);
- m_locRot[1] = MT_Matrix3x3( // 90º - Bottom
+ m_locRot[1] = MT_Matrix3x3( // 90� - Bottom
-s, c, 0.0,
0.0,0.0, 1.0,
s, c, 0.0);
- m_locRot[2] = MT_Matrix3x3( // 45º - Left
+ m_locRot[2] = MT_Matrix3x3( // 45� - Left
c, 0.0, s,
0, 1.0, 0.0,
-s, 0.0, c);
- m_locRot[3] = MT_Matrix3x3( // 45º - Right
+ m_locRot[3] = MT_Matrix3x3( // 45� - Right
c, 0.0, -s,
0.0, 1.0, 0.0,
s, 0.0, c);
|| m_mode == DOME_TRUNCATED_FRONT
|| m_mode == DOME_TRUNCATED_REAR))){
- m_locRot[0] = MT_Matrix3x3( // 90º - Top
+ m_locRot[0] = MT_Matrix3x3( // 90� - Top
1.0, 0.0, 0.0,
0.0, 0.0,-1.0,
0.0, 1.0, 0.0);
- m_locRot[1] = MT_Matrix3x3( // 90º - Bottom
+ m_locRot[1] = MT_Matrix3x3( // 90� - Bottom
1.0, 0.0, 0.0,
0.0, 0.0, 1.0,
0.0,-1.0, 0.0);
- m_locRot[2] = MT_Matrix3x3( // -90º - Left
+ m_locRot[2] = MT_Matrix3x3( // -90� - Left
0.0, 0.0, 1.0,
0.0, 1.0, 0.0,
-1.0, 0.0, 0.0);
- m_locRot[3] = MT_Matrix3x3( // 90º - Right
+ m_locRot[3] = MT_Matrix3x3( // 90� - Right
0.0, 0.0,-1.0,
0.0, 1.0, 0.0,
1.0, 0.0, 0.0);
- m_locRot[4] = MT_Matrix3x3( // 0º - Front
+ m_locRot[4] = MT_Matrix3x3( // 0� - Front
1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0);
- m_locRot[5] = MT_Matrix3x3( // 180º - Back - USED for ENVMAP only
+ m_locRot[5] = MT_Matrix3x3( // 180� - Back - USED for ENVMAP only
-1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0,-1.0);
0.0 ,0.0, 1.0,
s, -c, 0.0);
- m_locRot[2] = MT_Matrix3x3( // 45º - Left
+ m_locRot[2] = MT_Matrix3x3( // 45� - Left
-s, 0.0, c,
0, 1.0, 0.0,
-c, 0.0, -s);
- m_locRot[3] = MT_Matrix3x3( // 45º - Right
+ m_locRot[3] = MT_Matrix3x3( // 45� - Right
c, 0.0, s,
0, 1.0, 0.0,
-s, 0.0, c);
- m_locRot[4] = MT_Matrix3x3( // 135º - LeftBack
+ m_locRot[4] = MT_Matrix3x3( // 135� - LeftBack
-s, 0.0, -c,
0.0, 1.0, 0.0,
c, 0.0, -s);
- m_locRot[5] = MT_Matrix3x3( // 135º - RightBack
+ m_locRot[5] = MT_Matrix3x3( // 135� - RightBack
c, 0.0, -s,
0.0, 1.0, 0.0,
s, 0.0, c);
glVertex3f(-onebythree,-2 * onebythree, 3.0f);
glEnd();
- // domefacesId[2] => -90º (left)
+ // domefacesId[2] => -90� (left)
glBindTexture(GL_TEXTURE_2D, domefacesId[2]);
glBegin(GL_QUADS);
glTexCoord2f(uv_ratio,uv_ratio);
glVertex3f(-onebythree, 0.0f, 3.0f);
glEnd();
- // domefacesId[3] => 90º (right)
+ // domefacesId[3] => 90� (right)
glBindTexture(GL_TEXTURE_2D, domefacesId[3]);
glBegin(GL_QUADS);
glTexCoord2f(uv_ratio,uv_ratio);
glVertex3f(1.0f, 0.0f, 3.0f);
glEnd();
- // domefacesId[4] => 0º (front)
+ // domefacesId[4] => 0� (front)
glBindTexture(GL_TEXTURE_2D, domefacesId[4]);
glBegin(GL_QUADS);
glTexCoord2f(uv_ratio,uv_ratio);
glVertex3f(1.0f, -2 * onebythree, 3.0f);
glEnd();
- // domefacesId[5] => 180º (back)
+ // domefacesId[5] => 180� (back)
glBindTexture(GL_TEXTURE_2D, domefacesId[5]);
glBegin(GL_QUADS);
glTexCoord2f(uv_ratio,uv_ratio);
glBindTexture(GL_TEXTURE_2D, domefacesId[1]);
GLDrawTriangles(cubebottom, nfacesbottom);
- // domefacesId[1] => -45º (left)
+ // domefacesId[1] => -45� (left)
glBindTexture(GL_TEXTURE_2D, domefacesId[2]);
GLDrawTriangles(cubeleft, nfacesleft);
- // domefacesId[2] => 45º (right)
+ // domefacesId[2] => 45� (right)
glBindTexture(GL_TEXTURE_2D, domefacesId[3]);
GLDrawTriangles(cuberight, nfacesright);
- // domefacesId[0] => -135º (leftback)
+ // domefacesId[0] => -135� (leftback)
glBindTexture(GL_TEXTURE_2D, domefacesId[4]);
GLDrawTriangles(cubeleftback, nfacesleftback);
- // domefacesId[3] => 135º (rightback)
+ // domefacesId[3] => 135� (rightback)
glBindTexture(GL_TEXTURE_2D, domefacesId[5]);
GLDrawTriangles(cuberightback, nfacesrightback);
}
#include "KX_KetsjiEngine.h"
#include "KX_PythonInit.h" /* for config load/saving */
+#include <stdio.h>
+#include <stdlib.h>
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
}
case KX_GAME_SAVECFG:
{
+#ifndef DISABLE_PYTHON
if (m_ketsjiengine)
{
char mashal_path[512];
delete [] marshal_buffer;
}
break;
+#endif // DISABLE_PYTHON
}
case KX_GAME_LOADCFG:
{
+#ifndef DISABLE_PYTHON
if (m_ketsjiengine)
{
char mashal_path[512];
}
}
break;
+#endif // DISABLE_PYTHON
}
default:
; /* do nothing? this is an internal error !!! */
}
-
-
+#ifndef DISABLE_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
KX_PYATTRIBUTE_INT_RW("mode", KX_GAME_NODEF+1, KX_GAME_MAX-1, true, KX_GameActuator, m_mode),
{ NULL } //Sentinel
};
+
+#endif // DISABLE_PYTHON
m_pGraphicController(NULL),
m_xray(false),
m_pHitObject(NULL),
- m_isDeformable(false),
- m_attr_dict(NULL)
+ m_isDeformable(false)
+#ifndef DISABLE_PYTHON
+ , m_attr_dict(NULL)
+#endif
{
m_ignore_activity_culling = false;
m_pClient_info = new KX_ClientObjectInfo(this, KX_ClientObjectInfo::ACTOR);
{
delete m_pGraphicController;
}
-
+#ifndef DISABLE_PYTHON
if (m_attr_dict) {
PyDict_Clear(m_attr_dict); /* incase of circular refs or other weired cases */
Py_DECREF(m_attr_dict);
}
+#endif // DISABLE_PYTHON
}
KX_GameObject* KX_GameObject::GetClientObject(KX_ClientObjectInfo* info)
m_pClient_info = new KX_ClientObjectInfo(*m_pClient_info);
m_pClient_info->m_gameobject = this;
m_state = 0;
+
+#ifndef DISABLE_PYTHON
if(m_attr_dict)
m_attr_dict= PyDict_Copy(m_attr_dict);
+#endif
}
return list;
}
+/* ---------------------------------------------------------------------
+ * Some stuff taken from the header
+ * --------------------------------------------------------------------- */
+void KX_GameObject::Relink(GEN_Map<GEN_HashedPtr, void*> *map_parameter)
+{
+ // we will relink the sensors and actuators that use object references
+ // if the object is part of the replicated hierarchy, use the new
+ // object reference instead
+ SCA_SensorList& sensorlist = GetSensors();
+ SCA_SensorList::iterator sit;
+ for (sit=sensorlist.begin(); sit != sensorlist.end(); sit++)
+ {
+ (*sit)->Relink(map_parameter);
+ }
+ SCA_ActuatorList& actuatorlist = GetActuators();
+ SCA_ActuatorList::iterator ait;
+ for (ait=actuatorlist.begin(); ait != actuatorlist.end(); ait++)
+ {
+ (*ait)->Relink(map_parameter);
+ }
+}
+
#ifdef USE_MATHUTILS
/* These require an SGNode */
#endif // USE_MATHUTILS
+#ifndef DISABLE_PYTHON
/* ------- python stuff ---------------------------------------------------*/
-
PyMethodDef KX_GameObject::Methods[] = {
{"applyForce", (PyCFunction) KX_GameObject::sPyApplyForce, METH_VARARGS},
{"applyTorque", (PyCFunction) KX_GameObject::sPyApplyTorque, METH_VARARGS},
{NULL} //Sentinel
};
-
-/*
-bool KX_GameObject::ConvertPythonVectorArgs(PyObject* args,
- MT_Vector3& pos,
- MT_Vector3& pos2)
-{
- PyObject* pylist;
- PyObject* pylist2;
- bool error = (PyArg_ParseTuple(args,"OO",&pylist,&pylist2)) != 0;
-
- pos = ConvertPythonPylist(pylist);
- pos2 = ConvertPythonPylist(pylist2);
-
- return error;
-}
-*/
-
PyObject* KX_GameObject::PyReplaceMesh(PyObject* args)
{
KX_Scene *scene = KX_GetActiveScene();
return def;
}
-/* ---------------------------------------------------------------------
- * Some stuff taken from the header
- * --------------------------------------------------------------------- */
-void KX_GameObject::Relink(GEN_Map<GEN_HashedPtr, void*> *map_parameter)
-{
- // we will relink the sensors and actuators that use object references
- // if the object is part of the replicated hierarchy, use the new
- // object reference instead
- SCA_SensorList& sensorlist = GetSensors();
- SCA_SensorList::iterator sit;
- for (sit=sensorlist.begin(); sit != sensorlist.end(); sit++)
- {
- (*sit)->Relink(map_parameter);
- }
- SCA_ActuatorList& actuatorlist = GetActuators();
- SCA_ActuatorList::iterator ait;
- for (ait=actuatorlist.begin(); ait != actuatorlist.end(); ait++)
- {
- (*ait)->Relink(map_parameter);
- }
-}
-
-
bool ConvertPythonToGameObject(PyObject * value, KX_GameObject **object, bool py_none_ok, const char *error_prefix)
{
if (value==NULL) {
return false;
}
+#endif // DISABLE_PYTHON
class PHY_IPhysicsEnvironment;
struct Object;
+#ifndef DISABLE_PYTHON
/* utility conversion function */
bool ConvertPythonToGameObject(PyObject * value, KX_GameObject **object, bool py_none_ok, const char *error_prefix);
+#endif
#ifdef USE_MATHUTILS
void KX_GameObject_Mathutils_Callback_Init(void);
*/
static KX_GameObject* GetClientObject(KX_ClientObjectInfo* info);
+#ifndef DISABLE_PYTHON
// Python attributes that wont convert into CValue
//
// there are 2 places attributes can be stored, in the CValue,
// * when assigning a value, first see if it can be a CValue, if it can remove the "m_attr_dict" and set the CValue
//
PyObject* m_attr_dict;
+#endif
virtual void /* This function should be virtual - derived classed override it */
Relink(
CListValue* GetChildren();
CListValue* GetChildrenRecursive();
-
+
+#ifndef DISABLE_PYTHON
/**
* @section Python interface functions.
*/
/* getitem/setitem */
static PyMappingMethods Mapping;
static PySequenceMethods Sequence;
-
-private :
-
- /**
- * Random internal function to convert python function arguments
- * to 2 vectors.
- * @return true if conversion was possible.
- */
-
- bool
- ConvertPythonVectorArgs(
- PyObject* args,
- MT_Vector3& pos,
- MT_Vector3& pos2
- );
-
+#endif
};
*/
virtual void ConvertScene(
class KX_Scene* destinationscene,
+#ifndef DISABLE_PYTHON
PyObject* dictobj,
+#endif
class RAS_IRenderTools* rendertools,
class RAS_ICanvas* canvas)=0;
return res;
}
+#ifndef DISABLE_PYTHON
+
/* ------------------------------------------------------------------------- */
/* Python functions */
/* ------------------------------------------------------------------------- */
-
/* Integration hooks ------------------------------------------------------- */
PyTypeObject KX_IpoActuator::Type = {
PyVarObject_HEAD_INIT(NULL, 0)
{ NULL } //Sentinel
};
+#endif // DISABLE_PYTHON
+
/* eof */
m_rendertools(NULL),
m_sceneconverter(NULL),
m_networkdevice(NULL),
+#ifndef DISABLE_PYTHON
m_pythondictionary(NULL),
+#endif
m_keyboarddevice(NULL),
m_mousedevice(NULL),
m_rasterizer = rasterizer;
}
-
+#ifndef DISABLE_PYTHON
/*
* At the moment the GameLogic module is imported into 'pythondictionary' after this function is called.
* if this function ever changes to assign a copy, make sure the game logic module is imported into this dictionary before hand.
MT_assert(pythondictionary);
m_pythondictionary = pythondictionary;
}
-
+#endif
void KX_KetsjiEngine::SetSceneConverter(KX_ISceneConverter* sceneconverter)
m_logger->StartLog(tc_physics, m_kxsystem->GetTimeInSeconds(), true);
SG_SetActiveStage(SG_STAGE_PHYSICS1);
// set Python hooks for each scene
+#ifndef DISABLE_PYTHON
PHY_SetActiveEnvironment(scene->GetPhysicsEnvironment());
+#endif
KX_SetActiveScene(scene);
scene->GetPhysicsEnvironment()->endFrame();
m_suspendeddelta = scene->getSuspendedDelta();
// set Python hooks for each scene
+#ifndef DISABLE_PYTHON
PHY_SetActiveEnvironment(scene->GetPhysicsEnvironment());
+#endif
KX_SetActiveScene(scene);
m_logger->StartLog(tc_scenegraph, m_kxsystem->GetTimeInSeconds(), true);
scene);
m_sceneconverter->ConvertScene(tmpscene,
+#ifndef DISABLE_PYTHON
m_pythondictionary,
+#endif
m_rendertools,
m_canvas);
class RAS_IRenderTools* m_rendertools;
class KX_ISceneConverter* m_sceneconverter;
class NG_NetworkDeviceInterface* m_networkdevice;
+#ifndef DISABLE_PYTHON
PyObject* m_pythondictionary;
+#endif
class SCA_IInputDevice* m_keyboarddevice;
class SCA_IInputDevice* m_mousedevice;
class KX_Dome* m_dome; // dome stereo mode
void SetCanvas(RAS_ICanvas* canvas);
void SetRenderTools(RAS_IRenderTools* rendertools);
void SetRasterizer(RAS_IRasterizer* rasterizer);
+#ifndef DISABLE_PYTHON
void SetPythonDictionary(PyObject* pythondictionary);
+#endif
void SetSceneConverter(KX_ISceneConverter* sceneconverter);
void SetGame2IpoMode(bool game2ipo,int startFrame);
GPU_lamp_shadow_buffer_unbind(lamp);
}
+#ifndef DISABLE_PYTHON
/* ------------------------------------------------------------------------- */
/* Python Integration Hooks */
/* ------------------------------------------------------------------------- */
return PY_SET_ATTR_SUCCESS;
}
+#endif // DISABLE_PYTHON
void UnbindShadowBuffer(class RAS_IRasterizer *ras);
void Update();
+#ifndef DISABLE_PYTHON
/* attributes */
static PyObject* pyattr_get_color(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_color(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject* value);
static PyObject* pyattr_get_typeconst(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_type(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_type(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject* value);
+#endif
virtual bool IsLight(void) { return true; }
};
* ***** END GPL LICENSE BLOCK *****
*/
+#ifndef DISABLE_PYTHON
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
return false;
}
+
+#endif // DISABLE_PYTHON
#ifndef __KX_MESHPROXY
#define __KX_MESHPROXY
+#ifndef DISABLE_PYTHON
+
#include "SCA_IObject.h"
/* utility conversion function */
static PyObject * pyattr_get_numPolygons(void * self, const KX_PYATTRIBUTE_DEF * attrdef);
};
+#endif // DISABLE_PYTHON
+
#endif //__KX_MESHPROXY
return m_hitNormal;
}
+#ifndef DISABLE_PYTHON
+
/* ------------------------------------------------------------------------- */
/* Python functions */
/* ------------------------------------------------------------------------- */
return PyObjectFrom(self->HitNormal());
}
-
+#endif // DISABLE_PYTHON
/* eof */
const MT_Point3& HitPosition() const;
const MT_Vector3& HitNormal() const;
+#ifndef DISABLE_PYTHON
+
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
/* --------------------------------------------------------------------- */
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);
+#endif // DISABLE_PYTHON
+
/* --------------------------------------------------------------------- */
SCA_IObject* m_hitObject;
void* m_hitObject_Last; /* only use for comparison, never access */
return false; // was DT_CONTINUE; but this was defined in Sumo as false
}
+#ifndef DISABLE_PYTHON
/* ------------------------------------------------------------------------- */
/* Python Functions */
/* ------------------------------------------------------------------------- */
-//No methods
-
/* ------------------------------------------------------------------------- */
/* Python Integration Hooks */
/* ------------------------------------------------------------------------- */
KX_PYATTRIBUTE_FLOAT_RW_CHECK("resetDistance", 0, 100, KX_NearSensor, m_ResetMargin, CheckResetDistance),
{NULL} //Sentinel
};
+
+#endif // DISABLE_PYTHON
virtual bool BroadPhaseSensorFilterCollision(void*obj1,void*obj2) { return false; };
virtual sensortype GetSensorType() { return ST_NEAR; }
+#ifndef DISABLE_PYTHON
+
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
/* --------------------------------------------------------------------- */
return 0;
}
+#endif // DISABLE_PYTHON
+
};
#endif //KX_NEARSENSOR_H
return res;
}
-
+#ifndef DISABLE_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
return PY_SET_ATTR_SUCCESS;
}
+#endif // DISABLE_PYTHON
+
/* eof */
}
virtual bool Update();
-
+#ifndef DISABLE_PYTHON
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
return 0;
}
+
+#endif // DISABLE_PYTHON
+
};
#endif //__KX_OBJECTACTUATOR
return false;
}
+#ifndef DISABLE_PYTHON
+
/* ------------------------------------------------------------------------- */
/* Python functions */
/* ------------------------------------------------------------------------- */
return PY_SET_ATTR_SUCCESS;
}
+#endif // DISABLE_PYTHON
+
/* eof */
virtual void Relink(GEN_Map<GEN_HashedPtr, void*> *obj_map);
virtual bool UnlinkObject(SCA_IObject* clientobj);
+#ifndef DISABLE_PYTHON
+
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
/* --------------------------------------------------------------------- */
static PyObject* pyattr_get_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+#endif // DISABLE_PYTHON
+
}; /* end of class KX_ParentActuator : public SCA_PropertyActuator */
#endif
*
* ***** END GPL LICENSE BLOCK *****
*/
-#include <Python.h>
+
#include "PyObjectPlus.h"
#include "KX_PhysicsObjectWrapper.h"
{
}
+#ifndef DISABLE_PYTHON
PyObject* KX_PhysicsObjectWrapper::PySetPosition(PyObject* args)
{
{"setActive",(PyCFunction) KX_PhysicsObjectWrapper::sPySetActive, METH_VARARGS},
{NULL,NULL} //Sentinel
};
+
+#endif
KX_PhysicsObjectWrapper(class PHY_IPhysicsController* ctrl,class PHY_IPhysicsEnvironment* physenv);
virtual ~KX_PhysicsObjectWrapper();
+#ifndef DISABLE_PYTHON
+
KX_PYMETHOD_VARARGS(KX_PhysicsObjectWrapper,SetPosition);
KX_PYMETHOD_VARARGS(KX_PhysicsObjectWrapper,SetLinearVelocity);
KX_PYMETHOD_VARARGS(KX_PhysicsObjectWrapper,SetAngularVelocity);
KX_PYMETHOD_VARARGS(KX_PhysicsObjectWrapper,SetActive);
+#endif // DISABLE_PYTHON
+
private:
class PHY_IPhysicsController* m_ctrl;
PHY_IPhysicsEnvironment* m_physenv;
* ***** END GPL LICENSE BLOCK *****
*/
+#ifndef DISABLE_PYTHON
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
return mat->GetProxy();
}
}
+
+#endif // DISABLE_PYTHON
#ifndef __KX_POLYROXY
#define __KX_POLYPROXY
+#ifndef DISABLE_PYTHON
+
#include "SCA_IObject.h"
class KX_PolyProxy : public CValue
};
+#endif // DISABLE_PYTHON
+
#endif //__KX_POLYPROXY
m_tface(NULL),
m_mcol(NULL),
m_material(NULL),
+#ifndef DISABLE_PYTHON
m_pymaterial(NULL),
+#endif
m_pass(0)
{
}
m_tface = tface;
m_mcol = mcol;
m_material = ma;
+#ifndef DISABLE_PYTHON
m_pymaterial = 0;
+#endif
m_pass = 0;
}
KX_PolygonMaterial::~KX_PolygonMaterial()
{
+#ifndef DISABLE_PYTHON
if (m_pymaterial)
{
Py_DECREF(m_pymaterial);
}
+#endif // DISABLE_PYTHON
}
bool KX_PolygonMaterial::Activate(RAS_IRasterizer* rasty, TCachingInfo& cachingInfo) const
{
bool dopass = false;
+
+#ifndef DISABLE_PYTHON
if (m_pymaterial)
{
PyObject *pyRasty = PyCObject_FromVoidPtr((void*)rasty, NULL); /* new reference */
}
}
else
+#endif // DISABLE_PYTHON
{
switch (m_pass++)
{
RAS_IPolyMaterial::GetMaterialRGBAColor(rgba);
}
+#ifndef DISABLE_PYTHON
//----------------------------------------------------------------------------
//Python
self->m_specular= vec;
return PY_SET_ATTR_SUCCESS;
}
+
+#endif // DISABLE_PYTHON
MTFace* m_tface;
unsigned int* m_mcol;
Material* m_material;
+
+#ifndef DISABLE_PYTHON
PyObject* m_pymaterial;
+#endif
mutable int m_pass;
public:
}
virtual void GetMaterialRGBAColor(unsigned char *rgba) const;
+#ifndef DISABLE_PYTHON
KX_PYMETHOD_DOC(KX_PolygonMaterial, updateTexture);
KX_PYMETHOD_DOC(KX_PolygonMaterial, setTexture);
KX_PYMETHOD_DOC(KX_PolygonMaterial, activate);
static int pyattr_set_diffuse(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
static PyObject* pyattr_get_specular(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_specular(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+#endif
};
#endif // __KX_POLYGONMATERIAL_H__
#include <config.h>
#endif
+#ifndef DISABLE_PYTHON
+
// nasty glob variable to connect scripting language
// if there is a better way (without global), please do so!
static PHY_IPhysicsEnvironment* g_CurrentActivePhysicsEnvironment = NULL;
return g_CurrentActivePhysicsEnvironment;
}
+#endif // DISABLE_PYTHON
+
#ifndef PHY_PYTHON_CONSTRAINTBINDING
#define PHY_PYTHON_CONSTRAINTBINDING
+#ifndef DISABLE_PYTHON
+
#include <Python.h>
PyObject* initPythonConstraintBinding();
void PHY_RemovePythonConstraintBinding();
void PHY_SetActiveEnvironment(class PHY_IPhysicsEnvironment* env);
PHY_IPhysicsEnvironment* PHY_GetActiveEnvironment();
-
+#endif // DISABLE_PYTHON
#endif //PHY_PYTHON_CONSTRAINTBINDING
#pragma warning (disable : 4786)
#endif //WIN32
+#ifndef DISABLE_PYTHON
+
#include "MT_Vector3.h"
#include "MT_Vector4.h"
#include "MT_Matrix4x4.h"
return list;
#endif
}
+
+#endif // DISABLE_PYTHON
#include "KX_Python.h"
#include "PyObjectPlus.h"
+#ifndef DISABLE_PYTHON
#ifdef USE_MATHUTILS
extern "C" {
#include "../../blender/python/generic/Mathutils.h" /* so we can have mathutils callbacks */
PyObject* PyObjectFrom(const MT_Tuple4 &pos);
#endif
+
+#endif // DISABLE_PYTHON
#pragma warning (disable : 4786)
#endif //WIN32
+#ifndef DISABLE_PYTHON
+
extern "C" {
#include "bpy_internal_import.h" /* from the blender python api, but we want to import text too! */
#include "Mathutils.h" // Blender.Mathutils module copied here so the blenderlayer can use.
#include "Geometry.h" // Blender.Geometry module copied here so the blenderlayer can use.
#include "BGL.h"
+
+ #include "marshal.h" /* python header for loading/saving dicts */
}
+#endif
#include "KX_PythonInit.h"
//python physics binding
#include "DNA_ID.h"
#include "DNA_scene_types.h"
-
-#include "marshal.h" /* python header for loading/saving dicts */
-
#include "PHY_IPhysicsEnvironment.h"
-// FIXME: Enable for access to blender python modules. This is disabled because
-// python has dependencies on a lot of other modules and is a pain to link.
-//#define USE_BLENDER_PYTHON
-#ifdef USE_BLENDER_PYTHON
-//#include "BPY_extern.h"
-#endif
-
#include "BKE_main.h"
#include "BKE_utildefines.h"
#include "BKE_global.h"
static RAS_IRasterizer* gp_Rasterizer = NULL;
static char gp_GamePythonPath[FILE_MAXDIR + FILE_MAXFILE] = "";
static char gp_GamePythonPathOrig[FILE_MAXDIR + FILE_MAXFILE] = ""; // not super happy about this, but we need to remember the first loaded file for the global/dict load save
-static PyObject *gp_OrigPythonSysPath= NULL;
-static PyObject *gp_OrigPythonSysModules= NULL;
+void KX_SetActiveScene(class KX_Scene* scene)
+{
+ gp_KetsjiScene = scene;
+}
+
+class KX_Scene* KX_GetActiveScene()
+{
+ return gp_KetsjiScene;
+}
+
+class KX_KetsjiEngine* KX_GetActiveEngine()
+{
+ return gp_KetsjiEngine;
+}
+
+/* why is this in python? */
void KX_RasterizerDrawDebugLine(const MT_Vector3& from,const MT_Vector3& to,const MT_Vector3& color)
{
if (gp_Rasterizer)
gp_Rasterizer->DrawDebugLine(from,to,color);
}
+#ifndef DISABLE_PYTHON
+
+static PyObject *gp_OrigPythonSysPath= NULL;
+static PyObject *gp_OrigPythonSysModules= NULL;
+
/* Macro for building the keyboard translation */
//#define KX_MACRO_addToDict(dict, name) PyDict_SetItemString(dict, #name, PyLong_FromSsize_t(SCA_IInputDevice::KX_##name))
#define KX_MACRO_addToDict(dict, name) PyDict_SetItemString(dict, #name, item=PyLong_FromSsize_t(name)); Py_DECREF(item)
return BGL_Init();
}
-void KX_SetActiveScene(class KX_Scene* scene)
-{
- gp_KetsjiScene = scene;
-}
-
-class KX_Scene* KX_GetActiveScene()
-{
- return gp_KetsjiScene;
-}
-
-class KX_KetsjiEngine* KX_GetActiveEngine()
-{
- return gp_KetsjiEngine;
-}
-
// utility function for loading and saving the globalDict
int saveGamePythonConfig( char **marshal_buffer)
{
{
gp_GamePythonPathOrig[0] = '\0';
}
+
+#endif // DISABLE_PYTHON
extern bool gUseVisibilityTemp;
-
+#ifndef DISABLE_PYTHON
PyObject* initGameLogic(class KX_KetsjiEngine *engine, class KX_Scene* ketsjiscene);
PyObject* initGameKeys();
PyObject* initRasterizer(class RAS_IRasterizer* rasty,class RAS_ICanvas* canvas);
void pathGamePythonConfig( char *path );
int saveGamePythonConfig( char **marshal_buffer);
int loadGamePythonConfig(char *marshal_buffer, int marshal_length);
+#endif
class KX_KetsjiEngine;
class KX_Scene;
#ifndef _adr_py_init_types_h_ // only process once,
#define _adr_py_init_types_h_ // even if multiply included
+#ifndef DISABLE_PYTHON
+
/* Only for Class::Parents */
#include "BL_BlenderShader.h"
#include "BL_ShapeActionActuator.h"
#endif
}
+#endif // DISABLE_PYTHON
+
#endif
#ifndef _adr_py_init_types_h_ // only process once,
#define _adr_py_init_types_h_ // even if multiply included
+#ifndef DISABLE_PYTHON
void initPyTypes(void);
+#endif
#endif
* Readonly sequence wrapper for lookups on logic bricks
*/
+#ifndef DISABLE_PYTHON
#include "KX_PythonSeq.h"
#include "KX_GameObject.h"
NULL, /* PyObject *tp_weaklist; */
NULL
};
+
+#endif // DISABLE_PYTHON
#ifndef _adr_py_seq_h_ // only process once,
#define _adr_py_seq_h_ // even if multiply included
+#ifndef DISABLE_PYTHON
+
#include "PyObjectPlus.h"
// -------------------------
PyObject *KX_PythonSeq_CreatePyObject(PyObject *base, short type);
+#endif // DISABLE_PYTHON
+
#endif // _adr_py_seq_h_
/* Python Functions */
/* ------------------------------------------------------------------------- */
-/* none */
+#ifndef DISABLE_PYTHON
/* ------------------------------------------------------------------------- */
/* Python Integration Hooks */
{NULL} //Sentinel
};
+#endif // DISABLE_PYTHON
#include "KX_IPhysicsController.h"
#include "PHY_IPhysicsController.h"
+#include <stdio.h>
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
return result;
}
-
+#ifndef DISABLE_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
Py_RETURN_NONE;
}
+
+#endif // DISABLE_PYTHON
KX_RAY_AXIS_NEG_Z
};
+#ifndef DISABLE_PYTHON
/* Attributes */
static PyObject* pyattr_get_hitobject(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+#endif // DISABLE_PYTHON
+
};
#endif //__KX_RAYSENSOR_H
}
}
+#ifndef DISABLE_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
return actuator->m_lastCreatedObject->GetProxy();
}
+PyObject* KX_SCA_AddObjectActuator::PyInstantAddObject()
+{
+ InstantAddObject();
+
+ Py_RETURN_NONE;
+}
+
+#endif // DISABLE_PYTHON
void KX_SCA_AddObjectActuator::InstantAddObject()
{
replica->Release();
}
}
-
-PyObject* KX_SCA_AddObjectActuator::PyInstantAddObject()
-{
- InstantAddObject();
-
- Py_RETURN_NONE;
-}
void InstantAddObject();
+#ifndef DISABLE_PYTHON
+
KX_PYMETHOD_DOC_NOARGS(KX_SCA_AddObjectActuator,InstantAddObject);
static PyObject* pyattr_get_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
static PyObject* pyattr_get_objectLastCreated(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
+#endif // DISABLE_PYTHON
+
}; /* end of class KX_SCA_AddObjectActuator : public KX_EditObjectActuator */
#endif
#include <config.h>
#endif
+#ifndef DISABLE_PYTHON
+
/* ------------------------------------------------------------------------- */
/* Python functions */
/* ------------------------------------------------------------------------- */
{ NULL } //Sentinel
};
+#endif // DISABLE_PYTHON
+
/* ------------------------------------------------------------------------- */
/* Native functions */
/* ------------------------------------------------------------------------- */
return replica;
};
-
+#ifndef DISABLE_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions : integration hooks */
{ NULL } //Sentinel
};
+#endif // DISABLE_PYTHON
+
/* eof */
#include <config.h>
#endif
+#ifndef DISABLE_PYTHON
+
/* ------------------------------------------------------------------------- */
/* Python functions */
/* ------------------------------------------------------------------------- */
Py_RETURN_NONE;
}
+#endif // DISABLE_PYTHON
+
/* ------------------------------------------------------------------------- */
/* Native functions */
/* ------------------------------------------------------------------------- */
void InstantReplaceMesh();
+#ifndef DISABLE_PYTHON
+
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
/* --------------------------------------------------------------------- */
KX_PYMETHOD_DOC(KX_SCA_ReplaceMeshActuator,instantReplaceMesh);
+#endif // DISABLE_PYTHON
+
};
#endif
#include "KX_Light.h"
+#include <stdio.h>
+
void* KX_SceneReplicationFunc(SG_IObject* node,void* gameobj,void* scene)
{
KX_GameObject* replica = ((KX_Scene*)scene)->AddNodeReplicaObject(node,(KX_GameObject*)gameobj);
m_bucketmanager=new RAS_BucketManager();
+#ifndef DISABLE_PYTHON
m_attr_dict = PyDict_New(); /* new ref */
+#endif
}
{
delete m_bucketmanager;
}
+
+#ifndef DISABLE_PYTHON
PyDict_Clear(m_attr_dict);
Py_DECREF(m_attr_dict);
+#endif
}
RAS_BucketManager* KX_Scene::GetBucketManager()
return m_suspendeddelta;
}
+#ifndef DISABLE_PYTHON
+
//----------------------------------------------------------------------------
//Python
Py_INCREF(def);
return def;
}
+
+#endif // DISABLE_PYTHON
class KX_Scene : public PyObjectPlus, public SCA_IScene
{
Py_Header;
+
+#ifndef DISABLE_PYTHON
PyObject* m_attr_dict;
+#endif
struct CullingInfo {
int m_layer;
*/
void SetNodeTree(SG_Tree* root);
+#ifndef DISABLE_PYTHON
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
/* --------------------------------------------------------------------- */
static PyMappingMethods Mapping;
static PySequenceMethods Sequence;
+#endif
+
/**
* Sets the time the scene was suspended
*/
}
-
+#ifndef DISABLE_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
return PY_SET_ATTR_SUCCESS;
}
+#endif // DISABLE_PYTHON
+
/* eof */
virtual bool Update();
+#ifndef DISABLE_PYTHON
+
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
/* --------------------------------------------------------------------- */
static PyObject* pyattr_get_camera(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_camera(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+#endif // DISABLE_PYTHON
+
}; /* end of class KXSceneActuator */
#endif
}
-
+#ifndef DISABLE_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
return PY_SET_ATTR_SUCCESS;
}
+
+#endif // DISABLE_PYTHON
CValue* GetReplica();
void ProcessReplica();
+#ifndef DISABLE_PYTHON
+
/* -------------------------------------------------------------------- */
/* Python interface --------------------------------------------------- */
/* -------------------------------------------------------------------- */
static PyObject* pyattr_get_pitch(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_rollOffFactor(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_type(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
+
+#endif // DISABLE_PYTHON
+
};
#endif //__KX_SOUNDACTUATOR
}
}
+#ifndef DISABLE_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
KX_PYATTRIBUTE_INT_RW("mask",0,0x3FFFFFFF,false,KX_StateActuator,m_mask),
{ NULL } //Sentinel
};
+
+#endif // DISABLE_PYTHON
return false; // was DT_CONTINUE but this was defined in sumo as false.
}
+#ifndef DISABLE_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
return self->m_colliders->GetProxy();
}
+#endif
/* eof */
// todo: put some info for collision maybe
+#ifndef DISABLE_PYTHON
+
/* --------------------------------------------------------------------- */
/* Python interface ---------------------------------------------------- */
/* --------------------------------------------------------------------- */
static PyObject* pyattr_get_object_hit(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
static PyObject* pyattr_get_object_hit_list(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
-
+
+#endif
};
return result;
}
-
+#ifndef DISABLE_PYTHON
/* ------------------------------------------------------------------------- */
/* Python functions */
/* ------------------------------------------------------------------------- */
-
-
/* Integration hooks ------------------------------------------------------- */
PyTypeObject KX_TrackToActuator::Type = {
PyVarObject_HEAD_INIT(NULL, 0)
return PY_SET_ATTR_SUCCESS;
}
+#endif // DISABLE_PYTHON
+
/* eof */
virtual void Relink(GEN_Map<GEN_HashedPtr, void*> *obj_map);
virtual bool Update(double curtime, bool frame);
+#ifndef DISABLE_PYTHON
+
/* Python part */
/* These are used to get and set m_ob */
static PyObject* pyattr_get_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef);
static int pyattr_set_object(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+#endif // DISABLE_PYTHON
+
}; /* end of class KX_TrackToActuator : public KX_EditObjectActuator */
#endif
-#include <Python.h>
#include "PyObjectPlus.h"
#include "KX_VehicleWrapper.h"
m_motionStates.clear();
}
+#ifndef DISABLE_PYTHON
PyObject* KX_VehicleWrapper::PyAddWheel(PyObject* args)
{
PyAttributeDef KX_VehicleWrapper::Attributes[] = {
{ NULL } //Sentinel
};
+
+#endif // DISABLE_PYTHON
virtual ~KX_VehicleWrapper ();
int getConstraintId();
+#ifndef DISABLE_PYTHON
KX_PYMETHOD_VARARGS(KX_VehicleWrapper,AddWheel);
KX_PYMETHOD_VARARGS(KX_VehicleWrapper,GetNumWheels);
KX_PYMETHOD_VARARGS(KX_VehicleWrapper,SetSuspensionCompression);
KX_PYMETHOD_VARARGS(KX_VehicleWrapper,SetRollInfluence);
-
+#endif // DISABLE_PYTHON
private:
PHY_IVehicle* m_vehicle;
* ***** END GPL LICENSE BLOCK *****
*/
+#ifndef DISABLE_PYTHON
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
m_mesh->SetMeshModified(true);
Py_RETURN_NONE;
}
+
+#endif // DISABLE_PYTHON
#ifndef __KX_VERTEXPROXY
#define __KX_VERTEXPROXY
+#ifndef DISABLE_PYTHON
+
#include "SCA_IObject.h"
class KX_VertexProxy : public CValue
};
+#endif // DISABLE_PYTHON
+
#endif //__KX_VERTEXPROXY
return false;
}
+#ifndef DISABLE_PYTHON
+
/* ------------------------------------------------------------------------- */
/* Python functions */
/* ------------------------------------------------------------------------- */
KX_PYATTRIBUTE_BOOL_RW("useRecursion", KX_VisibilityActuator, m_recursive),
{ NULL } //Sentinel
};
+
+#endif // DISABLE_PYTHON
incs += ' #source/gameengine/Physics/Dummy'
incs += ' #source/blender/misc #source/blender/blenloader #extern/glew/include #source/blender/gpu'
-incs += ' ' + env['BF_PYTHON_INC']
incs += ' ' + env['BF_BULLET_INC']
incs += ' ' + env['BF_OPENGL_INC']
incs += ' ' + env['BF_SDL_INC']
else:
defs.append('DISABLE_SDL')
+
+if env['WITH_BF_PYTHON']:
+ incs += ' ' + env['BF_PYTHON_INC']
+else:
+ defs.append('DISABLE_PYTHON')
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'):
if env['BF_DEBUG']:
incs += ' #intern/guardedalloc'
incs += ' ' + env['BF_BULLET_INC']
-incs += ' ' + env['BF_PYTHON_INC']
-env.BlenderLib ( 'bf_bullet', Split(sources), Split(incs), [], libtype=['core','player'], priority=[350,50], cxx_compileflags=env['BGE_CXXFLAGS'])
+defs = []
+
+if env['WITH_BF_PYTHON']:
+ incs += ' ' + env['BF_PYTHON_INC']
+else:
+ defs.append('DISABLE_PYTHON')
+
+env.BlenderLib ( 'bf_bullet', Split(sources), Split(incs), defs, libtype=['core','player'], priority=[350,50], cxx_compileflags=env['BGE_CXXFLAGS'])
#include "GL/glew.h"
+#include <stdio.h>
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
incs = '. #source/kernel/gen_system #intern/string #intern/moto/include #source/gameengine/BlenderRoutines #extern/glew/include #source/gameengine/Expressions #source/gameengine/SceneGraph #source/blender/blenkernel #source/blender/makesdna'
-incs += ' ' + env['BF_PYTHON_INC']
-env.BlenderLib ( 'bf_rasterizer', sources, Split(incs), [], libtype=['core','player'], priority=[350,70], cxx_compileflags=env['BGE_CXXFLAGS'])
+defs = []
+
+if env['WITH_BF_PYTHON']:
+ incs += ' ' + env['BF_PYTHON_INC']
+else:
+ defs.append('DISABLE_PYTHON')
+
+env.BlenderLib ( 'bf_rasterizer', sources, Split(incs), defs, libtype=['core','player'], priority=[350,70], cxx_compileflags=env['BGE_CXXFLAGS'])
'Rasterizer/SConscript',
'Rasterizer/RAS_OpenGLRasterizer/SConscript',
'SceneGraph/SConscript',
- 'Physics/Bullet/SConscript',
- 'VideoTexture/SConscript'
+ 'Physics/Bullet/SConscript'
])
+if env['WITH_BF_PYTHON']:
+ SConscript(['VideoTexture/SConscript'])
+
if env['WITH_BF_PLAYER']:
SConscript(['GamePlayer/SConscript'])
../../../intern/moto/include
../../../intern/guardedalloc
../../../extern/glew/include
- ${PYTHON_INC}
)
IF(WITH_FFMPEG)
ADD_DEFINITIONS(-D__STDC_CONSTANT_MACROS)
ENDIF(WITH_FFMPEG)
+IF(WITH_PYTHON)
+ SET(INC ${INC} ${PYTHON_INC})
+ELSE(WITH_PYTHON)
+ ADD_DEFINITIONS(-DDISABLE_PYTHON)
+ENDIF(WITH_PYTHON)
+
BLENDERLIB(bf_videotex "${SRC}" "${INC}")
#env.BlenderLib ( 'bf_videotex', sources, Split(incs), [], libtype=['game','player'], priority=[25, 72], compileflags = cflags )
if env['BF_DEBUG']:
defs.append('_DEBUG')
-incs += ' ' + env['BF_PYTHON_INC']
+if env['WITH_BF_PYTHON']:
+ incs += ' ' + env['BF_PYTHON_INC']
+else:
+ defs.append('DISABLE_PYTHON')
if env['WITH_BF_FFMPEG']:
defs.append('WITH_FFMPEG')