omni/kit/KitUpdateOrder.h

File members: omni/kit/KitUpdateOrder.h

// Copyright (c) 2019-2023, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//

#pragma once

#include "../../carb/events/IEvents.h"

namespace omni
{
namespace kit
{

namespace update
{

enum PreUpdateOrdering : int32_t
{
    eTelmetryInitialize = -50,
    eFabricBeginFrame = -20,
    eUnspecifiedPreUpdateOrder = carb::events::kDefaultOrder
};

enum UpdateOrdering : int32_t
{
    eCheckForHydraRenderComplete = -100,

    eUsdTimelineStateRefresh = -90,

    ePythonAsyncFutureBeginUpdate = -50,

    ePythonExecBeginUpdate = -45,

    eOmniClientUpdate = -30,

    eUsdTimelineUpdate = -20,

    eUsdContextUpdate = -10,

    eUnspecifiedUpdateOrder = carb::events::kDefaultOrder,

    eUIRendering = 15,

    eFabricFlush = 20,

    eHydraRendering = 30,

    ePythonAsyncFutureEndUpdate = 50,

    ePythonExecEndUpdate = 100,
};

/*
 * IApp.next_update_async() is the original model of python scripting kit, a preferred
 * approach is either App.pre_update_async() and/or App.post_update_async(). Both can be used inside
 * a single app tick, pseudo python code:
 *       While true:
 *           await omni.kit.app.get_app().pre_update_async()
 *           # Do a bunch of python scripting things before USD Update or hydra rendering is scheduled
 *           await omni.kit.app.get_app().post_update_async()
 *           # Do a bunch of python scripting things after USD Update & hydra rendering has been scheduled
 *
 * Alternatively use either just pre_update_async() or post_update_async() in python depending on whether you want your
 * script to execute before USDUpdate or after.
 */

enum PostUpdateOrdering : int32_t
{
    eReleasePrevFrameGpuResources = -50,

    ePythonAsyncFuturePostUpdate = -25,

    ePythonExecPostUpdate = -10,

    eUnspecifiedPostUpdateOrder = carb::events::kDefaultOrder,

    eKitAppFactoryUpdate = eUnspecifiedPostUpdateOrder,

    eKitAppOSUpdate = eUnspecifiedPostUpdateOrder,

    eKitInternalUpdate = 100
};

#pragma push_macro("min")
#undef min

enum KitUsdStageEventOrdering : int32_t
{
    eKitUsdFileStageEvent = std::numeric_limits<carb::events::Order>::min() + 1,

    eKitUnspecifiedUsdStageEventOrder = carb::events::kDefaultOrder,
};

#pragma pop_macro("min")

enum IUsdStageEventOrdering : int32_t
{
    eIUsdStageUpdateAnimationGraph = 0,
    eIUsdStageUpdatePinocchioPrePhysics = 8,
    eIUsdStageUpdateTensorPrePhysics = 9,
    eIUsdStageUpdateForceFieldsPrePhysics = 9,
    eIUsdStageUpdatePhysicsVehicle = 9,
    eIUsdStageUpdatePhysicsCCT = 9,
    eIUsdStageUpdatePhysicsCameraPrePhysics = 9,
    eIUsdStageUpdatePhysics = 10,
    eIUsdStageUpdateFabricPostPhysics = 11,
    eIUsdStageUpdateVehiclePostPhysics = 12,
    eIUsdStageUpdateForceFieldsPostPhysics = 12,
    eIUsdStageUpdatePhysicsCameraPostPhysics = 12,
    eIUsdStageUpdatePhysicsUI = 12,
    eIUsdStageUpdatePinocchioPostPhysics = 13,
    eIUsdStageUpdateOmnigraph = 100,
    eIUsdStageUpdatePhysxFC = 102,
    eIUsdStageUpdateDebugDraw = 1000,
    eIUsdStageUpdateLast = 2000
};

} // namespace update
} // namespace kit
} // namespace omni