3.89 is up.
-3.89 - Added a generic input prompt method, noesis.userPrompt.
-3.89 - Added a new method for scripts to regiser tools, noesis.registerTool. New tools will be listed under the Noesis "Tools" menu once they're registered.
-3.89 - Added anaglyphic stereoscopic rendering, which can be enabled through the data viewer. (Persistent settings->View->Anaglyph 3D) Anaglyphic rendering obeys all of the same stereo settings as quadbuffered stereo rendering. (quadbuffering is only functional, to my knowledge, on nVidia Quadro cards)
-3.89 - Fixed matrix translation being uninitialized memory when converting a quaternion to a 4x3 matrix in Python.
-3.89 - User preference version value has been changed, so your preferences will be reset when you run this version.
-3.89 - Other assorted fixes and additions that I've lost track of.
Here's an example script showing how to register a tool and how to use noesis.userPrompt. You can save it as tool_test.py in your python folder to test it.
Code: Select all
from inc_noesis import *
import os
def registerNoesisTypes():
handle = noesis.registerTool("&Test tool script", testToolMethod)
return 1
def testValidateInput(inVal):
if os.path.isdir(inVal) is not True:
return "'" + inVal + "' is not a valid directory path!"
return None
def testToolMethod(toolIndex):
r = noesis.userPrompt(noesis.NOEUSERVAL_FOLDERPATH, "Open Folder", "Go find a folder.", "", testValidateInput)
if r is None:
return 0
noesis.messagePrompt("Selected '" + r + "'")
return 0
Currently, your tool can only access the noesis module, not the rapi module. I plan to allow querying the active loaded preview model and hooking into the rapi interface for the active preview at some point in the future, which will expand what you can do with tools scripts. For now, it's mostly useful for writing simple one-off tasks that you find useful during your Noesis usage. I'm going to write a binary find in files tool script next time I get a chance, because I can't find a nice tool to do that already.
Also, noesis.userPrompt has a number of native possible query types:
Code: Select all
NOEUSERVAL_STRING,
NOEUSERVAL_FLOAT,
NOEUSERVAL_INT,
NOEUSERVAL_BOOL,
NOEUSERVAL_FILEPATH,
NOEUSERVAL_FOLDERPATH,
Your validation method will receive the inVal parameter in the appropriate native Python type, so you could do something like this too:
Code: Select all
from inc_noesis import *
def registerNoesisTypes():
handle = noesis.registerTool("&Test tool script", testToolMethod)
return 1
def testValidateInput(inVal):
if inVal is not True:
return "Screw you, buddy, donkeys are always awesome."
return None
def testToolMethod(toolIndex):
r = noesis.userPrompt(noesis.NOEUSERVAL_BOOL, "Question", "Are donkeys totally awesome in all circumstances?", "Yes", testValidateInput)
if r is None:
return 0
noesis.messagePrompt("That's right, donkeys are awesome.")
return 0
(for the bool type, "yes" or "true" are true, anything else is false)