issue #0002802: Set a name to coin rootnodes of objects

This commit is contained in:
wmayer
2016-12-15 22:16:19 +01:00
parent d2a5d0de4b
commit 359a25d0c8
5 changed files with 27 additions and 5 deletions

View File

@@ -24,6 +24,7 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <QByteArray>
# include <qpixmap.h>
# include <Inventor/actions/SoSearchAction.h>
# include <Inventor/nodes/SoDrawStyle.h>
@@ -187,6 +188,19 @@ void ViewProviderDocumentObject::attach(App::DocumentObject *pcObj)
ext->extensionAttach(pcObj);
}
void ViewProviderDocumentObject::updateData(const App::Property* prop)
{
if (pcObject && prop == &pcObject->Label) {
// SoBase::setName() replaces characters that according to the
// VRML standard are invalid. To avoid the replacement we use
// the percent encoding.
QByteArray ba(pcObject->Label.getValue());
QByteArray name = ba.toPercentEncoding();
pcRoot->setName(name.constData());
}
ViewProvider::updateData(prop);
}
Gui::Document* ViewProviderDocumentObject::getDocument() const
{
App::Document* pAppDoc = pcObject->getDocument();