I’m currently trying to load a Krakatoa preset (from a custom path would be perfect) and to set dynamically selection sets active in the Matte Object rollout.
I have already tried to found those informations in the KrakatoaGUI.ms, but honestly, i can’t understand the structure, too complex for me ^^.
So, am i asking for something impossible ? And if it is possible, have you some clues, some more precise way to explore ? Because i’m a little bit lost !
Thanks in advance
Corentin (french with an approximate english level)
Unfortunately, currently there is no easy way to run a MAXScript function and load a preset without opening the UI.
It would require a completely new function to be written that does unattended loading of the preset without building the treeview dialog normally associated with the loading.
It is not impossible, but it sounds like I will have to write it as it is a bit convoluted. Also, the presets are generally saved at UI level and update the UI controls, not directly the renderer. It was a deliberate decision in order to be able to list the exact control names in the UI and handle them per rollout, reflecting the structure of the Krakatoa GUI. It would be much easier to save and load directly the properties of the renderer, but that would not let you use the existing presets and history records Krakatoa already creates.
If you can explain WHY you are trying to do what you are trying to do, it would help me figure out the right way to help…
So, i want to do that, because i’m working on my student short-movie, and i’m scripting a tool allowing to automatize all the render steps (vray and krakatoa, some characters are meshes, some others are particles), because we have too many processes, and i would be impossible to do that manually, for 130 shots. I have two types (hair and “classic” particles) of particles in each shot, so i have to apply two types of settings. But maybe it would be easier to write my preset directly in the code (maxscript), parameters by parameters, i will do some tests in that way, maybe it will be enough !
Actually writing your own preset system is rather easy. I was talking about the presets that are currently available throughout the Krakatoa GUI itself (the ones that open a tree view with all parameters).
--function to save all Krakatoa Renderer settings to an INI file
fn saveKMXPreset presetFile =
(
for p in FranticParticleRenderMXS.getPropNames() do
setIniSetting presetFile "Krakatoa" p ((FranticParticles.getProperty p) as string)
)
--function to LOAD the saved preset to the Krakatoa Renderer
fn loadKMXPreset presetFile =
(
local theKeys = getIniSetting presetFile "Krakatoa"
for p in theKeys do
FranticParticles.SetProperty p (getIniSetting presetFile "Krakatoa" p)
FranticParticleRenderMXS.GlobalRefreshGUI()
)
thePresetFile = (GetDir #temp + "\\kmxpreset.ini") --define a preset file - file extension does not matter
saveKMXPreset thePresetFile --save the current settings
edit thePresetFile --look at the result in the MXS Editor
--now change some settings in the Krakatoa UI manually and then run
loadKMXPreset thePresetFile --load the stored preset - the UI should revert to the old settings
--In both cases, Krakatoa MUST be the current renderer, otherwise an error will be shown.
Hey ! This is exactly what I needed ! Thank you VERY much !
By the way, i’m looking throught KrakatoaGUI.ms for the command allowing to add selections set in the active matte objects array, and also to activate the “> Save Multiple Layers” option…
I just find:
FranticParticles.SetProperty "Matte:UseMatteObjects" (state as string)
FranticParticles.SetProperty "Matte:SaveMultipleLayers" (state as string)
Matte:UseMatteObjects is the state of the Use Matte Objects checkbutton. All Krakatoa properties are stored internally as strings, hence the “as string” part.
Matte:SaveMultipleLayers is the state of the Use Multiple Objects checkbutton.
The names of the selection sets to be used are also stored in the properties as an array. Take a look at the function saveSelectionSets() to see how we convert the array of the listbox.items to a string with an array inside. You can say