@@ -41,6 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4141#include < OpenImageIO/imagebufalgo_util.h>
4242#include < OpenImageIO/argparse.h>
4343#include < OpenImageIO/strutil.h>
44+ #include < OpenImageIO/filesystem.h>
4445#include < OpenImageIO/timer.h>
4546
4647#include " OSL/oslexec.h"
@@ -236,10 +237,25 @@ static void
236237action_groupspec (int argc, const char *argv[])
237238{
238239 shadingsys->ShaderGroupEnd ();
240+ std::string groupspec (argv[1 ]);
241+ if (OIIO::Filesystem::exists (groupspec)) {
242+ // If it names a file, use the contents of the file as the group
243+ // specification.
244+ std::ifstream in;
245+ OIIO::Filesystem::open (in, groupspec);
246+ groupspec.clear ();
247+ while (in.good ()) {
248+ std::string line;
249+ std::getline (in, line);
250+ groupspec += line + " \n " ;
251+ }
252+ in.close ();
253+ }
239254 if (verbose)
240255 std::cout << " Processing group specification:\n ---\n "
241- << argv[1 ] << " \n ---\n " ;
242- shadergroup = shadingsys->ShaderGroupBegin (groupname, " surface" , argv[1 ]);
256+ << groupspec << " \n ---\n " ;
257+ add_shader (0 , NULL ); // becuase this is what sets the options
258+ shadergroup = shadingsys->ShaderGroupBegin (groupname, " surface" , groupspec);
243259}
244260
245261
0 commit comments