[Closed] Storing maxscript snippets
Hi,
I’ve recently released a script to store and manage maxscript snippets. It’s called Shred. Check it out on scriptspotor on my site. There’s also pretty good documentation if I may say so myself!
I know it’s a shameless plug, but since we’re mostly scripters here I thought it might be useful. If you’re like me and forgetting stuff you write all the time it really helps. Shred has features specific to maxscript (such as “execute code” or “copy as struct”) but you can use it to store any kind of text or code really.
If you’re looking for something outside of 3dsMax Vojtech Cada (Swordslayer) suggested a tool called Qsnipps.
I’m wondering, how do you remember where your clever bits of code are? I’m always impressed by DenisT for instance when he recalls when and where he made a cool function and is able to reproduce it here.
Hi Grabjacket,
I would like to try it out, since it looks really helpful to me.
However, i am not running max as admin and that prevents me from accessing the xml in the max root. Is there way to put it to the user directory instead?
Cheers, Heilandzack
Hi Luke,
there shouldn’t be any xml saved to the max root. But in all the excitement of this release it appears I’ve messed with the installation/startup procedure. Could you tell me what the listener says?
and make sure you’re using the latest version: https://www.dropbox.com/s/w3kcyxh48y9flhj/INSTALLER_Shred_2015-09-14_11-35-57_0.04.mzp?dl=0
EDIT: I’ve found the situation which creates an xml file somewhere you might not have rights to. When starting up the first time a new repository is made on your desktop. You can move this later if you want.
Lukas,
I’ve found that issue and now create a default repository on your desktop upon startup. Link is in the post above. Let me know how it goes! Otherwise: mail at klaasnienhuis dot nl
yeah, got it working now!
So far it works quite good, i’m gonna try to use it from now and let you know about ideas and problems.
One thing: It is not possible to tab through the metadata fields. It would be good, since i use tabbing a lot on the max UI.
edit: another idea:
Right now it seems like the shreds are saved with a unique ID as identifier. Do you think it is possible to use the name of the shred itself? This way it would also be possible to manipulate them with an external editor.
Hi Lukas,
thanks for the feedback. That really helps.
I’d love to implement tabbing! I tried it before and couldn’t get it to work though. I’ll ask around on this forum to see if it’s possible. It’s a .net gui which behaves a bit different in this regard.
The unique ID is to protect you issues when shreds are named the same or when using characters in the shred-name which are illegal in a filename. I can add a button in the toolbar to open a windows explorer at the shred you’ve selected though. That should make it easier to locate it and drop it into an editor such as notepad++, sublime or the regular maxscript editor.
You can add the user defined name as a suffix. For example, the shred will set the name to:
235656165798765415748
If the user wants to set the name manualy, for example to “edit_poly_fn”, then the final name will be:
235656165798765415748-edit_poly_fn
The filterString(or similar dotnet command) and the shred can works with both names.
In that case I only need to make sure the user doesn’t use characters in the shred name which are illegal in filenames. Do you know of a method to take care of that?
Stripped from RTT_Methods struct and slightly modified:
-- function to make a filename valid by replacing illegal characters with a '_'
function MakeFileNameValid fileName = -- fname must be just filename, no path....
(
local illegal_characters =":/\\~!@#$%^&*()+=|'?><;[]{}\"" -- illegal characters in file name
local res = copy fileName
-- make sure the object name is legal for a filename
local count = res.count
for i = 1 to count do
if (findString illegal_characters res[i]) != undefined do -- replace illegal characters with _
res[i] = "_"
res
)
i remember that i put a regex for file validator and for max node name validator on this forum.
ha! If only you’d stored that in shred, you’d find it back in a jiffy…