March 14 2016
The markup enclosed in the [[ ]]
is known as "suggested metadata", it's shown in the OSL specifications pdf, something like this:
surface wood
[[ string help = "Realistic wood shader" ]]
(
float Kd = 0.5
[[ string help = "Diffuse reflectivity",
float min = 0, float max = 1 ]] ,
color woodcolor = color (.7, .5, .3)
[[ string help = "Base color of the wood" ]],
color ringcolor = 0.25 * woodcolor
[[ string help = "Color of the dark rings" ]],
string texturename = "wood.tx"
[[ string help = "Texture map for the grain",
string widget = "filename" ]],
int pattern = 0
[[ string widget = "mapper",
string options = "oak:0|elm:1|walnut:2" ]]
)
is not currently supported, it gets ignored.
Until someone implements the parsing of suggested metadata the best you can do is implement the clamp yourself in your OSL code. The UI would still allow you to input values outside that range, therefore cosmetically this isn't a good solution, but if you make your code deal with unwanted extreme values appropriately you'll still get stuff done.
Later when metadata parsing is implemented it's easy enough to strip away your clamping code.
related: Can a Script node using OSL have a checkbox?