From 6ec219009ca5f4e27e8d729b4aa03075b7f4732d Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sun, 16 Dec 2012 00:26:35 -0500 Subject: [PATCH] Add isUsed bindings to pySimpleStateVariable This lets python scripts determine if variables in SDL blobs are used (at the default). --- Sources/Plasma/FeatureLib/pfPython/pySDL.cpp | 7 +++++++ Sources/Plasma/FeatureLib/pfPython/pySDL.h | 1 + Sources/Plasma/FeatureLib/pfPython/pySDLGlue.cpp | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/Sources/Plasma/FeatureLib/pfPython/pySDL.cpp b/Sources/Plasma/FeatureLib/pfPython/pySDL.cpp index 67ed05da..d49cb335 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pySDL.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pySDL.cpp @@ -284,3 +284,10 @@ bool pySimpleStateVariable::IsAlwaysNew() const plVarDescriptor *varDesc = fVar->GetVarDescriptor(); return varDesc->IsAlwaysNew(); } + +bool pySimpleStateVariable::IsUsed() const +{ + if (fVar) + return fVar->IsUsed(); + return false; +} diff --git a/Sources/Plasma/FeatureLib/pfPython/pySDL.h b/Sources/Plasma/FeatureLib/pfPython/pySDL.h index 2c63ce5d..dcc63ec0 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pySDL.h +++ b/Sources/Plasma/FeatureLib/pfPython/pySDL.h @@ -141,6 +141,7 @@ public: const char *GetDefault() const; bool IsAlwaysNew() const; bool IsInternal() const; + bool IsUsed() const; }; diff --git a/Sources/Plasma/FeatureLib/pfPython/pySDLGlue.cpp b/Sources/Plasma/FeatureLib/pfPython/pySDLGlue.cpp index b66fb9ad..e4d60dcf 100644 --- a/Sources/Plasma/FeatureLib/pfPython/pySDLGlue.cpp +++ b/Sources/Plasma/FeatureLib/pfPython/pySDLGlue.cpp @@ -264,6 +264,11 @@ PYTHON_METHOD_DEFINITION_NOARGS(ptSimpleStateVariable, isInternal) PYTHON_RETURN_BOOL(self->fThis->IsInternal()); } +PYTHON_METHOD_DEFINITION_NOARGS(ptSimpleStateVariable, isUsed) +{ + PYTHON_RETURN_BOOL(self->fThis->IsUsed()); +} + PYTHON_START_METHODS_TABLE(ptSimpleStateVariable) PYTHON_METHOD(ptSimpleStateVariable, setByte, "Params: val,idx=0\nSets a byte variable's value"), PYTHON_METHOD(ptSimpleStateVariable, setShort, "Params: val,idx=0\nSets a short variable's value"), @@ -285,6 +290,7 @@ PYTHON_START_METHODS_TABLE(ptSimpleStateVariable) PYTHON_METHOD_NOARGS(ptSimpleStateVariable, getDefault, "Returns the variable's default"), PYTHON_METHOD_NOARGS(ptSimpleStateVariable, isAlwaysNew, "Is this variable always new?"), PYTHON_METHOD_NOARGS(ptSimpleStateVariable, isInternal, "Is this an internal variable?"), + PYTHON_METHOD_NOARGS(ptSimpleStateVariable, isUsed, "Is this variable used?"), PYTHON_END_METHODS_TABLE; // Type structure definition