本文整理汇总了C++中ocio_namespace::ConstConfigRcPtr::getNumLooks方法的典型用法代码示例。如果您正苦于以下问题:C++ ConstConfigRcPtr::getNumLooks方法的具体用法?C++ ConstConfigRcPtr::getNumLooks怎么用?C++ ConstConfigRcPtr::getNumLooks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ocio_namespace::ConstConfigRcPtr
的用法示例。
在下文中一共展示了ConstConfigRcPtr::getNumLooks方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
static void
buildLookChoiceMenu(OCIO::ConstConfigRcPtr config,
ChoiceParamType* choice)
{
choice->resetOptions();
if (!config) {
return;
}
for (int i = 0; i < config->getNumLooks(); ++i) {
choice->appendOption(config->getLookNameByIndex(i));
}
}
示例2: main
//.........这里部分代码省略.........
{
convertsFromLinear = false;
convertsFromLinearErrorText = exception.what();
}
if(convertsToLinear && convertsFromLinear)
{
std::cout << cs->getName() << std::endl;
}
else if(!convertsToLinear && !convertsFromLinear)
{
std::cout << cs->getName();
std::cout << " -- error" << std::endl;
std::cout << "\t" << convertsToLinearErrorText << std::endl;
std::cout << "\t" << convertsFromLinearErrorText << std::endl;
errorcount += 1;
}
else if(convertsToLinear)
{
std::cout << cs->getName();
std::cout << " -- input only" << std::endl;
}
else if(convertsFromLinear)
{
std::cout << cs->getName();
std::cout << " -- output only" << std::endl;
}
}
}
std::cout << std::endl;
std::cout << "** Looks **" << std::endl;
if(config->getNumLooks()>0)
{
for(int i=0; i<config->getNumLooks(); ++i)
{
std::cout << config->getLookNameByIndex(i) << std::endl;
}
}
else
{
std::cout << "no looks defined" << std::endl;
}
std::cout << std::endl;
std::cout << "** Sanity Check **" << std::endl;
try
{
config->sanityCheck();
std::cout << "passed" << std::endl;
}
catch(OCIO::Exception & exception)
{
std::cout << "ERROR" << std::endl;
errorcount += 1;
std::cout << exception.what() << std::endl;
}
if(!outputconfig.empty())
{
std::ofstream output;
output.open(outputconfig.c_str());
if(!output.is_open())
{
示例3: catch
OCIOLookTransform::OCIOLookTransform(Node *n) : DD::Image::PixelIop(n)
{
m_hasColorSpaces = false;
m_inputColorSpaceIndex = 0;
m_outputColorSpaceIndex = 0;
m_lookIndex = 0;
m_dirIndex = 0;
m_ignoreErrors = false;
// Query the colorspace names from the current config
// TODO (when to) re-grab the list of available colorspaces? How to save/load?
OCIO::ConstConfigRcPtr config;
std::string linear;
try
{
config = OCIO::GetCurrentConfig();
OCIO::ConstColorSpaceRcPtr linearcs = config->getColorSpace(OCIO::ROLE_SCENE_LINEAR);
if(!linearcs) throw std::runtime_error("ROLE_SCENE_LINEAR not defined.");
linear = linearcs->getName();
}
catch (const OCIO::Exception& e)
{
std::cerr << "OCIOLookTransform: " << e.what() << std::endl;
}
catch (...)
{
std::cerr << "OCIOLookTransform: Unknown exception during OCIO setup." << std::endl;
}
if(!config)
{
m_hasColorSpaces = false;
return;
}
// Step 1: Make the std::vectors
for(int i=0; i<config->getNumLooks(); ++i)
{
m_lookNames.push_back(config->getLookNameByIndex(i));
}
for(int i = 0; i < config->getNumColorSpaces(); i++)
{
std::string csname = config->getColorSpaceNameByIndex(i);
#ifdef OCIO_CASCADE
std::string family = config->getColorSpace(csname.c_str())->getFamily();
if(family.empty())
m_colorSpaceNames.push_back(csname.c_str());
else
m_colorSpaceNames.push_back(family + "/" + csname);
#else
m_colorSpaceNames.push_back(csname);
#endif
if(csname == linear)
{
m_inputColorSpaceIndex = i;
m_outputColorSpaceIndex = i;
}
}
// Step 2: Create a cstr array for passing to Nuke
// (This must be done in a second pass, lest the original strings be reallocated)
for(unsigned int i=0; i<m_lookNames.size(); ++i)
{
m_lookCstrNames.push_back(m_lookNames[i].c_str());
}
m_lookCstrNames.push_back(NULL);
for(unsigned int i=0; i<m_colorSpaceNames.size(); ++i)
{
m_inputColorSpaceCstrNames.push_back(m_colorSpaceNames[i].c_str());
m_outputColorSpaceCstrNames.push_back(m_colorSpaceNames[i].c_str());
}
m_inputColorSpaceCstrNames.push_back(NULL);
m_outputColorSpaceCstrNames.push_back(NULL);
m_hasColorSpaces = (!m_colorSpaceNames.empty());
if(!m_hasColorSpaces)
{
std::cerr << "OCIOLookTransform: No ColorSpaces available for input and/or output." << std::endl;
}
}
示例4: PopulateOCIOMenus
static void PopulateOCIOMenus()
{
OCIO::ConstConfigRcPtr config = OCIO::GetCurrentConfig();
int csMenuID = glutCreateMenu(imageColorSpace_CB);
std::map<std::string, int> families;
for(int i=0; i<config->getNumColorSpaces(); ++i)
{
const char * csName = config->getColorSpaceNameByIndex(i);
if(csName && *csName)
{
OCIO::ConstColorSpaceRcPtr cs = config->getColorSpace(csName);
if(cs)
{
const char * family = cs->getFamily();
if(family && *family)
{
if(families.find(family)==families.end())
{
families[family] = glutCreateMenu(imageColorSpace_CB);
glutAddMenuEntry(csName, i);
glutSetMenu(csMenuID);
glutAddSubMenu(family, families[family]);
}
else
{
glutSetMenu(families[family]);
glutAddMenuEntry(csName, i);
}
}
else
{
glutSetMenu(csMenuID);
glutAddMenuEntry(csName, i);
}
}
}
}
int deviceMenuID = glutCreateMenu(displayDevice_CB);
for(int i=0; i<config->getNumDisplays(); ++i)
{
glutAddMenuEntry(config->getDisplay(i), i);
}
int transformMenuID = glutCreateMenu(transform_CB);
const char * defaultDisplay = config->getDefaultDisplay();
for(int i=0; i<config->getNumViews(defaultDisplay); ++i)
{
glutAddMenuEntry(config->getView(defaultDisplay, i), i);
}
int lookMenuID = glutCreateMenu(look_CB);
for(int i=0; i<config->getNumLooks(); ++i)
{
glutAddMenuEntry(config->getLookNameByIndex(i), i);
}
glutCreateMenu(menuCallback);
glutAddSubMenu("Image ColorSpace", csMenuID);
glutAddSubMenu("Transform", transformMenuID);
glutAddSubMenu("Device", deviceMenuID);
glutAddSubMenu("Looks Override", lookMenuID);
glutAttachMenu(GLUT_RIGHT_BUTTON);
}