Skip to content

Commit

Permalink
update to new gi updating structure
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoreilly committed Mar 9, 2024
1 parent 5423ee8 commit d8d3c0a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
6 changes: 3 additions & 3 deletions examples/boa/armaze/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,8 +585,8 @@ func (vw *GUI) UpdateWorldGUI() {
if vw.SceneView == nil || !vw.Disp {
return
}
updt := vw.SceneView.Scene.UpdateStartAsync()
defer vw.SceneView.Scene.UpdateEndAsyncRender(updt)
vw.SceneView.AsyncLock()
defer vw.SceneView.AsyncUnlock()

// update state:
vw.SetEmeryPose()
Expand All @@ -599,7 +599,7 @@ func (vw *GUI) UpdateWorldGUI() {
// update views:
vw.GrabEyeImg()
if vw.SceneView.IsVisible() {
vw.SceneView.SetNeedsRender(true)
vw.SceneView.NeedsRender()
}
// if vw.Scene2D.IsVisible() {
// vw.Scene2D.SetNeedsRender(true)
Expand Down
15 changes: 6 additions & 9 deletions examples/dls/armaze/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,9 @@ func (vw *GUI) ConfigWorldGUI(ev *Env) *gi.Body {
// 2D Scene

twov := gi.NewSVG(twofr, "sceneview")
twov.Style(func(s *styles.Style) {
twov.SVG.Fill = true
twov.SVG.Root.ViewBox.Size.Set(vw.Geom.Width+4, vw.Geom.Depth+4)
twov.SVG.Root.ViewBox.Min.Set(-0.5*(vw.Geom.Width+4), -0.5*(vw.Geom.Depth+4))
twov.SetReadOnly(false)
})
twov.SVG.Root.ViewBox.Size.Set(vw.Geom.Width+4, vw.Geom.Depth+4)
twov.SVG.Root.ViewBox.Min.Set(-0.5*(vw.Geom.Width+4), -0.5*(vw.Geom.Depth+4))
twov.SetReadOnly(false)

//////////////////////////////////////////
// Toolbar
Expand Down Expand Up @@ -586,8 +583,8 @@ func (vw *GUI) UpdateWorldGUI() {
if vw.SceneView == nil || !vw.Disp {
return
}
updt := vw.SceneView.Scene.UpdateStartAsync()
defer vw.SceneView.Scene.UpdateEndAsyncRender(updt)
vw.SceneView.AsyncLock()
defer vw.SceneView.AsyncUnlock()

// update state:
vw.SetEmeryPose()
Expand All @@ -600,7 +597,7 @@ func (vw *GUI) UpdateWorldGUI() {
// update views:
vw.GrabEyeImg()
if vw.SceneView.IsVisible() {
vw.SceneView.SetNeedsRender(true)
vw.SceneView.NeedsRender()
}
// if vw.Scene2D.IsVisible() {
// vw.Scene2D.SetNeedsRender(true)
Expand Down
4 changes: 2 additions & 2 deletions examples/objrec/objrec.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,10 +351,10 @@ func (ss *Sim) ConfigLoops() {
}
})
man.GetLoop(etime.Train, etime.Trial).OnStart.Add("UpdtImage", func() {
ss.GUI.Grid("Image").SetNeedsRender(true)
ss.GUI.Grid("Image").NeedsRender()
})
man.GetLoop(etime.Test, etime.Trial).OnStart.Add("UpdtImage", func() {
ss.GUI.Grid("Image").SetNeedsRender(true)
ss.GUI.Grid("Image").NeedsRender()
})

axon.LooperUpdtNetView(man, &ss.ViewUpdt, ss.Net, ss.NetViewCounters)
Expand Down

0 comments on commit d8d3c0a

Please sign in to comment.