[Closed] Export / Import Modifier and Utilities Button Sets through Script?
I am constantly bettering my routines regarding saving my personal Max settings. Among them are the Modifier Set and Utility Button Set.
It it possible through Max Script to export these settings (they are stored in the %localappdata%\Autodesk\3dsMax\2013 – 64bit\ENU\3dsmax.ini file) for future import?
If so, could anyone suggest a script?
Thanks!
fn getCurrentModifierSet asname:off =
(
ini = getMAXIniFile()
i = getinisetting ini #ModifierSets "CurrentModSet"
s = getinisetting ini #ModifierSets ("ModSetEntry" + i as string)
ids = filterstring s " "
ids = for k=1 to ids.count-1 by 2 collect [ids[k] as integer, ids[k+1] as integer]
modis = #()
for modi in Modifier.classes where (k = finditem ids [modi.classid[1], modi.classid[2]]) != 0 do modis[k] = if asname then modi.localizedname else modi
modis
)
/*
getCurrentModifierSet()
*/
similar for utilities…
Thanks Denis!
I have a few more questions;
- While ModifierSets is one word, Utility Sets are two words in the 3dsmax.ini.
- This function is for reading the current modifier sets. How should I do to write it back to the maxini-file?
Sorry Denis, I was unclear in my first question (the sentence was incomplete )
So let me start over.
I think I understand the MaxScript – forgive me my very non-technical termimology:
- it defines what ini file to look in; the 3dsmax.ini
- it checks which CurrentModSet is active
- it checks which MdSetEntries there are
- … it converts those numbers into Modifier names through its classID number, for example 2041212445 is Edit Poly.
When it comes to Utility Sets:
i = getinisetting ini #ModifierSets "CurrentModSet"
Above, you used a #-sign for the word ModifierSets. Since Utility Sets are two words, I couldn’t (didnt know how to) do so, but wrote instead:
i = getinisetting ini "Utility Sets" "CurrentModSet"
But that was not the end of it.
It seems like when your script gets to the part where it tries to find the item names for the utilities, it fails.
However, I realize that I dont really need the names.
What I wish for, is a script with two functions, GetCurrentSets and SetCurrentSets so to say. One function that saves out a file with the ID’s, and another function that reads the IDs from that file.
By this, you create a script that backups your Modifier/Utility Sets and restores them.
Thanks again.
i gave a function that gets modifier sets form the ini file. using reverse engineering you can make a function that sets modifier sets to the ini file.
Thank you kindly for your effort. Really appreciate it
Unfortunately, my skills in MaxScripting are at the bottom. I am completely dependent on the skills of you MaxScript geniuses.
So if anyone else has the time and energy for the second part (save + import), I would be very grateful!
if you want to know how it works try to figure it out yourself or just use it:
fn setModifierSet name modifirers ini: current:off =
(
if ini == unsupplied do ini = getMAXIniFile()
ss = getinisetting ini "ModifierSets"
count = 0
id = -1
for s in ss while id == -1 where matchpattern s pattern:"ModifierSetName*" do
(
if (getinisetting ini "ModifierSets" s) == name then id = count else count += 1
)
if id == -1 do id = count
id = id as string
setinisetting ini #ModifierSets ("ModifierSetName" + id) name
modis = ""
for class in modifirers do modis += class.classid[1] as string + " " + class.classid[2] as string + " "
setinisetting ini #ModifierSets ("ModSetEntry" + id) modis
if current do setinisetting ini #ModifierSets "CurrentModSet" id
id as integer
)
/*
setModifierSet "Mapping Modifiers" #(Unwrap_UVW, UVWMap)
*/