issue #0002802: Set a name to coin rootnodes of objects
This commit is contained in:
parent
1ec381a07f
commit
b97f93c5a8
|
@ -97,7 +97,10 @@ void SceneModel::setNode(QModelIndex index, SoNode* node)
|
|||
for (int i=0; i<group->getNumChildren();i++) {
|
||||
SoNode* child = group->getChild(i);
|
||||
setNode(this->index(i, 0, index), child);
|
||||
this->setData(this->index(i, 1, index), QVariant(QString::fromLatin1(child->getName())));
|
||||
// See ViewProviderDocumentObject::updateData
|
||||
QByteArray name(child->getName());
|
||||
name = QByteArray::fromPercentEncoding(name);
|
||||
this->setData(this->index(i, 1, index), QVariant(QString::fromUtf8(name)));
|
||||
}
|
||||
}
|
||||
// insert icon
|
||||
|
|
|
@ -263,13 +263,14 @@ SbMatrix ViewProvider::convert(const Base::Matrix4D &rcMatrix) const
|
|||
dMtrx[12],dMtrx[13],dMtrx[14], dMtrx[15]);
|
||||
}
|
||||
|
||||
void ViewProvider::addDisplayMaskMode( SoNode *node, const char* type )
|
||||
void ViewProvider::addDisplayMaskMode(SoNode *node, const char* type)
|
||||
{
|
||||
_sDisplayMaskModes[ type ] = pcModeSwitch->getNumChildren();
|
||||
pcModeSwitch->addChild( node );
|
||||
node->setName(type);
|
||||
_sDisplayMaskModes[type] = pcModeSwitch->getNumChildren();
|
||||
pcModeSwitch->addChild(node);
|
||||
}
|
||||
|
||||
void ViewProvider::setDisplayMaskMode( const char* type )
|
||||
void ViewProvider::setDisplayMaskMode(const char* type)
|
||||
{
|
||||
std::map<std::string, int>::const_iterator it = _sDisplayMaskModes.find( type );
|
||||
if (it != _sDisplayMaskModes.end())
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -62,6 +62,7 @@ public:
|
|||
App::PropertyBool Visibility;
|
||||
|
||||
virtual void attach(App::DocumentObject *pcObject);
|
||||
virtual void updateData(const App::Property*);
|
||||
/// Set the active mode, i.e. the first item of the 'Display' property.
|
||||
void setActiveMode();
|
||||
/// Hide the object in the view
|
||||
|
|
|
@ -180,6 +180,9 @@ void ViewProviderGeometryObject::updateData(const App::Property* prop)
|
|||
Base::Placement p = static_cast<const App::PropertyPlacement*>(prop)->getValue();
|
||||
updateTransform(p, pcTransform);
|
||||
}
|
||||
else {
|
||||
ViewProviderDocumentObject::updateData(prop);
|
||||
}
|
||||
}
|
||||
|
||||
bool ViewProviderGeometryObject::doubleClicked(void)
|
||||
|
|
Loading…
Reference in New Issue
Block a user