g3n / engine

Go 3D Game Engine (http://g3n.rocks)
https://discord.gg/NfaeVr8zDg
BSD 2-Clause "Simplified" License
2.79k stars 295 forks source link

panic: interface conversion: *core.Node is not gui.IPanel: missing method Cullable #253

Open fxrz12 opened 2 years ago

fxrz12 commented 2 years ago

Error when clicking Label on new windows: panic: interface conversion: *core.Node is not gui.IPanel: missing method Cullable

goroutine 1 [running, locked to thread]: github.com/g3n/engine/gui.(Window).onMouse(0xc0029fb880, {0x12a7903, 0xc00037f990}, {0x114bcab, 0xc00015da20}) C:/Users/fxrz1/GoProjects/src/github.com/g3n/engine/gui/window.go:144 +0x137 github.com/g3n/engine/core.(Dispatcher).Dispatch(0xe7bd5d, {0x12a7903, 0xd}, {0x1216d60, 0xc000142070}) C:/Users/fxrz1/GoProjects/src/github.com/g3n/engine/core/dispatcher.go:108 +0xa3 github.com/g3n/engine/gui.sendAncestry({0x133b508, 0xc002afc000}, 0x0, {0x0, 0x0}, {0x0, 0x0}, {0x12a7903, 0xd}, {0x1216d60, ...}) C:/Users/fxrz1/GoProjects/src/github.com/g3n/engine/gui/manager.go:234 +0x144 github.com/g3n/engine/gui.(manager).onMouse(0xc000178000, {0x12a7903, 0xd}, {0x1216d60, 0xc000142070}) C:/Users/fxrz1/GoProjects/src/github.com/g3n/engine/gui/manager.go:138 +0x177 github.com/g3n/engine/core.(Dispatcher).Dispatch(0x60037fb80, {0x12a7903, 0xd}, {0x1216d60, 0xc000142070}) C:/Users/fxrz1/GoProjects/src/github.com/g3n/engine/core/dispatcher.go:108 +0xa3 github.com/g3n/engine/window.Init.func3(0x11326c7, 0x0, 0x1, 0x0) C:/Users/fxrz1/GoProjects/src/github.com/g3n/engine/window/glfw.go:326 +0xb3 github.com/go-gl/glfw/v3.3/glfw.goMouseButtonCB(0xc000186360, 0x0, 0x1, 0x0) C:/Users/fxrz1/GoProjects/src/github.com/go-gl/glfw/v3.3/glfw/input.go:334 +0x57 github.com/go-gl/glfw/v3.3/glfw._Cfunc_glfwPollEvents() _cgo_gotypes.go:1517 +0x4e github.com/go-gl/glfw/v3.3/glfw.PollEvents() C:/Users/fxrz1/GoProjects/src/github.com/go-gl/glfw/v3.3/glfw/window.go:964 +0x17 github.com/g3n/engine/window.(GlfwWindow).PollEvents(...) C:/Users/fxrz1/GoProjects/src/github.com/g3n/engine/window/glfw.go:440 github.com/g3n/engine/app.(Application).Run(0xc0000221e0, 0xc00037fea0) C:/Users/fxrz1/GoProjects/src/github.com/g3n/engine/app/app-desktop.go:91 +0x85 main.runApp(0x124d260, 0x0, 0x12a618b) C:/Users/fxrz1/GoProjects/test/app.go:124 +0x45 main.main() C:/Users/fxrz1/GoProjects/test/app.go:78 +0x436 AL lib: (EE) alc_cleanup: 1 device not closed

Process finished with the exit code 2 I added the judgment and it was normal: // Move the window above everything contained in its parent if _, ok := w.Parent().(IPanel); ok { parent := w.Parent().(IPanel).GetPanel() parent.SetTopChild(w) } // If the click happened inside the draggable area, then set drag to true if w.overTop || w.overRight || w.overBottom || w.overLeft { w.drag = true Manager().SetCursorFocus(w) }

moltzaum commented 7 months ago

I also just ran into this issue.

Steps to reproduce:

window := gui.NewWindow(200, 300)
window.SetTitle("Sub-Window")
scene.Add(window)

Click on the bottom-right corner to cause the panic. Tested on Linux too, so its not just a Mac issue.