@@ -230,7 +230,21 @@ class SwingNodePropertyEditor(private val sciView: SciView, val nodeSpecificProp
230
230
} else {
231
231
hideShow.text = " Show"
232
232
}
233
- hideShow.addActionListener { _: ActionEvent ? -> obj.node.visible = ! obj.node.visible }
233
+ hideShow.addActionListener { _: ActionEvent ? ->
234
+ val newVisibility = ! obj.node.visible
235
+ obj.node.visible = newVisibility
236
+
237
+ // Notify SciView about the visibility change
238
+ sciView.requestPropEditorRefresh(obj.node)
239
+
240
+ // Publish a NodeChangedEvent
241
+ sciView.eventService.publish(NodeChangedEvent (obj.node))
242
+
243
+ // If the node is now invisible, deselect it
244
+ if (! newVisibility) {
245
+ sciView.setActiveNode(null )
246
+ }
247
+ }
234
248
popup.add(hideShow)
235
249
val removeItem = JMenuItem (" Remove" )
236
250
removeItem.foreground = Color .RED
@@ -244,7 +258,20 @@ class SwingNodePropertyEditor(private val sciView: SciView, val nodeSpecificProp
244
258
if (n != null ) {
245
259
val node = n.node
246
260
if (node != null && node !is Camera && node !is Scene ) {
247
- node.visible = ! node.visible
261
+ val newVisibility = ! node.visible
262
+ node.visible = newVisibility
263
+
264
+ // Notify SciView about the visibility change
265
+ sciView.requestPropEditorRefresh(node)
266
+
267
+ // Publish a NodeChangedEvent
268
+ sciView.eventService.publish(NodeChangedEvent (node))
269
+
270
+ // If the node is now invisible, deselect it
271
+ if (! newVisibility) {
272
+ sciView.setActiveNode(null )
273
+ }
274
+
248
275
tree.repaint()
249
276
}
250
277
}
@@ -279,7 +306,7 @@ class SwingNodePropertyEditor(private val sciView: SciView, val nodeSpecificProp
279
306
280
307
/* * Generates a properties panel for the given node. */
281
308
fun updateProperties (sceneNode : Node ? , rebuild : Boolean = false) {
282
- if (sceneNode == null ) {
309
+ if (sceneNode == null || ! sceneNode.visible ) {
283
310
try {
284
311
if (updateLock.tryLock() || updateLock.tryLock(200 , TimeUnit .MILLISECONDS )) {
285
312
updatePropertiesPanel(null )
0 commit comments