Cool plugin idea
-
There are some problems:
- Not sure if there is a way to get the list of last used models.
- There is no way to change the toolbar icons for buttons that has already been created (Webdialog might be an alternative to toolbar - would allow user to vary the size of the thumbs - 24px and 16px isn't much of an icon...)
- It's problematic getting the thumbnails for SketchUp models via SU Ruby
-
And if you use a temporary folder for the latest files?
Succeed to keep the files in a folder "Temp"
UI.openpanel "Open File", "C:\\Temp\\", "*.skp"
-
hmm? you can't reroute where/how SU saves the recent file history..
-
The best you could do is use an AppObserver and keep track of opened and saved files.
-
Records of recent files are stored here
HKEY_USERS/S-1-5-21-1123561945-651377827-1644491937-500/SOFTWARE/Google/SketchUp7/Recent File List
-
A combo of both those would be needed - the observer to detect when to re-read the recent list in the registry.
But where is the list stored on OSX? -
I had another idea, but I don't know if it may be useful.
.skz extension. You save the file to .skp, the plugin compresses it to .zip, and changes the extension from .zip to .skz.
Size of archives may be much smaller with sketchup files. Of course, the plugin reads .skz files too.
-
@thomthom said:
There are some problems:
- Not sure if there is a way to get the list of last used models.
- There is no way to change the toolbar icons for buttons that has already been created (Webdialog might be an alternative to toolbar - would allow user to vary the size of the thumbs - 24px and 16px isn't much of an icon...)
- It's problematic getting the thumbnails for SketchUp models via SU Ruby
This is an outline of what's needed...
You use [already made] a registry/plist entry for the Sketchup App' as 'RecentSKPs', 'Item0, 'Item1', 'Item2' etc up to 'Item11' - there are say 12 in all to allow for non-existent SKP's later [it only uses the first 6 out of the 12 anyway].
They are each set to '' initially and get populated with a file-path as you use the tool later...
You need the tool to run on 'Save' [usingModelObserver.onSaveModel(model)
] and to read the model's file-path and also to read the Sketchup App' RecentSKPs-set [all 12 items], making an array of the saved file-paths from each of these 'Items'.
It unique array from it - finding duplicate paths and removing them [noting their 'index' for the icons' updating too***], and it therefore removes duplicated file-paths if the file were already saved earlier with that path.
It also removes any entries where theFiles.exist?(file_path)
returns 'false
' - i.e. the file no longer exists.
If there are then fewer than 12 items then it pads out any later items in the array with ''.
It then uses the 12 item array to rewrite the registry/plist entries for the Sketchup App' 'RecentSKPs' 'Item0', 'Item1', 'Item2' etc up to 'Item11'.
It then uses the first 6 of these values to make the webdialog's html dynamically, this varies as as the list registry/plist entries changes...
The related 'icon' files are made by usingview.write_image(...)
as each SKP is saved. This PNG image is saved into a folder in../Plugins/
[taken from the Ruby's file location?] called../RecentSKPicons/
each PNG is named 0.png, 1.png, 2.png etc up to 11.png. ***As the registry/plist entries are updated/deleted the equivalent PNG is either deleted or renamed to match its equivalent registry/plist Item reference - the latest file-path's PNG is always called 0.png.
This is a major 'managenent' headache... BUT it is quite doable...
Clicking on a SKP's name or its icon in the dialog [which can be open at all times and minimized when not in use?] opens that SKP file.
-
Just as a heads up, Win 7 allows a right click in the task bar which gives you the last 10 opened files.
-
We're trying to find a 'cross-platform' solution though...
-
Adding to TIGs design specs:
With a crude PNG sniffer one can get the thumbnails for unopened .skp files. (I have such a sample already)
You could get away with just one temp thumbnail file, to use when writing out thumbnails from opened files. After writing it you can read it into ruby and pass it to the webdialog in base64 format and use that in a data URI. http://en.wikipedia.org/wiki/Data_URI_scheme (Note that this requires IE8 or newer)
-
Wow
I hope this works!
is anyone activly working on it?
-
I am not, unfortunately. Caught up in some other projects right now.
-
@tig said:
We're trying to find a 'cross-platform' solution though...
I understand that Tig, I just mentioned it because I thought perhaps some of the coding from Win 7 might help to make it work.
Advertisement