While adding scriptability to a File Format plugin, I found myself with a question that the documentation does not directly answer.
The format has optional compression. Scripting aside, this would normally be stored in revertInfo at ReadFinish and retrieved as an initial setting for an Options dialog, to be modified by user and/or later used at WriteStart. That all works fine, because revertInfo is of course associated with the document.
But scripting breaks this in a way that I can't solve. The apparently recommended way to script a File Format is:
* put the property, read when a document is opened, to the descriptor at ReadFinish
* get the property from descriptor before displaying options dialog (if scripting system wants you to show dialog, that is); put the property again, if it's changed
* get the property at WriteStart
Now, it seems from my testing (documentation doesn't address the question) that the ''descriptor'' that is passed in, at least when scripting is not active, is ''global'' to the plugin (shared across documents). This produces unexpected behaviour if you:
* open a document with property FALSE
* open another document, and save with property TRUE
* go back to first document, and save; property is read as TRUE, although revertInfo would be FALSE. (revertInfo is always overridden by the descriptor at OptionsStart.)
The built-in Photoshop formats (e.g. TIFF) did not seem to have this problem, but I can't find a solution, unless it's not overriding revertInfo with the descriptor property at OptionsStart. By not doing so, dialog options would not reflect a scripted setting, so that doesn't seem right.
How is this supposed to be solved?
Subscribe to:
Post Comments
(Atom)
No comments:
Post a Comment