+ Add method to get typeid of property via Python
This commit is contained in:
parent
5fdb762236
commit
4699856799
|
@ -23,6 +23,11 @@
|
|||
<UserDocu>Return the type of a named property. This can be (Hidden,ReadOnly,Output) or any combination. </UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="getTypeIdOfProperty">
|
||||
<Documentation>
|
||||
<UserDocu>Returns the C++ class name of a named property.</UserDocu>
|
||||
</Documentation>
|
||||
</Methode>
|
||||
<Methode Name="setEditorMode">
|
||||
<Documentation>
|
||||
<UserDocu>Set the behaviour of the property in the property editor.
|
||||
|
|
|
@ -64,8 +64,13 @@ PyObject* PropertyContainerPy::getTypeOfProperty(PyObject *args)
|
|||
if (!PyArg_ParseTuple(args, "s", &pstr)) // convert args: Python->C
|
||||
return NULL; // NULL triggers exception
|
||||
|
||||
short Type = getPropertyContainerPtr()->getPropertyType(pstr);
|
||||
Property* prop = getPropertyContainerPtr()->getPropertyByName(pstr);
|
||||
if (!prop) {
|
||||
PyErr_Format(PyExc_AttributeError, "Property container has no property '%s'", pstr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
short Type = prop->getType();
|
||||
if (Type & Prop_Hidden)
|
||||
ret.append(Py::String("Hidden"));
|
||||
if (Type & Prop_ReadOnly)
|
||||
|
@ -78,6 +83,22 @@ PyObject* PropertyContainerPy::getTypeOfProperty(PyObject *args)
|
|||
return Py::new_reference_to(ret);
|
||||
}
|
||||
|
||||
PyObject* PropertyContainerPy::getTypeIdOfProperty(PyObject *args)
|
||||
{
|
||||
char *pstr;
|
||||
if (!PyArg_ParseTuple(args, "s", &pstr)) // convert args: Python->C
|
||||
return NULL; // NULL triggers exception
|
||||
|
||||
Property* prop = getPropertyContainerPtr()->getPropertyByName(pstr);
|
||||
if (!prop) {
|
||||
PyErr_Format(PyExc_AttributeError, "Property container has no property '%s'", pstr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Py::String str(prop->getTypeId().getName());
|
||||
return Py::new_reference_to(str);
|
||||
}
|
||||
|
||||
PyObject* PropertyContainerPy::setEditorMode(PyObject *args)
|
||||
{
|
||||
char* name;
|
||||
|
|
Loading…
Reference in New Issue
Block a user