Gui: support in-place editing

The link support means that an object can now appear in more than one
places, and even inside a document different from its own. This patch
adds support for in-place editing, meaning that the object can be edited
at correct place regardless where it is.

See [here](https://git.io/fjPIk) for more info about the relavent APIs.

This patch includes two example of modifications to support in-place
editing. One is the ViewProviderDragger, which simply adds the dragger
node to editing root node by calling
View3DInventorViewer::setupEditingRoot(dragger). The other much more
complex one is ViewProviderSketch which calls setupEditingRoot(0) to
transfer all its children node into editing root. ViewProviderSketch
also includes various modifications to command invocation, because we
can no longer assume the active document is the owner of the editing
object.

This patch also includes necessary modification of the 'Show' module to
support in-place editing.
This commit is contained in:
Zheng, Lei
2019-07-10 12:41:44 +08:00
committed by wmayer
parent 576d51a78a
commit d4ac072306
29 changed files with 1449 additions and 942 deletions

View File

@@ -165,6 +165,9 @@ PyMethodDef Application::Methods[] = {
{"activateView", (PyCFunction)Application::sActivateView, METH_VARARGS,
"activateView(type)\n\n"
"Activate a view of the given type of the active document"},
{"editDocument", (PyCFunction)Application::sEditDocument, METH_VARARGS,
"editDocument() -> object or None\n\n"
"Return the current editing document or None if no one exists" },
{"getDocument", (PyCFunction) Application::sGetDocument, METH_VARARGS,
"getDocument(string) -> object\n\n"
"Get a document by its name"},
@@ -203,6 +206,20 @@ PyMethodDef Application::Methods[] = {
{NULL, NULL, 0, NULL} /* Sentinel */
};
PyObject* Gui::Application::sEditDocument(PyObject * /*self*/, PyObject *args)
{
if (!PyArg_ParseTuple(args, "")) // convert args: Python->C
return NULL; // NULL triggers exception
Document *pcDoc = Instance->editDocument();
if (pcDoc) {
return pcDoc->getPyObject();
}
else {
Py_Return;
}
}
PyObject* Gui::Application::sActiveDocument(PyObject * /*self*/, PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))