jriegel wrote:Really nice!
Thanks. I was hoping you would respond. I wanted to get your opinion on how I achieved this change, as I am starting to intrude on the "core". Here is the diff for the difference in the "old", "new" picture in the above post.
Code: Select all
tanderson@tanderson-Utopic:~/Programming/freeCad/free-cad-git$ git diff c198369 cf17e1c
diff --git a/src/App/DocumentObject.h b/src/App/DocumentObject.h
index 3f0b07a..0191464 100644
--- a/src/App/DocumentObject.h
+++ b/src/App/DocumentObject.h
@@ -49,6 +49,14 @@ enum ObjectStatus {
Expand = 16
};
+/*!Used to describe feature process*/
+enum class ObjectDescriptor
+{
+ None = 0,
+ Create,
+ Alter
+};
+
/** Return object for feature execution
*/
class AppExport DocumentObjectExecReturn
@@ -138,6 +146,8 @@ public:
* -1: the document examine all links of this object and if one is touched -> recompute
*/
virtual short mustExecute(void) const;
+
+ virtual ObjectDescriptor getDescriptor() const {return ObjectDescriptor::None;}
/// get the status Message
const char *getStatusString(void) const;
//removed irrelevant changes to dagview model
...
diff --git a/src/Mod/Part/App/DatumFeature.h b/src/Mod/Part/App/DatumFeature.h
index 0e744d5..940fc64 100644
--- a/src/Mod/Part/App/DatumFeature.h
+++ b/src/Mod/Part/App/DatumFeature.h
@@ -53,6 +53,8 @@ public:
/// Return a shape including Placement representing the datum feature
TopoDS_Shape getShape() const;
+
+ virtual App::ObjectDescriptor getDescriptor() const override {return App::ObjectDescriptor::Create;}
protected:
void onChanged (const App::Property* prop);
diff --git a/src/Mod/Sketcher/App/SketchObject.h b/src/Mod/Sketcher/App/SketchObject.h
index 45ef542..d3ca9fa 100644
--- a/src/Mod/Sketcher/App/SketchObject.h
+++ b/src/Mod/Sketcher/App/SketchObject.h
@@ -56,6 +56,7 @@ public:
const char* getViewProviderName(void) const {
return "SketcherGui::ViewProviderSketch";
}
+ virtual App::ObjectDescriptor getDescriptor() const override {return App::ObjectDescriptor::Create;}
//@}
/// add unspecified geometry
Really basic, just an enum added to App::DocumentObject and a virtual method added to App::DocumentObject and a couple of test subclasses. Note: The very first post of this thread was describing this. This works good for the dag layout engine, but I see these document object descriptors as having a lot more potential than just laying out the dagview. For example: when walking(visitors) up and down the graph for some other operation, the descriptors could be used to determine what path to take when there is a fork. I can put together a visual of an example situation, if this doesn't make sense.
tangent thought: If I remember correctly, you mentioned in another thread about the document having an actual graph in the future. Maybe what I am talking about, is something that would be best be served after a document graph implementation?
Thoughts?