Page tree

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Contents

When encountering an error during Katana scenegraph traversal RfK with either warn or abort according to specific settings on the scene and/or location in question. RfK also allows this behavior to be overridden with a custom AttributeFunction assigned with an attribute in PrmanGlobalSettings.

Errors within Katana scenegraph traversal are indicated (from Katana or the scene recipe) by an "errorMessage" attribute at that location. A fatal error is indicated when the location "type" has been set to "error" or if the attribute "errorSeverity" has been set to "critical". By default RfK will immediately abort the render on fatal errors, however there is a mechanism by which a custom override handler can be added to intercept and reinterpret the error location. An attribute function can be injected into RfK that will make the final determination of whether a location error is fatal or not. This attribute function runs after RfK has done its work for deriving the error's fatality essentially giving the author the last word.

Below you'll find an example of an override attribute function. The function is activated by setting the global string attribute:

"prmanGlobalStatements.plugin.errorHandlerAttrFncs" = "MyOverrideErrorHandler"


class MyOverrideErrorHandlerFnc : public Foundry::Katana::AttributeFunction
{

public:
    
    static FnAttribute::Attribute run(FnAttribute::Attribute args)
    {
        FnAttribute::GroupAttribute errorHandlerArgs = args;

        // Incoming arguments include location's attributes and the location path
        FnAttribute::GroupAttribute locationAttrs = errorHandlerArgs.getChildByName("attrs");
        FnAttribute::StringAttribute pathAttr = errorHandlerArgs.getChildByName("locationPath");

        std::string path = pathAttr.getValue("", false);

        // Return the integer "abort" attribute true to abort render, false to continue 
        FnAttribute::GroupBuilder gb;
		if (dont_want_to_abort_on_error)
		{
        	gb.set("abort", FnAttribute::IntAttribute(false));
        }
		else
		{
        	gb.set("abort", FnAttribute::IntAttribute(true));
        }
		return gb.build();
    }
};

DEFINE_ATTRIBUTEFUNCTION_PLUGIN(MyErrorOverrideHandlerFnc)

void registerMyOverride()
{
    REGISTER_PLUGIN(MyOverrideErrorHandlerFnc, "MyOverrideErrorHandler", 0, 1);
}