Well I got it working, however the stored color values reset after you close ZBrush…
Is there a way to store the current value of a number variable to a file and then load that stored value back into the variable the next time the script runs?
I tried VarSave and VarLoad but it didn’t work.
I mean, when the script re-runs after the program has been closed and re-opened the variables get re-declared at a value of 0. Where would you put in the VarLoad command so that the variables get updated with the saved information? Right now I have the declaration coming first followed by the VarLoad commands that are put into a button called “initialize” which also does a few other things. Here’s what the script looks like…
//Declare Variables
//M2
[VarDef,colorStoreRb,0]
[VarDef,colorStoreGb,0]
[VarDef,colorStoreBb,0]
//M1
[VarDef,colorStoreRa,0]
[VarDef,colorStoreGa,0]
[VarDef,colorStoreBa,0]
//Initialize: (This button replaces the least useful default materials with user made materials then reselects the default red wax material.)
[IButton,“Initialize”,“Press this before doing anything else”,
[IPress,Material:Fibers1]
[FileNameSetNext,“M2.zmt”][IPress,Material:Save]
[FileNameSetNext,“M2.zmt”][IPress,Material:Load]
[IPress,Material:DoubleDotsOmetal]
[FileNameSetNext,“M1.zmt”][IPress,Material:Save]
[FileNameSetNext,“M1.zmt”][IPress,Material:Load]
[IPress,Material:M2]
[FileNameSetNext,“MrgbPallete Session Backup\M2.zmt”][IPress,Material:Load]
[VarLoad,colorStoreRb,“Mrgb Session.zvr”]
[VarLoad,colorStoreGb,“Mrgb Session.zvr”]
[VarLoad,colorStoreBb,“Mrgb Session.zvr”]
[IPress,Material:M1]
[FileNameSetNext,“MrgbPallete Session Backup\M1.zmt”][IPress,Material:Load]
[VarLoad,colorStoreRa,“Mrgb Session.zvr”]
[VarLoad,colorStoreGa,“Mrgb Session.zvr”]
[VarLoad,colorStoreBa,“Mrgb Session.zvr”]
[IPress,Material:MatCap Red Wax]
]
//Button 1
//Loads MRGB
[IButton,“selectMrgb”,“Select the stored Material and Color”,
[ISet,Color:R,colorStoreRa]
[ISet,Color:G,colorStoreGa]
[ISet,Color:B,colorStoreBa]
[IPress,Material:M1]
]
//Stores MRGB
[IButton,“R”,“Store the current Material and Color to the palette button”,
[VarSet,colorStoreRa,Color:R]
[VarSet,colorStoreGa,Color:G]
[VarSet,colorStoreBa,Color:B]
[VarSave,colorStoreRa,“Mrgb Session.zvr”]
[VarSave,colorStoreGa,“Mrgb Session.zvr”]
[VarSave,colorStoreBa,“Mrgb Session.zvr”]
[IPress,Material:CopyMat]
[IPress,Material:M1]
[IPress,Material:M1]
[IPress,Material:PasteMat]
[FileNameSetNext,“M1.zmt”][IPress,Material:Save]
[FileNameSetNext,“MrgbPallete Session Backup\M1.zmt”][IPress,Material:Save]
]
//Button 2
//Loads MRGB
[IButton,“selectMrgb”,“Select the stored Material and Color”,
[ISet,Color:R,colorStoreRb]
[ISet,Color:G,colorStoreGb]
[ISet,Color:B,colorStoreBb]
[IPress,Material:M2]
]
//Stores MRGB
[IButton,“R”,“Store the current Material and Color to the palette button”,
[VarSet,colorStoreRb,Color:R]
[VarSet,colorStoreGb,Color:G]
[VarSet,colorStoreBb,Color:B]
[VarSave,colorStoreRb,“Mrgb Session.zvr”]
[VarSave,colorStoreGb,“Mrgb Session.zvr”]
[VarSave,colorStoreBb,“Mrgb Session.zvr”]
[IPress,Material:CopyMat]
[IPress,Material:M2]
[IPress,Material:M2]
[IPress,Material:PasteMat]
[FileNameSetNext,“M2.zmt”][IPress,Material:Save]
[FileNameSetNext,“MrgbPallete Session Backup\M2.zmt”][IPress,Material:Save]
]