option to build the BGE without python, uses existing python check (cmake and scons)
when python is disabled videotextures are not built.
This commit is contained in:
@@ -16,4 +16,7 @@ defs = []
|
||||
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] )
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef WIN32
|
||||
// don't show stl-warnings
|
||||
@@ -137,6 +138,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, int alw
|
||||
|
||||
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);
|
||||
|
||||
@@ -145,6 +147,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, int alw
|
||||
PyGILState_STATE gilstate = PyGILState_Ensure();
|
||||
|
||||
PyObject *pyGlobalDict = PyDict_New(); /* python utility storage, spans blend file loading */
|
||||
#endif
|
||||
|
||||
bgl::InitExtensions(true);
|
||||
|
||||
@@ -206,8 +209,9 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, int alw
|
||||
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;
|
||||
@@ -288,7 +292,9 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, int alw
|
||||
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
|
||||
@@ -365,7 +371,8 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, int alw
|
||||
networkdevice,
|
||||
startscenename,
|
||||
blscene);
|
||||
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
// some python things
|
||||
PyObject* dictionaryobject = initGamePythonScripting("Ketsji", psl_Lowest, blenderdata);
|
||||
ketsjiengine->SetPythonDictionary(dictionaryobject);
|
||||
@@ -383,6 +390,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, int alw
|
||||
#ifdef WITH_FFMPEG
|
||||
initVideoTexture();
|
||||
#endif
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
//initialize Dome Settings
|
||||
if(blscene->gm.stereoflag == STEREO_DOME)
|
||||
@@ -398,7 +406,9 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, int alw
|
||||
// convert and add scene
|
||||
sceneconverter->ConvertScene(
|
||||
startscene,
|
||||
#ifndef DISABLE_PYTHON
|
||||
dictionaryobject,
|
||||
#endif
|
||||
rendertools,
|
||||
canvas);
|
||||
ketsjiengine->AddScene(startscene);
|
||||
@@ -468,7 +478,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, int alw
|
||||
|
||||
|
||||
// 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.
|
||||
@@ -488,9 +498,11 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, int alw
|
||||
}
|
||||
Py_DECREF(gameLogic_keys_new);
|
||||
gameLogic_keys_new = NULL;
|
||||
|
||||
#endif
|
||||
ketsjiengine->StopEngine();
|
||||
#ifndef DISABLE_PYTHON
|
||||
exitGamePythonScripting();
|
||||
#endif
|
||||
networkdevice->Disconnect();
|
||||
}
|
||||
if (sceneconverter)
|
||||
@@ -498,9 +510,11 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, int alw
|
||||
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){
|
||||
@@ -555,14 +569,17 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, int alw
|
||||
|
||||
} 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,
|
||||
@@ -581,9 +598,11 @@ 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);
|
||||
|
||||
@@ -680,6 +699,7 @@ extern "C" void StartKetsjiShellSimulation(struct wmWindow *win,
|
||||
startscenename,
|
||||
blscene);
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
// some python things
|
||||
PyObject* dictionaryobject = initGamePythonScripting("Ketsji", psl_Lowest, blenderdata);
|
||||
ketsjiengine->SetPythonDictionary(dictionaryobject);
|
||||
@@ -694,13 +714,16 @@ extern "C" void StartKetsjiShellSimulation(struct wmWindow *win,
|
||||
#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);
|
||||
@@ -778,6 +801,8 @@ extern "C" void StartKetsjiShellSimulation(struct wmWindow *win,
|
||||
|
||||
} 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
|
||||
}
|
||||
|
||||
@@ -35,12 +35,17 @@ SET(INC
|
||||
../../../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)
|
||||
|
||||
@@ -25,7 +25,11 @@ incs += ' #source/blender/windowmanager'
|
||||
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']
|
||||
|
||||
|
||||
@@ -38,7 +38,10 @@ ADD_SUBDIRECTORY(Rasterizer)
|
||||
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)
|
||||
|
||||
@@ -432,6 +432,8 @@ bool BL_ActionActuator::Update(double curtime, bool frame)
|
||||
return keepgoing;
|
||||
};
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Python functions */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
@@ -675,3 +677,5 @@ PyObject* BL_ActionActuator::pyattr_get_channel_names(void *self_v, const KX_PYA
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
@@ -84,6 +84,8 @@ public:
|
||||
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);
|
||||
|
||||
@@ -129,6 +131,7 @@ public:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -175,6 +175,8 @@ bool BL_ArmatureActuator::Update(double curtime, bool frame)
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Python Integration Hooks */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
@@ -261,5 +263,5 @@ PyObject* BL_ArmatureActuator::pyattr_get_constraint(void *self, const struct KX
|
||||
return constraint->GetProxy();
|
||||
}
|
||||
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
|
||||
@@ -66,11 +66,15 @@ public:
|
||||
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();
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
#include "BLI_arithb.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
PyTypeObject BL_ArmatureChannel::Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
"BL_ArmatureChannel",
|
||||
@@ -74,6 +76,8 @@ PyObject *BL_ArmatureChannel::NewProxy(bool py_owns)
|
||||
return NewProxyPlus_Ext(this, &Type, m_posechannel, py_owns);
|
||||
}
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
BL_ArmatureChannel::BL_ArmatureChannel(
|
||||
BL_ArmatureObject *armature,
|
||||
bPoseChannel *posechannel)
|
||||
@@ -85,6 +89,8 @@ BL_ArmatureChannel::~BL_ArmatureChannel()
|
||||
{
|
||||
}
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
// PYTHON
|
||||
|
||||
PyMethodDef BL_ArmatureChannel::Methods[] = {
|
||||
@@ -459,3 +465,5 @@ PyObject *BL_ArmatureBone::py_bone_get_children(void *self, const struct KX_PYAT
|
||||
|
||||
return childrenlist;
|
||||
}
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
@@ -57,14 +57,15 @@ public:
|
||||
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.
|
||||
@@ -80,9 +81,12 @@ private:
|
||||
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
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
#include "BLI_arithb.h"
|
||||
#include "BLI_string.h"
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
PyTypeObject BL_ArmatureConstraint::Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
"BL_ArmatureConstraint",
|
||||
@@ -64,6 +66,8 @@ PyObject* BL_ArmatureConstraint::py_repr(void)
|
||||
return PyUnicode_FromString(m_name);
|
||||
}
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
BL_ArmatureConstraint::BL_ArmatureConstraint(
|
||||
BL_ArmatureObject *armature,
|
||||
bPoseChannel *posechannel,
|
||||
@@ -237,6 +241,8 @@ void BL_ArmatureConstraint::SetSubtarget(KX_GameObject* subtarget)
|
||||
|
||||
}
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
// PYTHON
|
||||
|
||||
PyMethodDef BL_ArmatureConstraint::Methods[] = {
|
||||
@@ -445,3 +451,4 @@ int BL_ArmatureConstraint::py_attr_setattr(void *self_v, const struct KX_PYATTRI
|
||||
return PY_SET_ATTR_FAIL;
|
||||
}
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
@@ -73,9 +73,6 @@ public:
|
||||
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);
|
||||
@@ -107,10 +104,14 @@ public:
|
||||
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
|
||||
|
||||
@@ -590,6 +590,8 @@ float BL_ArmatureObject::GetBoneLength(Bone* bone) const
|
||||
return (float)(MT_Point3(bone->head) - MT_Point3(bone->tail)).length();
|
||||
}
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
// PYTHON
|
||||
|
||||
PyTypeObject BL_ArmatureObject::Type = {
|
||||
@@ -654,3 +656,5 @@ KX_PYMETHODDEF_DOC_NOARGS(BL_ArmatureObject, update,
|
||||
SetActiveAction(NULL, 0, KX_GetActiveEngine()->GetFrameTime());
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
@@ -108,11 +108,15 @@ public:
|
||||
|
||||
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;
|
||||
|
||||
@@ -1897,7 +1897,9 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
|
||||
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,
|
||||
@@ -2653,7 +2655,11 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
|
||||
struct Object* blenderobj = gameobj->GetBlenderObject();
|
||||
int layerMask = (groupobj.find(blenderobj) == groupobj.end()) ? activeLayerBitInfo : 0;
|
||||
bool isInActiveLayer = (blenderobj->lay & layerMask)!=0;
|
||||
BL_ConvertControllers(blenderobj,gameobj,logicmgr,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++)
|
||||
{
|
||||
|
||||
@@ -40,7 +40,9 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
|
||||
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,
|
||||
|
||||
@@ -412,6 +412,8 @@ bool BL_ShapeActionActuator::Update(double curtime, bool frame)
|
||||
return keepgoing;
|
||||
};
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Python functions */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
@@ -492,3 +494,5 @@ int BL_ShapeActionActuator::pyattr_set_action(void *self_v, const KX_PYATTRIBUTE
|
||||
return PY_SET_ATTR_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
@@ -82,6 +82,8 @@ public:
|
||||
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);
|
||||
|
||||
@@ -123,6 +125,8 @@ public:
|
||||
|
||||
}
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
protected:
|
||||
|
||||
void SetStartTime(float curtime);
|
||||
|
||||
@@ -61,8 +61,13 @@ SET(INC
|
||||
../../../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] )
|
||||
|
||||
@@ -243,7 +243,9 @@ struct BlenderDebugDraw : public btIDebugDraw
|
||||
#endif
|
||||
|
||||
void KX_BlenderSceneConverter::ConvertScene(class KX_Scene* destinationscene,
|
||||
#ifndef DISABLE_PYTHON
|
||||
PyObject* dictobj,
|
||||
#endif
|
||||
class RAS_IRenderTools* rendertools,
|
||||
class RAS_ICanvas* canvas)
|
||||
{
|
||||
@@ -328,7 +330,9 @@ void KX_BlenderSceneConverter::ConvertScene(class KX_Scene* destinationscene,
|
||||
destinationscene,
|
||||
m_ketsjiEngine,
|
||||
physics_engine,
|
||||
#ifndef DISABLE_PYTHON
|
||||
dictobj,
|
||||
#endif
|
||||
rendertools,
|
||||
canvas,
|
||||
this,
|
||||
|
||||
@@ -89,7 +89,9 @@ public:
|
||||
*/
|
||||
virtual void ConvertScene(
|
||||
class KX_Scene* destinationscene,
|
||||
#ifndef DISABLE_PYTHON
|
||||
PyObject* dictobj,
|
||||
#endif
|
||||
class RAS_IRenderTools* rendertools,
|
||||
class RAS_ICanvas* canvas
|
||||
);
|
||||
|
||||
@@ -91,8 +91,10 @@ LinkControllerToActuators(
|
||||
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
|
||||
@@ -159,6 +161,8 @@ void BL_ConvertControllers(
|
||||
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) {
|
||||
@@ -187,6 +191,8 @@ void BL_ConvertControllers(
|
||||
pyctrl->SetDebug(true);
|
||||
}
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -211,7 +217,8 @@ void BL_ConvertControllers(
|
||||
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
|
||||
@@ -226,7 +233,8 @@ void BL_ConvertControllers(
|
||||
// pyctrl->Import();
|
||||
}
|
||||
}
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
//done with gamecontroller
|
||||
gamecontroller->Release();
|
||||
}
|
||||
|
||||
@@ -34,8 +34,10 @@
|
||||
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
|
||||
|
||||
@@ -130,7 +130,7 @@ void BL_ConvertProperties(Object* object,KX_GameObject* gameobj,SCA_TimeEventMan
|
||||
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) {
|
||||
@@ -145,6 +145,7 @@ void BL_ConvertProperties(Object* object,KX_GameObject* gameobj,SCA_TimeEventMan
|
||||
}
|
||||
}
|
||||
/* end warning check */
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
prop = prop->next;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
* Conversion of Blender data blocks to KX sensor system
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
|
||||
@@ -21,11 +21,15 @@ incs += ' #source/blender/windowmanager'
|
||||
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'])
|
||||
|
||||
@@ -205,9 +205,9 @@ CValue* CBoolValue::GetReplica()
|
||||
return replica;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
PyObject* CBoolValue::ConvertValueToPython()
|
||||
{
|
||||
return PyBool_FromLong(m_bool != 0);
|
||||
}
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
@@ -45,7 +45,9 @@ public:
|
||||
|
||||
void Configure(CValue* menuvalue);
|
||||
virtual CValue* GetReplica();
|
||||
#ifndef DISABLE_PYTHON
|
||||
virtual PyObject* ConvertValueToPython();
|
||||
#endif
|
||||
|
||||
private:
|
||||
bool m_bool;
|
||||
|
||||
@@ -34,8 +34,13 @@ SET(INC
|
||||
../../../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] )
|
||||
|
||||
@@ -314,9 +314,9 @@ CValue* CFloatValue::GetReplica()
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
PyObject* CFloatValue::ConvertValueToPython()
|
||||
{
|
||||
return PyFloat_FromDouble(m_float);
|
||||
}
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
@@ -36,7 +36,9 @@ public:
|
||||
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;
|
||||
|
||||
@@ -326,7 +326,7 @@ void CIntValue::SetValue(CValue* newval)
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
PyObject* CIntValue::ConvertValueToPython()
|
||||
{
|
||||
if((m_int > INT_MIN) && (m_int < INT_MAX))
|
||||
@@ -334,3 +334,4 @@ PyObject* CIntValue::ConvertValueToPython()
|
||||
else
|
||||
return PyLong_FromLongLong(m_int);
|
||||
}
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
@@ -47,7 +47,10 @@ public:
|
||||
void Configure(CValue* menuvalue);
|
||||
void AddConfigurationData(CValue* menuvalue);
|
||||
virtual CValue* GetReplica();
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
virtual PyObject* ConvertValueToPython();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
virtual ~CIntValue();
|
||||
|
||||
@@ -40,11 +40,13 @@
|
||||
#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
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "ListValue.h"
|
||||
#include "StringValue.h"
|
||||
#include "VoidValue.h"
|
||||
@@ -26,9 +28,255 @@
|
||||
#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)
|
||||
{
|
||||
@@ -297,13 +545,13 @@ PyMethodDef CListValue::Methods[] = {
|
||||
{"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
|
||||
};
|
||||
|
||||
@@ -311,213 +559,29 @@ PyAttributeDef CListValue::Attributes[] = {
|
||||
{ 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;
|
||||
@@ -542,7 +606,7 @@ PyObject* CListValue::Pyindex(PyObject *value)
|
||||
PyErr_SetString(PyExc_ValueError, "CList.index(x): x not in CListValue");
|
||||
}
|
||||
return result;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -552,7 +616,7 @@ PyObject* CListValue::Pycount(PyObject* value)
|
||||
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);
|
||||
@@ -580,9 +644,9 @@ PyObject* CListValue::Pyget(PyObject *args)
|
||||
|
||||
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;
|
||||
@@ -597,7 +661,7 @@ PyObject* CListValue::Pyget(PyObject *args)
|
||||
PyObject* CListValue::Pyfrom_id(PyObject* value)
|
||||
{
|
||||
uintptr_t id= (uintptr_t)PyLong_AsVoidPtr(value);
|
||||
|
||||
|
||||
if (PyErr_Occurred())
|
||||
return NULL;
|
||||
|
||||
@@ -608,72 +672,8 @@ PyObject* CListValue::Pyfrom_id(PyObject* value)
|
||||
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
|
||||
|
||||
@@ -60,6 +60,7 @@ public:
|
||||
|
||||
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);
|
||||
@@ -75,7 +76,7 @@ public:
|
||||
KX_PYMETHOD_O(CListValue,count);
|
||||
KX_PYMETHOD_VARARGS(CListValue,get);
|
||||
KX_PYMETHOD_O(CListValue,from_id);
|
||||
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifndef NO_EXP_PYTHON_EMBEDDING
|
||||
|
||||
/*------------------------------
|
||||
* PyObjectPlus cpp
|
||||
*
|
||||
@@ -52,6 +50,56 @@
|
||||
#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
|
||||
------------------------------*/
|
||||
@@ -78,17 +126,6 @@ PyTypeObject PyObjectPlus::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);
|
||||
@@ -202,11 +239,6 @@ void PyObjectPlus::py_base_dealloc(PyObject *self) // python wrapper
|
||||
#endif
|
||||
};
|
||||
|
||||
PyObjectPlus::PyObjectPlus() : SG_QList() // constructor
|
||||
{
|
||||
m_proxy= NULL;
|
||||
};
|
||||
|
||||
/*------------------------------
|
||||
* PyObjectPlus Methods -- Every class, even the abstract one should have a Methods
|
||||
------------------------------*/
|
||||
@@ -1067,30 +1099,6 @@ PyObject *PyObjectPlus::py_repr(void)
|
||||
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)
|
||||
@@ -1220,5 +1228,4 @@ void PyObjectPlus::SetDeprecationWarningFirst(WarnLink* wlink) {m_base_wlink_f
|
||||
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
|
||||
|
||||
@@ -27,8 +27,6 @@
|
||||
* ***** 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
|
||||
|
||||
@@ -45,6 +43,7 @@
|
||||
* Python defines
|
||||
------------------------------*/
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
#ifdef USE_MATHUTILS
|
||||
extern "C" {
|
||||
#include "../../blender/python/generic/Mathutils.h" /* so we can have mathutils callbacks */
|
||||
@@ -463,6 +462,20 @@ typedef struct KX_PYATTRIBUTE_DEF {
|
||||
------------------------------*/
|
||||
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
|
||||
@@ -480,11 +493,12 @@ class PyObjectPlus : public SG_QList
|
||||
|
||||
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.
|
||||
@@ -514,16 +528,6 @@ public:
|
||||
(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);
|
||||
@@ -536,12 +540,20 @@ public:
|
||||
static void ShowDeprecationWarning_func(const char* method,const char* prop);
|
||||
static void ClearDeprecationWarning();
|
||||
|
||||
#endif
|
||||
|
||||
void InvalidateProxy();
|
||||
|
||||
/**
|
||||
* Makes sure any internal data owned by this class is deep copied.
|
||||
*/
|
||||
virtual void ProcessReplica();
|
||||
|
||||
static bool m_ignore_deprecation_warnings;
|
||||
};
|
||||
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
PyObject *py_getattr_dict(PyObject *pydict, PyObject *tp_dict);
|
||||
#endif
|
||||
|
||||
#endif // _adr_py_lib_h_
|
||||
|
||||
#endif //NO_EXP_PYTHON_EMBEDDING
|
||||
|
||||
|
||||
@@ -4,6 +4,12 @@ Import ('env')
|
||||
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'])
|
||||
|
||||
@@ -39,9 +39,11 @@ public:
|
||||
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
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
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)
|
||||
@@ -64,6 +64,8 @@ PyTypeObject CValue::Type = {
|
||||
PyMethodDef CValue::Methods[] = {
|
||||
{NULL,NULL} //Sentinel
|
||||
};
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
|
||||
/*#define CVALUE_DEBUG*/
|
||||
#ifdef CVALUE_DEBUG
|
||||
@@ -90,10 +92,6 @@ std::vector<SmartCValueRef> gRefList;
|
||||
|
||||
CValue::CValue()
|
||||
: PyObjectPlus(),
|
||||
#else
|
||||
CValue::CValue()
|
||||
:
|
||||
#endif //NO_EXP_PYTHON_EMBEDDING
|
||||
|
||||
m_pNamedPropertyArray(NULL),
|
||||
m_refcount(1)
|
||||
@@ -526,8 +524,7 @@ CValue* CValue::FindIdentifier(const STR_String& identifiername)
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
#ifndef NO_EXP_PYTHON_EMBEDDING
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
PyAttributeDef CValue::Attributes[] = {
|
||||
KX_PYATTRIBUTE_RO_FUNCTION("name", CValue, pyattr_get_name),
|
||||
@@ -618,7 +615,8 @@ PyObject* CValue::ConvertKeysToPython( void )
|
||||
return pylist;
|
||||
}
|
||||
|
||||
#endif //NO_EXP_PYTHON_EMBEDDING
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -197,19 +197,14 @@ public:
|
||||
|
||||
|
||||
|
||||
#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,
|
||||
@@ -224,9 +219,9 @@ public:
|
||||
|
||||
|
||||
// Construction / Destruction
|
||||
#ifndef NO_EXP_PYTHON_EMBEDDING
|
||||
|
||||
CValue();
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
//static PyObject* PyMake(PyObject*,PyObject*);
|
||||
virtual PyObject *py_repr(void)
|
||||
{
|
||||
@@ -242,10 +237,7 @@ public:
|
||||
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
|
||||
|
||||
|
||||
|
||||
@@ -416,12 +408,8 @@ public: \
|
||||
class CPropValue : public CValue
|
||||
{
|
||||
public:
|
||||
#ifndef NO_EXP_PYTHON_EMBEDDING
|
||||
CPropValue() :
|
||||
CValue(),
|
||||
#else
|
||||
CPropValue() :
|
||||
#endif //NO_EXP_PYTHON_EMBEDDING
|
||||
m_strNewName()
|
||||
|
||||
{
|
||||
|
||||
@@ -34,7 +34,6 @@ SET(INC
|
||||
../../../source/gameengine/SceneGraph
|
||||
../../../intern/moto/include
|
||||
../../../source/gameengine/Rasterizer
|
||||
${PYTHON_INC}
|
||||
)
|
||||
|
||||
IF(WITH_SDL)
|
||||
@@ -43,5 +42,11 @@ ELSE(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] )
|
||||
|
||||
@@ -99,12 +99,12 @@ void SCA_2DFilterActuator::SetShaderText(const char *text)
|
||||
m_shaderText = text;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Python functions */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
|
||||
/* Integration hooks ------------------------------------------------------- */
|
||||
PyTypeObject SCA_2DFilterActuator::Type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
@@ -141,3 +141,5 @@ PyAttributeDef SCA_2DFilterActuator::Attributes[] = {
|
||||
KX_PYATTRIBUTE_FLOAT_RW("value", 0.0, 100.0, SCA_2DFilterActuator, m_float_arg),
|
||||
{ NULL } //Sentinel
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -91,7 +91,7 @@ CValue* SCA_ANDController::GetReplica()
|
||||
return replica;
|
||||
}
|
||||
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Python functions */
|
||||
@@ -127,5 +127,5 @@ PyMethodDef SCA_ANDController::Methods[] = {
|
||||
PyAttributeDef SCA_ANDController::Attributes[] = {
|
||||
{ NULL } //Sentinel
|
||||
};
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
/* eof */
|
||||
|
||||
@@ -114,6 +114,7 @@ void SCA_ActuatorSensor::Update()
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Python functions */
|
||||
@@ -163,4 +164,6 @@ int SCA_ActuatorSensor::CheckActuator(void *self, const PyAttributeDef*)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
/* eof */
|
||||
|
||||
@@ -56,11 +56,15 @@ public:
|
||||
virtual void ReParent(SCA_IObject* parent);
|
||||
void Update();
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* Python interface ---------------------------------------------------- */
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
||||
|
||||
static int CheckActuator(void *self, const PyAttributeDef*);
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -98,6 +98,8 @@ bool SCA_AlwaysSensor::Evaluate()
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Python functions */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
@@ -133,4 +135,6 @@ PyAttributeDef SCA_AlwaysSensor::Attributes[] = {
|
||||
{ NULL } //Sentinel
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/* eof */
|
||||
|
||||
@@ -124,6 +124,8 @@ bool SCA_DelaySensor::Evaluate()
|
||||
return trigger;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Python functions */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
@@ -162,4 +164,6 @@ PyAttributeDef SCA_DelaySensor::Attributes[] = {
|
||||
{ NULL } //Sentinel
|
||||
};
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
/* eof */
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
#include "InputParser.h"
|
||||
#include "MT_Transform.h" // for fuzzyZero
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
*/
|
||||
|
||||
#include "SCA_IActuator.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
#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
|
||||
@@ -196,6 +198,8 @@ void SCA_IController::ApplyState(unsigned int state)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* Python api */
|
||||
|
||||
PyTypeObject SCA_IController::Type = {
|
||||
@@ -247,3 +251,4 @@ PyObject* SCA_IController::pyattr_get_actuators(void *self_v, const KX_PYATTRIBU
|
||||
{
|
||||
return KX_PythonSeq_CreatePyObject((static_cast<SCA_IController*>(self_v))->m_proxy, KX_PYGENSEQ_CONT_TYPE_ACTUATORS);
|
||||
}
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
@@ -98,10 +98,12 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#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
|
||||
|
||||
@@ -173,6 +173,7 @@ CValue* SCA_ILogicBrick::GetEvent()
|
||||
|
||||
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* python stuff */
|
||||
|
||||
@@ -255,3 +256,5 @@ PyObject* SCA_ILogicBrick::BoolToPyArg(bool boolarg)
|
||||
{
|
||||
return PyLong_FromSsize_t(boolarg? KX_TRUE: KX_FALSE);
|
||||
}
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
@@ -125,6 +125,7 @@ public:
|
||||
static class SCA_LogicManager* m_sCurrentLogicManager;
|
||||
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
// python methods
|
||||
|
||||
static PyObject* pyattr_get_owner(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
|
||||
@@ -147,8 +148,9 @@ protected:
|
||||
|
||||
/** Convert a a c++ value to KX_TRUE, KX_FALSE in Python. */
|
||||
PyObject* BoolToPyArg(bool);
|
||||
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -307,7 +307,7 @@ void SCA_IObject::SetState(unsigned int state)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Python functions */
|
||||
@@ -345,3 +345,5 @@ PyMethodDef SCA_IObject::Methods[] = {
|
||||
PyAttributeDef SCA_IObject::Attributes[] = {
|
||||
{ NULL } //Sentinel
|
||||
};
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
@@ -41,7 +41,9 @@ class SCA_ISensor;
|
||||
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;
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
// needed for IsTriggered()
|
||||
#include "SCA_PythonController.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
@@ -288,6 +290,9 @@ void SCA_ISensor::Activate(class SCA_LogicManager* logicmgr)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* ----------------------------------------------- */
|
||||
/* Python Functions */
|
||||
/* ----------------------------------------------- */
|
||||
@@ -379,5 +384,6 @@ int SCA_ISensor::pyattr_check_tap(void *self_v, const KX_PYATTRIBUTE_DEF *attrde
|
||||
self->m_level = false;
|
||||
return 0;
|
||||
}
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
/* eof */
|
||||
|
||||
@@ -171,6 +171,7 @@ public:
|
||||
bool IsNoLink() const
|
||||
{ return !m_links; }
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
/* Python functions: */
|
||||
KX_PYMETHOD_DOC_NOARGS(SCA_ISensor,reset);
|
||||
|
||||
@@ -178,6 +179,7 @@ public:
|
||||
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
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "PyObjectPlus.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
@@ -244,6 +245,7 @@ bool SCA_JoystickSensor::isValid(SCA_JoystickSensor::KX_JOYSENSORMODE m)
|
||||
return res;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Python functions */
|
||||
@@ -413,3 +415,5 @@ PyObject* SCA_JoystickSensor::pyattr_get_connected(void *self_v, const KX_PYATTR
|
||||
SCA_Joystick *joy = ((SCA_JoystickManager *)self->m_eventmgr)->GetJoystickDevice(self->m_joyindex);
|
||||
return PyBool_FromLong( joy ? joy->Connected() : 0 );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -117,6 +117,8 @@ public:
|
||||
return m_joyindex;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* Python interface ---------------------------------------------------- */
|
||||
/* --------------------------------------------------------------------- */
|
||||
@@ -155,6 +157,8 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -403,6 +403,7 @@ void SCA_KeyboardSensor::LogKeystrokes(void)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Python Functions */
|
||||
@@ -495,6 +496,7 @@ PyObject* SCA_KeyboardSensor::pyattr_get_events(void *self_v, const KX_PYATTRIBU
|
||||
return resultlist;
|
||||
}
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
/* Accessed from python */
|
||||
|
||||
|
||||
@@ -103,6 +103,7 @@ public:
|
||||
virtual bool IsPositiveTrigger();
|
||||
bool TriggerOnAllKeys();
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* Python interface ---------------------------------------------------- */
|
||||
/* --------------------------------------------------------------------- */
|
||||
@@ -113,6 +114,7 @@ public:
|
||||
KX_PYMETHOD_DOC_O(SCA_KeyboardSensor,getKeyStatus);
|
||||
|
||||
static PyObject* pyattr_get_events(void* self_v, const KX_PYATTRIBUTE_DEF *attrdef);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -305,6 +305,9 @@ void SCA_LogicManager::EndFrame()
|
||||
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.
|
||||
@@ -313,6 +316,7 @@ void SCA_LogicManager::AddTriggeredController(SCA_IController* controller, SCA_I
|
||||
SCA_PythonController* pythonController = (SCA_PythonController*)controller;
|
||||
pythonController->AddTriggeredSensor(sensor);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
SCA_EventManager* SCA_LogicManager::FindEventManager(int eventmgrtype)
|
||||
|
||||
@@ -57,7 +57,7 @@ SCA_MouseSensor::SCA_MouseSensor(SCA_MouseManager* eventmgr,
|
||||
m_mousemode = mousemode;
|
||||
m_triggermode = true;
|
||||
|
||||
UpdateHotkey(this, NULL);
|
||||
UpdateHotkey(this);
|
||||
Init();
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ SCA_MouseSensor::~SCA_MouseSensor()
|
||||
/* 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
|
||||
@@ -100,9 +100,6 @@ int SCA_MouseSensor::UpdateHotkey(void *self, const PyAttributeDef*)
|
||||
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()
|
||||
@@ -239,6 +236,8 @@ bool SCA_MouseSensor::isValid(SCA_MouseSensor::KX_MOUSESENSORMODE m)
|
||||
return ((m > KX_MOUSESENSORMODE_NODEF) && (m < KX_MOUSESENSORMODE_MAX));
|
||||
}
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Python functions */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
@@ -296,10 +295,20 @@ PyMethodDef SCA_MouseSensor::Methods[] = {
|
||||
{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 */
|
||||
|
||||
@@ -86,8 +86,6 @@ class SCA_MouseSensor : public SCA_ISensor
|
||||
|
||||
bool isValid(KX_MOUSESENSORMODE);
|
||||
|
||||
static int UpdateHotkey(void *self, const PyAttributeDef*);
|
||||
|
||||
SCA_MouseSensor(class SCA_MouseManager* keybdmgr,
|
||||
int startx,int starty,
|
||||
short int mousemode,
|
||||
@@ -102,14 +100,20 @@ class SCA_MouseSensor : public SCA_ISensor
|
||||
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
|
||||
|
||||
@@ -91,7 +91,7 @@ CValue* SCA_NANDController::GetReplica()
|
||||
return replica;
|
||||
}
|
||||
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Python functions */
|
||||
@@ -128,4 +128,6 @@ PyAttributeDef SCA_NANDController::Attributes[] = {
|
||||
{ NULL } //Sentinel
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/* eof */
|
||||
|
||||
@@ -91,7 +91,7 @@ CValue* SCA_NORController::GetReplica()
|
||||
return replica;
|
||||
}
|
||||
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Python functions */
|
||||
@@ -128,4 +128,6 @@ PyAttributeDef SCA_NORController::Attributes[] = {
|
||||
{ NULL } //Sentinel
|
||||
};
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
/* eof */
|
||||
|
||||
@@ -87,6 +87,8 @@ void SCA_ORController::Trigger(SCA_LogicManager* logicmgr)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Python functions */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
@@ -122,4 +124,6 @@ PyAttributeDef SCA_ORController::Attributes[] = {
|
||||
{ NULL } //Sentinel
|
||||
};
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
/* eof */
|
||||
|
||||
@@ -221,6 +221,7 @@ void SCA_PropertyActuator::Relink(GEN_Map<GEN_HashedPtr, void*> *obj_map)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Python functions */
|
||||
@@ -260,4 +261,6 @@ PyAttributeDef SCA_PropertyActuator::Attributes[] = {
|
||||
{ NULL } //Sentinel
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/* eof */
|
||||
|
||||
@@ -290,16 +290,18 @@ CValue* SCA_PropertySensor::FindIdentifier(const STR_String& identifiername)
|
||||
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)
|
||||
@@ -334,4 +336,6 @@ PyAttributeDef SCA_PropertySensor::Attributes[] = {
|
||||
{ NULL } //Sentinel
|
||||
};
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
/* eof */
|
||||
|
||||
@@ -84,6 +84,8 @@ public:
|
||||
virtual bool IsPositiveTrigger();
|
||||
virtual CValue* FindIdentifier(const STR_String& identifiername);
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* Python interface ---------------------------------------------------- */
|
||||
/* --------------------------------------------------------------------- */
|
||||
@@ -92,6 +94,8 @@ public:
|
||||
* Test whether this is a sensible value (type check)
|
||||
*/
|
||||
static int validValueForProperty(void* self, const PyAttributeDef*);
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -34,8 +34,12 @@
|
||||
#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>
|
||||
|
||||
|
||||
@@ -49,13 +53,18 @@ SCA_PythonController* SCA_PythonController::m_sCurrentController = NULL;
|
||||
|
||||
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
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
@@ -78,6 +87,8 @@ int SCA_PythonController::Release()
|
||||
|
||||
SCA_PythonController::~SCA_PythonController()
|
||||
{
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
//printf("released python byte script\n");
|
||||
|
||||
Py_XDECREF(m_bytecode);
|
||||
@@ -88,6 +99,7 @@ SCA_PythonController::~SCA_PythonController()
|
||||
PyDict_Clear(m_pythondictionary);
|
||||
Py_DECREF(m_pythondictionary);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +107,8 @@ SCA_PythonController::~SCA_PythonController()
|
||||
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);
|
||||
@@ -113,6 +126,7 @@ CValue* SCA_PythonController::GetReplica()
|
||||
if (m_pythondictionary)
|
||||
Py_INCREF(replica->m_pythondictionary);
|
||||
*/
|
||||
#endif
|
||||
|
||||
// this will copy properties and so on...
|
||||
replica->ProcessReplica();
|
||||
@@ -136,7 +150,7 @@ void SCA_PythonController::SetScriptName(const STR_String& name)
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
void SCA_PythonController::SetDictionary(PyObject* pythondictionary)
|
||||
{
|
||||
if (m_pythondictionary)
|
||||
@@ -151,6 +165,7 @@ void SCA_PythonController::SetDictionary(PyObject* pythondictionary)
|
||||
PyDict_SetItemString(m_pythondictionary, "__file__", PyUnicode_FromString(m_scriptName.Ptr()));
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
int SCA_PythonController::IsTriggered(class SCA_ISensor* sensor)
|
||||
{
|
||||
@@ -160,6 +175,8 @@ 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)
|
||||
{
|
||||
@@ -360,6 +377,7 @@ bool SCA_PythonController::Import()
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr)
|
||||
{
|
||||
m_sCurrentController = this;
|
||||
@@ -514,5 +532,13 @@ int SCA_PythonController::pyattr_set_script(void *self_v, const KX_PYATTRIBUTE_D
|
||||
return PY_SET_ATTR_SUCCESS;
|
||||
}
|
||||
|
||||
#else // DISABLE_PYTHON
|
||||
|
||||
void SCA_PythonController::Trigger(SCA_LogicManager* logicmgr)
|
||||
{
|
||||
/* intentionally blank */
|
||||
}
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
/* eof */
|
||||
|
||||
@@ -42,8 +42,10 @@ class SCA_IObject;
|
||||
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 */
|
||||
@@ -53,9 +55,10 @@ class SCA_PythonController : public SCA_IController
|
||||
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:
|
||||
@@ -80,7 +83,9 @@ class SCA_PythonController : public SCA_IController
|
||||
|
||||
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); }
|
||||
@@ -89,7 +94,7 @@ class SCA_PythonController : public SCA_IController
|
||||
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__;
|
||||
@@ -106,8 +111,7 @@ class SCA_PythonController : public SCA_IController
|
||||
|
||||
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
|
||||
|
||||
@@ -309,6 +309,8 @@ void SCA_RandomActuator::enforceConstraints() {
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Python functions */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
@@ -546,5 +548,7 @@ KX_PYMETHODDEF_DOC_VARARGS(SCA_RandomActuator, setFloatNegativeExponential,
|
||||
enforceConstraints();
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/* eof */
|
||||
|
||||
@@ -91,6 +91,8 @@ class SCA_RandomActuator : public SCA_IActuator
|
||||
|
||||
virtual CValue* GetReplica();
|
||||
virtual void ProcessReplica();
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* Python interface ---------------------------------------------------- */
|
||||
@@ -109,6 +111,9 @@ class SCA_RandomActuator : public SCA_IActuator
|
||||
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
|
||||
|
||||
@@ -124,6 +124,8 @@ bool SCA_RandomSensor::Evaluate()
|
||||
return evaluateResult;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Python functions */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
@@ -178,4 +180,6 @@ int SCA_RandomSensor::pyattr_set_seed(void *self_v, const KX_PYATTRIBUTE_DEF *at
|
||||
return PY_SET_ATTR_SUCCESS;
|
||||
}
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
/* eof */
|
||||
|
||||
@@ -56,13 +56,15 @@ public:
|
||||
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
|
||||
|
||||
@@ -95,7 +95,7 @@ CValue* SCA_XNORController::GetReplica()
|
||||
return replica;
|
||||
}
|
||||
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Python functions */
|
||||
@@ -132,4 +132,6 @@ PyAttributeDef SCA_XNORController::Attributes[] = {
|
||||
{ NULL } //Sentinel
|
||||
};
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
/* eof */
|
||||
|
||||
@@ -95,7 +95,7 @@ CValue* SCA_XORController::GetReplica()
|
||||
return replica;
|
||||
}
|
||||
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Python functions */
|
||||
@@ -131,5 +131,6 @@ PyMethodDef SCA_XORController::Methods[] = {
|
||||
PyAttributeDef SCA_XORController::Attributes[] = {
|
||||
{ NULL } //Sentinel
|
||||
};
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
/* eof */
|
||||
|
||||
@@ -7,9 +7,6 @@ incs = '. #/source/kernel/gen_system #/intern/string'
|
||||
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']:
|
||||
@@ -17,6 +14,11 @@ 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')
|
||||
|
||||
@@ -58,8 +58,14 @@ incs = ['.',
|
||||
# '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'])
|
||||
|
||||
@@ -40,9 +40,13 @@ incs = ['.',
|
||||
'#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')
|
||||
|
||||
|
||||
@@ -728,6 +728,8 @@ void BL_Shader::SetUniform(int uniform, const int* val, int len)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
PyMethodDef BL_Shader::Methods[] =
|
||||
{
|
||||
// creation
|
||||
@@ -1409,4 +1411,6 @@ KX_PYMETHODDEF_DOC( BL_Shader, setUniformDef, "setUniformDef(name, enum)" )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
// eof
|
||||
|
||||
@@ -222,6 +222,7 @@ public:
|
||||
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); }
|
||||
|
||||
// -----------------------------------
|
||||
@@ -249,6 +250,7 @@ public:
|
||||
KX_PYMETHOD_DOC( BL_Shader, setUniformDef );
|
||||
KX_PYMETHOD_DOC( BL_Shader, setAttrib );
|
||||
KX_PYMETHOD_DOC( BL_Shader, setSampler);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif//__BL_SHADER_H__
|
||||
|
||||
@@ -59,7 +59,6 @@ SET(INC
|
||||
../../../source/blender/gpu
|
||||
../../../extern/bullet2/src
|
||||
../../../extern/glew/include
|
||||
${PYTHON_INC}
|
||||
)
|
||||
|
||||
IF(WITH_SDL)
|
||||
@@ -68,5 +67,11 @@ ELSE(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 )
|
||||
|
||||
@@ -36,8 +36,13 @@ SET(INC
|
||||
../../../../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] )
|
||||
|
||||
@@ -95,6 +95,8 @@ CValue* KX_NetworkMessageActuator::GetReplica()
|
||||
return replica;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Python interface --------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------- */
|
||||
@@ -133,3 +135,5 @@ PyAttributeDef KX_NetworkMessageActuator::Attributes[] = {
|
||||
KX_PYATTRIBUTE_STRING_RW("body", 0, 16384, false, KX_NetworkMessageActuator, m_body),
|
||||
{ NULL } //Sentinel
|
||||
};
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
@@ -158,6 +158,8 @@ bool KX_NetworkMessageSensor::IsPositiveTrigger()
|
||||
return m_IsUp;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* Python interface ---------------------------------------------------- */
|
||||
/* --------------------------------------------------------------------- */
|
||||
@@ -216,3 +218,5 @@ PyObject* KX_NetworkMessageSensor::pyattr_get_subjects(void *self_v, const KX_PY
|
||||
return (new CListValue())->NewProxy(true);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
@@ -66,6 +66,8 @@ public:
|
||||
virtual void Init();
|
||||
void EndFrame();
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
/* Python interface -------------------------------------------- */
|
||||
/* ------------------------------------------------------------- */
|
||||
@@ -74,6 +76,8 @@ public:
|
||||
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
|
||||
|
||||
@@ -7,6 +7,11 @@ incs = '. #source/kernel/gen_system #intern/string #intern/moto/include #source/
|
||||
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'])
|
||||
|
||||
@@ -153,6 +153,7 @@ bool KX_ArmatureSensor::Evaluate()
|
||||
return (reset) ? true : false;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Python functions */
|
||||
@@ -203,3 +204,5 @@ PyObject* KX_ArmatureSensor::pyattr_get_constraint(void *self, const struct KX_P
|
||||
}
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
@@ -66,11 +66,15 @@ public:
|
||||
// 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;
|
||||
|
||||
@@ -777,6 +777,18 @@ void KX_BlenderMaterial::UpdateIPO(
|
||||
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[] =
|
||||
{
|
||||
@@ -870,18 +882,6 @@ KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getShader , "getShader()")
|
||||
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() );
|
||||
@@ -941,3 +941,4 @@ KX_PYMETHODDEF_DOC( KX_BlenderMaterial, setBlending , "setBlending( GameLogic.sr
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
@@ -83,6 +83,7 @@ public:
|
||||
MT_Scalar ref, MT_Scalar emit, MT_Scalar alpha
|
||||
);
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
// --------------------------------
|
||||
virtual PyObject* py_repr(void) { return PyUnicode_FromString(mMaterial->matname.ReadPtr()); }
|
||||
|
||||
@@ -92,6 +93,7 @@ public:
|
||||
KX_PYMETHOD_DOC( KX_BlenderMaterial, setTexture );
|
||||
|
||||
KX_PYMETHOD_DOC( KX_BlenderMaterial, setBlending );
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
// --------------------------------
|
||||
// pre calculate to avoid pops/lag at startup
|
||||
|
||||
@@ -481,6 +481,7 @@ int KX_Camera::GetViewportTop() const
|
||||
return m_camdata.m_viewporttop;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
//----------------------------------------------------------------------------
|
||||
//Python
|
||||
|
||||
@@ -1030,4 +1031,4 @@ KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, getScreenRay,
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -41,8 +41,10 @@
|
||||
#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
|
||||
{
|
||||
@@ -267,6 +269,7 @@ public:
|
||||
|
||||
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);
|
||||
@@ -304,6 +307,7 @@ public:
|
||||
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
|
||||
|
||||
@@ -350,6 +350,8 @@ CValue *KX_CameraActuator::findObject(char *obName)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Python functions */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
@@ -416,4 +418,6 @@ int KX_CameraActuator::pyattr_set_object(void *self_v, const KX_PYATTRIBUTE_DEF
|
||||
return PY_SET_ATTR_SUCCESS;
|
||||
}
|
||||
|
||||
#endif // DISABLE_PYTHON
|
||||
|
||||
/* eof */
|
||||
|
||||
@@ -114,6 +114,8 @@ private :
|
||||
/** Methods inherited from SCA_ILogicBrick */
|
||||
virtual void Relink(GEN_Map<GEN_HashedPtr, void*> *obj_map);
|
||||
|
||||
#ifndef DISABLE_PYTHON
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
/* Python interface ---------------------------------------------------- */
|
||||
/* --------------------------------------------------------------------- */
|
||||
@@ -122,6 +124,8 @@ private :
|
||||
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
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user