Last active
August 30, 2021 06:48
-
-
Save jpankalainen/8385cfccce3b81fd0dfdb860e7461aa5 to your computer and use it in GitHub Desktop.
Repro for ObjectsChanged Reload notice issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include "pxr/pxr.h" | |
#include "pxr/usd/usd/stage.h" | |
#include "pxr/usd/usd/references.h" | |
#include "pxr/usd/usd/notice.h" | |
class StageListener : public pxr::TfWeakBase | |
{ | |
public: | |
void OnNotice( const pxr::UsdNotice::ObjectsChanged& notice, const pxr::UsdStageWeakPtr& sender ) | |
{ | |
//notice is broken here after stage->Reload | |
for( const pxr::SdfPath& path : notice.GetChangedInfoOnlyPaths() ) | |
{ | |
for( const pxr::TfToken& field : notice.GetChangedFields( path ) ) | |
{ | |
std::cout << field.GetString(); | |
} | |
} | |
} | |
}; | |
int main() | |
{ | |
pxr::UsdStageRefPtr stage = pxr::UsdStage::CreateInMemory( "Stage" ); | |
StageListener listener; | |
pxr::TfWeakPtr< StageListener > pListener = pxr::TfCreateWeakPtr( &listener ); | |
pxr::TfNotice::Register( pListener, &StageListener::OnNotice, stage ); | |
pxr::UsdPrim prim = stage->DefinePrim( pxr::SdfPath( "/Root" ) ); | |
stage->Reload(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment