Schema Prim Setting Flow
########################

The **useSchemaPrim** setting controls how the graph is backed by USD. The code was refactored to divert as much of the
old code as possible into the *deprecated/* directory so that it is isolated and won't change until such time as the
setting is made permanent and it can be deleted.

The graph is divided into three sections - code that was converted fully to use the schema approach, hybrid code that
uses the setting to switch between schema and non-schema behaviours, and deprecated code that is only used by the
non-schema code paths.

.. _omnigraph_extension_dependency_graph:

.. mermaid::

    flowchart LR
        subgraph Converted
            ComputeGraphImpl::parseGraph
            Graph::attachToStage
            Graph::changePipelineStage
            Graph::initFromStage
            Graph::onNodeTypeRegistered
            Graph::postLoadUpgradeFileFormatVersion
            Graph::rangeContainsOGNodes
            Graph::writeSettingsInUSD
            GraphContext::addPrimToCache
            GraphContext::attachToStage
            GraphContext::createNeededNodesForPrim
            GraphContext::createNewNode
            GraphContext::createNewSubgraph
            GraphContext::initializeFabric
            GraphContext::updateChangeProcessing
        end
        subgraph Uses Setting
            Graph::couldPrimBelongToGraph
            Graph::createGraphAsNode
            Graph::findFileFormatVersionInRange
            Graph::initContextAndFabric
            Graph::isGlobalGraphPrim
            Graph::isOmniGraphPrim
            Graph::isPrimAnOmniGraphMember
            Graph::reloadFromStage
            Graph::requiresFileFormatCallback
            Graph::setNodeInstance
            Graph::setPathToGraph
            Graph::writeFileFormatVersion
            Graph::writeSettingsToUSD
            Graph::writeTokenSetting
            GraphContext::_::getPrimsNodeTypeAttribute
            GraphContext::_addGatherPrimToFlatCacheIndex
            GraphContext::_addPrimToFlatCacheIndex
            GraphContext::checkForDynamicAttributes
            GraphContext::createNewNodeWithUSD
            GraphContext::createNewSubgraph
            GraphContext::createNodeFromPrim
            GraphContext::createNodesAndSubgraphs
            GraphContext::initializeNode
            GraphContext::getUpstreamPrims
            GraphContext::reloadGraphSettings
            Node::isPrimAnOmniGraphNode
            Node::getPrimsNodeTypeAttribute
            Node::Node
            OmniGraphUsdNoticeListener::processNewAndDeletedGraphs
            PluginInterface::attach
        end
        subgraph Deprecated
            ComputeGraphImpl::parseGraphNoSchema
            Graph::attachToStageNoSchema
            Graph::couldPrimBelongToGraphNoSchema
            Graph::createGraphAsNodeNoSchema
            Graph::findFileFormatVersionInRangeNoSchema
            Graph::initContextAndFlatCache
            Graph::initContextAndFlatCacheNoSchema
            Graph::initFromStageNoSchema
            Graph::isGlobalGraphPrimNoSchema
            Graph::reloadFromStageNoSchema
            Graph::writeFileFormatVersionNoSchema
            Graph::writeSettingsToUSDNoSchema
            GraphContext::_addPrimToFlatCacheIndexNoSchema
            GraphContext::attachToStageNoSchema
            GraphContext::checkForDynamicAttributesNoSchema
            GraphContext::createNewSubgraphNoSchema
            GraphContext::createNodesAndSubgraphsNoSchema
            GraphContext::initializeFlatcacheNoSchema
            GraphContext::reloadGraphSettingsNoSchema
            NoSchemaSupport::writeEvaluatorTypeToSettings
            NoSchemaSupport::writeGraphBackingTypeToSettings
            NoSchemaSupport::writeGraphPipelineStageToSettings
            NoSchemaSupport::writeEvaluationModeToSettings
            NoSchemaSupport::writeTokenSetting
            PluginInterface::attachNoSchema
        end
        ComputeGraphImpl::parseGraph --> ComputeGraphImpl::parseGraphNoSchema
        ComputeGraphImpl::parseGraph --> Graph::attachToStage
        ComputeGraphImpl::parseGraph --> Graph::findFileFormatVersionInRange
        ComputeGraphImpl::parseGraph --> Graph::initFromStage
        ComputeGraphImpl::parseGraph --> Graph::setNodeInstance
        ComputeGraphImpl::parseGraph --> GraphContext::initializeFabric
        ComputeGraphImpl::parseGraph --> Node::Node

        GraphContext::addPrimToCache --> GraphContext::_addPrimToFlatCacheIndex
        GraphContext::attachToStage --> Graph::writeSettingsInUSD
        GraphContext::attachToStage --> GraphContext::createNodesAndSubgraphs
        GraphContext::createNeededNodesForPrim --> GraphContext::createNodeFromPrim
        GraphContext::createNewNode --> Graph::setNodeInstance
        GraphContext::createNewNodeWithUSD --> GraphContext::_addPrimToFlatCacheIndex
        GraphContext::createNodeFromPrim --> Graph::setNodeInstance
        GraphContext::createNodeFromPrim --> GraphContext::initializeNode
        GraphContext::createNodesAndSubgraphs --> Graph::writeSettingsInUSD
        GraphContext::createNodesAndSubgraphs --> GraphContext::createNeededNodesForPrim
        GraphContext::createNodesAndSubgraphs --> GraphContext::createNodesAndSubgraphs
        GraphContext::initializeFabric --> GraphContext::_addGatherPrimToFlatCacheIndex
        GraphContext::initializeFabric --> GraphContext::_addGatherPrimToFlatCacheIndex
        GraphContext::initializeFabric --> GraphContext::_addPrimToFlatCacheIndex
        GraphContext::initializeFabric --> GraphContext::_addPrimToFlatCacheIndex
        GraphContext::initializeNode --> GraphContext::_::getPrimsNodeTypeAttribute
        GraphContext::initializeNode --> GraphContext::checkForDynamicAttributes
        GraphContext::initializeNode --> Node::getPrimsNodeTypeAttribute
        GraphContext::updateChangeProcessing --> GraphContext::_::getPrimsNodeTypeAttribute
        GraphContext::updateChangeProcessing --> GraphContext::_addPrimToFlatCacheIndex
        GraphContext::updateChangeProcessing --> GraphContext::createNodesAndSubgraphs
        GraphContext::updateChangeProcessing --> Node::getPrimsNodeTypeAttribute

        GraphContext::_addPrimToFlatCacheIndex --> GraphContext::_addPrimToFlatCacheIndexNoSchema
        GraphContext::attachToStage --> GraphContext::attachToStageNoSchema
        GraphContext::checkForDynamicAttributes --> GraphContext::checkForDynamicAttributesNoSchema
        GraphContext::createNewSubgraph --> GraphContext::createNewSubgraphNoSchema
        GraphContext::createNodesAndSubgraphs --> GraphContext::createNodesAndSubgraphsNoSchema
        GraphContext::initializeFabric --> GraphContext::initializeFlatcacheNoSchema
        GraphContext::reloadGraphSettings --> GraphContext::reloadGraphSettingsNoSchema

        Graph::attachToStage --> Graph::attachToStageNoSchema
        Graph::attachToStage --> GraphContext::attachToStage
        Graph::changePipelineStage --> Graph::setNodeInstance
        Graph::couldPrimBelongToGraph --> Graph::couldPrimBelongToGraphNoSchema
        Graph::couldPrimBelongToGraph --> Graph::isGlobalGraphPrim
        Graph::couldPrimBelongToGraph --> Graph::isPrimAnOmniGraphMember
        Graph::createGraphAsNode --> Graph::createGraphAsNodeNoSchema
        Graph::createGraphAsNode --> Graph::setNodeInstance
        Graph::createGraphAsNode --> GraphContext::initializeFabric
        Graph::findFileFormatVersionInRange --> Graph::findFileFormatVersionInRangeNoSchema
        Graph::initContextAndFabric --> GraphContext::initializeFabric
        Graph::initContextAndFlatCache --> Graph::initContextAndFlatCacheNoSchema
        Graph::initFromStage --> Graph::attachToStage
        Graph::initFromStage --> Graph::initContextAndFabric
        Graph::initFromStage --> Graph::initFromStageNoSchema
        Graph::isGlobalGraphPrim --> Graph::isGlobalGraphPrimNoSchema
        Graph::postLoadUpgradeFileFormatVersion --> Graph::writeFileFormatVersion
        Graph::reloadFromStage --> Graph::attachToStage
        Graph::reloadFromStage --> Graph::rangeContainsOGNodes
        Graph::reloadFromStage --> Graph::reloadFromStageNoSchema
        Graph::reloadFromStage --> GraphContext::initializeFabric
        Graph::writeFileFormatVersion --> Graph::writeFileFormatVersionNoSchema
        Graph::writeSettingsToUSD --> Graph::writeFileFormatVersionNoSchema
        Graph::writeSettingsToUSD --> Graph::writeSettingsToUSDNoSchema
        Graph::writeSettingsToUSDNoSchema --> NoSchemaSupport::writeEvaluatorTypeToSettings
        Graph::writeSettingsToUSDNoSchema --> NoSchemaSupport::writeGraphBackingTypeToSettings
        Graph::writeSettingsToUSDNoSchema --> NoSchemaSupport::writeGraphPipelineStageToSettings

        NoSchemaSupport::writeEvaluatorTypeToSettings --> NoSchemaSupport::writeTokenSetting
        NoSchemaSupport::writeGraphBackingTypeToSettings --> NoSchemaSupport::writeTokenSetting
        NoSchemaSupport::writeGraphPipelineStageToSettings --> NoSchemaSupport::writeTokenSetting
        NoSchemaSupport::writeEvaluationModeToSettings --> NoSchemaSupport::writeTokenSetting

        Node::Node --> Node::isPrimAnOmniGraphNode

        PluginInterface::attach --> ComputeGraphImpl::parseGraph
        PluginInterface::attach --> Graph::findFileFormatVersionInRange
        PluginInterface::attach --> Graph::initContextAndFabric
        PluginInterface::attach --> Graph::rangeContainsOGNodes
        PluginInterface::attach --> PluginInterface::attachNoSchema

        OmniGraphUsdNoticeListener::processNewAndDeletedGraphs --> ComputeGraphImpl::parseGraph
        OmniGraphUsdNoticeListener::processNewAndDeletedGraphs --> Graph::isGlobalGraphPrim
