imageworks/OpenShadingLanguage — pull request #300 by lgritz (2013-11-29 21:23:58+00:00)
Title: testshade: consolidate --iparam, --fparam, --vparam, --sparam ==> --param

--param takes two arguments: name and value. For aggregates (like colors or matrices), the value is a comma-separated list (no spaces, or it won't recognize it as one argument).

The type is deduced from the appearance of the argument:
1.3,0.5,0.5 is a vector
2 is an int
2.0 is a float (to pass an 'integer' as a float, use the decimal point)
blah is a string (doesn't fit any other patterns)

When ambiguous -- for example, if you really want a string "14", you can use an optional type override like this:

--param:type=string ...

So, as an illustrative example:

OLD:

testshade --iparam I 14 --vparam V 1 2 3 --fparam F 3 --sparam Foo foo --sparam Zero 0 ...

NEW:

testshade --param I 14 --param V 1,2,3 --fparam F 3.0 --param Foo foo --param:type=string Zero 0 ...

The new code allows passing of matrix values, which the old did not account for.

Also, the new code can allow explicit disambiguation of triple types:

testshade --param:type=point 0,0,0 --param:type=color 0.2,0.3,0.5 ...

There's also an optional parameter that lets you specify the lockgeom status of a parameter. Just let that slide for now, you'll see shortly how I'm using that (in another patch).

N.B. This depends upon the following OIIO patch: https://github.com/OpenImageIO/oiio/pull/752