@@ -213,17 +213,21 @@ class SciView : SceneryBase, CalibratedRealInterval<CalibratedAxis> {
213
213
*/
214
214
private var animating = false
215
215
216
+ /* *
217
+ * Track whether the scene changed and needs an update in the next tick
218
+ */
219
+ public var needSceneUpdate: Boolean = false
220
+
216
221
/* *
217
222
* This tracks the actively selected Node in the scene
218
223
*/
219
224
var activeNode: Node ? = null
220
225
private set
221
226
222
- /*
223
- * Return the SciJava Display that contains SciView
224
- */ /*
225
- * Set the SciJava Display
226
- */ var display: Display <* >? = null
227
+ /* *
228
+ * The SciJava Display that contains SciView
229
+ */
230
+ var display: Display <* >? = null
227
231
228
232
/* *
229
233
* List of available LUTs for caching
@@ -410,6 +414,22 @@ class SciView : SceneryBase, CalibratedRealInterval<CalibratedAxis> {
410
414
controls = Controls (this )
411
415
412
416
imageToVolumeMap = HashMap <Any , Volume >()
417
+
418
+ // Create a hook for running after each frame is rendered
419
+ renderer?.runAfterRendering?.add { this .updateAferRendering() }
420
+ }
421
+
422
+ /* *
423
+ * A method that is run after the scene is rendered
424
+ */
425
+ private fun updateAferRendering () {
426
+ if (needSceneUpdate) {
427
+ mainWindow.rebuildSceneTree()
428
+ if (activeNode == null ){
429
+ (mainWindow as SwingMainWindow ).nodePropertyEditor.updateProperties(null )
430
+ }
431
+ needSceneUpdate = false
432
+ }
413
433
}
414
434
415
435
fun toggleSidebar (): Boolean {
@@ -1026,13 +1046,13 @@ class SciView : SceneryBase, CalibratedRealInterval<CalibratedAxis> {
1026
1046
@Suppress(" UNUSED_PARAMETER" )
1027
1047
@EventHandler
1028
1048
protected fun onNodeAdded (event : NodeAddedEvent ? ) {
1029
- mainWindow.rebuildSceneTree()
1049
+ needSceneUpdate = true
1030
1050
}
1031
1051
1032
1052
@Suppress(" UNUSED_PARAMETER" )
1033
1053
@EventHandler
1034
1054
protected fun onNodeRemoved (event : NodeRemovedEvent ? ) {
1035
- mainWindow.rebuildSceneTree()
1055
+ needSceneUpdate = true
1036
1056
}
1037
1057
1038
1058
@Suppress(" UNUSED_PARAMETER" )
0 commit comments