Skip to content

Commit

Permalink
Merge branch 'master' into feature/add-ci-openexr-3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldsmith authored Oct 3, 2024
2 parents 4a39b2c + 1266761 commit ca14dae
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 30 deletions.
6 changes: 3 additions & 3 deletions OpenEXR_CTL/exrdpx/exrToDpx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,13 @@ writePixels
const Rgba &pixel = pixels[y][x];

unsigned int r =
(unsigned int) (clamp (float (pixel.r), 0.0f, 1023.0f) + 0.5f);
(unsigned int) (Imath::clamp (float (pixel.r), 0.0f, 1023.0f) + 0.5f);

unsigned int g =
(unsigned int) (clamp (float (pixel.g), 0.0f, 1023.0f) + 0.5f);
(unsigned int) (Imath::clamp (float (pixel.g), 0.0f, 1023.0f) + 0.5f);

unsigned int b =
(unsigned int) (clamp (float (pixel.b), 0.0f, 1023.0f) + 0.5f);
(unsigned int) (Imath::clamp (float (pixel.b), 0.0f, 1023.0f) + 0.5f);

unsigned int word = (r << 22) | (g << 12) | (b << 2);

Expand Down
21 changes: 9 additions & 12 deletions ctlrender/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -468,11 +468,8 @@ int main(int argc, const char **argv)

if (input_image_files.size() < 2)
{
fprintf(stderr,
"one or more source filenames and a destination "
"file or directory must be\nprovided. if more than one "
"source filenames is provided then the last argument\nmust "
"be a directory. see -help for more details.\n");
usage(NULL);

exit(1);
}

Expand Down Expand Up @@ -509,9 +506,9 @@ int main(int argc, const char **argv)
if (!force_overwrite_output_file)
{
fprintf(stderr,
"The destination file %s already exists.\n"
"Cravenly refusing to overwrite unless you supply "
"the -force option.\n", outputFile);
"The destination file %s already exists. Refusing to overwrite the existing file.\n"
"To overwrite the existing file use the -force option.\n"
, outputFile);
exit(1);
}
else
Expand Down Expand Up @@ -588,8 +585,8 @@ int main(int argc, const char **argv)
"You have specified a destination file "
"type with the -format option, but the\noutput "
"file extension does not match the format "
"specified by the -format option.\nCravenly "
"refusing to do this unless you specify the "
"specified by the -format option.\nThis behavior "
"can be overridden by specifing the "
"-force option (which\nwill make the -format "
"option take priority).\n");
exit(1);
Expand Down Expand Up @@ -671,7 +668,7 @@ int main(int argc, const char **argv)
}
if (access(outputFile, F_OK) >= 0)
{
fprintf(stderr, "Cravenly refusing to overwrite the file '%s'.\n", outputFile);
fprintf(stderr, "Can not overwrite the file '%s'.\n", outputFile);
exit(1);
}
actual_format.squish = noalpha;
Expand All @@ -683,7 +680,7 @@ int main(int argc, const char **argv)

} catch (std::exception &e)
{
fprintf(stderr, "exception thrown (oops...): %s\n", e.what());
fprintf(stderr, "\nexception thrown (oops...): %s\n", e.what());
return 1;
}
}
2 changes: 1 addition & 1 deletion ctlrender/transform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ void set_ctl_function_argument_from_ctl_results(Ctl::FunctionArgPtr *arg, const
}
else
{
THROW(Iex::ArgExc, "CTL parameter '" << dst->name() << "' not specified on the command line and does not have a default value.");
THROW(Iex::ArgExc, "A value for the CTL input variable '" << dst->name() << "' does not exist, was not specified on the command line,\nand does not have a default value. A value can be provided at runtime using command line parameters. See '-help param'\n");
throw(std::exception());
}
return;
Expand Down
37 changes: 23 additions & 14 deletions ctlrender/usage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@

void usage(const char *section) {
if(section==NULL) {
fprintf(stdout, ""
fprintf(stdout, "\n"
"ctlrender - transforms an image using one or more CTL scripts, potentially\n"
" converting the file format in the process\n"
"\nusage:\n"
Expand Down Expand Up @@ -110,9 +110,18 @@ void usage(const char *section) {
"\n"
" -verbose Increases the level of output verbosity.\n"
" -quiet Decreases the level of output verbosity.\n"
"");
"\n"
" -force Overrides the default program behavior in some\n"
" instances such as overwriting existing files and\n"
" requiring format specified and file extensions\n"
" match.\n"
"\n"
" -help Prints this message. Additional help details are\n"
" available for some options by specifying an option\n"
" after '-help' (e.g. '-help format').\n"
"\n");
} else if(!strncmp(section, "format", 1)) {
fprintf(stdout, ""
fprintf(stdout, "\n"
"format conversion:\n"
"\n"
" ctlrender provides file format conversion either implicitly by the\n"
Expand Down Expand Up @@ -156,10 +165,10 @@ void usage(const char *section) {
"\n"
" Note that no automatic depth scaling is performed, please see\n"
" '-help scale' for more details on how scaling is performed.\n"
"");
"\n");
} else if(!strncmp(section, "compression", 2)) {
#if defined(HAVE_OPENEXR)
fprintf(stdout, ""
fprintf(stdout, "\n"
"exr compression:\n"
"\n"
" ctlrender provides the option of a compression scheme when saving an \n"
Expand All @@ -185,9 +194,9 @@ void usage(const char *section) {
"\n"
" B44A (lossy) Like B44 but smaller for images containing large\n"
" uniform areas.\n"
"");
"\n");
#else
fprintf(stdout, ""
fprintf(stdout, "\n"
"exr compression:\n"
"\n"
" ctlrender provides the option of a compression scheme when saving an \n"
Expand All @@ -198,21 +207,21 @@ void usage(const char *section) {
"\n"
" OpenEXR support must be enabled for the '-compression' option to be\n"
" meaningful. Please see build documentation for details.\n"
"");
"\n");
#endif
} else if(!strncmp(section, "ctl", 1)) {
fprintf(stdout, ""
fprintf(stdout, "\n"
"ctl file interpretation:\n"
" ctlrender treats all ctl files as if they take their input as 'R', 'G',\n"
" 'B', and 'A' (optional) channels, and produce output as 'R', 'G', and\n"
" 'B', and 'A' (if required) channels. In the event of a single channel\n"
" input file only the 'G' channel will be used.\n"
"");
"\n");
//" The *LAST* function in the file is the function that will be called to\n"
//" provide the transform. This is to maintain compatability with scripts\n"
//" developed for Autodesk's TOXIC product.\n"
} else if(!strncmp(section, "scale", 1)) {
fprintf(stderr, ""
fprintf(stderr, "\n"
"input and output value scaling:\n"
"\n"
" To deal with differences in input and output file bit depth, the ability\n"
Expand Down Expand Up @@ -258,9 +267,9 @@ void usage(const char *section) {
"\n"
" In all cases the CTL output values (after output_scaling) are clipped\n"
" to the maximum values supported by the output file format.\n"
"");
"\n");
} else if(!strncmp(section, "param", 1)) {
fprintf(stdout, ""
fprintf(stdout, "\n"
"ctl parameters:\n"
"\n"
" In CTL scripts it is possible to define parameters that are not set\n"
Expand All @@ -275,7 +284,7 @@ void usage(const char *section) {
" -global_param1 <name> <float1>\n"
" -global_param2 <name> <float1> <float2>\n"
" -global_param3 <name> <float1> <float2> <float3>\n"
"");
"\n");
} else {
fprintf(stdout, ""
"The '%s' section of the help does not exist. Try running ctlrender with\n"
Expand Down

0 comments on commit ca14dae

Please sign in to comment.