File tree Expand file tree Collapse file tree 3 files changed +18
-10
lines changed
Expand file tree Collapse file tree 3 files changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,10 @@ void frameTick();
6363// Do shutdown work and de-initialize Polyscope
6464void shutdown (bool allowMidFrameShutdown = false );
6565
66+ // Remove all structures / quantities / groups / slice planes / callbacks / etc, as if Polyscope was just initialized.
67+ // (But does _not_ reset option & config settings, nor de-initialize the render engine)
68+ void removeEverything ();
69+
6670// Returns true if the user has tried to exit the window at the OS level, e.g clicking the close button. Useful for
6771// deciding when to exit your control loop when using frameTick()
6872bool windowRequestsClose ();
Original file line number Diff line number Diff line change @@ -1208,6 +1208,18 @@ bool isHeadless() {
12081208 return false ;
12091209}
12101210
1211+ void removeEverything () {
1212+ removeAllStructures ();
1213+ removeAllGroups ();
1214+ removeAllSlicePlanes ();
1215+ removeAllTransformationGizmos ();
1216+ clearMessages ();
1217+ state::userCallback = nullptr ;
1218+ state::filesDroppedCallback = nullptr ;
1219+ options::configureImGuiStyleCallback = configureImGuiStyle; // restore defaults
1220+ options::prepareImGuiFontsCallback = loadBaseFonts;
1221+ }
1222+
12111223void shutdown (bool allowMidFrameShutdown) {
12121224 checkInitialized ();
12131225
@@ -1220,16 +1232,7 @@ void shutdown(bool allowMidFrameShutdown) {
12201232 writePrefsFile ();
12211233 }
12221234
1223- // Clear out all structures and other scene objects
1224- removeAllStructures ();
1225- removeAllGroups ();
1226- removeAllSlicePlanes ();
1227- removeAllTransformationGizmos ();
1228- clearMessages ();
1229- state::userCallback = nullptr ;
1230- state::filesDroppedCallback = nullptr ;
1231- options::configureImGuiStyleCallback = configureImGuiStyle; // restore defaults
1232- options::prepareImGuiFontsCallback = loadBaseFonts;
1235+ removeEverything ();
12331236
12341237 // Shut down the render engine
12351238 render::engine->shutdown ();
Original file line number Diff line number Diff line change @@ -424,6 +424,7 @@ float computeRelativeMotionScale() {
424424 return state::lengthScale;
425425 }
426426 }
427+ return -1 .; // should be unreachable
427428}
428429
429430void projectCenterToBeValidForView () {
You can’t perform that action at this time.
0 commit comments