Jump to method on node double click?

NodeCanvas Forums General Discussion Jump to method on node double click?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #9108
    zxc

    Hi,

    In my workflow I use a lot of “execute function” nodes, execute “implemented action” nodes and most of conditions check a function. On double clicking a node I would like to display a method in question. Instead I get a mostly useles view of a generic Node Canvas node code.

    I guess that the default double click reaction should be displaying a piece of users’ code that’s executed. Displaying Node Canvas behaviour code should be something well hidden.

    That’s my thinking about it.

    #9113
    Gavalakis
    Keymaster

    Hello again,

    While I agree that double-clicking opens the node’s code isn’t that useful, making it opening the IDE to the selected method would require a lot of hacks and things will get messy. That’s because code-wise a node just knows about the task that it is assigned and the Execute Function task for example is just another subclass of ActionTask. Furthermore opening the IDE to the declared line will require a complete text parser just for those tasks.

    I will take a look at it, but can’t promise anything if it can’t be abstracted enough without many sub-cases involved.
    Thanks for understanding 🙂

    Join us on Discord: https://discord.gg/97q2Rjh

    #9112
    zxc

    Yeah, I know that most of the “easy for user” things end up as dirty hacks from developer side. I just notied that me and my teammates had this tendency to double click a node to take a peek at a function and only after a moment we always realised that – sadly – it doesn’t work that way.

    #9111
    zxc

    Okay, we sat down to some hacking and produced a working proof of concept.

    I created a “ShowInEditor” method in Task, and launch it on double click in Node (then override it in ActionBT and probably I should do the same in CoditionBT).

    Each specific Task implements ShowInEditor in its’ own way. For ExecuteFunction Task, I’ve written a working proof of concept.

    #9110
    zxc

    I even expanded upon this proof of concept code and got it working for both execute function actions and check function conditions. Had great fun and works like a charm (though I’m pretty sure it will fall apart spectacularly, cause it’s a tape and glue programming :)). As an interface it works wonderful. Double click and you see a function – awesome.

    #9109
    Gavalakis
    Keymaster

    Hey,

    So thinking about this, since what you want (ShowInEditor) is practicaly only applicable in the Script Control Tasks (Execute, Get, Set etc), creating a virtual method ShowInEditor is a bit overkill in my opinion. Here are 2 solutions:

    1. Interface way

    Create an interface like IReflectionTask with one void method ‘ShowInEditor’.
    Implement that interface in all Script Control tasks and it’s method ShowInEditor (like you did)
    In Node.cs line #638 where the double click is handled, add this extra check:

    Still hacky.

    2. Inspector Button

    In OnTaskInspectorGUI of eg Execute Function, add a simply GUI button “ShowInEditor” and do the stuff there:

    Join us on Discord: https://discord.gg/97q2Rjh

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.