HAVE_PYTHON

This commit is contained in:
David Rose 2005-07-06 15:05:21 +00:00
parent 97428d8d0b
commit eb8f9aef49
3 changed files with 11 additions and 0 deletions

View File

@ -31,6 +31,7 @@ set_repository(CConnectionRepository *repository,
_ai_id = ai_id;
}
#ifdef HAVE_PYTHON
////////////////////////////////////////////////////////////////////
// Function: CDistributedSmoothNodeBase::set_clock_delta
// Access: Published, Static
@ -41,6 +42,7 @@ INLINE void CDistributedSmoothNodeBase::
set_clock_delta(PyObject *clock_delta) {
_clock_delta = clock_delta;
}
#endif // HAVE_PYTHON
////////////////////////////////////////////////////////////////////
// Function: CDistributedSmoothNodeBase::only_changed

View File

@ -28,7 +28,10 @@ static const double network_time_precision = 100.0; // Matches ClockDelta.py
CConnectionRepository *CDistributedSmoothNodeBase::_repository = NULL;
bool CDistributedSmoothNodeBase::_is_ai;
CHANNEL_TYPE CDistributedSmoothNodeBase::_ai_id;
#ifdef HAVE_PYTHON
PyObject *CDistributedSmoothNodeBase::_clock_delta = NULL;
#endif
////////////////////////////////////////////////////////////////////
// Function: CDistributedSmoothNodeBase::Constructor
@ -269,10 +272,12 @@ begin_send_update(DCPacker &packer, const string &field_name) {
////////////////////////////////////////////////////////////////////
void CDistributedSmoothNodeBase::
finish_send_update(DCPacker &packer) {
#ifdef HAVE_PYTHON
PyObject *clock_delta = PyObject_GetAttrString(_clock_delta, "delta");
nassertv(clock_delta != NULL);
double delta = PyFloat_AsDouble(clock_delta);
Py_DECREF(clock_delta);
#endif // HAVE_PYTHON
double local_time = ClockObject::get_global_clock()->get_frame_time();

View File

@ -43,8 +43,10 @@ PUBLISHED:
set_repository(CConnectionRepository *repository,
bool is_ai, CHANNEL_TYPE ai_id);
#ifdef HAVE_PYTHON
INLINE static void
set_clock_delta(PyObject *clock_delta);
#endif
void initialize(const NodePath &node_path, DCClass *dclass,
CHANNEL_TYPE do_id);
@ -87,7 +89,9 @@ private:
static CConnectionRepository *_repository;
static bool _is_ai;
static CHANNEL_TYPE _ai_id;
#ifdef HAVE_PYTHON
static PyObject *_clock_delta;
#endif
LPoint3f _store_xyz;
LVecBase3f _store_hpr;