App: Property related API changes
Property: * Extended property status bitset. Mirror most of PropertyType and allow dynamic change property type. * Cache property name and type to improve performance * Centralize property status change signalling * Change aboutToSetValue()/hasSetValue() to virtual * Add new API getFullName() to obtain full quanlified name of the property AtomicPropertyChangeInterface: * Allow calling aboutToSetValue()/hasSetValue() when actually changed PropertyLists: * Refactor implementation by an abstract class PropertyListBase and a template class PropertyListsT, to allow better code reuse. PropertyListT is derived from AtomicPropertyChangeInterface to allow more efficient change on individual elements. * All list type property now accept setting python value as a dictionary with index as key to set individual element of a list. * Add touch list for more efficient handling of value changes. The list contains the index of changed value. And empty touch list should be treated as the entire list is changed. PropertyContainerPy expose this functionality with getPropertyTouchList(). PropertyPersistentObject: * New property to allow dynamic creation of any FreeCAD object derived from Base::Persistence, and use it as a property. DynamicProperty: * Use boost multi_index_container for efficient property lookup while keeping order. * Modify to be allowed to use in PropertyContainer directly PropertyContainer: * Use boost multi_index_container for efficient property lookup while keeping order. * Allow adding/removing dynamic property on all property container * Modify Save/Restore() to persist property status, and better handle transient property which can now be dynamically enabled/disabled per object. * Add new API getFullName() to obtain full quanlified name of the property. Implemented by Document, DocumentObject, and also ViewProviderDocumentObject if future patch DocumentObject and FeaturePython are modified to accommondate the dynamic property changes. Removed get/setCustomAttribute() implementation from DocumentObjectPy, and rely on PropertyContainerPy for the implementation, because of the additional dynamic property support in property container. Gui::ViewProviderDocumentObject, which is derived from PropertyContainer, is also modified accordingly
This commit is contained in:
@@ -89,6 +89,15 @@ public:
|
||||
virtual void finishRestoring();
|
||||
//@}
|
||||
|
||||
virtual bool removeDynamicProperty(const char* prop) override;
|
||||
|
||||
virtual App::Property* addDynamicProperty(
|
||||
const char* type, const char* name=0,
|
||||
const char* group=0, const char* doc=0,
|
||||
short attr=0, bool ro=false, bool hidden=false) override;
|
||||
|
||||
virtual std::string getFullName() const override;
|
||||
|
||||
protected:
|
||||
/*! Get the active mdi view of the document this view provider is part of.
|
||||
@note The returned mdi view doesn't need to be a 3d view but can be e.g.
|
||||
@@ -127,10 +136,12 @@ protected:
|
||||
/** @name Transaction handling
|
||||
*/
|
||||
//@{
|
||||
/// \internal get called when removing a property of name \a prop
|
||||
void onAboutToRemoveProperty(const char* prop);
|
||||
virtual bool isAttachedToDocument() const;
|
||||
virtual const char* detachFromDocument();
|
||||
|
||||
/// get called when a property status has changed
|
||||
virtual void onPropertyStatusChanged(const App::Property &prop, unsigned long oldStatus) override;
|
||||
|
||||
//@}
|
||||
|
||||
protected:
|
||||
@@ -140,6 +151,7 @@ protected:
|
||||
private:
|
||||
std::vector<const char*> aDisplayEnumsArray;
|
||||
std::vector<std::string> aDisplayModesArray;
|
||||
bool _UpdatingView;
|
||||
|
||||
friend class Document;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user