ZBrushCentral

Help on a "open recent" script

Trying to make a decent Open Recent file type thing, so far I have this limited thing, I would ultimately like to figure out how to save the var after the standard load button is pressed. Any fancy ideas or perhaps a better solution for what I have?

[ISubPalette,Tool:TestTools,1]

[IButton,"Tool:TestTools:Load Tool","Load Your Tool",
[IPress,Tool:Inventory:Load Tool]

//Query's and sets Last Loaded or Saved File
[VarSet,LastFile,[FileNameGetLastUsed]]
[VarSave, LastFile, LastFileData]
,,,]

[IButton,"Tool:TestTools:Load Recent","Load Your most Recent Tool",

//Loads above query and imports the file
[VarLoad, LastFile, LastFileData]
[FileNameSetNext, LastFile]
[IPress,Tool:Inventory:Load Tool],,,]


It’s not possible to monitor the ZBrush interface contstantly using a plugin (and only possible to a limited extent using a zscript) so you can’t capture the existing Load Tool button.

What you could do is combine the actions in your two buttons so that you have a single button. To load a tool of your choice you would just press the button; to load the last loaded you would Shift-click the button (or something along those lines). See the examples in the Code Samples: Suggested ZScript Functionalities thread at the top of this forum.

thanks! cool idea, I have it implimented now, works good.

I’m finding the problem with it now is that I don’t know how to have it save the var after the user saves the tool.

right now all it does is saves the var onces the load is pressed, so if the user saves their file as a new version after a session of zbrushing, the open recent will only load the last loaded. I guess it comes back to not being able to query specific interface items.

Actually, this is a cool idea for a simple SAVE/LOAD TOOL plugin. You might design it so it includes two buttons: SAVE and LOAD RECENT.

Of course the user would be obligated to save their model through your SAVE button instead of the standard TOOL:Save As button allowing you to capture the path and tool file name and push it into a LIFO array which is immediately saved to a file.

When the user presses the LOAD RECENT button, your plugin reloads the array from the file and pops up a note with a list of recent files for the user to choose from, then loads the selected tool.

I like this notion so much I’m thinking of a way to add it to several of my own scripts where it would be handy to have a “recently used” list available.

Sven

Thanks, :slight_smile: Yea, its a rather standard feature, a category zbrush has tended to ignore :confused:

The list idea is good, would be more robust, I’ll have to get more familiar with arrays. What are you refering to when you mention “LIFO”?

LIFO = last in first out…
Sorry, I actually meant the newest filename gets inserted at the top of the array, pushing everything else down, dropping the oldest filename off.

Arrays are simple.

[VarDef, Recentnames(10), “” ]

Save or load the entire array in one command…
[VarSave, Recentnames ]
[VarLoad, Recentnames ]

Sven