@@ -76,38 +76,66 @@ IECORESCENE_API void removeComponentConnectionAdapters( ShaderNetwork *network )
7676// / The name of the boolean blindData label used by add/removeComponentConnectionAdapters
7777IECORESCENE_API const IECore::InternedString &componentConnectionAdapterLabel ();
7878
79+ // / Converts various aspects of how shaders are stored to be ready to pass directly to OSL.
80+ // / The `oslVersion` argument is used to determine how conversion is performed, and should be passed a
81+ // / value of `OSL_VERSION`. Conversions include:
82+ // /
83+ // / - Connections involving the individual components of point/color parameters.
84+ // / For OSL prior to 1.10, intermediate shaders are inserted to emulate connections between components.
85+ // / For later versions, no new shaders are inserted, but components are renamed from our `.x, .y, .z`
86+ // / suffixes to OSL's `[0], [1], [2]` suffixes.
87+ // / - Splines
88+ // / We support SplineData as a parameter type. For OSL, these must be converted to 3 parameters named
89+ // / `<splineName>Positions`, `<splineName>Values` and `<splineName>Basis`. We also support input
90+ // / connections to spline Y values, specified as `<splineName>[N].y`, which currently must be implemented
91+ // / using an adapter shader.
92+ IECORESCENE_API void convertToOSLConventions ( ShaderNetwork *network, int oslVersion );
93+
7994// / Finds connections involving the individual components of point/color parameters, and converts them
8095// / for use with OSL. The `oslVersion` argument is used to determine how conversion is performed,
8196// / and should be passed a value of `OSL_VERSION`. For OSL prior to 1.10, intermediate shaders are
8297// / inserted to emulate connections between components. For later versions, no new shaders are inserted, but
8398// / components are renamed from our `.x, .y, .z` suffixes to OSL's `[0], [1], [2]` suffixes.
84- // / \todo Remove the version without the `oslVersion` argument.
99+ // / \deprecated: Use convertToOSLConventions instead
85100IECORESCENE_API void convertOSLComponentConnections ( ShaderNetwork *network );
86101IECORESCENE_API void convertOSLComponentConnections ( ShaderNetwork *network, int oslVersion );
87102
88103// / Converts from the legacy ObjectVector format previously used to represent shader networks.
89104IECORESCENE_API ShaderNetworkPtr convertObjectVector ( const IECore::ObjectVector *network );
90105
91106// / We use a convention where ramps are represented by a single SplineData in Cortex, but must be expanded
92- // / out into basic types when being passed to a renderer. We need two functions to convert back and forth.
107+ // / out into basic types when being passed to a renderer. We need two functions to convert back and forth.
108+
93109
94- // / Look for parameters matching our spline convention, for any possible <prefix> :
110+ // / Look throughout the network for parameters matching our spline convention, for any possible <prefix> :
95111// / <prefix>Positions, a float vector parameter
96112// / <prefix>Values, a vector of a value type, such as float or color
97113// / <prefix>Basis, a string parameter
98114// / For each set of parameters found matching this convention, the 3 parameters will be replaced with one
99- // / spline parameter named <prefix>. If none are found, the input is passed through unchanged.
100- IECORESCENE_API IECore::ConstCompoundDataPtr collapseSplineParameters ( const IECore::ConstCompoundDataPtr& parameters );
115+ // / spline parameter named <prefix>. If input connections are represented using an adapter shader, they
116+ // / will be converted to direct connections to the spline using our support for spline element
117+ // / connections.
118+ // / If `targetPrefix` is given, only translates connections to shaders with a type starting with this string
119+ IECORESCENE_API void collapseSplines ( ShaderNetwork *network, std::string targetPrefix = " " );
120+
121+ // / Look throughout the network for spline parameters. If any are found, they will be expanded out into
122+ // / 3 parameters named <name>Positions, <name>Values and <name>Basis.
123+ // / We also support input connections to spline Y values, specified as `<splineName>[N].y`, which currently
124+ // / must be implemented by inserting an adapter shader.
125+ // / If `targetPrefix` is given, only translates connections to shaders with a type starting with this string
126+ IECORESCENE_API void expandSplines ( ShaderNetwork *network, std::string targetPrefix = " " );
127+
101128
102- // / Look for spline parameters. If any are found, they will be expanded out into 3 parameters named
103- // / <name>Positions, <name>Values and <name>Basis. If none are found, the input is passed through unchanged.
104- IECORESCENE_API IECore::ConstCompoundDataPtr expandSplineParameters ( const IECore::ConstCompoundDataPtr& parameters );
129+ // / \deprecated: Use collapseSplines on the whole network, which can handle input connections
130+ IECORESCENE_API IECore::ConstCompoundDataPtr collapseSplineParameters ( const IECore::ConstCompoundDataPtr& parametersData );
131+
132+ // / \deprecated: Use expandSplines on the whole network, which can handle input connections
133+ IECORESCENE_API IECore::ConstCompoundDataPtr expandSplineParameters ( const IECore::ConstCompoundDataPtr& parametersData );
105134
106135
107136} // namespace ShaderNetworkAlgo
108137
109138} // namespace IECoreScene
110139
111140#include " IECoreScene/ShaderNetworkAlgo.inl"
112-
113141#endif // IECORESCENE_SHADERNETWORKALGO_H
0 commit comments