VVISF & VVGL
Sample Code VI- Interacting with ISFScene

Interacting with the ISFScene

Internally, VVISF::ISFScene uses VVISF::ISFDoc to represent the value and state of an ISF file during rendering. This means that you can get an ISFScene's currently-used ISFDoc, and adjust rendering parameters by getting the appropriate attribute from the doc and changing its value.

ISFSceneRef tmpScene = XXX; // this is assumed to be non-nil in the real world...
// get the scene's doc- interacting with the doc affects rendering
ISFDocRef tmpDoc = tmpScene->doc();
if (tmpDoc == nullptr)
return;
// get the attribute from the doc for the fake float input, make sure it's a float
ISFAttrRef floatAttr = tmpDoc->input(string("floatInputName"));
if (floatAttr == nullptr || floatAttr->type() != ISFValType_Float)
return;
// get the float attribute's current, min, and max vals
ISFVal currentVal = floatAttr->currentVal();
ISFVal minVal = floatAttr->minVal();
ISFVal maxVal = floatAttr->maxVal();
double tmpVal = currentVal.getDoubleVal();
// add .01 to the current val, looping the value around the min/max
tmpVal += 0.01;
if (!maxVal.isNullVal() && tmpVal > maxVal.getDoubleVal()) {
if (!minVal.isNullVal())
tmpVal = minVal.getDoubleVal();
else
tmpVal = 0.;
}
currentVal = ISFFloatVal(tmpVal);
// apply the new value we calculated to the attribute
floatAttr->setCurrentVal(currentVal);