Accessing application preferences in Lua

Forums: Accessing application preferences in Lua
Forum for OctaneRender Lua scripting examples, discussion and support.

Accessing application preferences in Lua

Postby stratified » Tue Jan 07, 2014 4:32 am

stratified Tue Jan 07, 2014 4:32 am
Hi all,

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
User avatar
stratified
OctaneRender Team
OctaneRender Team
 
Posts: 945
Joined: Wed Aug 15, 2012 6:32 am
Location: Auckland, New Zealand

Re: Accessing application preferences in Lua

Postby Tugpsx » Tue Jan 07, 2014 4:58 am

Tugpsx Tue Jan 07, 2014 4:58 am
Awesome! Thanks with the next release and combined with the object loader this should be key to storing and recalling paths
Dell Win Vista 32 | NVIDIA Quadro NVS135M | Core2 Duo T7500 2.20GHz | 4GB
CyberPowerPC Win 7 64| NVIDIA GTX660Ti (3G) GTX480(1.5G) | 16GB
Tugpsx
Licensed Customer
Licensed Customer
 
Posts: 1058
Joined: Thu Feb 04, 2010 8:04 pm
Location: Chicago, IL

Return to Lua Scripting


Who is online

Users browsing this forum: No registered users and 0 guests

Mon Aug 26, 2019 8:06 am [ UTC ]