how do I tell if a scene has changed since it was last saved?

hypersuperduper

New member
I have a new lscript I am working on that inspects the scene file to help identify and present dependencies and references to the selected object in the scene. It works pretty well, and can find everything from expression references to nodal motion references to ik dependencies and spline control but since I am parsing the scene file I want to make sure that it is up to date because inspecting an out of date scene file will give the user bad info. I could of course just make the script save the scene, but that seems a little presumptive. what i would like to do is trigger an error if you have changes in layout that aren't saved, so that the user has an opportunity to save the scene.

How do I go about checking if the scene has been changed?
 

jwiede

Electron wrangler
Well, not quite what you asked for, and be aware really complex scenes can take a while to load/save, but if you want to be certain to inspect a "current" copy of the scene, what you could do is "SaveSceneCopy" the scene off to wherever the TEMP env var points and then use that as the basis for your analysis.

Perhaps initially present a dialog stating "Scene has changes from last save" if scene is changed, give options to "Use Disk File" / "Save Scene" / "Cancel"?

Short of installing a MasterHandler of some sort, watching for any change messages, then interacting via comring or something, I'm not sure there is a "direct" API or means of determining whether the scene has been "changed".
 
Last edited:

jwiede

Electron wrangler

Hmm, interesting, goes back quite a ways too (copyrighted 2007 back in the 11.5 LWSDK). I see it in C/C++ LWSDK as well (lwchange.h), but it doesn't appear to be referenced in the docs anywhere, AFAICT.

I tried some experiments to see if any obvious object agents existed ("Change()", "Changed()", "Changes()", "ChangeFuncs()", etc.) but none were found. I'm starting to doubt either the object agent or methods exist in lscript, based on experiments and some other digging, but if they do, I'd be interested in as what?
 
Last edited:

hypersuperduper

New member
Well, not quite what you asked for, and be aware really complex scenes can take a while to load/save, but if you want to be certain to inspect a "current" copy of the scene, what you could do is "SaveSceneCopy" the scene off to wherever the TEMP env var points and then use that as the basis for your analysis.

Perhaps initially present a dialog stating "Scene has changes from last save" if scene is changed, give options to "Use Disk File" / "Save Scene" / "Cancel"?

Short of installing a MasterHandler of some sort, watching for any change messages, then interacting via comring or something, I'm not sure there is a "direct" API or means of determining whether the scene has been "changed".

I was considering this approach as well. I am not concerned about process time. It already takes a few seconds to inspect a complex scene, so a few more seconds is not going to make a difference. Is there a way to make sure that the scene copy is finished saving before performing the inspection?
 
Top Bottom