On request we've added access to the user's preferences in lua. Don't worry, credentials aren't accessible in lua.
In Octane, preferences are stored in an internal node of type
octane.NT_LOCAL_APP_PREFS
. You can fetch it by calling octane.project.getPreferences()
. Getting and setting preferences is a matter of manipulating a node.Here's a small example:
- Code: Select all
-- get the local preferences node
local prefs = octane.project.getPreferences()
-- get the directories
print(prefs:getAttribute(octane.A_LAST_PROJECT_DIRECTORY))
print(prefs:getAttribute(octane.A_LAST_IMAGE_DIRECTORY))
print(prefs:getAttribute(octane.A_LAST_GEOMETRY_DIRECTORY))
print(prefs:getAttribute(octane.A_LAST_RENDER_DIRECTORY))
-- update the script image directory, if you would check your preferences in the
-- standalone, they've changed.
prefs:setAttribute(octane.A_SCRIPT_DIRECTORY, "/tmp/")
If you can, always avoid modifying a user's preferences. If you can't be transparent about it. Silently modifying a user's preferences is not cool!
If there are any questions, just ask.
cheers,
Thomas