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:
@@ -110,10 +110,26 @@ public:
|
||||
virtual const char* getViewProviderName(void) const {
|
||||
return "";
|
||||
}
|
||||
/// This function is introduced to allow Python feature override its view provider
|
||||
/**
|
||||
* This function is introduced to allow Python feature override its view provider.
|
||||
* The default implementation just returns \ref getViewProviderName().
|
||||
*
|
||||
* If this method is reimplemented in sub-classes then also reimplement \ref
|
||||
* allowOverrideViewProviderName() accordingly.
|
||||
*/
|
||||
virtual const char *getViewProviderNameOverride() const {
|
||||
return getViewProviderName();
|
||||
}
|
||||
/**
|
||||
* The function indicates whether the object type allows to define a view provider type
|
||||
* different than the standard type. The default implementation returns false.
|
||||
* The function can be overriden by Python feature to return true where the type can be
|
||||
* retrieved from its proxy object.
|
||||
* \sa getViewProviderNameOverride()
|
||||
*/
|
||||
virtual bool allowOverrideViewProviderName() const {
|
||||
return false;
|
||||
}
|
||||
/// Constructor
|
||||
DocumentObject(void);
|
||||
virtual ~DocumentObject();
|
||||
|
||||
Reference in New Issue
Block a user