Skip to content

Commit 07ebe6e

Browse files
SciView: Add requestPropEditorRefresh() and key binding from #296. Closes #296.
1 parent dd41974 commit 07ebe6e

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/main/java/sc/iview/SciView.kt

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1046,6 +1046,10 @@ class SciView : SceneryBase, CalibratedRealInterval<CalibratedAxis> {
10461046
// help window
10471047
h.addBehaviour("show help", showHelpDisplay())
10481048
h.addKeyBinding("show help", "F1")
1049+
1050+
//update scene inspector
1051+
h.addBehaviour("update scene graph", ClickBehaviour { _: Int, _: Int -> requestPropEditorRefresh() })
1052+
h.addKeyBinding("update scene graph", "shift ctrl I")
10491053
}
10501054

10511055
/*
@@ -1082,7 +1086,7 @@ class SciView : SceneryBase, CalibratedRealInterval<CalibratedAxis> {
10821086
inner class AnimatedCenteringBeforeArcBallControl : ArcballCameraControl {
10831087
//a bunch of necessary c'tors (originally defined in the ArcballCameraControl class)
10841088
constructor(name: String, n: Function0<Camera?>, w: Int, h: Int, target: Function0<Vector3f>) : super(name, n, w, h, target) {}
1085-
constructor(name: String,n: Supplier<Camera?>, w: Int, h: Int, target: Supplier<Vector3f>) : super(name, n, w, h, target) {}
1089+
constructor(name: String, n: Supplier<Camera?>, w: Int, h: Int, target: Supplier<Vector3f>) : super(name, n, w, h, target) {}
10861090
constructor(name: String, n: Function0<Camera?>, w: Int, h: Int, target: Vector3f) : super(name, n, w, h, target) {}
10871091
constructor(name: String, n: Supplier<Camera?>, w: Int, h: Int, target: Vector3f) : super(name, n, w, h, target) {}
10881092

@@ -2383,6 +2387,21 @@ class SciView : SceneryBase, CalibratedRealInterval<CalibratedAxis> {
23832387
return "Node name: " + n.name + " Node type: " + n.nodeType + " To String: " + n
23842388
}
23852389

2390+
/**
2391+
* Triggers the inspector tree to be completely rebuilt/refreshed.
2392+
*/
2393+
fun requestPropEditorRefresh() {
2394+
eventService!!.publish(NodeChangedEvent(scene))
2395+
}
2396+
2397+
/**
2398+
* Triggers the inspector to rebuild/refresh the given node.
2399+
* @param n Root of the subtree to get rebuilt/refreshed.
2400+
*/
2401+
fun requestPropEditorRefresh(n: Node?) {
2402+
eventService!!.publish(NodeChangedEvent(n))
2403+
}
2404+
23862405
companion object {
23872406
//bounds for the controls
23882407
@JvmField

0 commit comments

Comments
 (0)