Ark2000 / PankuConsole

Feature-packed real-time debugging toolkit for Godot Engine.
https://k2kra.xyz/PankuConsole/
MIT License
997 stars 38 forks source link

wrong current scene in shell #171

Closed Bartusew closed 4 months ago

Bartusew commented 4 months ago

I have a project where I use GDExtension called "Debug Draw 3D" by DmitriySalnikov and I give panku console a try but current scene which i think should be register game root node, or scenes root node... I don't how to describe or tell them apart.. But instead it registers some of the nodes that Extension creates in order to work. Which is annoying to switch to current.get_parent() and then getting the child of game root every time.

obraz

Steps to reproduce the behavior:

  1. Create an empty project
  2. Install Debug Draw from AssetLib or it's github repo
  3. Reload the project
  4. Install panku console
  5. and after setting up key input to open it you should see wrong registering of node

You can also use this MRP: PankuConsoleMRP.zip

I don't know much about this addon so maybe there is an easy fix and I'm wasting my and someone else's time.. but I think instead of registering those two nodes it should register this node obraz

I'm using Godot 4.2.2 on Windows 10 Godot Engine v4.2.2.stable.official.15073afe3 - https://godotengine.org Vulkan API 1.3.260 - Forward+ - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce GTX 1660 Ti

Im using "Debug Draw 3D" version 1.4.1 and Panku Console from assetLib version 1.7.7 (at least that's how it's marked on assetLib)

Like I said, there is propably way to switch current scene in shell with some command that I don't know. But well, I won't know it until I ask about it ;)

Ark2000 commented 4 months ago

Thanks for your feedback!

source: https://github.com/Ark2000/PankuConsole/blob/master/addons/panku_console/modules/variable_tracker/module.gd

goto line 91

## Find the root node of current active scene.
func get_scene_root() -> Node:
    # Assuming current scene is the first node in tree that is not autoload singleton.
    for node in core.get_tree().root.get_children():
        if not _is_singleton(node):
            return node

    return null

change above to:

func get_scene_root() -> Node:
        var nodes := core.get_tree().root.get_children()
        nodes.reverse()
    for node in nodes:
        if not _is_singleton(node):
            return node
    return null

Currently the scene root node is acquired by a weak assumption (since seems there's no concrete way to do this), well, maybe the assumption needs a reversal.

image

it should work now.

Bartusew commented 4 months ago

Thank you very much. I was thinking that it was implemented in this kind of way, which would desribe why It broke for me. But I didn't know where to find the code responsible for that, so thanks again ;)