Files
OpenShadingLanguage/testsuite/isconnected/run.py
T
Larry Gritz e30aeb3c69 Make an option to have OSL isconnected() return 1 for userdata parameters.
This adds a new ShadingSystem attribute, "userdata_isconnected". The
default of 0 is the old/usual behavior that most applications want.
However, setting this attribute to 1 will cause the OSL built-in
function isconnected(paramname) to return 1 not only for connected
parameters, but also for parameters that may be bound to userdata
(i.e., those that have lockgeom=0).

The use case for this involves a renderer implementation that can mix
C++ and OSL nodes within a shading group. The outputs exported by the
C++ nodes propagate their values to the downstream node via
get_userdata(), hijacking the mechanism that is generally used geometric
primitive variable interpolation. But from the point of view of the
downstream node, they should semantically appear to be a connection.
2016-04-05 16:23:47 -07:00

13 lines
638 B
Python
Executable File

#!/usr/bin/env python
command = testshade("--layer upstream upstream --layer downstream test " +
"--connect upstream out downstream a " +
"--connect upstream struct1 downstream mystruct1")
# Run again, this time considering userdata (lockgeom=0) parameters to be
# isconnected(). This time, parameter c should look like a connection.
command += testshade("--userdata_isconnected " +
"--layer upstream upstream --layer downstream test " +
"--connect upstream out downstream a " +
"--connect upstream struct1 downstream mystruct1")