Browse Source

Add isUsed bindings to pySimpleStateVariable

This lets python scripts determine if variables in SDL blobs are used (at
the default).
Adam Johnson 12 years ago
parent
commit
6ec219009c
  1. 7
      Sources/Plasma/FeatureLib/pfPython/pySDL.cpp
  2. 1
      Sources/Plasma/FeatureLib/pfPython/pySDL.h
  3. 6
      Sources/Plasma/FeatureLib/pfPython/pySDLGlue.cpp

7
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;
}

1
Sources/Plasma/FeatureLib/pfPython/pySDL.h

@ -141,6 +141,7 @@ public:
const char *GetDefault() const;
bool IsAlwaysNew() const;
bool IsInternal() const;
bool IsUsed() const;
};

6
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

Loading…
Cancel
Save