add define to inactivate some code blocks if needed
This commit is contained in:
@@ -32,6 +32,8 @@
|
||||
#include "Console.h"
|
||||
#include "Interpreter.h"
|
||||
|
||||
#define ATTR_TRACKING
|
||||
|
||||
using namespace Base;
|
||||
|
||||
PyObject* Base::BaseExceptionFreeCADError = 0;
|
||||
@@ -164,6 +166,7 @@ PyObject* PyObjectBase::__getattro(PyObject * obj, PyObject *attro)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef ATTR_TRACKING
|
||||
// If an attribute references this as parent then reset it (bug #0002902)
|
||||
PyObject* cur = pyObj->getTrackedAttribute(attr);
|
||||
if (cur) {
|
||||
@@ -173,9 +176,10 @@ PyObject* PyObjectBase::__getattro(PyObject * obj, PyObject *attro)
|
||||
pyObj->untrackAttribute(attr);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
PyObject* value = pyObj->_getattr(attr);
|
||||
#if 1
|
||||
#ifdef ATTR_TRACKING
|
||||
if (value && PyObject_TypeCheck(value, &(PyObjectBase::Type))) {
|
||||
if (!static_cast<PyObjectBase*>(value)->isConst() &&
|
||||
!static_cast<PyObjectBase*>(value)->isNotTracking()) {
|
||||
@@ -223,6 +227,7 @@ int PyObjectBase::__setattro(PyObject *obj, PyObject *attro, PyObject *value)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef ATTR_TRACKING
|
||||
// If an attribute references this as parent then reset it
|
||||
// before setting the new attribute
|
||||
PyObject* cur = static_cast<PyObjectBase*>(obj)->getTrackedAttribute(attr);
|
||||
@@ -233,9 +238,10 @@ int PyObjectBase::__setattro(PyObject *obj, PyObject *attro, PyObject *value)
|
||||
static_cast<PyObjectBase*>(obj)->untrackAttribute(attr);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int ret = static_cast<PyObjectBase*>(obj)->_setattr(attr, value);
|
||||
#if 1
|
||||
#ifdef ATTR_TRACKING
|
||||
if (ret == 0) {
|
||||
static_cast<PyObjectBase*>(obj)->startNotify();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user