Why does Grasshopper set documents to be modified without any changes?

Hi McNeel

I’m running Rhino v7.34 and I’ve noticed that in Grasshopper if I go to File → Document Properties, but then don’t do anything (repeat, nothing but oggle with my human eyes) except close that pop-up window, an asterisk appears in the title bar of the Grasshopper window indicating it has been modified. Why is that?

Also, I’m developing a GH custom plug-in at the moment and I’m finding that the document of a GH_Cluster is also instantly set to be IsModified=True. You can see this on the canvas if you have a cluster and in a separate C# script component you include:

GH_Document doc = Grasshopper.Instances.ActiveCanvas.Document;
GH_Cluster cluster = (GH_Cluster) doc.Objects.FirstOrDefault(o => o is GH_Cluster);
Print(cluster.Document(null).IsModified.ToString());

Why is that?

Seeing as the IsModified has a setter, is there a principle/rule here in which I can safely set this to be false?

An example use case is my plug-in adding the cluster’s document to the document server to zoom in and display something to the user. This feels messy but, in theory, would it be safe for me to set this to be false when my code knows the cluster hasn’t changed so that the user isn’t presented with a pop-up when they close that cluster editing document if they haven’t actually made any further changes?

Thanks in advance

Probably because I didn’t get around to writing a before/after comparer and just assume that the values have changed. For document properties that’s probably not that hard, comparing cluster documents sounds move involved.

I’ll have a look at the code, but any fixes will go into Rhino 8. I don’t think we’re going to release any more Rhino 7 service releases unless there’s a very good reason.

Logged under: RH-78238 and RH-78239.