MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenColorIO / ValidateDynamicProperty

Function ValidateDynamicProperty

src/OpenColorIO/Op.cpp:375–418  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

373{
374template<typename T>
375void ValidateDynamicProperty(OpRcPtr op, std::shared_ptr<T> & prop, DynamicPropertyType type)
376{
377 if (op->hasDynamicProperty(type))
378 {
379 if (!prop)
380 {
381 // Initialize property.
382 DynamicPropertyRcPtr dp = op->getDynamicProperty(type);
383 prop = OCIO_DYNAMIC_POINTER_CAST<T>(dp);
384 }
385 else
386 {
387 // If the property is already initialized, it means that it is already being used
388 // elsewhere in this OpVec.
389 std::ostringstream os;
390 switch (type)
391 {
392 case DYNAMIC_PROPERTY_EXPOSURE:
393 os << "Exposure";
394 break;
395 case DYNAMIC_PROPERTY_CONTRAST:
396 os << "Contrast";
397 break;
398 case DYNAMIC_PROPERTY_GAMMA:
399 os << "Gamma";
400 break;
401 case DYNAMIC_PROPERTY_GRADING_PRIMARY:
402 os << "Grading primary";
403 break;
404 case DYNAMIC_PROPERTY_GRADING_RGBCURVE:
405 os << "Grading RGB curve";
406 break;
407 case DYNAMIC_PROPERTY_GRADING_TONE:
408 os << "Grading tone";
409 break;
410 case DYNAMIC_PROPERTY_GRADING_HUECURVE:
411 os << "Grading hue curve";
412 break;
413 }
414 os << " dynamic property can only be there once.";
415 LogWarning(os.str());
416 }
417 }
418}
419}
420
421// Warn if there is more than one property of a given type that is currently dynamic. There may

Callers 1

Calls 3

LogWarningFunction · 0.85
hasDynamicPropertyMethod · 0.45
getDynamicPropertyMethod · 0.45

Tested by

no test coverage detected