bitbrain / beehave

🐝 behavior tree AI for Godot Engine
https://bitbra.in/beehave
MIT License
1.92k stars 118 forks source link

Debugger visuals broken in 4.2 #232

Closed bitbrain closed 3 months ago

bitbrain commented 1 year ago

Godot version: 4.2 Beehave Version: 2.7.6

Describe the bug

With the debugger being fixed in 4.2, its visuals are still broken: Screenshot 2023-10-14 142405

bits-by-brandon commented 10 months ago

@bitbrain Partially able to fix this by updating the property reference from port_offset to port_h_offset. That only fixed the x axis though https://github.com/bitbrain/beehave/blob/6597b7524d2154c8921dd24650bd70335d04178c/addons/beehave/debug/graph_node.gd#L146

bits-by-brandon commented 10 months ago

Also from this PR: https://github.com/godotengine/godot/pull/79311

GraphNode: get_port_input/output_position returns no longer the position premultiplied with the scale

Could this be part of the issue?

bits-by-brandon commented 10 months ago

Oh wait I think I see the issue. The ports positions are now based on the inner container node, not the outermost node.

bitbrain commented 10 months ago

@bits-by-brandon feel free to raise a PR!

bits-by-brandon commented 10 months ago

Fiddled around with it for a little bit, and I can't seem go find a way to fix this without changing a lot of the layout implementation. I'm hesitant to lay a bunch of conditionals in here, im wondering if we need a different 4.2.x branch, or some other strategy for separating the layout needed for 4.2

bitbrain commented 10 months ago

@bits-by-brandon I recommend creating a new scene structure for 4.2 (but keep the existing debugger) and have a toggle like this somewhere:

if godot 4.2+: load new debugger else: load old debugger

bits-by-brandon commented 10 months ago

@bitbrain Okay working with something along these lines. I could also use has_method to branch based on capabilities instead of version numbers

func _ready() -> void:
    var version_info = Engine.get_version_info()
    if version_info.minor >= 2:
        modify_node_layout()
    else:
        build_custom_layout()