Add virtual method allowOverrideViewProviderName to DocumentObject to indicate if a DocumentObject's view provider type can be overriden.
For most object types this is not allowed to avoid to create incompatible combinations via Python or manipulated project files and possibly provoke crashes. For more details see also: https://forum.freecadweb.org/viewtopic.php?f=10&t=38970&p=333951#p333951
This commit is contained in:
@@ -51,6 +51,7 @@ public:
|
||||
bool onBeforeChangeLabel(std::string &newLabel);
|
||||
void onChanged(const Property* prop);
|
||||
void onDocumentRestored();
|
||||
bool allowOverrideViewProviderName() const;
|
||||
std::string getViewProviderName();
|
||||
PyObject *getPyObject(void);
|
||||
|
||||
@@ -192,7 +193,10 @@ public:
|
||||
}
|
||||
return DocumentObject::StdReturn;
|
||||
}
|
||||
virtual const char* getViewProviderNameOverride(void) const override{
|
||||
virtual bool allowOverrideViewProviderName() const {
|
||||
return imp->allowOverrideViewProviderName();
|
||||
}
|
||||
virtual const char* getViewProviderNameOverride(void) const override {
|
||||
viewProviderName = imp->getViewProviderName();
|
||||
if(viewProviderName.size())
|
||||
return viewProviderName.c_str();
|
||||
|
||||
Reference in New Issue
Block a user