App/Gui: allow change dynamic property group and documentation

Exposed as PropertyContainerPy.setGroup/DocumentationOfProperty.

Added a menu action to property view for rename dynamic property group.
This commit is contained in:
Zheng, Lei
2019-12-28 09:22:52 +08:00
committed by Chris Hennes
parent 72ae26dfee
commit 8cf3cf330b
7 changed files with 105 additions and 4 deletions

View File

@@ -339,6 +339,25 @@ PyObject* PropertyContainerPy::getGroupOfProperty(PyObject *args)
return Py::new_reference_to(Py::String(""));
}
PyObject* PropertyContainerPy::setGroupOfProperty(PyObject *args)
{
char *pstr;
char *group;
if (!PyArg_ParseTuple(args, "ss", &pstr, &group)) // convert args: Python->C
return NULL; // NULL triggers exception
PY_TRY {
Property* prop = getPropertyContainerPtr()->getDynamicPropertyByName(pstr);
if (!prop) {
PyErr_Format(PyExc_AttributeError, "Property container has no dynamic property '%s'", pstr);
return 0;
}
prop->getContainer()->changeDynamicProperty(prop,group,0);
Py_Return;
} PY_CATCH
}
PyObject* PropertyContainerPy::getDocumentationOfProperty(PyObject *args)
{
char *pstr;
@@ -358,6 +377,24 @@ PyObject* PropertyContainerPy::getDocumentationOfProperty(PyObject *args)
return Py::new_reference_to(Py::String(""));
}
PyObject* PropertyContainerPy::setDocumentationOfProperty(PyObject *args)
{
char *pstr;
char *doc;
if (!PyArg_ParseTuple(args, "ss", &pstr, &doc)) // convert args: Python->C
return NULL; // NULL triggers exception
PY_TRY {
Property* prop = getPropertyContainerPtr()->getDynamicPropertyByName(pstr);
if (!prop) {
PyErr_Format(PyExc_AttributeError, "Property container has no dynamic property '%s'", pstr);
return 0;
}
prop->getContainer()->changeDynamicProperty(prop,0,doc);
Py_Return;
} PY_CATCH
}
PyObject* PropertyContainerPy::getEnumerationsOfProperty(PyObject *args)
{
char *pstr;