Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-11-06 05:39:36 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-11-06 05:39:36 +0400
commit4c17f8e5de94f3abc65995e7a2964bb9e6ea7642 (patch)
tree001add4dd98c14818079e5f591d584c5ece7ac6a /source/gameengine/Expressions
parent2a7ade9de24860bbd13e4be8480e9285d1f3fe4c (diff)
PyUnicode_From_STR_String utility function which passes STR_String to PyUnicode_FromStringAndSize (saves a call to strlen).
Also made CValue::ConvertKeysToPython use faster list creation and improved some of the macro formatting.
Diffstat (limited to 'source/gameengine/Expressions')
-rw-r--r--source/gameengine/Expressions/Expression.h32
-rw-r--r--source/gameengine/Expressions/ListValue.h4
-rw-r--r--source/gameengine/Expressions/PyObjectPlus.cpp7
-rw-r--r--source/gameengine/Expressions/PyObjectPlus.h275
-rw-r--r--source/gameengine/Expressions/Value.cpp20
-rw-r--r--source/gameengine/Expressions/Value.h43
6 files changed, 233 insertions, 148 deletions
diff --git a/source/gameengine/Expressions/Expression.h b/source/gameengine/Expressions/Expression.h
index 875bd758b68..b9232477c34 100644
--- a/source/gameengine/Expressions/Expression.h
+++ b/source/gameengine/Expressions/Expression.h
@@ -24,19 +24,25 @@
//extern int gRefCountExpr; // only for debugging purposes (detect mem.leaks)
-#define PLUGIN_DECLARE_SERIAL_EXPRESSION(class_name,base_class_name) \
-public: \
- virtual base_class_name * Copy() { return new class_name; } \
- virtual bool EdSerialize(CompressorArchive& arch,class CFactoryManager* facmgr,bool bIsStoring); \
- virtual bool EdIdSerialize(CompressorArchive& arch,class CFactoryManager* facmgr,bool bIsStoring) \
-{ \
- if (bIsStoring) \
- { \
- unsigned char exprID = GetExpressionID(); \
- arch << exprID; \
- } \
- return true; \
-} \
+#define PLUGIN_DECLARE_SERIAL_EXPRESSION(class_name, base_class_name) \
+public: \
+ virtual base_class_name * Copy() { \
+ return new class_name; \
+ } \
+ virtual bool EdSerialize(CompressorArchive& arch, \
+ class CFactoryManager* facmgr, \
+ bool bIsStoring); \
+ virtual bool EdIdSerialize(CompressorArchive& arch, \
+ class CFactoryManager* facmgr, \
+ bool bIsStoring) \
+ { \
+ if (bIsStoring) \
+ { \
+ unsigned char exprID = GetExpressionID(); \
+ arch << exprID; \
+ } \
+ return true; \
+ } \
diff --git a/source/gameengine/Expressions/ListValue.h b/source/gameengine/Expressions/ListValue.h
index 76451215f82..26c11cccc7a 100644
--- a/source/gameengine/Expressions/ListValue.h
+++ b/source/gameengine/Expressions/ListValue.h
@@ -23,7 +23,7 @@
class CListValue : public CPropValue
{
- Py_Header;
+ Py_Header
//PLUGIN_DECLARE_SERIAL (CListValue,CValue)
public:
@@ -58,7 +58,7 @@ public:
void Resize(int num);
void SetValue(int i,CValue* val);
CValue* GetValue(int i){ assertd(i < m_pValueArray.size()); return m_pValueArray[i];}
- int GetCount() { return m_pValueArray.size();};
+ int GetCount() { return m_pValueArray.size(); }
virtual const STR_String & GetText();
bool CheckEqual(CValue* first,CValue* second);
diff --git a/source/gameengine/Expressions/PyObjectPlus.cpp b/source/gameengine/Expressions/PyObjectPlus.cpp
index 87f776a726e..f263bf15f02 100644
--- a/source/gameengine/Expressions/PyObjectPlus.cpp
+++ b/source/gameengine/Expressions/PyObjectPlus.cpp
@@ -470,7 +470,7 @@ PyObject *PyObjectPlus::py_get_attrdef(PyObject *self_py, const PyAttributeDef *
case KX_PYATTRIBUTE_TYPE_STRING:
{
STR_String *val = reinterpret_cast<STR_String*>(ptr);
- return PyUnicode_FromString(*val);
+ return PyUnicode_From_STR_String(*val);
}
case KX_PYATTRIBUTE_TYPE_CHAR:
{
@@ -1171,6 +1171,11 @@ PyObject *PyObjectPlus::NewProxyPlus_Ext(PyObjectPlus *self, PyTypeObject *tp, v
return self->m_proxy;
}
+PyObject *PyUnicode_From_STR_String(const STR_String& str)
+{
+ return PyUnicode_FromStringAndSize(str.ReadPtr(), str.Length());
+}
+
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
/* deprecation warning management */
diff --git a/source/gameengine/Expressions/PyObjectPlus.h b/source/gameengine/Expressions/PyObjectPlus.h
index f7bd1b91466..3e1c54b0cc7 100644
--- a/source/gameengine/Expressions/PyObjectPlus.h
+++ b/source/gameengine/Expressions/PyObjectPlus.h
@@ -29,11 +29,12 @@
* \ingroup expressions
*/
+#ifndef _PY_OBJECT_PLUS_H
+#define _PY_OBJECT_PLUS_H
+
/* for now keep weakrefs optional */
#define USE_WEAKREFS
-#ifndef _adr_py_lib_h_ // only process once,
-#define _adr_py_lib_h_ // even if multiply included
#ifndef __cplusplus // c++ only
#error Must be compiled with C++
@@ -45,10 +46,6 @@
#include "SG_QList.h"
#include <stddef.h>
-/*------------------------------
- * Python defines
-------------------------------*/
-
#ifdef WITH_PYTHON
#ifdef USE_MATHUTILS
extern "C" {
@@ -110,7 +107,7 @@ typedef struct PyObjectPlus_Proxy {
#define BGE_PROXY_PYOWNS(_self) (((PyObjectPlus_Proxy *)_self)->py_owns)
#define BGE_PROXY_PYREF(_self) (((PyObjectPlus_Proxy *)_self)->py_ref)
#ifdef USE_WEAKREFS
- #define BGE_PROXY_WKREF(_self) (((PyObjectPlus_Proxy *)_self)->in_weakreflist)
+# define BGE_PROXY_WKREF(_self) (((PyObjectPlus_Proxy *)_self)->in_weakreflist)
#endif
/* Note, sometimes we dont care what BGE type this is as long as its a proxy */
@@ -124,45 +121,61 @@ typedef struct PyObjectPlus_Proxy {
// PyC++ class
// AttributesPtr correspond to attributes of proxy generic pointer
// each PyC++ class must be registered in KX_PythonInitTypes.cpp
-#define __Py_Header \
- public: \
- static PyTypeObject Type; \
- static PyMethodDef Methods[]; \
- static PyAttributeDef Attributes[]; \
- virtual PyTypeObject *GetType(void) {return &Type;}; \
- virtual PyObject *GetProxy() {return GetProxyPlus_Ext(this, &Type, NULL);}; \
- virtual PyObject *NewProxy(bool py_owns) {return NewProxyPlus_Ext(this, &Type, NULL, py_owns);}; \
+#define __Py_Header \
+public: \
+ static PyTypeObject Type; \
+ static PyMethodDef Methods[]; \
+ static PyAttributeDef Attributes[]; \
+ virtual PyTypeObject *GetType(void) { \
+ return &Type; \
+ } \
+ virtual PyObject *GetProxy() { \
+ return GetProxyPlus_Ext(this, &Type, NULL); \
+ } \
+ virtual PyObject *NewProxy(bool py_owns) { \
+ return NewProxyPlus_Ext(this, &Type, NULL, py_owns); \
+ } \
// leave above line empty (macro)!
// use this macro for class that use generic pointer in proxy
// GetProxy() and NewProxy() must be defined to set the correct pointer in the proxy
-#define __Py_HeaderPtr \
- public: \
- static PyTypeObject Type; \
- static PyMethodDef Methods[]; \
- static PyAttributeDef Attributes[]; \
- static PyAttributeDef AttributesPtr[]; \
- virtual PyTypeObject *GetType(void) {return &Type;}; \
- virtual PyObject *GetProxy(); \
- virtual PyObject *NewProxy(bool py_owns); \
+#define __Py_HeaderPtr \
+public: \
+ static PyTypeObject Type; \
+ static PyMethodDef Methods[]; \
+ static PyAttributeDef Attributes[]; \
+ static PyAttributeDef AttributesPtr[]; \
+ virtual PyTypeObject *GetType(void) { \
+ return &Type; \
+ } \
+ virtual PyObject *GetProxy(); \
+ virtual PyObject *NewProxy(bool py_owns); \
// leave above line empty (macro)!
#ifdef WITH_CXX_GUARDEDALLOC
-#define Py_Header __Py_Header \
- void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, Type.tp_name); } \
- void operator delete(void *mem) { MEM_freeN(mem); } \
+#define Py_Header __Py_Header \
+ void *operator new(size_t num_bytes) { \
+ return MEM_mallocN(num_bytes, Type.tp_name); \
+ } \
+ void operator delete(void *mem) { \
+ MEM_freeN(mem); \
+ } \
#else
-#define Py_Header __Py_Header
+# define Py_Header __Py_Header
#endif
#ifdef WITH_CXX_GUARDEDALLOC
-#define Py_HeaderPtr __Py_HeaderPtr \
- void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, Type.tp_name); } \
- void operator delete( void *mem ) { MEM_freeN(mem); } \
+#define Py_HeaderPtr __Py_HeaderPtr \
+ void *operator new(size_t num_bytes) { \
+ return MEM_mallocN(num_bytes, Type.tp_name); \
+ } \
+ void operator delete( void *mem ) { \
+ MEM_freeN(mem); \
+ } \
#else
-#define Py_HeaderPtr __Py_HeaderPtr
+# define Py_HeaderPtr __Py_HeaderPtr
#endif
/*
@@ -180,65 +193,109 @@ typedef struct PyObjectPlus_Proxy {
* These macros are helpfull when embedding Python routines. The second
* macro is one that also requires a documentation string
*/
-#define KX_PYMETHOD(class_name, method_name) \
- PyObject* Py##method_name(PyObject* args, PyObject* kwds); \
- static PyObject* sPy##method_name( PyObject* self, PyObject* args, PyObject* kwds) { \
- if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_RuntimeError, #class_name "." #method_name "() - " BGE_PROXY_ERROR_MSG); return NULL; } \
- return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(args, kwds); \
- }; \
-
-#define KX_PYMETHOD_VARARGS(class_name, method_name) \
- PyObject* Py##method_name(PyObject* args); \
- static PyObject* sPy##method_name( PyObject* self, PyObject* args) { \
- if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_RuntimeError, #class_name "." #method_name "() - " BGE_PROXY_ERROR_MSG); return NULL; } \
- return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(args); \
- }; \
-
-#define KX_PYMETHOD_NOARGS(class_name, method_name) \
- PyObject* Py##method_name(); \
- static PyObject* sPy##method_name( PyObject* self) { \
- if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_RuntimeError, #class_name "." #method_name "() - " BGE_PROXY_ERROR_MSG); return NULL; } \
- return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(); \
- }; \
-
-#define KX_PYMETHOD_O(class_name, method_name) \
- PyObject* Py##method_name(PyObject* value); \
- static PyObject* sPy##method_name( PyObject* self, PyObject* value) { \
- if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_RuntimeError, #class_name "." #method_name "(value) - " BGE_PROXY_ERROR_MSG); return NULL; } \
- return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(value); \
- }; \
-
-#define KX_PYMETHOD_DOC(class_name, method_name) \
- PyObject* Py##method_name(PyObject* args, PyObject* kwds); \
- static PyObject* sPy##method_name( PyObject* self, PyObject* args, PyObject* kwds) { \
- if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_RuntimeError, #class_name "." #method_name "(...) - " BGE_PROXY_ERROR_MSG); return NULL; } \
- return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(args, kwds); \
- }; \
- static const char method_name##_doc[]; \
-
-#define KX_PYMETHOD_DOC_VARARGS(class_name, method_name) \
- PyObject* Py##method_name(PyObject* args); \
- static PyObject* sPy##method_name( PyObject* self, PyObject* args) { \
- if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_RuntimeError, #class_name "." #method_name "(...) - " BGE_PROXY_ERROR_MSG); return NULL; } \
- return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(args); \
- }; \
- static const char method_name##_doc[]; \
-
-#define KX_PYMETHOD_DOC_O(class_name, method_name) \
- PyObject* Py##method_name(PyObject* value); \
- static PyObject* sPy##method_name( PyObject* self, PyObject* value) { \
- if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_RuntimeError, #class_name "." #method_name "(value) - " BGE_PROXY_ERROR_MSG); return NULL; } \
- return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(value); \
- }; \
- static const char method_name##_doc[]; \
-
-#define KX_PYMETHOD_DOC_NOARGS(class_name, method_name) \
- PyObject* Py##method_name(); \
- static PyObject* sPy##method_name( PyObject* self) { \
- if(BGE_PROXY_REF(self)==NULL) { PyErr_SetString(PyExc_RuntimeError, #class_name "." #method_name "() - " BGE_PROXY_ERROR_MSG); return NULL; } \
- return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(); \
- }; \
- static const char method_name##_doc[]; \
+#define KX_PYMETHOD(class_name, method_name) \
+ PyObject* Py##method_name(PyObject* args, PyObject* kwds); \
+ static PyObject* \
+ sPy##method_name(PyObject* self, PyObject* args, PyObject* kwds) { \
+ if(BGE_PROXY_REF(self)==NULL) { \
+ PyErr_SetString(PyExc_RuntimeError, \
+ #class_name "." #method_name "() - " \
+ BGE_PROXY_ERROR_MSG); \
+ return NULL; \
+ } \
+ return((class_name*)BGE_PROXY_REF(self))->Py##method_name(args, kwds); \
+ } \
+
+#define KX_PYMETHOD_VARARGS(class_name, method_name) \
+ PyObject* Py##method_name(PyObject* args); \
+ static PyObject* \
+ sPy##method_name(PyObject* self, PyObject* args) { \
+ if(BGE_PROXY_REF(self)==NULL) { \
+ PyErr_SetString(PyExc_RuntimeError, \
+ #class_name "." #method_name "() - " \
+ BGE_PROXY_ERROR_MSG); return NULL; \
+ } \
+ return((class_name*)BGE_PROXY_REF(self))->Py##method_name(args); \
+ } \
+
+#define KX_PYMETHOD_NOARGS(class_name, method_name) \
+ PyObject* Py##method_name(); \
+ static PyObject* \
+ sPy##method_name(PyObject* self) { \
+ if(BGE_PROXY_REF(self)==NULL) { \
+ PyErr_SetString(PyExc_RuntimeError, \
+ #class_name "." #method_name "() - " \
+ BGE_PROXY_ERROR_MSG); return NULL; \
+ } \
+ return((class_name*)BGE_PROXY_REF(self))->Py##method_name(); \
+ } \
+
+#define KX_PYMETHOD_O(class_name, method_name) \
+ PyObject* Py##method_name(PyObject* value); \
+ static PyObject* \
+ sPy##method_name(PyObject* self, PyObject* value) { \
+ if(BGE_PROXY_REF(self)==NULL) { \
+ PyErr_SetString(PyExc_RuntimeError, \
+ #class_name "." #method_name "(value) - " \
+ BGE_PROXY_ERROR_MSG); return NULL; \
+ } \
+ return((class_name*)BGE_PROXY_REF(self))->Py##method_name(value); \
+ } \
+
+#define KX_PYMETHOD_DOC(class_name, method_name) \
+ PyObject* Py##method_name(PyObject* args, PyObject* kwds); \
+ static PyObject* \
+ sPy##method_name(PyObject* self, PyObject* args, PyObject* kwds) { \
+ if(BGE_PROXY_REF(self)==NULL) { \
+ PyErr_SetString(PyExc_RuntimeError, \
+ #class_name "." #method_name "(...) - " \
+ BGE_PROXY_ERROR_MSG); return NULL; \
+ } \
+ return((class_name*)BGE_PROXY_REF(self))->Py##method_name(args, kwds); \
+ } \
+ static const char method_name##_doc[]; \
+
+#define KX_PYMETHOD_DOC_VARARGS(class_name, method_name) \
+ PyObject* Py##method_name(PyObject* args); \
+ static PyObject* \
+ sPy##method_name(PyObject* self, PyObject* args) { \
+ if(BGE_PROXY_REF(self)==NULL) { \
+ PyErr_SetString(PyExc_RuntimeError, \
+ #class_name "." #method_name "(...) - " \
+ BGE_PROXY_ERROR_MSG); \
+ return NULL; \
+ } \
+ return((class_name*)BGE_PROXY_REF(self))->Py##method_name(args); \
+ } \
+ static const char method_name##_doc[]; \
+
+#define KX_PYMETHOD_DOC_O(class_name, method_name) \
+ PyObject* Py##method_name(PyObject* value); \
+ static PyObject* \
+ sPy##method_name(PyObject* self, PyObject* value) { \
+ if(BGE_PROXY_REF(self)==NULL) { \
+ PyErr_SetString(PyExc_RuntimeError, \
+ #class_name "." #method_name "(value) - " \
+ BGE_PROXY_ERROR_MSG); \
+ return NULL; \
+ } \
+ return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(value); \
+ } \
+ static const char method_name##_doc[]; \
+
+#define KX_PYMETHOD_DOC_NOARGS(class_name, method_name) \
+ PyObject* Py##method_name(); \
+ static PyObject* \
+ sPy##method_name(PyObject* self) { \
+ if(BGE_PROXY_REF(self)==NULL) { \
+ PyErr_SetString(PyExc_RuntimeError, \
+ #class_name "." #method_name "() - " \
+ BGE_PROXY_ERROR_MSG); \
+ return NULL; \
+ } \
+ return ((class_name*)BGE_PROXY_REF(self))->Py##method_name(); \
+ } \
+ static const char method_name##_doc[]; \
/* The line above should remain empty */
@@ -290,7 +347,7 @@ enum KX_PYATTRIBUTE_TYPE {
KX_PYATTRIBUTE_TYPE_FUNCTION,
KX_PYATTRIBUTE_TYPE_VECTOR,
KX_PYATTRIBUTE_TYPE_FLAG,
- KX_PYATTRIBUTE_TYPE_CHAR,
+ KX_PYATTRIBUTE_TYPE_CHAR
};
enum KX_PYATTRIBUTE_ACCESS {
@@ -479,23 +536,31 @@ typedef PyTypeObject * PyParentObject; // Define the PyParent Object
#else // WITH_PYTHON
#ifdef WITH_CXX_GUARDEDALLOC
-#define Py_Header \
- public: \
- void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:PyObjectPlus"); } \
- void operator delete( void *mem ) { MEM_freeN(mem); } \
+#define Py_Header \
+public: \
+ void *operator new(size_t num_bytes) { \
+ return MEM_mallocN(num_bytes, "GE:PyObjectPlus"); \
+ } \
+ void operator delete( void *mem ) { \
+ MEM_freeN(mem); \
+ } \
-#define Py_HeaderPtr \
- public: \
- void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:PyObjectPlusPtr"); } \
- void operator delete( void *mem ) { MEM_freeN(mem); } \
+#define Py_HeaderPtr \
+public: \
+ void *operator new(size_t num_bytes) { \
+ return MEM_mallocN(num_bytes, "GE:PyObjectPlusPtr"); \
+ } \
+ void operator delete( void *mem ) { \
+ MEM_freeN(mem); \
+ } \
#else // WITH_CXX_GUARDEDALLOC
#define Py_Header \
- public: \
+public: \
#define Py_HeaderPtr \
- public: \
+public: \
#endif // WITH_CXX_GUARDEDALLOC
@@ -515,7 +580,7 @@ typedef PyTypeObject * PyParentObject; // Define the PyParent Object
// possibility to use them at SCA_ILogicBrick, CValue and PyObjectPlus level.
class PyObjectPlus : public SG_QList
{ // The PyObjectPlus abstract class
- Py_Header; // Always start with Py_Header
+ Py_Header // Always start with Py_Header
public:
PyObjectPlus();
@@ -580,6 +645,8 @@ public:
#ifdef WITH_PYTHON
PyObject *py_getattr_dict(PyObject *pydict, PyObject *tp_dict);
+
+PyObject *PyUnicode_From_STR_String(const STR_String& str);
#endif
-#endif // _adr_py_lib_h_
+#endif // _PY_OBJECT_PLUS_H
diff --git a/source/gameengine/Expressions/Value.cpp b/source/gameengine/Expressions/Value.cpp
index 41c0850a779..91fdbb0dabc 100644
--- a/source/gameengine/Expressions/Value.cpp
+++ b/source/gameengine/Expressions/Value.cpp
@@ -532,7 +532,7 @@ PyAttributeDef CValue::Attributes[] = {
PyObject * CValue::pyattr_get_name(void * self_v, const KX_PYATTRIBUTE_DEF * attrdef) {
CValue * self = static_cast<CValue *> (self_v);
- return PyUnicode_FromString(self->GetName());
+ return PyUnicode_From_STR_String(self->GetName());
}
CValue* CValue::ConvertPythonToValue(PyObject* pyobj, const char *error_prefix)
@@ -596,22 +596,24 @@ CValue* CValue::ConvertPythonToValue(PyObject* pyobj, const char *error_prefix)
}
-PyObject* CValue::ConvertKeysToPython( void )
+PyObject* CValue::ConvertKeysToPython(void)
{
- PyObject *pylist = PyList_New( 0 );
- PyObject *pystr;
-
if (m_pNamedPropertyArray)
{
+ PyObject *pylist= PyList_New(m_pNamedPropertyArray->size());
+ Py_ssize_t i= 0;
+
std::map<STR_String,CValue*>::iterator it;
for (it= m_pNamedPropertyArray->begin(); (it != m_pNamedPropertyArray->end()); it++)
{
- pystr = PyUnicode_FromString( (*it).first );
- PyList_Append(pylist, pystr);
- Py_DECREF( pystr );
+ PyList_SET_ITEM(pylist, i++, PyUnicode_From_STR_String((*it).first));
}
+
+ return pylist;
+ }
+ else {
+ return PyList_New(0);
}
- return pylist;
}
#endif // WITH_PYTHON
diff --git a/source/gameengine/Expressions/Value.h b/source/gameengine/Expressions/Value.h
index 955e688ad7b..f9697a55d3f 100644
--- a/source/gameengine/Expressions/Value.h
+++ b/source/gameengine/Expressions/Value.h
@@ -200,7 +200,7 @@ public:
class CValue : public PyObjectPlus
{
-Py_Header;
+Py_Header
public:
enum AllocationTYPE {
STACKVALUE = 0,
@@ -319,7 +319,7 @@ public:
virtual const STR_String & GetText() = 0;
virtual double GetNumber() = 0;
- double* ZeroVector() { return m_sZeroVec; };
+ double* ZeroVector() { return m_sZeroVec; }
virtual double* GetVector3(bool bGetTransformedVec = false);
virtual STR_String& GetName() = 0; // Retrieve the name of the value
@@ -348,11 +348,11 @@ public:
virtual bool IsSelected() { return m_ValFlags.Selected; }
inline bool IsReleaseRequested() { return m_ValFlags.ReleaseRequested; }
virtual bool IsVisible() { return m_ValFlags.Visible;}
- virtual void SetCustomFlag1(bool bCustomFlag) { m_ValFlags.CustomFlag1 = bCustomFlag;};
- virtual bool IsCustomFlag1() { return m_ValFlags.CustomFlag1;};
+ virtual void SetCustomFlag1(bool bCustomFlag) { m_ValFlags.CustomFlag1 = bCustomFlag;}
+ virtual bool IsCustomFlag1() { return m_ValFlags.CustomFlag1;}
- virtual void SetCustomFlag2(bool bCustomFlag) { m_ValFlags.CustomFlag2 = bCustomFlag;};
- virtual bool IsCustomFlag2() { return m_ValFlags.CustomFlag2;};
+ virtual void SetCustomFlag2(bool bCustomFlag) { m_ValFlags.CustomFlag2 = bCustomFlag;}
+ virtual bool IsCustomFlag2() { return m_ValFlags.CustomFlag2;}
protected:
virtual void DisableRefCount(); // Disable reference counting for this value
@@ -379,18 +379,23 @@ private:
// of object. So, for *any* CValue-derived object this should be set to CValue,
// for *any* CExpression-derived object this should be set to CExpression.
//
-#define PLUGIN_DECLARE_SERIAL(class_name, root_base_class_name) \
-public: \
- virtual root_base_class_name * Copy() { return new class_name; } \
- virtual bool EdSerialize(CompressorArchive& arch,class CFactoryManager* facmgr,bool bIsStoring); \
- virtual bool EdIdSerialize(CompressorArchive& arch,class CFactoryManager* facmgr,bool bIsStoring) \
-{ \
- if (bIsStoring) \
- arch.StoreString(#class_name); \
- \
- return false; \
-} \
-
+#define PLUGIN_DECLARE_SERIAL(class_name, root_base_class_name) \
+public: \
+ virtual root_base_class_name *Copy() { \
+ return new class_name; \
+ } \
+ virtual bool EdSerialize(CompressorArchive& arch, \
+ class CFactoryManager* facmgr, \
+ bool bIsStoring); \
+ virtual bool EdIdSerialize(CompressorArchive& arch, \
+ class CFactoryManager* facmgr, \
+ bool bIsStoring) \
+ { \
+ if (bIsStoring) \
+ arch.StoreString(#class_name); \
+ return false; \
+ } \
+
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
@@ -424,7 +429,7 @@ public:
//if (namefromprop.Length() > 0)
// return namefromprop;
return m_strNewName;
- }; // name of Value
+ } // name of Value
protected:
STR_String m_strNewName; // Identification